[ task #1793 ] Create new permission to restrict commercial agent margin to logged user
This commit is contained in:
parent
3db231cea6
commit
c667f8734a
@ -12,6 +12,7 @@ For users:
|
||||
MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
|
||||
- Introduce option MAIN_HTML_TITLE to start to control format of html title content.
|
||||
- Add extrafields on bank account cards.
|
||||
- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* 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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -761,6 +761,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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* 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 '<form method="post" name="sel" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans('SalesRepresentative').'</td>';
|
||||
print '<td colspan="4">';
|
||||
print $form->select_dolusers($agentid,'agentid',1);
|
||||
print '</td></tr>';
|
||||
if ($user->rights->margin->read->all) {
|
||||
print '<tr><td width="20%">'.$langs->trans('SalesRepresentative').'</td>';
|
||||
print '<td colspan="4">';
|
||||
print $form->select_dolusers($agentid, 'agentid', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Start date
|
||||
print '<td>'.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')</td>';
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -56,7 +57,7 @@ function marges_admin_prepare_head()
|
||||
*/
|
||||
function marges_prepare_head()
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs, $conf, $user;
|
||||
$langs->load("marges@marges");
|
||||
|
||||
$h = 0;
|
||||
@ -72,10 +73,15 @@ function marges_prepare_head()
|
||||
$head[$h][2] = 'customerMargins';
|
||||
$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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user