From f0365e49e255f592605e1c2bbc2e92bcebb68cf2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2016 18:05:26 +0200 Subject: [PATCH] Fix book keeper can edit accounting account of taxes --- htdocs/accountancy/index.php | 4 +-- htdocs/admin/dict.php | 33 ++++++++++++++++++------- htdocs/core/menus/standard/eldy.lib.php | 1 + htdocs/langs/en_US/accountancy.lang | 1 + 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index f605f504539..7c99ca35d1e 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -83,7 +83,7 @@ $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'')."
\n"; print "
\n"; $step++; -$textlink = ''.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("Dictionaries")."-".$langs->transnoentitiesnoconv("DictionaryVAT").''; +$textlink = ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").''; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print "
\n"; print "
\n"; @@ -94,7 +94,7 @@ print "
\n"; print "
\n"; if (! empty($conf->tax->enabled)) { - $textlink = ''.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("Dictionaries")."-".$langs->transnoentitiesnoconv("DictionarySocialContributions").''; + $textlink = ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print "
\n"; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c0f8d7251a4..1b03c0a6d3e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -56,6 +56,7 @@ $id=GETPOST('id','int'); $rowid=GETPOST('rowid','alpha'); $allowed=$user->admin; +if ($id == 7 && ! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Tax page allowed to manager of chart account if ($id == 10 && ! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Vat page allowed to manager of chart account if (! $allowed) accessforbidden(); @@ -912,11 +913,17 @@ if ($id) $linkback=''.$langs->trans("BackToDictionaryList").''; } $titlepicto='title_setup'; -if (GETPOST('from') == 'accountancy') +if ($id == 10 && GETPOST('from') == 'accountancy') { $titre=$langs->trans("MenuVatAccounts"); - $titlepicto='title_accountancy'; + $titlepicto='title_accountancy'; } +if ($id == 7 && GETPOST('from') == 'accountancy') +{ + $titre=$langs->trans("MenuTaxAccounts"); + $titlepicto='title_accountancy'; +} + print load_fiche_titre($titre,$linkback,$titlepicto); if (empty($id)) @@ -974,6 +981,7 @@ if ($id) print '
'; print ''; + print ''; print ''; @@ -1134,7 +1142,7 @@ if ($id) - // List of available recod in database + // List of available record in database dol_syslog("htdocs/admin/dict", LOG_DEBUG); $resql=$db->query($sql); if ($resql) @@ -1148,6 +1156,7 @@ if ($id) $paramwithsearch = $param; if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; + if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha'); // There is several pages if ($num > $listlimit) @@ -1337,7 +1346,11 @@ if ($id) $valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country); } } - else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { + else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { + $valuetoshow=yn($valuetoshow); + $align="center"; + } + else if ($fieldlist[$field]=='type_cdr') { if(empty($valuetoshow)) $valuetoshow = $langs->trans('None'); elseif($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth'); elseif($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext'); @@ -1521,10 +1534,12 @@ if ($id) else print ''; // Delete link - if ($iserasable) + if ($iserasable) { - if ($user->admin) print ''; - //else print ''; // Some dictionnary can be edited by other profile than admin + print ''; } else print ''; @@ -1786,8 +1801,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') $size=''; $class=''; if ($fieldlist[$field]=='code') $size='size="8" '; if ($fieldlist[$field]=='position') $size='size="4" '; - if ($fieldlist[$field]=='libelle') $class='centpercent'; - if ($fieldlist[$field]=='tracking') $class='centpercent'; + if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; + if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent'; if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; print ''; print ''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index ab06863a371..b5f672d5210 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -947,6 +947,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 20); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 40); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30); + if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50); // Binding diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index f41bc17814d..c0b956ed18c 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -47,6 +47,7 @@ AccountAccountingShort=Account AccountAccountingSuggest=Accounting account suggest MenuDefaultAccounts=Default accounts MenuVatAccounts=Vat accounts +MenuTaxAccounts=Tax accounts MenuProductsAccounts=Product accounts ProductsBinding=Products accounts Ventilation=Binding to accounts
 '.img_delete().''.img_delete().''; + if ($user->admin) print ''.img_delete().''; + //else print ''.img_delete().''; // Some dictionnary can be edited by other profile than admin + print '