From ac408c2ef6d1e6e8675940a0d33207a1d83dce10 Mon Sep 17 00:00:00 2001 From: Regis Houssin <regis@dolibarr.fr> Date: Thu, 5 May 2011 09:02:12 +0000 Subject: [PATCH] Fix: uniformize code Fix: add permissions in paypal module --- htdocs/includes/modules/modPaybox.class.php | 2 +- htdocs/includes/modules/modPaypal.class.php | 28 +++++++++++------- htdocs/langs/en_US/admin.lang | 8 +++-- htdocs/langs/fr_FR/admin.lang | 8 +++-- .../img/{paybox.png => object_paybox.png} | Bin .../img/{paypal.png => object_paypal.png} | Bin htdocs/paypal/transaction.php | 2 +- 7 files changed, 32 insertions(+), 16 deletions(-) rename htdocs/paybox/img/{paybox.png => object_paybox.png} (100%) rename htdocs/paypal/img/{paypal.png => object_paypal.png} (100%) diff --git a/htdocs/includes/modules/modPaybox.class.php b/htdocs/includes/modules/modPaybox.class.php index 16454bdee80..ce586ac0177 100644 --- a/htdocs/includes/modules/modPaybox.class.php +++ b/htdocs/includes/modules/modPaybox.class.php @@ -65,7 +65,7 @@ class modPayBox extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png' - $this->picto=DOL_URL_ROOT.'/paybox/img/paybox.png'; + $this->picto='paybox@paybox'; // Data directories to create when module is enabled. $this->dirs = array('/paybox/temp'); diff --git a/htdocs/includes/modules/modPaypal.class.php b/htdocs/includes/modules/modPaypal.class.php index 436ac75c092..6a2f4ef9b47 100644 --- a/htdocs/includes/modules/modPaypal.class.php +++ b/htdocs/includes/modules/modPaypal.class.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr> * * 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 @@ -65,7 +66,7 @@ class modPaypal extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png' - $this->picto=DOL_URL_ROOT.'/paypal/img/paypal.png'; + $this->picto='paypal@paypal'; // Data directories to create when module is enabled. $this->dirs = array('/paypal/temp'); @@ -81,7 +82,7 @@ class modPaypal extends DolibarrModules $this->requiredby = array(); // List of modules id to disable if this one is disabled $this->phpmin = array(4,1); // Minimum version of PHP required by module $this->need_dolibarr_version = array(3,0,-2); // Minimum version of Dolibarr required by module - $this->langfiles = array("paybox"); + $this->langfiles = array("paypal"); // Constants $this->const = array(); // List of particular constants to add when module is enabled @@ -108,14 +109,21 @@ class modPaypal extends DolibarrModules $this->rights = array(); // Permission array used by this module $r=0; - // Add here list of permission defined by an id, a label, a boolean and two constant strings. - // Example: - // $this->rights[$r][0] = 2000; // Permission id (must not be already used) - // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $r++; + $this->rights[$r][0] = 50201; // id de la permission + $this->rights[$r][1] = 'Read transactions'; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (deprecated) + $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'transaction'; + $this->rights[$r][5] = 'read'; + $r++; + + $this->rights[$r][0] = 50202; // id de la permission + $this->rights[$r][1] = 'Import transactions'; // libelle de la permission + $this->rights[$r][2] = 'w'; // type de la permission (deprecated) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'transaction'; + $this->rights[$r][5] = 'import'; + $r++; // Main menu entries diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 170c6dccec9..7505d97ca53 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -411,12 +411,14 @@ Module2900Name= GeoIPMaxmind Module2900Desc= GeoIP Maxmind conversions capabilities Module5000Name=Multi-company Module5000Desc=Allows you to manage multiple companies -Module10000Name=PayBox -Module10000Desc=Module to offer an online payment page by credit card with PayBox Module13452Name=SpeedFinder Module13452Desc=Search engine in AJAX to find a name from a part of a phone number within 2 seconds +Module50000Name=PayBox +Module50000Desc=Module to offer an online payment page by credit card with PayBox Module50100Name=Point of sales Module50100Desc=Point of sales module +Module50200Name= Paypal +Module50200Desc= Module to offer an online payment page by credit card with Paypal Permission11=Read customer invoices Permission12=Create/modify customer invoices Permission13=Unvalidate customer invoices @@ -620,6 +622,8 @@ Permission2501=Read documents Permission2502=Download documents Permission2503=Submit or delete documents Permission2515=Setup documents directories +Permission50201= Read transactions +Permission50202= Import transactions DictionnaryCompanyType=Company types DictionnaryCompanyJuridicalType=Juridical kinds of company DictionnaryProspectLevel=Prospect potential level diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 89036be9029..b42d17c2ec4 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -412,12 +412,14 @@ Module2900Name= GeoIPMaxmind Module2900Desc= Capacités de conversion GeoIP Maxmind Module5000Name= Multi-société Module5000Desc= Permet de gérer plusieurs sociétés -Module10000Name= PayBox -Module10000Desc= Module permettant d'offrir en ligne une page de paiement par carte de crédit avec PayBox Module13452Name= SpeedFinder Module13452Desc= Moteur de recherche en AJAX pour trouver un nom à partir d'une partie d'un numéro de téléphone en 2 secondes +Module50000Name= PayBox +Module50000Desc= Module permettant d'offrir en ligne une page de paiement par carte de crédit avec PayBox Module50100Name= Point de vente Module50100Desc= Caisse enregistreuse de point de vente +Module50200Name= Paypal +Module50200Desc= Module permettant d'offrir en ligne une page de paiement par carte de crédit avec Paypal Permission11= Consulter les factures clients Permission12= Créer/modifier les factures clients Permission13= Dé-valider les factures clients @@ -629,6 +631,8 @@ Permission2515= Administrer les rubriques de documents Permission8555= Utilisation du module Permission8556= Définir les sites ecommerce Permission8557= Importer les données +Permission50201= Consulter les transactions +Permission50202= Importer les transactions DictionnaryCompanyType= Types de sociétés DictionnaryCompanyJuridicalType= Formes juridiques DictionnaryProspectLevel= Niveau de potentiel des prospects diff --git a/htdocs/paybox/img/paybox.png b/htdocs/paybox/img/object_paybox.png similarity index 100% rename from htdocs/paybox/img/paybox.png rename to htdocs/paybox/img/object_paybox.png diff --git a/htdocs/paypal/img/paypal.png b/htdocs/paypal/img/object_paypal.png similarity index 100% rename from htdocs/paypal/img/paypal.png rename to htdocs/paypal/img/object_paypal.png diff --git a/htdocs/paypal/transaction.php b/htdocs/paypal/transaction.php index c91179d2016..aa6d2aaa9af 100644 --- a/htdocs/paypal/transaction.php +++ b/htdocs/paypal/transaction.php @@ -30,7 +30,7 @@ require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php"); $langs->load("paypal"); // Security check -//$result=restrictedArea($user,'paypal'); +$result=restrictedArea($user,'paypal','','','transaction'); $action = GETPOST('action'); $id = GETPOST('id'); -- GitLab