From c3ba2f704d90258ace6b6bf0caf634497437a08e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Nov 2007 21:07:46 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Ajout=20protection=20pour=20interdire=20?= =?UTF-8?q?paiement=20de=20type=20non=20esp=E8ce=20sur=20compte=20caisse.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/adherents/adherent.class.php | 13 +++---- htdocs/adherents/card_subscriptions.php | 9 +++-- htdocs/adherents/cotisation.class.php | 3 +- htdocs/adherents/fiche_subscription.php | 47 ++++++++++++++++++------- htdocs/compta/bank/account.class.php | 16 +++++++-- htdocs/compta/bank/account.php | 20 +++++++---- htdocs/compta/bank/ligne.php | 1 + htdocs/compta/paiement/fiche.php | 16 ++++----- htdocs/langs/en_US/errors.lang | 3 +- htdocs/langs/en_US/members.lang | 1 + htdocs/langs/fr_FR/errors.lang | 3 +- htdocs/langs/fr_FR/members.lang | 1 + htdocs/theme/dev/dev.css | 3 +- htdocs/theme/dolibarr/dolibarr.css | 2 +- htdocs/theme/eldy/eldy.css.php | 26 +++++++------- htdocs/theme/freelug/freelug.css.php | 2 +- htdocs/theme/rodolphe/rodolphe.css | 2 +- htdocs/theme/yellow/yellow.css.php | 2 +- 18 files changed, 112 insertions(+), 58 deletions(-) diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 6f8923da5e7..6264bcd3e87 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -1132,8 +1132,9 @@ class Adherent extends CommonObject // Insertion dans la gestion bancaire si configuré pour if ($conf->global->ADHERENT_BANK_USE && $accountid) { - $acct=new Account($this->db,$accountid); - + $acct=new Account($this->db); + $result=$acct->fetch($accountid); + $dateop=time(); $insertid=$acct->addline($dateop, $operation, $label, $montant, $num_chq, '', $user, $emetteur_nom, $emetteur_banque); @@ -1143,10 +1144,10 @@ class Adherent extends CommonObject if ($inserturlid > 0) { // Met a jour la table cotisation - - $sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid." WHERE rowid=".$rowid; - $resql = $this->db->query($sql); + + dolibarr_syslog("Adherent::cotisation sql=".$sql); + $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); @@ -1163,7 +1164,7 @@ class Adherent extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$acct->error; $this->db->rollback(); return -3; } diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 9a8a4504ae8..29e356bcf36 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** @@ -155,7 +154,8 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio else { $db->rollback(); - dolibarr_print_error($db,$adh->error); + $errmsg=$adh->error; + $action = 'addsubscription'; } } } @@ -224,6 +224,11 @@ print "\n"; if ($errmsg) { + if (eregi('^Error',$errmsg)) + { + $langs->load("errors"); + $errmsg=$langs->trans($errmsg); + } print '
'.$errmsg.'
'; print "\n"; } diff --git a/htdocs/adherents/cotisation.class.php b/htdocs/adherents/cotisation.class.php index 4e5a1245681..216dfe1fa33 100644 --- a/htdocs/adherents/cotisation.class.php +++ b/htdocs/adherents/cotisation.class.php @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** @@ -32,7 +31,7 @@ \class Cotisation \brief Classe permettant de gèrer les cotisations */ -class Cotisation +class Cotisation extends CommonObject { var $id; var $db; diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index edce2ed3233..96a8719b72e 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** @@ -273,30 +272,47 @@ if ($rowid && $action != 'edit') // Ref print ''.$langs->trans("Ref").''; - print ''; - if ($previous_id || $next_id) print '
'; - print $subscription->ref; - if ($previous_id || $next_id) print ''.$previous_id.''.$next_id.'
'; + print ''; + print $html->showrefnav($subscription,'rowid','',1); print ''; // Member $adh->ref=$adh->fullname; print ''; - print ''.$langs->trans("Member").''.$adh->getNomUrl(1,0,'subscription').''; + print ''.$langs->trans("Member").''.$adh->getNomUrl(1,0,'subscription').''; print ''; // Date subscription print ''; - print ''.$langs->trans("DateSubscription").''.dolibarr_print_date($subscription->dateh,'dayhour').''; + print ''.$langs->trans("DateSubscription").''.dolibarr_print_date($subscription->dateh,'dayhour').''; print ''; // Date end subscription print ''; - print ''.$langs->trans("DateEndSubscription").''.dolibarr_print_date($subscription->datef,'day').''; + print ''.$langs->trans("DateEndSubscription").''.dolibarr_print_date($subscription->datef,'day').''; print ''; // Amount - print ''.$langs->trans("Amount").''.price($subscription->amount).''; + print ''.$langs->trans("Amount").''.price($subscription->amount).''; + + // Bank account + if ($conf->banque->enabled) + { + if ($subscription->fk_bank) + { + $bankline=new AccountLine($db); + $bankline->fetch($subscription->fk_bank); + + $bank=new Account($db); + $bank->fetch($bankline->fk_account); + + print ''; + print ''.$langs->trans('BankAccount').''; + print ''.$bank->getNomUrl(1).''; + print ''.$langs->trans("BankLineConciliated").''.yn($bankline->rappro).''; + print ''; + } + } print "\n"; print ''; @@ -312,9 +328,16 @@ if ($rowid && $action != 'edit') if ($user->rights->adherent->cotisation->creer) { - print "id."&action=edit\">".$langs->trans("Edit").""; - } - + if (! $bankline->rappro) + { + print "id."&action=edit\">".$langs->trans("Edit").""; + } + else + { + print "trans("BankLineConciliated")."\" href=\"#\">".$langs->trans("Edit").""; + } + } + // Supprimer if ($user->rights->adherent->cotisation->creer) { diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index 48df2228198..e168426cc59 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** @@ -207,12 +206,23 @@ class Account extends CommonObject } // Verification parametres + if (! $oper) + { + $this->error="Account::addline oper not defined"; + return -1; + } if (! $this->rowid) { $this->error="Account::addline this->rowid not defined"; - return -1; + return -2; } - + if ($this->courant == 2 && $oper != 'LIQ') + { + $this->error="ErrorCashAccountAcceptsOnlyCashMoney"; + return -3; + } + + $this->db->begin(); $datev = $date; diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 7404761de40..0800fed2496 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -562,17 +562,25 @@ if ($account || $_GET["ref"]) if ($links[$key]['type']=='company') { $societestatic->id=$links[$key]['url_id']; $societestatic->nom=$links[$key]['label']; - print $societestatic->getNomUrl(0,'',16); + print $societestatic->getNomUrl(1,'',16); } - else if ($links[$key]['type']=='sc') { + /*else if ($links[$key]['type']=='sc') { $chargestatic->id=$links[$key]['url_id']; - $chargestatic->nom=$links[$key]['label']; - print $chargestatic->getNomUrl(0,'',16); - } + if (eregi('^\((.*)\)$',$links[$key]['label'],$reg)) + { + if ($reg[1]=='socialcontribution') $reg[1]='SocialContribution'; + $chargestatic->lib=$langs->trans($reg[1]); + } + else + { + $chargestatic->lib=$links[$key]['label']; + } + print $chargestatic->getNomUrl(1,'',16); + }*/ else if ($links[$key]['type']=='member') { $memberstatic->id=$links[$key]['url_id']; $memberstatic->ref=$links[$key]['label']; - print $memberstatic->getNomUrl(0,'',16); + print $memberstatic->getNomUrl(1,16,'card'); } } print ''; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 835d5f14035..58d99e6d23a 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -35,6 +35,7 @@ if (! $user->rights->banque->lire && ! $user->rights->banque->consolidate) $langs->load("banks"); $langs->load("bills"); +if ($conf->adherent->enabled) $langs->load("members"); $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; $orig_account=isset($_GET["orig_account"])?$_GET["orig_account"]:$_POST["orig_account"]; diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index 8aede00023c..73e4f9d2cf4 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** @@ -158,21 +157,23 @@ if ($mesg) print $mesg.'
'; print ''; +// Ref print ''; + +// Bank account if ($conf->banque->enabled) { if ($paiement->bank_account) { - // Si compte renseigné, on affiche libelle - $bank=new Account($db); - $bank->fetch($paiement->bank_account); - $bankline=new AccountLine($db); $bankline->fetch($paiement->bank_line); + $bank=new Account($db); + $bank->fetch($bankline->fk_account); + print ''; print ''; - print ''; + print ''; print ''; print ''; } @@ -201,8 +202,7 @@ print '
'.$langs->trans('Ref').''.$paiement->id.'
'.$langs->trans('BankAccount').''.img_object($langs->trans("ShowAccount"),'account').' '.$bank->label.''.$bank->getNomUrl(1).''.$langs->trans("BankLineConciliated").''.yn($bankline->rappro).'
'; /* - * - * + * Liste des factures */ $allow_delete = 1 ; $sql = 'SELECT f.facnumber, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.rowid as socid'; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 5799e904a13..9100b6d3537 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -1,4 +1,5 @@ # Dolibarr language file - en_US - errors ErrorDuplicateTrigger=A trigger file named '%s' is already loaded. Remove duplicate trigger file in directory '%s'. ErrorFailToDeleteFile=Failed to remove file '%s'. -ErrorThisContactIsAlreadyDefinedAsThisType=this contact is already defined as contact for this type. \ No newline at end of file +ErrorThisContactIsAlreadyDefinedAsThisType=This contact is already defined as contact for this type. +ErrorCashAccountAcceptsOnlyCashMoney=This bank account is a cash account, so it accepts payments of type cash only. diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 1813e479b5f..df1bcb3e27f 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -6,6 +6,7 @@ SubscriptionCard=Subscription card Member=Member Members=Members MemberAccount=Member login +ShowMember=Show member card UserNotLinkedToMember=User not linked to a member MembersTickets=Members Tickets FundationMembers=Fundation members diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 16b76319894..522fbf0439a 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -1,4 +1,5 @@ # Dolibarr language file - fr_FR - errors ErrorDuplicateTrigger=Un fichier trigger du nom de '%s' est deja chargé. Supprimer le doublon du répertoire '%s'. ErrorFailToDeleteFile=Echec de l'effacement du fichier '%s'. -ErrorThisContactIsAlreadyDefinedAsThisType=Ce contact est déjà défini comme contact pour ce type. \ No newline at end of file +ErrorThisContactIsAlreadyDefinedAsThisType=Ce contact est déjà défini comme contact pour ce type. +ErrorCashAccountAcceptsOnlyCashMoney=Ce compte bancaire est de type caisse et n'accepte que les mode de réglement de type espèce. \ No newline at end of file diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index bf63965d7d2..130f45cb4ef 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -5,6 +5,7 @@ MemberCard=Fiche adh SubscriptionCard=Fiche adhésion Member=Adhérent Members=Adhérents +ShowMember=Afficher fiche adhérent MemberAccount=Login adhérent UserNotLinkedToMember=Utilisateur non lié à un adhérent MembersTickets=Etiquettes d'adhérents diff --git a/htdocs/theme/dev/dev.css b/htdocs/theme/dev/dev.css index 9e1dbd866c6..e384822b99f 100644 --- a/htdocs/theme/dev/dev.css +++ b/htdocs/theme/dev/dev.css @@ -518,12 +518,13 @@ a.butAction:hover { .butActionRefused { background: white; border: 1px outset #AAAAAA; - color: #AAAAAA; + color: #AAAAAA !important; font: 105% Bold; padding: 0em 1em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; + cursor: not-allowed; } a.butActionDelete:link { diff --git a/htdocs/theme/dolibarr/dolibarr.css b/htdocs/theme/dolibarr/dolibarr.css index 3d7f7eccd2f..34d61daa083 100644 --- a/htdocs/theme/dolibarr/dolibarr.css +++ b/htdocs/theme/dolibarr/dolibarr.css @@ -393,7 +393,7 @@ a.butAction:visited { background: white; border: 1px solid #8CACBB; color: #4369 a.butAction:active { background: white; border: 1px solid #8CACBB; color: #436976; font: 105% Bold; padding: 0em 1em; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; } a.butAction:hover { background: #dee7ec; } -.butActionRefused { background: white; border: 1px solid #AAAAAA; color: #AAAAAA; font: 105% Bold; padding: 0em 1em; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; } +.butActionRefused { background: white; border: 1px solid #AAAAAA; color: #AAAAAA !important; font: 105% Bold; padding: 0em 1em; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; cursor: not-allowed; } a.butActionDelete:link { background: white; border: 1px solid #8CACBB; color: #436976; font: 105% Bold; padding: 0em 1em; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; } a.butActionDelete:visited { background: white; border: 1px solid #8CACBB; color: #436976; font: 105% Bold; padding: 0em 1em; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; } diff --git a/htdocs/theme/eldy/eldy.css.php b/htdocs/theme/eldy/eldy.css.php index 22fad2da89d..b0a9e55dce8 100644 --- a/htdocs/theme/eldy/eldy.css.php +++ b/htdocs/theme/eldy/eldy.css.php @@ -40,7 +40,7 @@ if (! isset($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_ ?> /* ============================================================================== */ -/* Styles par d�faut */ +/* Styles par defaut */ /* ============================================================================== */ body { @@ -686,7 +686,7 @@ a.tabimage { /* Boutons actions */ /* ============================================================================== */ -/* Nouvelle syntaxe � utiliser */ +/* Nouvelle syntaxe a utiliser */ a.butAction:link { font-size: 12px; font-family: helvetica, verdana, arial, sans-serif; @@ -732,16 +732,18 @@ a.butAction:hover { font-size: 12px; text-decoration: none; white-space: nowrap; } -.butActionRefused { font-size: 12px; - font-family: helvetica, verdana, arial, sans-serif; - font-weight: bold; - background: white; - border: 1px solid #AAAAAA; - color: #AAAAAA; - padding: 0em 0.7em; - margin: 0em 0.5em; - text-decoration: none; - white-space: nowrap; } +.butActionRefused { font-size: 12px !important; + font-family: helvetica, verdana, arial, sans-serif !important; + font-weight: bold !important; + background: white !important; + border: 1px solid #AAAAAA !important; + color: #AAAAAA !important; + padding: 0em 0.7em !important; + margin: 0em 0.5em !important; + text-decoration: none !important; + white-space: nowrap !important; + cursor: not-allowed; + } a.butActionDelete { font-size: 12px; font-family: helvetica, verdana, arial, sans-serif; diff --git a/htdocs/theme/freelug/freelug.css.php b/htdocs/theme/freelug/freelug.css.php index 7852e4a0837..e16499fc6da 100644 --- a/htdocs/theme/freelug/freelug.css.php +++ b/htdocs/theme/freelug/freelug.css.php @@ -508,7 +508,7 @@ a.butAction:visited { font-family: helvetica, verdana, arial, sans-serif; backgr a.butAction:active { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #999999; color: #436969; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.butAction:hover { font-family: helvetica, verdana, arial, sans-serif; background: #eeeedd; border: 1px solid #999999; color: #436969; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } -.butActionRefused { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #AAAAAA; color: #AAAAAA; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } +.butActionRefused { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #AAAAAA; color: #AAAAAA !important; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; cursor: not-allowed; } a.butActionDelete:link { font-family: helvetica, verdana, arial, sans-serif; background: white; diff --git a/htdocs/theme/rodolphe/rodolphe.css b/htdocs/theme/rodolphe/rodolphe.css index cd8e3502392..ec64c72c139 100644 --- a/htdocs/theme/rodolphe/rodolphe.css +++ b/htdocs/theme/rodolphe/rodolphe.css @@ -449,7 +449,7 @@ a.butAction:visited { font-family: helvetica, verdana, arial, sans-serif; backgr a.butAction:active { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #999999; color: #436969; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.butAction:hover { font-family: helvetica, verdana, arial, sans-serif; background: #78746d; border: 1px solid #999999; color: #436969; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } -.butActionRefused { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #AAAAAA; color: #AAAAAA; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } +.butActionRefused { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #AAAAAA; color: #AAAAAA !important; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; cursor: not-allowed; } a.butActionDelete:link { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #997777; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.butActionDelete:active { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #997777; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } diff --git a/htdocs/theme/yellow/yellow.css.php b/htdocs/theme/yellow/yellow.css.php index aaad1257707..e62dfc66137 100644 --- a/htdocs/theme/yellow/yellow.css.php +++ b/htdocs/theme/yellow/yellow.css.php @@ -480,7 +480,7 @@ a.butAction:visited { font-family: helvetica, verdana, arial, sans-serif; backgr a.butAction:active { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #999999; color: #436969; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.butAction:hover { font-family: helvetica, verdana, arial, sans-serif; background: #eeeecc; border: 1px solid #999999; color: #436969; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } -.butActionRefused { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #AAAAAA; color: #AAAAAA; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } +.butActionRefused { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #AAAAAA; color: #AAAAAA !important; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; cursor: not-allowed; } a.butActionDelete:link { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #997777; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.butActionDelete:active { font-family: helvetica, verdana, arial, sans-serif; background: white; border: 1px solid #997777; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }