Fix: [ bug #1374 ] Salaries module requires "Special costs" module to
work but it does not enable it
This commit is contained in:
parent
f36b9effe8
commit
f95c87f1d6
@ -50,7 +50,7 @@ if ($user->societe_id > 0)
|
|||||||
unset($_GET["action"]);
|
unset($_GET["action"]);
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id');
|
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
|
||||||
|
|
||||||
|
|
||||||
$object = new ActionComm($db);
|
$object = new ActionComm($db);
|
||||||
|
|||||||
@ -53,7 +53,7 @@ if ($user->societe_id > 0)
|
|||||||
unset($_GET["action"]);
|
unset($_GET["action"]);
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id');
|
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
|
||||||
|
|
||||||
$object = new ActionComm($db);
|
$object = new ActionComm($db);
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ $originid=GETPOST('originid','int');
|
|||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id');
|
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
|
||||||
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
|
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
|
||||||
|
|
||||||
$error=GETPOST("error");
|
$error=GETPOST("error");
|
||||||
|
|||||||
@ -40,7 +40,7 @@ if ($user->societe_id > 0)
|
|||||||
$socid = $user->societe_id;
|
$socid = $user->societe_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id');
|
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -36,7 +36,7 @@ $langs->load("bills");
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
$result = restrictedArea($user, 'tax|salaries', '', '', 'charges|');
|
||||||
|
|
||||||
$year=$_GET["year"];
|
$year=$_GET["year"];
|
||||||
$filtre=$_GET["filtre"];
|
$filtre=$_GET["filtre"];
|
||||||
|
|||||||
@ -37,14 +37,14 @@ $id=GETPOST("id",'int');
|
|||||||
$action=GETPOST('action');
|
$action=GETPOST('action');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = GETPOST("socid","int");
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
$result = restrictedArea($user, 'salaries', '', '', '');
|
||||||
|
|
||||||
$sal = new PaymentSalary($db);
|
$sal = new PaymentSalary($db);
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('taxsalarycard'));
|
$hookmanager->initHooks(array('salarycard'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -29,9 +29,9 @@ $langs->load("salaries");
|
|||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = GETPOST("socid","int");
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
$result = restrictedArea($user, 'salaries', '', '', '');
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
|||||||
@ -97,7 +97,7 @@ function dol_hash($chain,$type=0)
|
|||||||
* If GETPOST('action') defined, we also check write and delete permission.
|
* If GETPOST('action') defined, we also check write and delete permission.
|
||||||
*
|
*
|
||||||
* @param User $user User to check
|
* @param User $user User to check
|
||||||
* @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', ...)
|
* @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
|
||||||
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
|
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
|
||||||
* @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
|
* @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
|
||||||
* @param string $feature2 Feature to check, second level of permission (optional)
|
* @param string $feature2 Feature to check, second level of permission (optional)
|
||||||
@ -123,12 +123,13 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
|||||||
|
|
||||||
if ($dbt_select != 'rowid' && $dbt_select != 'id') $objectid = "'".$objectid."'";
|
if ($dbt_select != 'rowid' && $dbt_select != 'id') $objectid = "'".$objectid."'";
|
||||||
|
|
||||||
// More features to check
|
// Features/modules to check
|
||||||
$features = explode("&", $features);
|
$featuresarray = array($features);
|
||||||
|
if (preg_match('/&/', $features)) $featuresarray = explode("&", $features);
|
||||||
|
else if (preg_match('/\|/', $features)) $featuresarray = explode("|", $features);
|
||||||
|
|
||||||
// More subfeatures to check
|
// More subfeatures to check
|
||||||
if (!empty($feature2))
|
if (! empty($feature2)) $feature2 = explode("|", $feature2);
|
||||||
$feature2 = explode("&", $feature2);
|
|
||||||
|
|
||||||
// More parameters
|
// More parameters
|
||||||
$params = explode('&', $dbtablename);
|
$params = explode('&', $dbtablename);
|
||||||
@ -138,106 +139,113 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
|||||||
$listofmodules=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
$listofmodules=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||||
|
|
||||||
// Check read permission from module
|
// Check read permission from module
|
||||||
$readok=1;
|
$readok=1; $nbko=0;
|
||||||
foreach ($features as $feature)
|
foreach ($featuresarray as $feature)
|
||||||
{
|
{
|
||||||
if (! empty($user->societe_id) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($feature,$listofmodules)) // If limits on modules for external users, module must be into list of modules for external users
|
if (! empty($user->societe_id) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($feature,$listofmodules)) // If limits on modules for external users, module must be into list of modules for external users
|
||||||
{
|
{
|
||||||
$readok=0;
|
$readok=0; $nbko++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($feature == 'societe')
|
if ($feature == 'societe')
|
||||||
{
|
{
|
||||||
if (! $user->rights->societe->lire && ! $user->rights->fournisseur->lire) $readok=0;
|
if (! $user->rights->societe->lire && ! $user->rights->fournisseur->lire) { $readok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'contact')
|
else if ($feature == 'contact')
|
||||||
{
|
{
|
||||||
if (! $user->rights->societe->contact->lire) $readok=0;
|
if (! $user->rights->societe->contact->lire) { $readok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'produit|service')
|
else if ($feature == 'produit|service')
|
||||||
{
|
{
|
||||||
if (! $user->rights->produit->lire && ! $user->rights->service->lire) $readok=0;
|
if (! $user->rights->produit->lire && ! $user->rights->service->lire) { $readok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'prelevement')
|
else if ($feature == 'prelevement')
|
||||||
{
|
{
|
||||||
if (! $user->rights->prelevement->bons->lire) $readok=0;
|
if (! $user->rights->prelevement->bons->lire) { $readok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'cheque')
|
else if ($feature == 'cheque')
|
||||||
{
|
{
|
||||||
if (! $user->rights->banque->cheque) $readok=0;
|
if (! $user->rights->banque->cheque) { $readok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'projet')
|
else if ($feature == 'projet')
|
||||||
{
|
{
|
||||||
if (! $user->rights->projet->lire && ! $user->rights->projet->all->lire) $readok=0;
|
if (! $user->rights->projet->lire && ! $user->rights->projet->all->lire) { $readok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if (! empty($feature2)) // This should be used for future changes
|
else if (! empty($feature2)) // This should be used for future changes
|
||||||
{
|
{
|
||||||
foreach($feature2 as $subfeature)
|
foreach($feature2 as $subfeature)
|
||||||
{
|
{
|
||||||
if (empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) $readok=0;
|
if (! empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $readok=0; $nbko++; }
|
||||||
else { $readok=1; break; } // For bypass the second test if the first is ok
|
else if (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $readok=0; $nbko++; }
|
||||||
|
else { $readok=1; break; } // Break is to bypass second test if the first is ok
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions
|
else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions
|
||||||
{
|
{
|
||||||
if (empty($user->rights->$feature->lire)
|
if (empty($user->rights->$feature->lire)
|
||||||
&& empty($user->rights->$feature->read)
|
&& empty($user->rights->$feature->read)
|
||||||
&& empty($user->rights->$feature->run)) $readok=0;
|
&& empty($user->rights->$feature->run)) { $readok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a or and at least one ok
|
||||||
|
if (preg_match('/\|/', $features) && $nbko < count($featuresarray)) $readok=1;
|
||||||
|
|
||||||
if (! $readok) accessforbidden();
|
if (! $readok) accessforbidden();
|
||||||
//print "Read access is ok";
|
//print "Read access is ok";
|
||||||
|
|
||||||
// Check write permission from module
|
// Check write permission from module
|
||||||
$createok=1;
|
$createok=1; $nbko=0;
|
||||||
if (GETPOST("action") == 'create')
|
if (GETPOST("action") == 'create')
|
||||||
{
|
{
|
||||||
foreach ($features as $feature)
|
foreach ($featuresarray as $feature)
|
||||||
{
|
{
|
||||||
if ($feature == 'contact')
|
if ($feature == 'contact')
|
||||||
{
|
{
|
||||||
if (! $user->rights->societe->contact->creer) $createok=0;
|
if (! $user->rights->societe->contact->creer) { $createok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'produit|service')
|
else if ($feature == 'produit|service')
|
||||||
{
|
{
|
||||||
if (! $user->rights->produit->creer && ! $user->rights->service->creer) $createok=0;
|
if (! $user->rights->produit->creer && ! $user->rights->service->creer) { $createok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'prelevement')
|
else if ($feature == 'prelevement')
|
||||||
{
|
{
|
||||||
if (! $user->rights->prelevement->bons->creer) $createok=0;
|
if (! $user->rights->prelevement->bons->creer) { $createok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'commande_fournisseur')
|
else if ($feature == 'commande_fournisseur')
|
||||||
{
|
{
|
||||||
if (! $user->rights->fournisseur->commande->creer) $createok=0;
|
if (! $user->rights->fournisseur->commande->creer) { $createok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'banque')
|
else if ($feature == 'banque')
|
||||||
{
|
{
|
||||||
if (! $user->rights->banque->modifier) $createok=0;
|
if (! $user->rights->banque->modifier) { $createok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if ($feature == 'cheque')
|
else if ($feature == 'cheque')
|
||||||
{
|
{
|
||||||
if (! $user->rights->banque->cheque) $createok=0;
|
if (! $user->rights->banque->cheque) { $createok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
else if (! empty($feature2)) // This should be used for future changes
|
else if (! empty($feature2)) // This should be used
|
||||||
{
|
{
|
||||||
foreach($feature2 as $subfeature)
|
foreach($feature2 as $subfeature)
|
||||||
{
|
{
|
||||||
if (empty($user->rights->$feature->$subfeature->creer)
|
if (empty($user->rights->$feature->$subfeature->creer)
|
||||||
&& empty($user->rights->$feature->$subfeature->write)
|
&& empty($user->rights->$feature->$subfeature->write)
|
||||||
&& empty($user->rights->$feature->$subfeature->create)) $createok=0;
|
&& empty($user->rights->$feature->$subfeature->create)) { $createok=0; $nbko++; }
|
||||||
else { $createok=1; break; } // For bypass the second test if the first is ok
|
else { $createok=1; break; } // Break to bypass second test if the first is ok
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (! empty($feature)) // This is for old permissions
|
else if (! empty($feature)) // This is for old permissions ('creer' or 'write')
|
||||||
{
|
{
|
||||||
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
|
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
|
||||||
if (empty($user->rights->$feature->creer)
|
if (empty($user->rights->$feature->creer)
|
||||||
&& empty($user->rights->$feature->write)) $createok=0;
|
&& empty($user->rights->$feature->write)) { $createok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a or and at least one ok
|
||||||
|
if (preg_match('/\|/', $features) && $nbko < count($featuresarray)) $createok=1;
|
||||||
|
|
||||||
if (! $createok) accessforbidden();
|
if (! $createok) accessforbidden();
|
||||||
//print "Write access is ok";
|
//print "Write access is ok";
|
||||||
}
|
}
|
||||||
@ -253,10 +261,10 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check delete permission from module
|
// Check delete permission from module
|
||||||
$deleteok=1;
|
$deleteok=1; $nbko=0;
|
||||||
if ((GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes') || GETPOST("action") == 'delete')
|
if ((GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes') || GETPOST("action") == 'delete')
|
||||||
{
|
{
|
||||||
foreach ($features as $feature)
|
foreach ($featuresarray as $feature)
|
||||||
{
|
{
|
||||||
if ($feature == 'contact')
|
if ($feature == 'contact')
|
||||||
{
|
{
|
||||||
@ -312,7 +320,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
|||||||
// is linked to a company allowed to $user.
|
// is linked to a company allowed to $user.
|
||||||
if (! empty($objectid) && $objectid > 0)
|
if (! empty($objectid) && $objectid > 0)
|
||||||
{
|
{
|
||||||
foreach ($features as $feature)
|
foreach ($featuresarray as $feature)
|
||||||
{
|
{
|
||||||
$sql='';
|
$sql='';
|
||||||
|
|
||||||
|
|||||||
@ -175,10 +175,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/liste.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/liste.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
|
||||||
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/stats.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/stats.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
||||||
-- Special expenses
|
-- Special expenses
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '1', '', 0, 6, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)', '', 0, 6, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2201__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2202__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/fiche.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/fiche.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->write', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2203__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->read', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/sociales/charges.php?leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/sociales/charges.php?leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
||||||
|
|||||||
@ -797,42 +797,46 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
{
|
{
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
|
|
||||||
$newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy",$langs->trans("MenuSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax');
|
$permtoshowmenu=((! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read));
|
||||||
|
$newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy",$langs->trans("MenuSpecialExpenses"), 0, $permtoshowmenu, '', $mainmenu, 'tax');
|
||||||
|
|
||||||
// Salaries
|
// Salaries
|
||||||
if (! empty($conf->salaries->enabled))
|
if (! empty($conf->salaries->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("salaries");
|
$langs->load("salaries");
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->salaries->read, '', $mainmenu, 'tax_salary');
|
$newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->salaries->read, '', $mainmenu, 'tax_salary');
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/fiche.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->create);
|
if (empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/fiche.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->write);
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->read);
|
if (empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->read);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Social contributions
|
// Social contributions
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
|
if (! empty($conf->tax->enabled))
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
|
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
|
|
||||||
// VAT
|
|
||||||
if (empty($conf->global->TAX_DISABLE_VAT_MENUS))
|
|
||||||
{
|
{
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat');
|
$newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
if (empty($leftmenu) || preg_match('/^tax_social/i',$leftmenu)) $newmenu->add("/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
if (empty($leftmenu) || preg_match('/^tax_social/i',$leftmenu)) $newmenu->add("/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
// VAT
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
|
if (empty($conf->global->TAX_DISABLE_VAT_MENUS))
|
||||||
global $mysoc;
|
|
||||||
|
|
||||||
//Local Taxes
|
|
||||||
if($mysoc->country_code=='ES' && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1"))
|
|
||||||
{
|
{
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire);
|
$newmenu->add("/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat');
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
||||||
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
||||||
//if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
|
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
|
||||||
|
global $mysoc;
|
||||||
|
|
||||||
|
//Local Taxes
|
||||||
|
if($mysoc->country_code=='ES' && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1"))
|
||||||
|
{
|
||||||
|
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire);
|
||||||
|
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
||||||
|
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
||||||
|
if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
||||||
|
//if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compta simple
|
// Compta simple
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
@ -93,15 +93,15 @@ class modSalaries extends DolibarrModules
|
|||||||
$this->rights[$r][5] = '';
|
$this->rights[$r][5] = '';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 511;
|
$this->rights[$r][0] = 512;
|
||||||
$this->rights[$r][1] = 'Create/modify salaries';
|
$this->rights[$r][1] = 'Create/modify salaries';
|
||||||
$this->rights[$r][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[$r][4] = 'create';
|
$this->rights[$r][4] = 'write';
|
||||||
$this->rights[$r][5] = '';
|
$this->rights[$r][5] = '';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 512;
|
$this->rights[$r][0] = 514;
|
||||||
$this->rights[$r][1] = 'Delete salaries';
|
$this->rights[$r][1] = 'Delete salaries';
|
||||||
$this->rights[$r][2] = 'd';
|
$this->rights[$r][2] = 'd';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
@ -109,7 +109,7 @@ class modSalaries extends DolibarrModules
|
|||||||
$this->rights[$r][5] = '';
|
$this->rights[$r][5] = '';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 515;
|
$this->rights[$r][0] = 517;
|
||||||
$this->rights[$r][1] = 'Export salaries';
|
$this->rights[$r][1] = 'Export salaries';
|
||||||
$this->rights[$r][2] = 'r';
|
$this->rights[$r][2] = 'r';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user