Fix: Ajout protection pour interdire paiement de type non espce sur compte caisse.

This commit is contained in:
Laurent Destailleur 2007-11-18 21:07:46 +00:00
parent 52d6005929
commit c3ba2f704d
18 changed files with 112 additions and 58 deletions

View File

@ -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;
}

View File

@ -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 "</div>\n";
if ($errmsg)
{
if (eregi('^Error',$errmsg))
{
$langs->load("errors");
$errmsg=$langs->trans($errmsg);
}
print '<div class="error">'.$errmsg.'</div>';
print "\n";
}

View File

@ -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;

View File

@ -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 '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td class="valeur" colspan="2">';
if ($previous_id || $next_id) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print $subscription->ref;
if ($previous_id || $next_id) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_id.'</td><td class="nobordernopadding" align="center" width="20">'.$next_id.'</td></tr></table>';
print '<td class="valeur" colspan="3">';
print $html->showrefnav($subscription,'rowid','',1);
print '</td></tr>';
// Member
$adh->ref=$adh->fullname;
print '<tr>';
print '<td>'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1,0,'subscription').'</td>';
print '<td>'.$langs->trans("Member").'</td><td class="valeur" colspan="3">'.$adh->getNomUrl(1,0,'subscription').'</td>';
print '</tr>';
// Date subscription
print '<tr>';
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur">'.dolibarr_print_date($subscription->dateh,'dayhour').'</td>';
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="3">'.dolibarr_print_date($subscription->dateh,'dayhour').'</td>';
print '</tr>';
// Date end subscription
print '<tr>';
print '<td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur">'.dolibarr_print_date($subscription->datef,'day').'</td>';
print '<td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="3">'.dolibarr_print_date($subscription->datef,'day').'</td>';
print '</tr>';
// Amount
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur">'.price($subscription->amount).'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="3">'.price($subscription->amount).'</td></tr>';
// 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 '<tr>';
print '<td valign="top" width="140">'.$langs->trans('BankAccount').'</td>';
print '<td>'.$bank->getNomUrl(1).'</td>';
print '<td>'.$langs->trans("BankLineConciliated").'</td><td>'.yn($bankline->rappro).'</td>';
print '</tr>';
}
}
print "</table>\n";
print '</form>';
@ -312,9 +328,16 @@ if ($rowid && $action != 'edit')
if ($user->rights->adherent->cotisation->creer)
{
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=edit\">".$langs->trans("Edit")."</a>";
}
if (! $bankline->rappro)
{
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=edit\">".$langs->trans("Edit")."</a>";
}
else
{
print "<a class=\"butActionRefused\" title=\"".$langs->trans("BankLineConciliated")."\" href=\"#\">".$langs->trans("Edit")."</a>";
}
}
// Supprimer
if ($user->rights->adherent->cotisation->creer)
{

View File

@ -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;

View File

@ -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 '</td>';

View File

@ -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"];

View File

@ -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.'<br>';
print '<table class="border" width="100%">';
// Ref
print '<tr><td valign="top" width="140">'.$langs->trans('Ref').'</td><td colspan="3">'.$paiement->id.'</td></tr>';
// 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 '<tr>';
print '<td valign="top" width="140">'.$langs->trans('BankAccount').'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$bank->id.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$bank->label.'</a></td>';
print '<td>'.$bank->getNomUrl(1).'</td>';
print '<td>'.$langs->trans("BankLineConciliated").'</td><td>'.yn($bankline->rappro).'</td>';
print '</tr>';
}
@ -201,8 +202,7 @@ print '</table>';
/*
*
*
* 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';

View File

@ -1,4 +1,5 @@
# Dolibarr language file - en_US - errors
ErrorDuplicateTrigger=A trigger file named '<b>%s</b>' is already loaded. Remove duplicate trigger file in directory '<b>%s</b>'.
ErrorFailToDeleteFile=Failed to remove file '<b>%s</b>'.
ErrorThisContactIsAlreadyDefinedAsThisType=this contact is already defined as contact for this type.
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.

View File

@ -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

View File

@ -1,4 +1,5 @@
# Dolibarr language file - fr_FR - errors
ErrorDuplicateTrigger=Un fichier trigger du nom de '<b>%s</b>' est deja chargé. Supprimer le doublon du répertoire '<b>%s</b>'.
ErrorFailToDeleteFile=Echec de l'effacement du fichier '<b>%s</b>'.
ErrorThisContactIsAlreadyDefinedAsThisType=Ce contact est déjà défini comme contact pour ce type.
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 <b>espèce</b>.

View File

@ -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

View File

@ -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 {

View File

@ -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; }

View File

@ -40,7 +40,7 @@ if (! isset($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_
?>
/* ============================================================================== */
/* Styles par d<EFBFBD>faut */
/* Styles par defaut */
/* ============================================================================== */
body {
@ -686,7 +686,7 @@ a.tabimage {
/* Boutons actions */
/* ============================================================================== */
/* Nouvelle syntaxe <EFBFBD> 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;

View File

@ -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;

View File

@ -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; }

View File

@ -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; }