コード例 #1
0
         $datelast = dol_time_plus_duree(dol_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;
             }
         }
     }
     // Insert first subscription
     if ($datefirst) {
         // Cree premiere cotisation et met a jour datefin dans adherent
         //print "xx".$datefirst."\n";
         $crowid = $member->cotisation($datefirst, $pricefirst, 0);
     }
     // Insert last subscription
     if ($datelast) {
         // Cree derniere cotisation et met a jour datefin dans adherent
         //print "yy".dol_print_date($datelast)."\n";
         $crowid = $member->cotisation($datelast, $pricelast, 0);
     }
 }
 if (!$error || $forcecommit) {
     if (!$error) {
         print $langs->transnoentities("NoErrorCommitIsDone") . "\n";
     } else {
         print $langs->transnoentities("ErrorButCommitIsDone") . "\n";
     }
     $db->commit();