diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index eebec62f5eb..635c40e55f4 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -64,61 +64,88 @@ if ($_POST["action"] == 'cotisation') $reyear=$_POST["reyear"]; $cotisation=$_POST["cotisation"]; - $adh = new Adherent($db); - $adh->id = $rowid; - $adh->fetch($rowid); if ($cotisation > 0) { $db->begin(); - - // rajout du nouveau cotisant dans les listes qui vont bien + + $adh = new Adherent($db); + $adh->id = $rowid; + $adh->fetch($rowid); + + // Rajout du nouveau cotisant dans les listes qui vont bien // if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == "0000-00-00 00:00:00"){ - if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == 0){ + if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == 0) + { $adh->add_to_mailman(ADHERENT_MAILMAN_LISTS_COTISANT); } $crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); - - // insertion dans la gestion banquaire si configure pour - if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE) + if ($crowid > 0) { - $acct=new Account($db,$_POST["accountid"]); - - $dateop=strftime("%Y%m%d",time()); - $amount=$cotisation; - $insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"], '', $user); - if ($insertid <= 0) + // Insertion dans la gestion banquaire si configuré pour + if ($conf->global->ADHERENT_BANK_USE) { - $db->rollback(); - dolibarr_print_error($db,$acct->error); - } - else - { - // met a jour la table cotisation - $sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=$crowid "; - $result = $db->query($sql); - if ($result) + $acct=new Account($db,$_POST["accountid"]); + + $dateop=strftime("%Y%m%d",time()); + $amount=$cotisation; + + $insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"], '', $user); + if ($insertid > 0) { - $db->commit(); - //Header("Location: fiche.php"); + $inserturlid=$acct->add_url_line($insertid, $adh->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $adh->getFullname(), 'member'); + if ($inserturlid > 0) + { + // Met a jour la table cotisation + $sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid." WHERE rowid=".$crowid; + $resql = $db->query($sql); + if ($resql) + { + $db->commit(); + //Header("Location: fiche.php"); + } + else + { + $db->rollback(); + dolibarr_print_error($db); + } + } + else + { + $db->rollback(); + dolibarr_print_error($db,$acct->error); + } } else { $db->rollback(); - dolibarr_print_error($db); + dolibarr_print_error($db,$acct->error); } } + else + { + $db->commit(); + } } else { - $db->commit(); + $db->rollback(); + dolibarr_print_error($db); } + // Envoi mail if (defined("ADHERENT_MAIL_COTIS") && defined("ADHERENT_MAIL_COTIS_SUBJECT")){ $adh->send_an_email($adh->email,ADHERENT_MAIL_COTIS,ADHERENT_MAIL_COTIS_SUBJECT); } - } + else + { + $adh = new Adherent($db); + $adh->id = $rowid; + $adh->fetch($rowid); + } + $mesg='
'.$langs->trans("FieldRequired",$langs->trans("Amount")).'
'; + $action = "edit"; } @@ -776,7 +803,7 @@ if ($rowid) print ''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->monnaie).''; - if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE) + if ($conf->global->ADHERENT_BANK_USE) { print ''.$langs->trans("PaymentMode").''; $html->select_types_paiements('','operation'); @@ -790,7 +817,9 @@ if ($rowid) print ''; print "\n"; - print ''.$langs->trans("Label").'prenom).' '.stripslashes($adh->nom).' '.strftime("%Y",$adh->datefin).'" >'; + print ''.$langs->trans("Label").''; + print 'datefin?$adh->datefin:time())).'" >'; } print ''; diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index c466b5cf0a8..85c7c1284c2 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -56,8 +56,9 @@ $sql .= " WHERE d.fk_adherent_type = t.rowid "; if ($_GET["type"]) { $sql.=" AND t.rowid=".$_GET["type"]; } -if (isset($_GET["statut"])) { - $sql.=" AND d.statut = $statut"; +if (isset($_GET["statut"])) +{ + $sql.=" AND d.statut in ($statut)"; // Peut valoir un nombre ou liste de nombre séparés par virgules } if ( $_POST["action"] == 'search') { @@ -78,12 +79,13 @@ if ($result) $titre=$langs->trans("MembersList"); if (isset($_GET["statut"])) { - if ($statut == -1) { $titre=$langs->trans("MembersListToValid"); } - if ($statut == 1) { $titre=$langs->trans("MembersListValid"); } - if ($statut == 0) { $titre=$langs->trans("MembersListResiliated"); } + if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); } + if ($statut == '-1') { $titre=$langs->trans("MembersListToValid"); } + if ($statut == '1') { $titre=$langs->trans("MembersListValid"); } + if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); } } elseif ($_POST["action"] == 'search') { - $titre="Liste des adhérents répondant aux critères"; + $titre=$langs->trans("MembersListQualified"); } if ($_GET["type"]) {