From d1f70a37df0f7dc7987967b1c6a49a8a20961116 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Fri, 18 Sep 2020 07:56:13 +0200 Subject: [PATCH 1/8] Preselect thirparty on new from list (part 1) --- htdocs/comm/propal/list.php | 4 +++- htdocs/commande/list.php | 6 ++++-- htdocs/compta/facture/list.php | 4 +++- htdocs/expedition/list.php | 4 ++++ htdocs/fourn/commande/list.php | 6 ++++-- htdocs/fourn/facture/list.php | 4 +++- htdocs/supplier_proposal/list.php | 6 ++++-- 7 files changed, 25 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7bce96633fc..a13c0fd0436 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -483,7 +483,9 @@ if ($resql) $newcardbutton = ''; if ($user->rights->propal->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/propal/card.php?action=create'); + $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); } // Fields title search diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 898c581407f..dc33f4dda54 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -486,8 +486,10 @@ if ($resql) $newcardbutton = ''; if ($contextpage == 'orderlist' && $user->rights->commande->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/commande/card.php?action=create'); - } + $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); + } // Lines of title fields print '
'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 41e0817310e..557170b44dd 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -677,7 +677,9 @@ if ($resql) $newcardbutton = ''; if ($user->rights->facture->creer && $contextpage != 'poslist') { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/facture/card.php?action=create'); + $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); } $i = 0; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 5c94ff3da95..fb4bc36e0fd 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -362,6 +362,10 @@ if ($resql) $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'); } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index ea2e44b775d..676aa050e63 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -652,8 +652,10 @@ if ($resql) $newcardbutton = ''; if ($user->rights->fournisseur->commande->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fourn/commande/card.php?action=create'); - } + $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); + } // Fields title search print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 655798deac7..9146a8aecc5 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -511,7 +511,9 @@ if ($resql) $newcardbutton = ''; if ($user->rights->fournisseur->facture->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fourn/facture/card.php?action=create'); + $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); } $i = 0; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 008a81542ec..26254f33b79 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -417,8 +417,10 @@ if ($resql) $newcardbutton = ''; if ($user->rights->supplier_proposal->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create'); - } + $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); + } // Fields title search print ''; From 1b04ef8aad50592b874a8f99b9e0b49f598dcb86 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Fri, 18 Sep 2020 10:36:40 +0200 Subject: [PATCH 2/8] Add function to all list that support $socid --- htdocs/accountancy/bookkeeping/list.php | 4 +++- htdocs/compta/bank/various_payment/list.php | 4 +++- htdocs/compta/localtax/list.php | 4 +++- htdocs/compta/paiement/cheque/list.php | 4 +++- htdocs/compta/tva/list.php | 6 ++++-- htdocs/contrat/list.php | 4 +++- htdocs/expensereport/list.php | 4 +++- htdocs/fichinter/list.php | 5 ++++- htdocs/loan/list.php | 5 +++-- htdocs/projet/list.php | 4 +++- htdocs/salaries/list.php | 4 +++- htdocs/societe/list.php | 4 +++- htdocs/ticket/list.php | 5 ++++- htdocs/user/list.php | 4 +++- 14 files changed, 45 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 9a623287fc2..987f7f3fd28 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -640,7 +640,9 @@ $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredL $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); -$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer); +$url = './card.php?action=create'; +if (!empty($socid)) $url .= '&socid='.$socid; +$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->rights->accounting->mouvements->creer); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index cfecfecffa5..527ab256f4a 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -254,7 +254,9 @@ if ($result) $newcardbutton = ''; if ($user->rights->banque->modifier) { - $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'); + $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); } print ''; diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index a8b37c3ef93..4107f1a808e 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -45,7 +45,9 @@ $localtax_static = new Localtax($db); $newcardbutton = ''; if ($user->rights->tax->charges->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt); + $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); } 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 e76936c71fd..a06601d9dd4 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -127,7 +127,9 @@ if ($resql) $newcardbutton = ''; if ($user->rights->banque->cheque) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'); + $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); } print ''; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 5b09da5305c..c5ebdcf50d4 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -149,8 +149,10 @@ if ($result) $newcardbutton = ''; if ($user->rights->tax->charges->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewVATPayment', ($ltt + 1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/tva/card.php?action=create'); - } + $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); + } print ''; if ($optioncss != '') print ''; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e15d6467755..1d7cf438ce7 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -372,7 +372,9 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; if ($user->rights->contrat->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contrat/card.php?action=create'); + $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); } print ''; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index a21ed4d6612..44fbc14b241 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -464,7 +464,9 @@ if ($resql) $newcardbutton = ''; if ($user->rights->expensereport->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expensereport/card.php?action=create'); + $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); } 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/fichinter/list.php b/htdocs/fichinter/list.php index 0204689b9b0..fcad99c975e 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -319,7 +319,10 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - $morehtmlcenter .= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fichinter/card.php?action=create', '', $user->rights->ficheinter->creer); + + $url = DOL_URL_ROOT.'/fichinter/card.php?action=create'; + if (!empty($socid)) $url .= '&socid='.$socid; + $morehtmlcenter .= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->rights->ficheinter->creer); // Lines of title fields print ''."\n"; diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index fc0e766ed9b..a4faa006007 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -153,9 +153,10 @@ if ($resql) $newcardbutton = ''; if ($user->rights->loan->write) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/loan/card.php?action=create'); + $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); } - print ''."\n"; if ($optioncss != '') print ''; print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index a682d7ef383..af6cbb9a57f 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -451,7 +451,9 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; if ($user->rights->projet->creer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create'); + $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); } print ''; diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 6c4ee37a979..4c56579c0b5 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -156,7 +156,9 @@ if ($result) $newcardbutton = ''; if (!empty($user->rights->salaries->write)) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/salaries/card.php?action=create'); + $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); } print ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 96b50a34bf8..2569abc28e7 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -612,7 +612,9 @@ if ($user->rights->societe->creer && $contextpage != 'poslist') if ($type == 'f') $label = 'NewSupplier'; } - $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter); + $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); } print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index c4c1cbadcc9..8f1021ffecd 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -569,7 +569,10 @@ if ($socid) print ''; if ($projectid) print ''; $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid : '').($projectid ? '&origin=projet_project&originid='.$projectid : ''), '', !empty($user->rights->ticket->write)); + +$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)); $picto = 'ticket'; if ($socid > 0) $picto = ''; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index b51a486d58d..2e6adde0c66 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -304,7 +304,9 @@ $text = $langs->trans("ListOfUsers"); $newcardbutton = ''; if ($canadduser) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu='); + $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); } print ''."\n"; From dc4250aed7235ea894a8279d524c8881dd5d9a2f Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Fri, 18 Sep 2020 10:46:23 +0200 Subject: [PATCH 3/8] Make button visiblity identical on most lists --- htdocs/comm/propal/list.php | 10 +++----- htdocs/commande/list.php | 10 +++----- htdocs/compta/bank/various_payment/list.php | 10 +++----- htdocs/compta/facture/list.php | 10 +++----- htdocs/compta/localtax/list.php | 10 +++----- htdocs/compta/paiement/cheque/list.php | 10 +++----- htdocs/compta/tva/list.php | 10 +++----- htdocs/contrat/list.php | 10 +++----- htdocs/expedition/list.php | 14 +++++------ htdocs/expensereport/list.php | 10 +++----- htdocs/fourn/commande/list.php | 10 +++----- htdocs/fourn/facture/list.php | 10 +++----- htdocs/loan/list.php | 11 ++++----- htdocs/projet/list.php | 10 +++----- htdocs/salaries/list.php | 10 +++----- htdocs/societe/list.php | 27 +++++++++------------ htdocs/supplier_proposal/list.php | 10 +++----- htdocs/ticket/list.php | 2 +- htdocs/user/list.php | 9 +++---- 19 files changed, 83 insertions(+), 120 deletions(-) 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 ''; From ae8c302c19357b977329c1e79df59c2a253728e5 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Fri, 18 Sep 2020 10:52:17 +0200 Subject: [PATCH 4/8] merge variable declaration --- htdocs/comm/propal/list.php | 4 +--- htdocs/commande/list.php | 4 +--- htdocs/compta/bank/various_payment/list.php | 4 +--- htdocs/compta/facture/list.php | 4 +--- htdocs/compta/localtax/list.php | 4 +--- htdocs/compta/paiement/cheque/list.php | 4 +--- htdocs/compta/tva/list.php | 4 +--- htdocs/contrat/list.php | 4 +--- htdocs/expedition/list.php | 6 ++---- htdocs/expensereport/list.php | 4 +--- htdocs/fichinter/list.php | 2 +- htdocs/fourn/commande/list.php | 4 +--- htdocs/fourn/facture/list.php | 4 +--- htdocs/loan/list.php | 4 +--- htdocs/projet/list.php | 4 +--- htdocs/salaries/list.php | 4 +--- htdocs/societe/list.php | 3 +-- htdocs/supplier_proposal/list.php | 4 +--- htdocs/ticket/list.php | 4 +--- htdocs/user/list.php | 3 +-- 20 files changed, 21 insertions(+), 57 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 8468e071f35..f066edb8fb2 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -480,11 +480,9 @@ if ($resql) if (in_array($massaction, array('presend', 'predelete', 'closed'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $newcardbutton = ''; - $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); + $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 91f5b9d8602..c65ffe18e12 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -483,11 +483,9 @@ if ($resql) if (in_array($massaction, array('presend', 'predelete', 'createbills'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $newcardbutton = ''; - $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); + $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 3b99fc599a5..d4b8bb512cd 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -251,11 +251,9 @@ if ($result) if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); - $newcardbutton = ''; - $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); + $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 d3198dcc9b2..f7cb7dc8cca 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -674,11 +674,9 @@ if ($resql) if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $newcardbutton = ''; - $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'); + $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 7de2fcc8c0b..2015e16da93 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -42,11 +42,9 @@ llxHeader(); $localtax_static = new Localtax($db); -$newcardbutton = ''; - $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); +$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 405b99cd2e0..3bb45c4e312 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -124,11 +124,9 @@ if ($resql) if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; - $newcardbutton = ''; - $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); + $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 d05b4d823ef..8c9b9efb5a6 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -146,11 +146,9 @@ if ($result) if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($typeid) $param .= '&typeid='.$typeid; - $newcardbutton = ''; - $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); + $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 91e6faecb59..945e6a7d936 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -369,11 +369,9 @@ if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete'] = 'selectMassAction('', $arrayofmassactions); -$newcardbutton = ''; - $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); +$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 af1b138d7b7..7744487c1b7 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -359,13 +359,11 @@ if ($resql) if (in_array($massaction, array('presend'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $newcardbutton = ''; - // 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); + // $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 29b0aa1a202..fbe9ea2a84a 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -461,11 +461,9 @@ if ($resql) } else { $title = $langs->trans("ListTripsAndExpenses"); - $newcardbutton = ''; - $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); + $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/fichinter/list.php b/htdocs/fichinter/list.php index fcad99c975e..b01183fe94a 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -322,7 +322,7 @@ if ($resql) $url = DOL_URL_ROOT.'/fichinter/card.php?action=create'; if (!empty($socid)) $url .= '&socid='.$socid; - $morehtmlcenter .= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->rights->ficheinter->creer); + $newcardbutton = dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->rights->ficheinter->creer); // Lines of title fields print ''."\n"; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index ca1d25dd9d7..9663f2de3db 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -649,11 +649,9 @@ if ($resql) if (in_array($massaction, array('presend', 'predelete', 'createbills'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $newcardbutton = ''; - $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); + $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 ea7c807e107..9af06728a4b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -508,11 +508,9 @@ if ($resql) if (in_array($massaction, array('presend', 'predelete', 'createbills'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $newcardbutton = ''; - $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); + $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 21a131eb525..fa624873e2f 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -150,11 +150,9 @@ if ($resql) if ($search_amount) $param .= "&search_amount=".urlencode($search_amount); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); - $newcardbutton = ''; - $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); + $newcardbutton = dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url, '', $user->rights->loan->write); print ''."\n"; if ($optioncss != '') print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 7667d2abf20..d6065f32476 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -448,11 +448,9 @@ if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = $massactionbutton = $form->selectMassAction('', $arrayofmassactions); -$newcardbutton = ''; - $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); +$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 e43b412f6c1..11a5aa10bbc 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -153,11 +153,9 @@ if ($result) if ($typeid) $param .= '&typeid='.$typeid; if ($optioncss != '') $param .= '&optioncss='.$optioncss; - $newcardbutton = ''; - $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); + $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 3f8fef2b87d..5730c46674f 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -598,7 +598,6 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete'] = 'selectMassAction('', $arrayofmassactions); -$newcardbutton = ''; $typefilter = ''; $label = 'MenuNewThirdParty'; @@ -612,7 +611,7 @@ if (!empty($type)) $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'); +$newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer && $contextpage != 'poslist'); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index e8e2f79d85a..33f04d427f2 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -414,11 +414,9 @@ if ($resql) if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $newcardbutton = ''; - $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); + $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 1bdcaed0e01..b99ee599305 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -568,11 +568,9 @@ print ''; if ($socid) print ''; if ($projectid) print ''; -$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, '', $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 ac2719ff1c8..91181bb2c4f 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -301,10 +301,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $text = $langs->trans("ListOfUsers"); -$newcardbutton = ''; $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); +$newcardbutton = dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $canadduser); print ''."\n"; if ($optioncss != '') print ''; From eac9e54e0bd86c8c9957156ab9c22f2746f8d431 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Fri, 18 Sep 2020 11:48:53 +0200 Subject: [PATCH 5/8] fix more different button visibility --- htdocs/categories/index.php | 6 +----- htdocs/comm/action/list.php | 21 +++++++++++---------- htdocs/compta/bank/list.php | 7 +------ htdocs/contact/list.php | 6 +----- htdocs/holiday/list.php | 6 +----- htdocs/product/list.php | 25 +++++++++++-------------- htdocs/projet/tasks/list.php | 6 +----- 7 files changed, 27 insertions(+), 50 deletions(-) diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index ccdd8be58b9..b3a69583c7f 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -64,11 +64,7 @@ $arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss); - -$newcardbutton = ''; -if (!empty($user->rights->categorie->creer)) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type)); -} +$newcardbutton = dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', $url, '', $user->rights->categorie->creer); print load_fiche_titre($title, $newcardbutton, 'object_category'); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index ee47dbc3387..4584365f208 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -519,20 +519,21 @@ if ($resql) $viewmode .= ''; - $newcardbutton = ''; - if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) - { - $tmpforcreatebutton = dol_getdate(dol_now(), true); + $tmpforcreatebutton = dol_getdate(dol_now(), true); - $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; + $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; + + //$param='month='.$monthshown.'&year='.$year; + $hourminsec = '100000'; + + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; + $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create); - //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; - $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); - } $param .= '&action='.$action; - print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1 * $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode); print $s; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 882244518f7..a97d4452e2d 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -247,12 +247,7 @@ if ($user->rights->banque->supprimer) $arrayofmassactions['predelete'] = 'selectMassAction('', $arrayofmassactions); -$newcardbutton = ''; -if ($user->rights->banque->configurer) -{ - $newcardbutton .= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create'); -} - +$newcardbutton = dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->rights->banque->configurer); // Lines of title fields print ''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 1772f94abfb..03324ed26c4 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -538,11 +538,7 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete'] = 'selectMassAction('', $arrayofmassactions); -$newcardbutton = ''; -if ($user->rights->societe->contact->creer) -{ - $newcardbutton .= dolGetButtonTitle($langs->trans('NewContactAddress'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create'); -} +$newcardbutton = dolGetButtonTitle($langs->trans('NewContactAddress'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create', '', $user->rights->societe->contact->creer); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index e5d20b9f12f..eca873ff92b 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -432,11 +432,7 @@ if ($resql) } else { $title = $langs->trans("ListeCP"); - $newcardbutton = ''; - if ($user->rights->holiday->write) - { - $newcardbutton .= dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=request'); - } + $newcardbutton = dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=request', '', $user->rights->holiday->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1); } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ca789bc3ffe..47c8fd7e32b 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -531,21 +531,18 @@ if ($resql) if ($type === "") $perm = ($user->rights->produit->creer || $user->rights->service->creer); elseif ($type == Product::TYPE_SERVICE) $perm = $user->rights->service->creer; elseif ($type == Product::TYPE_PRODUCT) $perm = $user->rights->produit->creer; - if ($perm) - { - $oldtype = $type; - $params = array(); - if ($type === "") $params['forcenohideoftext'] = 1; - if ($type === "") { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', 1, $params); - $type = Product::TYPE_SERVICE; - } - $label = 'NewProduct'; - if ($type == Product::TYPE_SERVICE) $label = 'NewService'; - $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type, '', 1, $params); - - $type = $oldtype; + $oldtype = $type; + $params = array(); + if ($type === "") $params['forcenohideoftext'] = 1; + if ($type === "") { + $newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); + $type = Product::TYPE_SERVICE; } + $label = 'NewProduct'; + if ($type == Product::TYPE_SERVICE) $label = 'NewService'; + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type, '', $perm, $params); + + $type = $oldtype; print ''; if ($optioncss != '') print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 1ffd3541344..27d1dbbafb3 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -421,11 +421,7 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete'] = 'selectMassAction('', $arrayofmassactions); -$newcardbutton = ''; -if ($user->rights->projet->creer) -{ - $newcardbutton .= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create'); -} +$newcardbutton = dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $user->rights->projet->creer); print ''; if ($optioncss != '') print ''; From ccb570d87d36034ee43154b097e2aa7ba43cbf76 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 18 Sep 2020 10:23:47 +0000 Subject: [PATCH 6/8] Fixing style errors. --- htdocs/expedition/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2286e12b51a..91462ca5729 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -363,7 +363,7 @@ if ($resql) // $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); + $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"; From ce6758657a531143946a13d53c1b0ea455978cdc Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Wed, 23 Sep 2020 08:59:30 +0200 Subject: [PATCH 7/8] Fix visiblity when came from Extended POS + doc --- htdocs/compta/facture/list.php | 14 ++++++++++---- htdocs/societe/list.php | 13 +++++++++---- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f7cb7dc8cca..f4b45b5d628 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -674,9 +674,13 @@ if ($resql) if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $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'); + // Show the new button only when this page is not opend from the Extended POS + if($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, '', $user->rights->facture->creer); + } $i = 0; print ''."\n"; @@ -754,6 +758,7 @@ if ($resql) $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + // Show the massaction checkboxes only when this page is not opend from the Extended POS if ($massactionbutton && $contextpage != 'poslist') $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); print '
'; @@ -1564,7 +1569,7 @@ if ($resql) if (!$i) $totalarray['nbfield']++; } - // Action column + // Action column (Show the massaction button only when this page is not opend from the Extended POS) print ''; if (($massactionbutton || $massaction) && $contextpage != 'poslist') // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { @@ -1595,6 +1600,7 @@ if ($resql) print "\n"; + // Show the file area only when this page is not opend from the Extended POS if ($contextpage != 'poslist') { $hidegeneratedfilelistifempty = 1; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5730c46674f..d9e3b3a19eb 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -609,9 +609,13 @@ if (!empty($type)) 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'); +// Show the new button only when this page is not opend from the Extended POS (pop-up window) +if($contextpage != 'poslist') +{ + $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); +} print '
'; if ($optioncss != '') print ''; @@ -694,6 +698,7 @@ if ($moreforfilter) $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +// Show the massaction checkboxes only when this page is not opend from the Extended POS if ($massactionbutton && $contextpage != 'poslist') $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); if (empty($arrayfields['customerorsupplier']['checked'])) print ''; @@ -1301,7 +1306,7 @@ while ($i < min($num, $limit)) if (!$i) $totalarray['nbfield']++; } - // Action column + // Action column (Show the massaction button only when this page is not opend from the Extended POS) print ''; if (($massactionbutton || $massaction) && $contextpage != 'poslist') // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { From e037f2e5c7afb4448f319b28c21f52ecdee16b57 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 23 Sep 2020 07:11:59 +0000 Subject: [PATCH 8/8] Fixing style errors. --- htdocs/compta/facture/list.php | 2 +- htdocs/societe/list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 4a856539196..c144b388093 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -675,7 +675,7 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); // Show the new button only when this page is not opend from the Extended POS - if($contextpage != 'poslist') + if ($contextpage != 'poslist') { $url = DOL_URL_ROOT.'/compta/facture/card.php?action=create'; if (!empty($socid)) $url .= '&socid='.$socid; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 15853f13a66..ea0b3a55d8e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -611,7 +611,7 @@ if (!empty($type)) // Show the new button only when this page is not opend from the Extended POS (pop-up window) // but allow it too, when a user has the rights to create a new customer -if($contextpage != 'poslist') +if ($contextpage != 'poslist') { $url = DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter; if (!empty($socid)) $url .= '&socid='.$socid;