diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 16b67dd4876..62e6db446c1 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -375,8 +375,8 @@ $listofreferent = array( 'lang'=>'entrepot', 'buttonnew'=>'AddWarehouse', 'project_field'=>'fk_project', - 'testnew'=>$user->rights->stock->creer, - 'test'=>$conf->stock->enabled && $user->rights->stock->lire && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT)), + 'testnew'=>$user->hasRight('stock', 'creer'), + 'test'=>!empty($conf->stock->enabled) && $user->hasRight('stock','lire') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT)), 'propal'=>array( 'name'=>"Proposals", 'title'=>"ListProposalsAssociatedProject", @@ -386,8 +386,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'propal', 'buttonnew'=>'AddProp', - 'testnew'=>$user->rights->propal->creer, - 'test'=>$conf->propal->enabled && $user->rights->propale->lire), + 'testnew'=>$user->hasRight('propal', 'creer'), + 'test'=>!empty($conf->propal->enabled) && $user->hasRight('propale', 'lire')), 'order'=>array( 'name'=>"CustomersOrders", 'title'=>"ListOrdersAssociatedProject", @@ -397,8 +397,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'orders', 'buttonnew'=>'CreateOrder', - 'testnew'=>$user->rights->commande->creer, - 'test'=>$conf->commande->enabled && $user->rights->commande->lire), + 'testnew'=>$user->hasRight('commande', 'creer'), + 'test'=>!empty($conf->commande->enabled) && $user->hasRight('commande', 'lire')), 'invoice'=>array( 'name'=>"CustomersInvoices", 'title'=>"ListInvoicesAssociatedProject", @@ -409,8 +409,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'bills', 'buttonnew'=>'CreateBill', - 'testnew'=>$user->rights->facture->creer, - 'test'=>$conf->facture->enabled && $user->rights->facture->lire), + 'testnew'=>$user->hasRight('facture', 'creer'), + 'test'=>!empty($conf->facture->enabled) && $user->hasRight('facture', 'lire')), 'invoice_predefined'=>array( 'name'=>"PredefinedInvoices", 'title'=>"ListPredefinedInvoicesAssociatedProject", @@ -420,8 +420,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'bills', 'buttonnew'=>'CreateBill', - 'testnew'=>$user->rights->facture->creer, - 'test'=>$conf->facture->enabled && $user->rights->facture->lire), + 'testnew'=>$user->hasRight('facture', 'creer'), + 'test'=>!empty($conf->facture->enabled) && $user->hasRight('facture', 'lire')), 'proposal_supplier'=>array( 'name'=>"SuppliersProposals", 'title'=>"ListSupplierProposalsAssociatedProject", @@ -431,8 +431,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'supplier_proposal', 'buttonnew'=>'AddSupplierProposal', - 'testnew'=>$user->rights->supplier_proposal->creer, - 'test'=>$conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire), + 'testnew'=>$user->hasRight('supplier_proposal', 'creer'), + 'test'=>!empty($conf->supplier_proposal->enabled) && $user->hasRight('supplier_proposal', 'lire')), 'order_supplier'=>array( 'name'=>"SuppliersOrders", 'title'=>"ListSupplierOrdersAssociatedProject", @@ -442,8 +442,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'suppliers', 'buttonnew'=>'AddSupplierOrder', - 'testnew'=>($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer), - 'test'=>$conf->supplier_order->enabled && ($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)), + 'testnew'=>$user->hasRight('fournisseur','commande', 'creer') || $user->hasRight('supplier_order', 'creer'), + 'test'=>!empty($conf->supplier_order->enabled) && $user->hasRight('fournisseur', 'supplier_order', 'lire') || $user->hasRight('supplier_order', 'lire')), 'invoice_supplier'=>array( 'name'=>"BillsSuppliers", 'title'=>"ListSupplierInvoicesAssociatedProject", @@ -454,8 +454,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'suppliers', 'buttonnew'=>'AddSupplierInvoice', - 'testnew'=>($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), - 'test'=>$conf->supplier_invoice->enabled && ($user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire)), + 'testnew'=>$user->hasRight('fournisseur','facture', 'creer') || $user->hasRight('supplier_invoice', 'creer'), + 'test'=>!empty($conf->supplier_invoice->enabled) && $user->hasRight('fournisseur','facture', 'lire') || $user->hasRight('supplier_invoice', 'lire')), 'contract'=>array( 'name'=>"Contracts", 'title'=>"ListContractAssociatedProject", @@ -465,8 +465,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'contracts', 'buttonnew'=>'AddContract', - 'testnew'=>$user->rights->contrat->creer, - 'test'=>$conf->contrat->enabled && $user->rights->contrat->lire), + 'testnew'=>$user->hasRight('contrat', 'creer'), + 'test'=>!empty($conf->contrat->enabled) && $user->hasRight('contrat', 'lire')), 'intervention'=>array( 'name'=>"Interventions", 'title'=>"ListFichinterAssociatedProject", @@ -478,8 +478,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'interventions', 'buttonnew'=>'AddIntervention', - 'testnew'=>$user->rights->ficheinter->creer, - 'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire), + 'testnew'=>$user->hasRight('ficheinter', 'creer'), + 'test'=>!empty($conf->ficheinter->enabled) && $user->hasRight('ficheinter', 'lire')), 'shipping'=>array( 'name'=>"Shippings", 'title'=>"ListShippingAssociatedProject", @@ -500,9 +500,9 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/mrp/mo_card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'mrp', 'buttonnew'=>'CreateMO', - 'testnew'=>'$user->rights->mrp->write', + 'testnew'=>$user->hasRight('mrp', 'write'), 'project_field'=>'fk_project', - 'test'=>$conf->mrp->enabled && $user->rights->mrp->read), + 'test'=>!empty($conf->mrp->enabled) && $user->hasRight('mrp', 'read')), 'trip'=>array( 'name'=>"TripsAndExpenses", 'title'=>"ListExpenseReportsAssociatedProject", @@ -514,8 +514,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/deplacement/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'trips', 'buttonnew'=>'AddTrip', - 'testnew'=>$user->rights->deplacement->creer, - 'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire), + 'testnew'=>$user->hasRight('deplacement', 'creer'), + 'test'=>!empty($conf->deplacement->enabled) && $user->hasRight('deplacement', 'lire')), 'expensereport'=>array( 'name'=>"ExpenseReports", 'title'=>"ListExpenseReportsAssociatedProject", @@ -527,8 +527,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'trips', 'buttonnew'=>'AddTrip', - 'testnew'=>$user->rights->expensereport->creer, - 'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire), + 'testnew'=>$user->hasRight('expensereport', 'creer'), + 'test'=>!empty($conf->expensereport->enabled) && $user->hasRight('expensereport', 'lire')), 'donation'=>array( 'name'=>"Donation", 'title'=>"ListDonationsAssociatedProject", @@ -540,8 +540,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'donations', 'buttonnew'=>'AddDonation', - 'testnew'=>$user->rights->don->creer, - 'test'=>$conf->don->enabled && $user->rights->don->lire), + 'testnew'=>$user->hasRight('don', 'creer'), + 'test'=>!empty($conf->don->enabled) && $user->hasRight('don', 'lire')), 'loan'=>array( 'name'=>"Loan", 'title'=>"ListLoanAssociatedProject", @@ -553,8 +553,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'loan', 'buttonnew'=>'AddLoan', - 'testnew'=>$user->rights->loan->write, - 'test'=>$conf->loan->enabled && $user->rights->loan->read), + 'testnew'=>$user->hasRight('loan', 'write'), + 'test'=>!empty($conf->loan->enabled) && $user->hasRight('loan', 'read')), 'chargesociales'=>array( 'name'=>"SocialContribution", 'title'=>"ListSocialContributionAssociatedProject", @@ -566,8 +566,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/compta/sociales/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'compta', 'buttonnew'=>'AddSocialContribution', - 'testnew'=>$user->rights->tax->charges->lire, - 'test'=>$conf->tax->enabled && $user->rights->tax->charges->lire), + 'testnew'=>$user->hasRight('tax', 'charges', 'lire'), + 'test'=>!empty($conf->tax->enabled) && $user->hasRight('tax', 'charges', 'lire')), 'project_task'=>array( 'name'=>"TaskTimeSpent", 'title'=>"ListTaskTimeUserProject", @@ -578,8 +578,8 @@ $listofreferent = array( 'disableamount'=>0, 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'buttonnew'=>'AddTimeSpent', - 'testnew'=>$user->rights->projet->creer, - 'test'=>($conf->project->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))), + 'testnew'=>$user->hasRight('project', 'creer'), + 'test'=>!empty($conf->project->enabled) && $user->hasRight('projet', 'lire') && !empty($conf->global->PROJECT_HIDE_TASKS)), 'stock_mouvement'=>array( 'name'=>"MouvementStockAssociated", 'title'=>"ListMouvementStockProject", @@ -588,7 +588,7 @@ $listofreferent = array( 'table'=>'stock_mouvement', 'datefieldname'=>'datem', 'disableamount'=>0, - 'test'=>($conf->stock->enabled && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))), + 'test'=>!empty($conf->stock->enabled) && $user->hasRight('stock', 'mouvement', 'lire') && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)), 'salaries'=>array( 'name'=>"Salaries", 'title'=>"ListSalariesAssociatedProject", @@ -600,8 +600,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/salaries/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'salaries', 'buttonnew'=>'AddSalary', - 'testnew'=>$user->rights->salaries->write, - 'test'=>$conf->salaries->enabled && $user->rights->salaries->read), + 'testnew'=>$user->hasRight('salaries', 'write'), + 'test'=>!empty($conf->salaries->enabled) && $user->hasRight('salaries', 'read')), 'variouspayment'=>array( 'name'=>"VariousPayments", 'title'=>"ListVariousPaymentsAssociatedProject", @@ -613,8 +613,8 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'banks', 'buttonnew'=>'AddVariousPayment', - 'testnew'=>$user->rights->banque->modifier, - 'test'=>$conf->banque->enabled && $user->rights->banque->lire && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)), + 'testnew'=>$user->hasRight('banque', 'modifier'), + 'test'=>!empty($conf->banque->enabled) && $user->hasRight('banque', 'lire') && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)), /* No need for this, available on dedicated tab "Agenda/Events" 'agenda'=>array( 'name'=>"Agenda",