diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 747a0ced42f..47de225807e 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -188,7 +188,7 @@ class Adherent } else { - $this->error=$langs->trans("ErrorFailedToSendPassword"); + $this->error=$langs->trans("ErrorFailedToSendMail",$from,$this->email).'. '.$mailfile->error; return -1; } @@ -677,7 +677,7 @@ class Adherent $tab=array(); $sql = "SELECT *"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_options"; - $sql .= " WHERE adhid=$rowid"; + $sql .= " WHERE adhid=".$rowid; $result=$this->db->query( $sql); diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php new file mode 100644 index 00000000000..2bb37f85e32 --- /dev/null +++ b/htdocs/adherents/card_subscriptions.php @@ -0,0 +1,415 @@ + + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2004-2007 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/adherents/fiche.php + \ingroup adherent + \brief Page d'ajout, edition, suppression d'une fiche adhérent + \version $Revision$ +*/ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php"); +require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); +require_once(DOL_DOCUMENT_ROOT."/includes/xmlrpc/xmlrpc.php"); + +$langs->load("companies"); +$langs->load("bills"); +$langs->load("members"); +$langs->load("users"); + +$user->getrights('adherent'); + +$adh = new Adherent($db); +$adho = new AdherentOptions($db); +$errmsg=''; + +$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; +$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; +$typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"]; + + + +/* + * Actions + */ + +if ($_POST["action"] == 'cotisation' && ! $_POST["cancel"]) +{ + $langs->load("banks"); + + $adh->id = $rowid; + $adh->fetch($rowid); + + $reday=$_POST["reday"]; + $remonth=$_POST["remonth"]; + $reyear=$_POST["reyear"]; + if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"]) + { + $datecotisation=dolibarr_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + } + $cotisation=$_POST["cotisation"]; + + $accountid=$_POST["accountid"]; + $operation=$_POST["operation"]; + $label=$_POST["label"]; + $num_chq=$_POST["num_chq"]; + + + if (! $datecotisation) + { + $errmsg=$langs->trans("BadDateFormat"); + $action='addsubscription'; + } + + if (! $_POST["cotisation"] > 0) + { + $errmsg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); + $action='addsubscription'; + } + if ($conf->global->ADHERENT_BANK_USE) + { + if (! $_POST["accountid"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->trans("FinancialAccount")); + if (! $_POST["operation"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->trans("PaymentMode")); + if (! $_POST["label"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->trans("Label")); + if ($errmsg) $action='addsubscription'; + } + + if ($action=='cotisation') + { + $db->begin(); + + $crowid=$adh->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq); + + if ($crowid > 0) + { + $db->commit(); + + // Envoi mail + if ($_POST["sendmail"]) + { + $result=$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT); + if ($result < 0) $errmsg=$adh->error; + } + + $_POST["cotisation"]=''; + $_POST["accountid"]=''; + $_POST["operation"]=''; + $_POST["label"]=''; + $_POST["num_chq"]=''; + } + else + { + $db->rollback(); + dolibarr_print_error($db,$adh->error); + } + } +} + + + +/* + * + */ + +llxHeader(); + + +if ($errmsg) +{ + print '
'.$errmsg.'
'; + print "\n"; +} + +// fetch optionals attributes and labels +$adho->fetch_optionals(); + + + +/* ************************************************************************** */ +/* */ +/* Mode affichage */ +/* */ +/* ************************************************************************** */ + +$adh = new Adherent($db); +$adh->id = $rowid; +$adh->fetch($rowid); +$adh->fetch_optionals($rowid); + +$adht = new AdherentType($db); +$adht->fetch($adh->typeid); + +$html = new Form($db); + + +/* +* Affichage onglets +*/ +$head = member_prepare_head($adh); + +dolibarr_fiche_head($head, 'subscription', $langs->trans("Member")); + + +print '
'; +print ''; + +// Ref +print ''; + +// Nom +print ''; +print ''; + +// Prenom +print ''; +print ''; + +// Login +print ''; + +// Type +print '\n"; + +// Status +print ''; + + +print "
'.$langs->trans("Ref").''.$adh->id.' 
'.$langs->trans("Lastname").''.$adh->nom.' 
'.$langs->trans("Firstname").''.$adh->prenom.' 
'.$langs->trans("Login").''.$adh->login.' 
'.$langs->trans("Type").''.$adh->type."
'.$langs->trans("Status").''.$adh->getLibStatut(4).'
\n"; +print '
'; + +print "\n"; + + +/* +* Barre d'actions +* +*/ +print '
'; + +if ($action != 'addsubscription') +{ + print "".$langs->trans("NewSubscription").""; +} + +print '
'; +print "
\n"; + + + +/* +* Bandeau des cotisations +* +*/ + +print ''; + +print ''; +print ''; +print '
'; + + +/* +* Liste des cotisations +* +*/ +$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,"; +$sql.= " c.rowid as crowid, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh, c.fk_bank,"; +$sql.= " ba.rowid as baid, ba.label, ba.bank"; +$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; +$sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid; + +$result = $db->query($sql); +if ($result) +{ +$cotisationstatic=new Cotisation($db); +$accountstatic=new Account($db); + +$num = $db->num_rows($result); +$i = 0; + +print "\n"; + +print ''; +print ''; +print ''; +print ''; +if ($conf->global->ADHERENT_BANK_USE) +{ + print ''; +} +print "\n"; + +$var=True; +while ($i < $num) +{ + $objp = $db->fetch_object($result); + $var=!$var; + print ""; + $cotisationstatic->ref=$objp->crowid; + $cotisationstatic->id=$objp->crowid; + print ''; + print "\n"; + print ''; + if ($conf->global->ADHERENT_BANK_USE) + { + print ''; + } + print ""; + $i++; +} +print "
'.$langs->trans("Ref").''.$langs->trans("DateSubscription").''.$langs->trans("Amount").''.$langs->trans("Account").'
'.$cotisationstatic->getNomUrl(1).'".dolibarr_print_date($objp->dateadh,'day')."'.price($objp->cotisation).''; + if ($objp->fk_bank) + { + $accountstatic->label=$objp->label; + $accountstatic->id=$objp->baid; + print $accountstatic->getNomUrl(1); + } + else + { + print ' '; + } + print '
"; +} +else +{ +dolibarr_print_error($db); +} + +print '
'; + + +// Date fin cotisation +print "\n"; +print ''; +print ''; +print ''; +print '
'.$langs->trans("SubscriptionEndDate"); +print ''; +if ($adh->datefin) +{ + if ($adh->datefin < time()) + { + print dolibarr_print_date($adh->datefin,'day')." ".img_warning($langs->trans("Late")); + } + else + { + print dolibarr_print_date($adh->datefin,'day'); + } +} +else +{ + print $langs->trans("SubscriptionNotReceived")." ".img_warning($langs->trans("Late")); +} +print '
'; + + +/* +* Ajout d'une nouvelle cotisation +*/ +if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer) +{ + print '
'; + print "\n\n\n"; + + print '
'; + print ''; + print ''; + print "\n"; + + print ''; + + print '"; + + + print ''; + + if ($conf->global->ADHERENT_BANK_USE) + { + print '\n"; + + print '\n"; + + print ''; + print ''; + + print ''; + print ''; + + print ''; + print ''; + + print ''; + print ''; + } + + print ''; + print ''; + + + print ''; + + print '
'.$langs->trans("NewCotisation").'
'.$langs->trans("DateSubscription").''; + if ($adh->datefin > 0) + { + $html->select_date(dolibarr_time_plus_duree($adh->datefin,1,'d'),'','','','',"cotisation"); + } + else + { + $html->select_date('','','','','',"cotisation"); + } + print "
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("FinancialAccount").''; + $html->select_comptes($_POST["accountid"],'accountid',0,'',1); + print "
'.$langs->trans("PaymentMode").''; + $html->select_types_paiements($_POST["operation"],'operation'); + print "
'.$langs->trans('Numero'); + print ' (Numéro chèque ou virement)'; // \todo a traduire + print '
'.$langs->trans('CheckTransmitter'); + print ' (Emetteur du chèque)'; // \todo a traduire + print '
'.$langs->trans('Bank'); + print ' (Banque du chèque)'; // \todo a traduire + print '
'.$langs->trans("Label").'datefin?$adh->datefin:time())).'" >
'.$langs->trans("SendAcknowledgementByMail").'global->ADHERENT_MAIL_COTIS?' checked="true"':'').'>
'; + print ''; + print '     '; + print ''; + print '
'; + print '
'; + + print "\n\n\n"; +} + +print '
'; + + + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 59bea961153..b35ad62e055 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2007 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -499,7 +499,7 @@ if ($action == 'edit') */ $head = member_prepare_head($adh); - dolibarr_fiche_head($head, 'general', $langs->trans("Member").": ".$adh->fullname); + dolibarr_fiche_head($head, 'general', $langs->trans("Member")); print '
'; @@ -515,7 +515,7 @@ if ($action == 'edit') print ''.$langs->trans("Ref").''.$adh->id.' '; // Nom - print ''.$langs->trans("Name").''; + print ''.$langs->trans("Lastname").''; // Notes print ''.$langs->trans("Notes").''; @@ -632,7 +632,7 @@ if ($action == 'create') // Login print ''.$langs->trans("Login").'*'; - // Mot de pass + // Mot de passe print ''.$langs->trans("Password").'*'; // Type @@ -759,13 +759,13 @@ if ($rowid && $action != 'edit') */ $head = member_prepare_head($adh); - dolibarr_fiche_head($head, 'general', $langs->trans("Member").": ".$adh->fullname); + dolibarr_fiche_head($head, 'general', $langs->trans("Member")); // Confirmation de la suppression de l'adhérent if ($action == 'delete') { - $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_delete"); + $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete"); print '
'; } @@ -835,19 +835,22 @@ if ($rowid && $action != 'edit') print ''.$langs->trans("Ref").''.$adh->id.' '; // Nom - print ''.$langs->trans("Lastname").'*'.$adh->nom.' '; + print ''.$langs->trans("Lastname").''.$adh->nom.' '; print ''.$langs->trans("Notes").''; // Prenom - print ''.$langs->trans("Firstname").'*'.$adh->prenom.' '; + print ''.$langs->trans("Firstname").''.$adh->prenom.' '; print ''; print nl2br($adh->commentaire).' '; // Login - print ''.$langs->trans("Login").'*'.$adh->login.' '; + print ''.$langs->trans("Login").''.$adh->login.' '; + + // Password + print ''.$langs->trans("Password").''.eregi_replace('.','*',$adh->pass).''; // Type - print ''.$langs->trans("Type").'*'.$adh->type."\n"; + print ''.$langs->trans("Type").''.$adh->type."\n"; // Morphy print ''.$langs->trans("Person").''.$adh->getmorphylib().''; @@ -987,155 +990,8 @@ if ($rowid && $action != 'edit') print ''; print ''; - - /* - * Liste des cotisations - * - */ - $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,"; - $sql.= " c.rowid as crowid, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh, c.fk_bank,"; - $sql.= " ba.rowid as baid, ba.label, ba.bank"; - $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; - $sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid; - - $result = $db->query($sql); - if ($result) - { - $cotisationstatic=new Cotisation($db); - $accountstatic=new Account($db); - - $num = $db->num_rows($result); - $i = 0; - - print "\n"; - - print ''; - print ''; - print ''; - print ''; - if ($conf->global->ADHERENT_BANK_USE) - { - print ''; - } - print "\n"; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ""; - $cotisationstatic->ref=$objp->crowid; - $cotisationstatic->id=$objp->crowid; - print ''; - print "\n"; - print ''; - if ($conf->global->ADHERENT_BANK_USE) - { - print ''; - } - print ""; - $i++; - } - print "
'.$langs->trans("Ref").''.$langs->trans("DateSubscription").''.$langs->trans("Amount").''.$langs->trans("Account").'
'.$cotisationstatic->getNomUrl(1).'".dolibarr_print_date($objp->dateadh)."'.price($objp->cotisation).''; - if ($objp->fk_bank) - { - $accountstatic->label=$objp->label; - $accountstatic->id=$objp->baid; - print $accountstatic->getNomUrl(1); - } - else - { - print ' '; - } - print '
"; - } - else - { - dolibarr_print_error($db); - } - print ''; - - /* - * Ajout d'une nouvelle cotisation - */ - if ($user->rights->adherent->cotisation->creer) - { - print "\n\n\n"; - - print ''; - print "\n"; - - print ''; - print ''; - print ''; - - print ''; - - print '"; - - - print ''; - - if ($conf->global->ADHERENT_BANK_USE) - { - print '\n"; - - print '\n"; - - print '\n"; - - print ''; - print ''; - } - - print ''; - - print '
'.$langs->trans("SubscriptionEndDate"); - print ''; - print ''; - print ''; - if ($adh->datefin) - { - if ($adh->datefin < time()) - { - print dolibarr_print_date($adh->datefin)." ".img_warning($langs->trans("Late")); - } - else - { - print dolibarr_print_date($adh->datefin); - } - } - else - { - print $langs->trans("SubscriptionNotReceived")." ".img_warning($langs->trans("Late")); - } - print '
'.$langs->trans("NewCotisation").'
'.$langs->trans("DateSubscription").''; - if ($adh->datefin > 0) - { - $html->select_date(dolibarr_time_plus_duree($adh->datefin,1,'d'),'','','','',"cotisation"); - } - else - { - $html->select_date('','','','','',"cotisation"); - } - print "
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("PaymentMode").''; - $html->select_types_paiements($_POST["operation"],'operation'); - print "
'.$langs->trans("FinancialAccount").''; - $html->select_comptes($_POST["accountid"],'accountid',0,'',1); - print "
'.$langs->trans("Numero").''; - print ''; - print "
'.$langs->trans("Label").'datefin?$adh->datefin:time())).'" >
'; - print '
'; - - print "\n\n\n"; - } - print ''; print ''; diff --git a/htdocs/adherents/info.php b/htdocs/adherents/info.php index f028af61e61..34bc0d43c49 100644 --- a/htdocs/adherents/info.php +++ b/htdocs/adherents/info.php @@ -58,7 +58,7 @@ $adh->info($_GET["id"]); */ $head = member_prepare_head($adh); -dolibarr_fiche_head($head, 'info', $langs->trans("Member").": ".$adh->fullname); +dolibarr_fiche_head($head, 'info', $langs->trans("Member")); print '
'; diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 46914a01d9d..6733039e7e1 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -83,7 +83,7 @@ if (! $result) */ $head = member_prepare_head($adh); -dolibarr_fiche_head($head, 'ldap', $langs->trans("Member").": ".$adh->fullname); +dolibarr_fiche_head($head, 'ldap', $langs->trans("Member")); @@ -96,18 +96,18 @@ print ''; print ''; // Nom -print ''; +print ''; print ''; // Prenom -print ''; +print ''; print ''; // Login -print ''; +print ''; // Type -print '\n"; +print '\n"; $langs->load("admin"); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 89eb70acf56..cdc85f815e2 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -44,7 +44,8 @@ ReceivedCustomersPaymentsToValid=Received customers payments to validate PaymentsReportsForYear=Payments reports for %s PaymentsReports=Payments reports PaymentsAlreadyDone=Payments already done -PaymentMode=Payment rule +PaymentRule=Payment rule +PaymentMode=Payment type PaymentConditions=Payment term PaymentConditionsShort=Payment term PaymentAmount=Payment amount diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index b2143debe15..215a275683d 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -351,6 +351,7 @@ CloseWindow=Close window Question=Question Response=Response Priority=Priority +SendAcknowledgementByMail=Send Ack. by mail # Countries CountryFR=France CountryBE=Belgium diff --git a/htdocs/langs/fr_BE/bills.lang b/htdocs/langs/fr_BE/bills.lang index 8b5c84a62c4..4340f80357b 100644 --- a/htdocs/langs/fr_BE/bills.lang +++ b/htdocs/langs/fr_BE/bills.lang @@ -46,6 +46,7 @@ ReceivedCustomersPaymentsToValid=Paiements clients re PaymentsReportsForYear=Rapports de paiements pour %s PaymentsReports=Rapports de paiements PaymentsAlreadyDone=Versements déjà effectués +PaymentRule=Condition de réglement PaymentMode=Mode règlement PaymentConditionsShort=Conditions règlement ClassifyPayed=Classer 'Payée' diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index ceba065c34c..52dd936676c 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -351,6 +351,7 @@ CloseWindow=Fermer fen Question=Question Response=Réponse Priority=Priorité +SendAcknowledgementByMail=Envoi A.R. par mail # Countries CountryFR=France CountryBE=Belgique diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php index cf9fb96b251..e140f06494d 100644 --- a/htdocs/lib/CMailFile.class.php +++ b/htdocs/lib/CMailFile.class.php @@ -171,7 +171,7 @@ class CMailFile //$this->send_to_file(); $errorlevel=error_reporting(); - //error_reporting($errorlevel ^ E_WARNING); // Désactive warnings + error_reporting($errorlevel ^ E_WARNING); // Désactive warnings if (! $conf->global->MAIN_DISABLE_ALL_MAILS) { diff --git a/htdocs/lib/member.lib.php b/htdocs/lib/member.lib.php index 423f62df25e..cf1d6200d6b 100644 --- a/htdocs/lib/member.lib.php +++ b/htdocs/lib/member.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2007 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,6 +50,11 @@ function member_prepare_head($member) $h++; } + $head[$h][0] = DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$member->id; + $head[$h][1] = $langs->trans("Subscriptions"); + $head[$h][2] = 'subscription'; + $h++; + $head[$h][0] = DOL_URL_ROOT.'/adherents/info.php?id='.$member->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info';
'.$langs->trans("Ref").''.$adh->id.' 
'.$langs->trans("Lastname").'*'.$adh->nom.' 
'.$langs->trans("Lastname").''.$adh->nom.' 
'.$langs->trans("Firstname").'*'.$adh->prenom.' 
'.$langs->trans("Firstname").''.$adh->prenom.' 
'.$langs->trans("Login").'*'.$adh->login.' 
'.$langs->trans("Login").''.$adh->login.' 
'.$langs->trans("Type").'*'.$adh->type."
'.$langs->trans("Type").''.$adh->type."