diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index a13c0fd0436..8468e071f35 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -481,12 +481,10 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - if ($user->rights->propal->creer) - { - $url = DOL_URL_ROOT.'/comm/propal/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/comm/propal/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', $url, '', $user->rights->propal->creer); // Fields title search print '
'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index dc33f4dda54..91f5b9d8602 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -484,12 +484,10 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - if ($contextpage == 'orderlist' && $user->rights->commande->creer) - { - $url = DOL_URL_ROOT.'/commande/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/commande/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $user->rights->commande->creer); // Lines of title fields print ''; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 527ab256f4a..3b99fc599a5 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -252,12 +252,10 @@ if ($result) if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); $newcardbutton = ''; - if ($user->rights->banque->modifier) - { - $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '' $user->rights->banque->modifier); print ''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 557170b44dd..d3198dcc9b2 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -675,12 +675,10 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - if ($user->rights->facture->creer && $contextpage != 'poslist') - { - $url = DOL_URL_ROOT.'/compta/facture/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/compta/facture/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->rights->facture->creer && $contextpage != 'poslist'); $i = 0; print ''."\n"; diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 4107f1a808e..7de2fcc8c0b 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -43,12 +43,10 @@ llxHeader(); $localtax_static = new Localtax($db); $newcardbutton = ''; -if ($user->rights->tax->charges->creer) -{ - $url = DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url); -} + +$url = DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt; +if (!empty($socid)) $url .= '&socid='.$socid; +$newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer); print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Payments", $mysoc->country_code), $newcardbutton, 'title_accountancy'); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index a06601d9dd4..405b99cd2e0 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -125,12 +125,10 @@ if ($resql) if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; $newcardbutton = ''; - if ($user->rights->banque->cheque) - { - $url = DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->cheque); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index c5ebdcf50d4..d05b4d823ef 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -147,12 +147,10 @@ if ($result) if ($typeid) $param .= '&typeid='.$typeid; $newcardbutton = ''; - if ($user->rights->tax->charges->creer) - { - $url = DOL_URL_ROOT.'/compta/tva/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewVATPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/compta/tva/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewVATPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 1d7cf438ce7..91e6faecb59 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -370,12 +370,10 @@ if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; -if ($user->rights->contrat->creer) -{ - $url = DOL_URL_ROOT.'/contrat/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url); -} + +$url = DOL_URL_ROOT.'/contrat/card.php?action=create'; +if (!empty($socid)) $url .= '&socid='.$socid; +$newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index fb4bc36e0fd..af1b138d7b7 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -360,14 +360,12 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - if ($user->rights->expedition->creer) - { - // Currently: a sending can't create from sending list - // $url = DOL_URL_ROOT.'/expedition/card.php?action=create'; - // if (!empty($socid)) $url .= '&socid='.$socid; - // $newcardbutton .= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', $url); - $newcardbutton .= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expedition/card.php?action=create2'); - } + + // Currently: a sending can't create from sending list + // $url = DOL_URL_ROOT.'/expedition/card.php?action=create'; + // if (!empty($socid)) $url .= '&socid='.$socid; + // $newcardbutton .= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', $url, '', $user->rights->expedition->creer); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expedition/card.php?action=create2', '' , $user->rights->expedition->creer); $i = 0; print ''."\n"; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 44fbc14b241..29b0aa1a202 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -462,12 +462,10 @@ if ($resql) $title = $langs->trans("ListTripsAndExpenses"); $newcardbutton = ''; - if ($user->rights->expensereport->creer) - { - $url = DOL_URL_ROOT.'/expensereport/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/expensereport/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->creer); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'trip', 0, $newcardbutton, '', $limit, 0, 0, 1); } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 676aa050e63..ca1d25dd9d7 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -650,12 +650,10 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - if ($user->rights->fournisseur->commande->creer) - { - $url = DOL_URL_ROOT.'/fourn/commande/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/fourn/commande/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $user->rights->fournisseur->commande->creer); // Fields title search print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 9146a8aecc5..ea7c807e107 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -509,12 +509,10 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - if ($user->rights->fournisseur->facture->creer) - { - $url = DOL_URL_ROOT.'/fourn/facture/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/fourn/facture/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->rights->fournisseur->facture->creer); $i = 0; print ''."\n"; diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index a4faa006007..21a131eb525 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -151,12 +151,11 @@ if ($resql) if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); $newcardbutton = ''; - if ($user->rights->loan->write) - { - $url = DOL_URL_ROOT.'/loan/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/loan/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url, '', $user->rights->loan->write); + print ''."\n"; if ($optioncss != '') print ''; print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index af6cbb9a57f..7667d2abf20 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -449,12 +449,10 @@ if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; -if ($user->rights->projet->creer) -{ - $url = DOL_URL_ROOT.'/projet/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', $url); -} + +$url = DOL_URL_ROOT.'/projet/card.php?action=create'; +if (!empty($socid)) $url .= '&socid='.$socid; +$newcardbutton .= dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', $url, '', $user->rights->projet->creer); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 4c56579c0b5..e43b412f6c1 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -154,12 +154,10 @@ if ($result) if ($optioncss != '') $param .= '&optioncss='.$optioncss; $newcardbutton = ''; - if (!empty($user->rights->salaries->write)) - { - $url = DOL_URL_ROOT.'/salaries/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/salaries/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 2569abc28e7..3f8fef2b87d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -599,24 +599,21 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; -if ($user->rights->societe->creer && $contextpage != 'poslist') +$typefilter = ''; +$label = 'MenuNewThirdParty'; + +if (!empty($type)) { - $typefilter = ''; - $label = 'MenuNewThirdParty'; - - if (!empty($type)) - { - $typefilter = '&type='.$type; - if ($type == 'p') $label = 'MenuNewProspect'; - if ($type == 'c') $label = 'MenuNewCustomer'; - if ($type == 'f') $label = 'NewSupplier'; - } - - $url = DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url); + $typefilter = '&type='.$type; + if ($type == 'p') $label = 'MenuNewProspect'; + if ($type == 'c') $label = 'MenuNewCustomer'; + if ($type == 'f') $label = 'NewSupplier'; } +$url = DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter; +if (!empty($socid)) $url .= '&socid='.$socid; +$newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer && $contextpage != 'poslist'); + print ''; if ($optioncss != '') print ''; print ''; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 26254f33b79..e8e2f79d85a 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -415,12 +415,10 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - if ($user->rights->supplier_proposal->creer) - { - $url = DOL_URL_ROOT.'/supplier_proposal/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', $url); - } + + $url = DOL_URL_ROOT.'/supplier_proposal/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', $url, '', $user->rights->supplier_proposal->creer); // Fields title search print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 8f1021ffecd..1bdcaed0e01 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -572,7 +572,7 @@ $newcardbutton = ''; $url = DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid : '').($projectid ? '&origin=projet_project&originid='.$projectid : ''); if (!empty($socid)) $url .= '&socid='.$socid; -$newcardbutton .= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', !empty($user->rights->ticket->write)); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write); $picto = 'ticket'; if ($socid > 0) $picto = ''; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 2e6adde0c66..ac2719ff1c8 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -302,12 +302,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $text = $langs->trans("ListOfUsers"); $newcardbutton = ''; -if ($canadduser) -{ - $url = DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu='; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url); -} +$url = DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu='; +if (!empty($socid)) $url .= '&socid='.$socid; +$newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $canadduser); print ''."\n"; if ($optioncss != '') print '';