Withdrawls: Add user permission control

This commit is contained in:
Juanjo Menent 2011-01-15 08:51:22 +00:00
parent e16eda8308
commit 07046ce3b4
8 changed files with 47 additions and 22 deletions

View File

@ -55,7 +55,7 @@ if (GETPOST("action") == 'confirm_credite' && GETPOST("confirm") == 'yes')
exit;
}
if (GETPOST("action") == 'infotrans')
if (GETPOST("action") == 'infotrans' && $user->rights->prelevement->bons->send)
{
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
@ -83,7 +83,7 @@ if (GETPOST("action") == 'infotrans')
}
}
if (GETPOST("action") == 'infocredit')
if (GETPOST("action") == 'infocredit' && $user->rights->prelevement->bons->credit)
{
$bon = new BonPrelevement($db,"");
$bon->fetch($_GET["id"]);
@ -171,7 +171,7 @@ if ($_GET["id"])
print '</table>';
dol_fiche_end();
if($bon->date_trans == 0)
if($bon->date_trans == 0 && $user->rights->prelevement->bons->send)
{
print '<form method="post" name="userfile" action="fiche.php?id='.$bon->id.'" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -194,7 +194,7 @@ if ($_GET["id"])
print '</form>';
}
if($bon->date_trans <> 0 && $bon->date_credit == 0)
if($bon->date_trans <> 0 && $bon->date_credit == 0 && $user->rights->prelevement->bons->credit)
{
print '<form name="infocredit" method="post" action="fiche.php?id='.$bon->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -143,7 +143,7 @@ if ($_GET["id"])
dol_print_error($db);
}
if ($_GET["action"] == 'rejet' && $user->rights->prelevement->bons->creer)
if ($_GET["action"] == 'rejet' && $user->rights->prelevement->bons->credit)
{
$html = new Form($db);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -83,21 +84,39 @@ class modPrelevement extends DolibarrModules
// Permissions
$this->rights = array();
$this->rights_class = 'prelevement';
$r=0;
$r++;
$this->rights[$r][0] = 151;
$this->rights[$r][1] = 'Read withdrawals';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'bons';
$this->rights[$r][5] = 'lire';
$this->rights[1][0] = 151;
$this->rights[1][1] = 'Read withdrawals';
$this->rights[1][2] = 'r';
$this->rights[1][3] = 1;
$this->rights[1][4] = 'bons';
$this->rights[1][5] = 'lire';
$this->rights[4][0] = 152;
$this->rights[4][1] = 'Create/modify a withdrawals';
$this->rights[4][2] = 'w';
$this->rights[4][3] = 0;
$this->rights[4][4] = 'bons';
$this->rights[4][5] = 'creer';
$r++;
$this->rights[$r][0] = 152;
$this->rights[$r][1] = 'Create/modify a withdrawals';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'bons';
$this->rights[$r][5] = 'creer';
$r++;
$this->rights[$r][0] = 153;
$this->rights[$r][1] = 'Send withdrawals to bank';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'bons';
$this->rights[$r][5] = 'send';
$r++;
$this->rights[$r][0] = 154;
$this->rights[$r][1] = 'credit/refuse withdrawals';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'bons';
$this->rights[$r][5] = 'credit';
/* $this->rights[2][0] = 154;
$this->rights[2][1] = 'Setup withdraw account';
$this->rights[2][2] = 'w';

View File

@ -471,7 +471,8 @@ Permission146=Consultar proveïdors
Permission147=Consultar estadístiques
Permission151=Consultar domiciliacions
Permission152=Crear/modificar domiciliacions
Permission153=Consultar domiciliacions
Permission153=Enviar domiciliacions
Permission154=Abonar/tornar domiciliacions
Permission161=Consultar contractes de servei
Permission162=Crear/modificar contractes de servei
Permission163=Activar els serveis d'un contracte

View File

@ -476,6 +476,8 @@ Permission147=Read stats
Permission151=Read standing orders
Permission152=Create/modify a standing orders request
Permission153=Read standing orders receipts
Permission153=Transmission standing orders receipts
Permission154=Credit/refuse standing orders receipts
Permission161=Read contracts
Permission162=Create/modify contracts
Permission163=Activate a service of a contract

View File

@ -471,7 +471,8 @@ Permission146=Consultar proveedores
Permission147=Consultar estadísticas
Permission151=Consultar domiciliaciones
Permission152=Crear/modificar domiciliaciones
Permission153=Consultar domiciliaciones
Permission153=Enviar domiciliaciones
Permission154=Abonar/devolver domiciliaciones
Permission161=Consultar contratos de servicio
Permission162=Crear/modificar contratos de servicio
Permission163=Activar los servicios de un contrato

View File

@ -471,7 +471,8 @@ Permission146=Consultar proveedores
Permission147=Consultar estadísticas
Permission151=Consultar domiciliaciones
Permission152=Crear/modificar domiciliaciones
Permission153=Consultar domiciliaciones
Permission153=Enviar domiciliaciones
Permission154=Abonar/devolver domiciliaciones
Permission161=Consultar contratos de servicio
Permission162=Crear/modificar contratos de servicio
Permission163=Activar los servicios de un contrato

View File

@ -475,7 +475,8 @@ Permission146= Consulter les fournisseurs
Permission147= Consulter les stats
Permission151= Consulter les prélèvements
Permission152= Créer/modifier une demande de prélèvements
Permission153= Consulter les bons de prélèvements
Permission153= Emission des bons de prélèvements
Permission154= Crediter/rejeter les bons de prélèvements
Permission161= Consulter les contrats de services
Permission162= Créer/modifier les contrats de services
Permission163= Activer les services d'un contrat