$Adherents = array(); $AdherentsAValider = array(); $MemberUpToDate = array(); $AdherentsResilies = array(); $AdherentType = array(); $result = $staticmember->getView('tag', array("group" => true)); if (count($result->rows)) { foreach ($result->rows as $aRow) { $AdherentType[$aRow->key] = $aRow->value; } } $now = dol_now(); $doc->_id = "_temp_view"; $doc->map = "function(doc) {\n var now = Math.round(+new Date()/1000);\n var status = 0;\n\n if(doc.class && doc.class==\"Adherent\"){\n if(doc.last_subscription_date_end && doc.Status == 1) {\n if(doc.last_subscription_date_end < now)\n status = \"expired\";\n else\n status = \"actived\";\n }\n else\n status= doc.Status;\n\n if(doc.Tag.length > 0) {\n for(var idx in doc.Tag) {\n emit([doc.Tag[idx],status], 1);\n }\n }\n\n }\n}"; $doc->reduce = "function(keys, values) {\n return sum(values)\n}"; $result = $staticmember->storeDoc($doc); if (count($result->rows)) { foreach ($result->rows as $aRow) { $Adherents[$aRow->key[0]][$aRow->key[1]] = $aRow->value; } } foreach ($AdherentType as $key => $adhtype) { foreach ($staticmember->fk_extrafields->fields->Status->values as $idx => $row) { if ($Adherents[$key][$idx]) { $somme[$idx] += $Adherents[$key][$idx]; $total += $Adherents[$key][$idx]; } } } print '<tr><td width="30%" class="notopnoleft" valign="top">'; /*