diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index b0a4ffae858..e69dc2b6fc0 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -1782,7 +1782,7 @@ class Adherent if ($mode == 0) { if ($statut == -1) return $langs->trans("MemberStatusDraft"); - if ($statut == 1) + if ($statut >= 1) { if (! $date_end_subscription) return $langs->trans("MemberStatusActive"); elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate"); @@ -1793,7 +1793,7 @@ class Adherent if ($mode == 1) { if ($statut == -1) return $langs->trans("MemberStatusDraft"); - if ($statut == 1) + if ($statut >= 1) { if (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort"); elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort"); @@ -1804,7 +1804,7 @@ class Adherent if ($mode == 2) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); - if ($statut == 1) + if ($statut >= 1) { if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActiveShort"); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLateShort"); @@ -1815,7 +1815,7 @@ class Adherent if ($mode == 3) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0'); - if ($statut == 1) + if ($statut >= 1) { if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1'); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); @@ -1826,7 +1826,7 @@ class Adherent if ($mode == 4) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); - if ($statut == 1) + if ($statut >= 1) { if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActive"); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLate"); @@ -1837,7 +1837,7 @@ class Adherent if ($mode == 5) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); - if ($statut == 1) + if ($statut >= 1) { if (! $date_end_subscription) return $langs->trans("MemberStatusActive").' '.img_picto($langs->trans('MemberStatusActive'),'statut1'); elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate").' '.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index a2dd613afb9..a4566137ce7 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -604,7 +604,6 @@ if ($action == 'edit') $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Morale"); print "".$langs->trans("Person").""; - print $adh->morphy; $htmls->select_array("morphy", $morphys, $adh->morphy); print ""; diff --git a/scripts/adherents/sync_member_ldap2dolibarr.php b/scripts/adherents/sync_member_ldap2dolibarr.php index bc3482f3cf5..73fbeb4f88a 100644 --- a/scripts/adherents/sync_member_ldap2dolibarr.php +++ b/scripts/adherents/sync_member_ldap2dolibarr.php @@ -215,6 +215,7 @@ if ($result >= 0) $member->datevalid=dolibarr_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); $member->statut=$ldapuser[$conf->global->LDAP_FIELD_MEMBER_STATUS]; } + //if ($member->statut > 1) $member->statut=1; //print_r($ldapuser); @@ -238,36 +239,48 @@ if ($result >= 0) //print_r($member); - // Insertion première adhésion $datefirst=''; if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE) { $datefirst=dolibarr_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); - } - if ($datefirst) - { - // Cree premiere cotisation et met a jour datefin dans adherent - $price=price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT]); - //print "xx".$datefirst."\n"; - $crowid=$member->cotisation($datefirst, $price, 0); + $pricefirst=price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT]); } - // Insertion dernière adhésion $datelast=''; if ($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE) { $datelast=dolibarr_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE]); + $pricelast=price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT]); } elseif ($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) { $datelast=dolibarr_time_plus_duree(dolibarr_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION]),-1,'y')+60*60*24; + $pricelast=price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT]); + + // Cas special ou date derniere <= date premiere + if ($datefirst && $datelast && $datelast <= $datefirst) + { + // On ne va inserer que la premiere + $datelast=0; + if (! $pricefirst && $pricelast) $pricefirst = $pricelast; + } } + + + // Insertion première adhésion + if ($datefirst) + { + // Cree premiere cotisation et met a jour datefin dans adherent + //print "xx".$datefirst."\n"; + $crowid=$member->cotisation($datefirst, $pricefirst, 0); + } + + // Insertion dernière adhésion if ($datelast) { // Cree derniere cotisation et met a jour datefin dans adherent - $price=price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT]); //print "yy".dolibarr_print_date($datelast)."\n"; - $crowid=$member->cotisation($datelast, $price, 0); + $crowid=$member->cotisation($datelast, $pricelast, 0); } }