From 1fdeb753db65a074e290db173cc77eaf776dae17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2007 09:35:15 +0000 Subject: [PATCH] Fix: Gestion des droits sur compte bancaire incomplete. Pas assez de droit pour rapprocher. Melange entre droit de creer/supprimer ecriture bancaire et droit de saisir virement. --- htdocs/adherents/cotisations.php | 12 +++++----- htdocs/compta/bank/ligne.php | 26 ++++++++++----------- htdocs/compta/bank/pre.inc.php | 4 ++-- htdocs/compta/bank/rappro.php | 2 +- htdocs/compta/bank/releve.php | 24 +++++++++---------- htdocs/compta/bank/virement.php | 2 +- htdocs/includes/modules/modBanque.class.php | 10 +++++++- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index c52c513f2d3..d809c309177 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -58,7 +58,7 @@ $date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_selec // Cette fonction me semble pas utile. Si on a fait des adhesions alors que module banque // pas actif c'est qu'on voulait pas d'insertion en banque. // si on active apres coup, on va pas modifier toutes les adhesions pour avoir une ecriture -// en banque mais on va mettre le solde banque direct a la valeur apres toutes les adhésions. +// en banque mais on va mettre le solde banque direct a la valeur apres toutes les adh�sions. $allowinsertbankafter=0; if (! $user->rights->adherent->cotisation->lire) @@ -70,7 +70,7 @@ if (! $user->rights->adherent->cotisation->lire) */ // Insertion de la cotisation dans le compte banquaire -if ($allowinsertbankafter && $user->rights->banque->modifier && $_POST["action"] == '2bank' && $_POST["rowid"] !='') +if ($allowinsertbankafter && $_POST["action"] == '2bank' && $_POST["rowid"] !='') { if (defined("ADHERENT_BANK_USE") && $conf->global->ADHERENT_BANK_USE) { @@ -83,7 +83,7 @@ if ($allowinsertbankafter && $user->rights->banque->modifier && $_POST["action"] $msg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("OperationType")).'
'; } - // Créer un tiers + facture et enregistrer son paiement ? -> Non requis avec module compta expert + // Cr�er un tiers + facture et enregistrer son paiement ? -> Non requis avec module compta expert // Eventuellement offrir option a la creation adhesion if (! $msg) @@ -211,7 +211,7 @@ if ($result) $var=!$var; - if ($allowinsertbankafter && $user->rights->banque->modifier && ! $objp->fk_account && $conf->banque->enabled && $conf->global->ADHERENT_BANK_USE && $objp->cotisation) + if ($allowinsertbankafter && ! $objp->fk_account && $conf->banque->enabled && $conf->global->ADHERENT_BANK_USE && $objp->cotisation) { print "
"; } @@ -251,7 +251,7 @@ if ($result) else { print ""; - if ($allowinsertbankafter && $user->rights->banque->modifier && $objp->cotisation) + if ($allowinsertbankafter && $objp->cotisation) { print ''; print ''; @@ -279,7 +279,7 @@ if ($result) print ''.price($objp->cotisation).''; print ""; - if ($allowinsertbankafter && $user->rights->banque->modifier && ! $objp->fk_account && $conf->banque->enabled && $conf->global->ADHERENT_BANK_USE && $objp->cotisation) + if ($allowinsertbankafter && ! $objp->fk_account && $conf->banque->enabled && $conf->global->ADHERENT_BANK_USE && $objp->cotisation) { print "
\n"; } diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 58d99e6d23a..a29467df0b7 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -24,7 +24,7 @@ /** \file htdocs/compta/bank/ligne.php \ingroup compta - \brief Page édition d'une écriture bancaire + \brief Page �dition d'une �criture bancaire \version $Revision$ */ @@ -91,7 +91,7 @@ if ($_POST["action"] == "update") { $objp = $db->fetch_object($result); if ($objp->rappro) - die ("Vous ne pouvez pas modifier une écriture déjà rapprochée"); + die ("Vous ne pouvez pas modifier une �criture d�j� rapproch�e"); } $db->begin(); @@ -100,7 +100,7 @@ if ($_POST["action"] == "update") $dateop = $_POST["dateoyear"].'-'.$_POST["dateomonth"].'-'.$_POST["dateoday"]; $dateval= $_POST["datevyear"].'-'.$_POST["datevmonth"].'-'.$_POST["datevday"]; $sql = "UPDATE ".MAIN_DB_PREFIX."bank"; - $sql.= " SET label='".addslashes($_POST["label"])."',"; // Todo: créer une classe pour séparer les requêtes sql + $sql.= " SET label='".addslashes($_POST["label"])."',"; // Todo: cr�er une classe pour s�parer les requ�tes sql if (isset($_POST['amount'])) $sql.=" amount='$amount',"; $sql.= " dateo = '".$dateop."', datev = '".$dateval."',"; $sql.= " fk_account = ".$_POST['accountid']; @@ -218,7 +218,7 @@ if ($result) // Confirmations if ($_GET["action"] == 'delete_categ') { - $html->form_confirm("ligne.php?rowid=".$_GET["rowid"]."&cat1=".$_GET["fk_categ"]."&orig_account=".$orig_account,"Supprimer dans la catégorie","Etes-vous sûr de vouloir supprimer le classement dans la catégorie ?","confirm_delete_categ"); + $html->form_confirm("ligne.php?rowid=".$_GET["rowid"]."&cat1=".$_GET["fk_categ"]."&orig_account=".$orig_account,"Supprimer dans la cat�gorie","Etes-vous s�r de vouloir supprimer le classement dans la cat�gorie ?","confirm_delete_categ"); print '
'; } @@ -233,7 +233,7 @@ if ($result) $links=$acct->get_url($rowid); - // Tableau sur 4 colonne si déja rapproché, sinon sur 5 colonnes + // Tableau sur 4 colonne si d�ja rapproch�, sinon sur 5 colonnes // Author print ''.$langs->trans("Author").""; @@ -266,7 +266,7 @@ if ($result) // Date ope print ''.$langs->trans("DateOperation").''; - if (! $objp->rappro && $user->rights->banque->modifier) + if (! $objp->rappro && ($user->rights->banque->modifier || $user->rights->banque->consolidate)) { print ''; $html->select_date($objp->do,'dateo','','','','update'); @@ -281,7 +281,7 @@ if ($result) // Value date print "".$langs->trans("DateValue").""; - if (! $objp->rappro && $user->rights->banque->modifier) + if (! $objp->rappro && ($user->rights->banque->modifier || $user->rights->banque->consolidate)) { print ''; $html->select_date($objp->dv,'datev','','','','update'); @@ -301,13 +301,13 @@ if ($result) // Description print "".$langs->trans("Label").""; - if (! $objp->rappro && $user->rights->banque->modifier) + if (! $objp->rappro && ($user->rights->banque->modifier || $user->rights->banque->consolidate)) { print ''; print ''; if (eregi('^\((.*)\)$',$objp->label,$reg)) { - // Label générique car entre parenthèses. On l'affiche en le traduisant + // Label g�n�rique car entre parenth�ses. On l'affiche en le traduisant print $langs->trans($reg[1]); } else @@ -411,7 +411,7 @@ if ($result) // Type paiement print "".$langs->trans("Type")." / ".$langs->trans("Numero").""; - if ($user->rights->banque->modifier) + if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print "
rowid\">"; print ''; @@ -434,7 +434,7 @@ if ($result) print "rowid\">"; print ''; print ""; - print ''; + print ''; print ''; print "
"; } @@ -446,7 +446,7 @@ if ($result) // Emetteur print "".$langs->trans("CheckTransmitter").""; - if ($user->rights->banque->modifier) + if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print "
rowid\">"; print ''; diff --git a/htdocs/compta/bank/pre.inc.php b/htdocs/compta/bank/pre.inc.php index 55c868e17e2..5fc0d0211f1 100644 --- a/htdocs/compta/bank/pre.inc.php +++ b/htdocs/compta/bank/pre.inc.php @@ -75,9 +75,9 @@ function llxHeader($head = "") // Obsolete. Replaced by page Rapport E/S // $menu->add_submenu(DOL_URL_ROOT."/compta/bank/bilan.php","Bilan",1,$user->rights->banque->lire); - if ($user->rights->banque->modifier) + if ($user->rights->banque->transfer) { - $menu->add_submenu(DOL_URL_ROOT."/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->modifier); + $menu->add_submenu(DOL_URL_ROOT."/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer); } if ($conf->global->COMPTA_ONLINE_PAYMENT_BPLC) diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index c2b1b870ce9..ee2c8c2f529 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -315,7 +315,7 @@ if ($resql) print img_edit(); print '  '; - if ($objp->do <= mktime() ) { + if ($objp->do <= dolibarr_mktime() ) { print ''; print img_delete(); print ''; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index b3dda1a5ad0..affa50ee225 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -22,7 +22,7 @@ /** \file htdocs/compta/bank/releve.php \ingroup banque - \brief Page d'affichage d'un relevé + \brief Page d'affichage d'un relev� \version $Revision$ */ @@ -67,7 +67,7 @@ llxHeader(); $html = new Form($db); -// Récupère info du compte +// R�cup�re info du compte $acct = new Account($db); if ($_GET["account"]) { @@ -82,7 +82,7 @@ if ($_GET["ref"]) if (! isset($_GET["num"])) { /* - * Vue liste tous relevés confondus + * Vue liste tous relev�s confondus */ $sql = "SELECT distinct(b.num_releve) as numr"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -156,7 +156,7 @@ else */ if ($_GET["rel"] == 'prev') { - // Recherche valeur pour num = numéro relevé précédent + // Recherche valeur pour num = num�ro relev� pr�c�dent $sql = "SELECT distinct(num_releve) as num"; $sql.= " FROM ".MAIN_DB_PREFIX."bank"; $sql.= " WHERE num_releve < ".$_GET["num"]." AND fk_account = ".$_GET["account"]; @@ -176,7 +176,7 @@ else } elseif ($_GET["rel"] == 'next') { - // Recherche valeur pour num = numéro relevé précédent + // Recherche valeur pour num = num�ro relev� pr�c�dent $sql = "SELECT distinct(num_releve) as num"; $sql.= " FROM ".MAIN_DB_PREFIX."bank"; $sql.= " WHERE num_releve > ".$_GET["num"]." AND fk_account = ".$_GET["account"]; @@ -195,7 +195,7 @@ else } } else { - // On veut le relevé num + // On veut le relev� num $num=$_GET["num"]; } $ve=$_GET["ve"]; @@ -222,7 +222,7 @@ else print ' '; print "\n"; - // Calcul du solde de départ du relev + // Calcul du solde de d�part du relev $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank"; $sql.= " WHERE num_releve < ".$num." AND fk_account = ".$acct->id; $resql=$db->query($sql); @@ -233,7 +233,7 @@ else $db->free($resql); } - // Recherche les écritures pour le relev + // Recherche les �critures pour le relev $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " WHERE num_releve='".$num."'"; @@ -251,7 +251,7 @@ else $numrows = $db->num_rows($result); $i = 0; - // Ligne Solde début releve + // Ligne Solde d�but releve print "id."\"> "; print "".$langs->trans("InitialBankBalance")." :".price($total)." \n"; @@ -281,7 +281,7 @@ else // Libelle print ''; $reg=array(); - eregi('\((.+)\)',$objp->label,$reg); // Si texte entouré de parenthèe on tente recherche de traduction + eregi('\((.+)\)',$objp->label,$reg); // Si texte entour� de parenth�e on tente recherche de traduction if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); else print $objp->label; print ''; @@ -354,7 +354,7 @@ else } } - // Catégories + // Cat�gories if ($ve) { $sql = "SELECT label FROM ".MAIN_DB_PREFIX."bank_categ as ct, ".MAIN_DB_PREFIX."bank_class as cl"; @@ -393,7 +393,7 @@ else print "".price($total)."\n"; - if ($user->rights->banque->modifier) + if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print "rowid&account=".$acct->id."\">"; print img_edit(); diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 123b3e238d1..3099e2213cb 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -33,7 +33,7 @@ $langs->load("banks"); $user->getrights('banque'); -if (!$user->rights->banque->modifier) +if (! $user->rights->banque->transfer) accessforbidden(); diff --git a/htdocs/includes/modules/modBanque.class.php b/htdocs/includes/modules/modBanque.class.php index 6c216087bc9..812091c38b4 100644 --- a/htdocs/includes/modules/modBanque.class.php +++ b/htdocs/includes/modules/modBanque.class.php @@ -93,7 +93,7 @@ class modBanque extends DolibarrModules $r++; $this->rights[$r][0] = 112; // id de la permission - $this->rights[$r][1] = 'Créer/modifier/supprimer écriture bancaire'; // libelle de la permission + $this->rights[$r][1] = 'Créer/modifier montant/supprimer écriture bancaire'; // libelle de la permission $this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut $this->rights[$r][4] = 'modifier'; @@ -119,6 +119,14 @@ class modBanque extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut $this->rights[$r][4] = 'export'; + $r++; + $this->rights[$r][0] = 116; // id de la permission + $this->rights[$r][1] = 'Virements entre comptes'; // libelle de la permission + $this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'transfer'; + + // Exports //--------