diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 6b404ff448b..096aa0c88bc 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -559,20 +559,21 @@ if ($account > 0) } else { - if ($user->rights->banque->modifier) + print ''; + if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { - print ''; print ''; print img_edit(); - print '  '; + print ''; + } + print ' '; + if ($user->rights->banque->modifier) + { print ''; print img_delete(); - print ''; - } - else - { - print " "; + print ''; } + print ''; } print ""; @@ -609,15 +610,26 @@ if ($account > 0) { print '
'; - if ($user->rights->banque->modifier && $acct->type != 2 && $acct->rappro) // Si non compte cash et rapprochable + if ($acct->type != 2 && $acct->rappro) // Si non compte cash et rapprochable { - print ''.$langs->trans("Conciliate").''; + if ($user->rights->banque->consolidate) + { + print ''.$langs->trans("Conciliate").''; + } + else + { + print ''.$langs->trans("Conciliate").''; + } } if ($user->rights->banque->modifier) { print ''.$langs->trans("AddBankRecord").''; } + else + { + print ''.$langs->trans("AddBankRecord").''; + } print '
'; } diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index da69f5bc5d6..a0306211c2a 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -31,7 +31,7 @@ require("./pre.inc.php"); -if (!$user->rights->banque->modifier) +if (!$user->rights->banque->modifier && !$user->rights->banque->consolidate) accessforbidden(); $langs->load("banks"); diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index 9237ff6e8a6..337b6f22772 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 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 @@ -30,17 +30,18 @@ require("./pre.inc.php"); $langs->load("banks"); +$langs->load("bills"); $user->getrights('compta'); -if (! $user->rights->banque->modifier) accessforbidden(); +if (! $user->rights->banque->consolidate) accessforbidden(); /* * Action rapprochement */ -if ($_POST["action"] == 'rappro') +if ($user->rights->banque->consolidate && $_POST["action"] == 'rappro') { // Definition, nettoyage parametres $valrappro=1; @@ -232,6 +233,22 @@ if ($resql) print ''; $newline=0; } + elseif ($links[$key]['type']=='payment_supplier') { + print ''; + if (eregi('^\((.*)\)$',$links[$key]['label'],$reg)) + { + // Label générique car entre parenthèses. On l'affiche en le traduisant + if ($reg[1]=='paiement') $reg[1]='Payment'; + print img_object($langs->trans('ShowPayment'),'payment').' '; + print $langs->trans($reg[1]); + } + else + { + print $links[$key]['label']; + } + print ''; + $newline=0; + } elseif ($links[$key]['type']=='company') { print ''; print img_object($langs->trans('ShowCustomer'),'company').' '; diff --git a/htdocs/includes/modules/modBanque.class.php b/htdocs/includes/modules/modBanque.class.php index bf02c02b3f4..7ae6470d955 100644 --- a/htdocs/includes/modules/modBanque.class.php +++ b/htdocs/includes/modules/modBanque.class.php @@ -45,66 +45,73 @@ class modBanque extends DolibarrModules * \brief Constructeur. Definit les noms, constantes et boites * \param DB handler d'accès base */ - function modBanque($DB) - { - $this->db = $DB ; - $this->id = 'banque'; // Same value xxx than in file modXxx.class.php file - $this->numero = 85 ; + function modBanque($DB) + { + $this->db = $DB ; + $this->id = 'banque'; // Same value xxx than in file modXxx.class.php file + $this->numero = 85 ; - $this->family = "financial"; - $this->name = "Banque"; - $this->description = "Gestion des comptes financiers de type Comptes bancaires ou postaux"; + $this->family = "financial"; + $this->name = "Banque"; + $this->description = "Gestion des comptes financiers de type Comptes bancaires ou postaux"; - $this->revision = explode(' ','$Revision$'); - $this->version = $this->revision[1]; + $this->revision = explode(' ','$Revision$'); + $this->version = $this->revision[1]; - $this->const_name = 'MAIN_MODULE_BANQUE'; - $this->special = 0; - $this->picto='account'; + $this->const_name = 'MAIN_MODULE_BANQUE'; + $this->special = 0; + $this->picto='account'; - // Dépendances - $this->depends = array(); - $this->requiredby = array("modComptabilite","modComptabiliteExpert"); - $this->conflictwith = array(); - $this->langfiles = array("banks"); - - // Constantes - $this->const = array(); + // Dépendances + $this->depends = array(); + $this->requiredby = array("modComptabilite","modComptabiliteExpert"); + $this->conflictwith = array(); + $this->langfiles = array("banks"); + + // Constantes + $this->const = array(); - $this->dirs = array(); + $this->dirs = array(); - // Boites - $this->boxes = array(); + // Boites + $this->boxes = array(); - $this->boxes[0][0] = "Soldes Comptes Bancaires"; - $this->boxes[0][1] = "box_comptes.php"; + $this->boxes[0][0] = "Soldes Comptes Bancaires"; + $this->boxes[0][1] = "box_comptes.php"; - // Permissions - $this->rights = array(); - $this->rights_class = 'banque'; - $r=0; - - $r++; - $this->rights[$r][0] = 111; // id de la permission - $this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission - $this->rights[$r][2] = 'a'; // type de la permission (déprécié à ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par défaut - $this->rights[$r][4] = 'lire'; + // Permissions + $this->rights = array(); + $this->rights_class = 'banque'; + $r=0; + + $r++; + $this->rights[$r][0] = 111; // id de la permission + $this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 1; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'lire'; - $r++; - $this->rights[$r][0] = 112; // id de la permission - $this->rights[$r][1] = 'Créer modifier rapprocher transactions'; // libelle de la permission - $this->rights[$r][2] = 'a'; // 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'; + $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][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'; - $r++; - $this->rights[$r][0] = 113; // id de la permission - $this->rights[$r][1] = 'Configurer les comptes bancaires (créer, gérer catégories)'; // libelle de la permission - $this->rights[$r][2] = 'a'; // 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] = 'configurer'; - } + $r++; + $this->rights[$r][0] = 113; // id de la permission + $this->rights[$r][1] = 'Configurer les comptes bancaires (créer, gérer catégories)'; // libelle de la permission + $this->rights[$r][2] = 'a'; // 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] = 'configurer'; + + $r++; + $this->rights[$r][0] = 114; // id de la permission + $this->rights[$r][1] = 'Rapprocher transactions'; // 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] = 'consolidate'; + } /** diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql index f68b4782ff7..2cc158353f8 100644 --- a/mysql/migration/2.1.0-2.2.0.sql +++ b/mysql/migration/2.1.0-2.2.0.sql @@ -16,6 +16,10 @@ update llx_bank_url set type='payment_supplier' where (type='' or type is null) alter table llx_bank_url modify `type` enum("?","company","payment","payment_supplier","member","subscription","donation","sc","payment_sc") NOT NULL; +insert into llx_rights_def (id, libelle, module, type, bydefault, subperms, perms) values (114,'Rapprocher transactions','banque','w',0,null,'consolidate'); +update llx_rights_def set libelle='Créer/modifier/supprimer écriture bancaire' where perms='modifier' AND module='banque'; + + update llx_actioncomm set fk_action = 9 where fk_action = 10; ALTER TABLE llx_cotisation ADD UNIQUE INDEX uk_cotisation (fk_adherent,dateadh);