diff --git a/ChangeLog b/ChangeLog index 9aae192541f..9023171f337 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,11 @@ -------------------------------------------------------------- English Dolibarr ChangeLog -------------------------------------------------------------- -***** ChangeLog for 3.8 compared to 3.7.* ***** -- New: Add Option to not change date on cloning project -- New: Add check list from table for extrafield type - ***** ChangeLog for 3.8 compared to 3.7.* ***** For users: +- New: Add Option to not change date on cloning project +- New: Add check list from table for extrafield type - New: Use new combobox. - New: Add hidden option MAXTABS_IN_CARD. - Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined' @@ -16,6 +14,7 @@ For users: - Introduce option MAIN_HTML_TITLE to start to control format of html title content. - Add extrafields on bank account cards. - Added delay between mails in Newsletter module +- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user For translators: - Update language files. diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index 19100576a83..a9bfb987ca1 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Marcos García * * 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 @@ -129,6 +130,14 @@ class modMargin extends DolibarrModules $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'creer'; + + $r++; + $this->rights[$r][0] = 59003; // id de la permission + $this->rights[$r][1] = 'Read every user margin'; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'read'; + $this->rights[$r][5] = 'all'; } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0c1bf74a146..51fdbc5efe0 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -763,6 +763,7 @@ Permission55001=Read polls Permission55002=Create/modify polls Permission59001=Read commercial margins Permission59002=Define commercial margins +Permission59003=Read every user margin DictionaryCompanyType=Thirdparties type DictionaryCompanyJuridicalType=Juridical kinds of thirdparties DictionaryProspectLevel=Prospect potential level diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index 0cf9bc34410..bc7446f51f9 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -16,6 +16,7 @@ MarginDetails=Margin details ProductMargins=Product margins CustomerMargins=Customer margins SalesRepresentativeMargins=Sales representative margins +UserMargins=User margins ProductService=Product or Service AllProducts=All products and services ChooseProduct/Service=Choose product or service diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 8a0aefba711..32525114ee3 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2015 Marcos García * * 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 @@ -34,7 +35,12 @@ $langs->load("products"); $langs->load("margins"); // Security check -$agentid = GETPOST('agentid','int'); + +if ($user->rights->margin->read->all) { + $agentid = GETPOST('agentid', 'int'); +} else { + $agentid = $user->id; +} $mesg = ''; @@ -85,10 +91,12 @@ dol_fiche_head($head, 'agentMargins', $titre, 0, $picto); print '
'; print ''; -print ''; -print ''; +if ($user->rights->margin->read->all) { + print ''; + print ''; +} // Start date print ''; diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index 1f904c44f2d..1478dd9dcb0 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2014-2015 Marcos García * * 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 @@ -77,10 +77,15 @@ function marges_prepare_head() $h++; } + if ($user->rights->margin->read->all) { + $title = 'UserMargins'; + } else { + $title = 'SalesRepresentativeMargins'; + } + $head[$h][0] = DOL_URL_ROOT."/margin/agentMargins.php"; - $head[$h][1] = $langs->trans("SalesRepresentativeMargins"); + $head[$h][1] = $langs->trans($title); $head[$h][2] = 'agentMargins'; - $h++; return $head; }
'.$langs->trans('SalesRepresentative').''; -print $form->select_dolusers($agentid,'agentid',1); -print '
'.$langs->trans('SalesRepresentative').''; + print $form->select_dolusers($agentid, 'agentid', 1); + print '
'.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')