From c68928b8d0ac1e54775dce3f8c24aaff61510514 Mon Sep 17 00:00:00 2001 From: Tim Otte Date: Tue, 8 Sep 2020 15:53:47 +0200 Subject: [PATCH 001/102] Added incoterms to substitution array --- htdocs/core/class/commondocgenerator.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index f610e6bb952..5c129cb0803 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -397,6 +397,8 @@ abstract class CommonDocGenerator $array_key.'_payment_term_code'=>$object->cond_reglement_code, $array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)), + $array_key.'_incoterms'=>$object->display_incoterms(), + $array_key.'_bank_iban'=>$bank_account->iban, $array_key.'_bank_bic'=>$bank_account->bic, From d1f70a37df0f7dc7987967b1c6a49a8a20961116 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Fri, 18 Sep 2020 07:56:13 +0200 Subject: [PATCH 002/102] 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 003/102] 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 004/102] 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 005/102] 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 006/102] 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 007/102] 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 dc562be441721147d965c5eb231804b9840c0892 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Sep 2020 20:02:19 +0200 Subject: [PATCH 008/102] Prepare 12.0.3 --- ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6ee67b86faa..e908a78b498 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,54 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 12.0.3 compared to 12.0.2 ***** +FIX: 10.0 - when the mime file name is different from the filesystem n… +FIX: 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename +FIX: 11.0 - expenses lines overlapping the total amounts frame +FIX: 12.0 - round value of virtual stock on product stock reassort list +FIX: #14469 +FIX: #14474 Error when deleting +FIX: #14530 +FIX: #14703 +FIX: - Accountancy balance Error SQL on entity +FIX: Bad number of subscription (forgotten when member was resiliated) +FIX: bad route url to delete subproduct with API +FIX: Category for suplements not saved +FIX: Compatibility with modules without document generation +FIX: cron load lang +FIX: Cron load lang +FIX: CSS +FIX: Error management. Do no try to approve PO if validation fails. +FIX: expenses lines overlapping the frame for total amounts. +FIX: Filter in "billed" of orders was not saved +FIX: infinite fetch object linked loop +FIX: Intervention lose html tags when updating +FIX: JS CRASH - bad usage of moreparam +FIX: lang fr retained warranty +FIX: look and feel v12 +FIX: Look and feel v12: First tab must be name of object +FIX: missing entity check +FIX: missing param for hook +FIX: Missing transaction on PO actions +FIX: MySql Strict mode +FIX: param entity in html form file +FIX: Problems on FEC format +FIX: round stock value on product list +FIX: - Send mail from contact : select mail model +FIX: set sales representatives on create company card +FIX: Setup of stock increase/decrease +FIX: sign of amount with credit note and multicurrencies +FIX: Static property called as non static +FIX: task leftmenu +FIX: title button attribute id empty +FIX: unit price divided by quantity when accepting supplier price pro… +FIX: unit price divided by quantity when accepting supplier price proposal +FIX: Update extrafields on line only if it is supported +FIX: Update line of BOM +FIX: using decimal on stock correction +FIX: Visualization rights correction on last modified contacts box +FIX: Wrong redirection +FIX: Yogosha report 4425 (backport) ***** ChangeLog for 12.0.2 compared to 12.0.1 ***** FIX: computation of the bottom margin of returns NaN because body is not loaded yet From 83bb3bdb00b6bfa327e18dda0a5cadcbfe860982 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Sep 2020 20:03:18 +0200 Subject: [PATCH 009/102] 12.0.3 --- ChangeLog | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e908a78b498..e7abb3f7cd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,6 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 12.0.3 compared to 12.0.2 ***** -FIX: 10.0 - when the mime file name is different from the filesystem n… FIX: 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename FIX: 11.0 - expenses lines overlapping the total amounts frame FIX: 12.0 - round value of virtual stock on product stock reassort list @@ -16,7 +15,6 @@ FIX: Bad number of subscription (forgotten when member was resiliated) FIX: bad route url to delete subproduct with API FIX: Category for suplements not saved FIX: Compatibility with modules without document generation -FIX: cron load lang FIX: Cron load lang FIX: CSS FIX: Error management. Do no try to approve PO if validation fails. @@ -24,9 +22,8 @@ FIX: expenses lines overlapping the frame for total amounts. FIX: Filter in "billed" of orders was not saved FIX: infinite fetch object linked loop FIX: Intervention lose html tags when updating -FIX: JS CRASH - bad usage of moreparam +FIX: JS CRASH - bad usage of moreparam FIX: lang fr retained warranty -FIX: look and feel v12 FIX: Look and feel v12: First tab must be name of object FIX: missing entity check FIX: missing param for hook @@ -42,7 +39,6 @@ FIX: sign of amount with credit note and multicurrencies FIX: Static property called as non static FIX: task leftmenu FIX: title button attribute id empty -FIX: unit price divided by quantity when accepting supplier price pro… FIX: unit price divided by quantity when accepting supplier price proposal FIX: Update extrafields on line only if it is supported FIX: Update line of BOM From c596f80fd554909cd6f512cff0eba10d9cb76d75 Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Sun, 20 Sep 2020 23:29:59 +0200 Subject: [PATCH 010/102] NEW Show available stock in TakePOS --- htdocs/takepos/invoice.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3ab9f91c9ff..397ff291ec5 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1065,7 +1065,29 @@ if ($placeid > 0) $htmlforlines .= ''; $htmlforlines .= ''.vatrate($line->remise_percent, true).''; - $htmlforlines .= ''.$line->qty.''; + $htmlforlines .= ''; + if (!empty($conf->stock->enabled)) + { + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; + $sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; + $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; + $sql .= " ".MAIN_DB_PREFIX."product_stock as ps"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; + $sql .= " WHERE ps.reel != 0"; + $sql .= " AND ps.fk_entrepot = ".$conf->global->$constantforkey; + $sql .= " AND e.entity IN (".getEntity('stock').")"; + $sql .= " AND ps.fk_product = ".$line->fk_product; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $stock_real = price2num($obj->reel, 'MS'); + if ($line->qty>$stock_real) $htmlforlines .= ""; + $htmlforlines .= $line->qty.' ('.$langs->trans("Of").' '.$stock_real.')'; + if ($line->qty>$stock_real) $htmlforlines .= ""; + } + } + else $htmlforlines .= $line->qty; + $htmlforlines .= ''; $htmlforlines .= ''.price($line->total_ttc).''; } $htmlforlines .= ''."\n"; From 05275a2b6787806358b0743f140617064e78ec4a Mon Sep 17 00:00:00 2001 From: Tim Otte Date: Mon, 21 Sep 2020 08:50:39 +0200 Subject: [PATCH 011/102] Added check if method exists --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 5c129cb0803..28f8634dea6 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -397,7 +397,7 @@ abstract class CommonDocGenerator $array_key.'_payment_term_code'=>$object->cond_reglement_code, $array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)), - $array_key.'_incoterms'=>$object->display_incoterms(), + $array_key.'_incoterms'=>(method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''), $array_key.'_bank_iban'=>$bank_account->iban, $array_key.'_bank_bic'=>$bank_account->bic, From 6380a294fc390eeaf059a32662455805cda2a11e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Sep 2020 12:16:22 +0200 Subject: [PATCH 012/102] FIX Restore multiselect (selection of prospect level) --- htdocs/core/class/html.form.class.php | 5 +- htdocs/core/lib/functions.lib.php | 15 +- .../multiselect/jquery.multi-select.js | 360 ++++++++++++++++++ .../multiselect/jquery.multi-select.min.js | 9 + htdocs/main.inc.php | 4 + htdocs/theme/eldy/global.inc.php | 15 +- htdocs/theme/md/style.css.php | 4 + 7 files changed, 398 insertions(+), 14 deletions(-) create mode 100644 htdocs/includes/jquery/plugins/multiselect/jquery.multi-select.js create mode 100644 htdocs/includes/jquery/plugins/multiselect/jquery.multi-select.min.js diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9cd56c3b29a..27e7029c254 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6461,11 +6461,12 @@ class Form templateSelection: formatSelection /* For 4.0 */ }); });'."\n"; - } elseif ($addjscombo == 2) + } elseif ($addjscombo == 2 && ! defined('DISABLE_MULTISELECT')) { // Add other js lib // TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin // ... + $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');'; $out .= '$(document).ready(function () { $(\'#'.$htmlname.'\').multiSelect({ containerHTML: \'
\', @@ -7158,7 +7159,7 @@ class Form } //if ($conf->browser->layout == 'phone') $ret.='
'; - $ret .= '
'; + $ret .= '
'; // For thirdparty, contact, user, member, the ref is the id, so we show something else if ($object->element == 'societe') diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 43b01f5ea6b..90f919fe2d7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1350,19 +1350,28 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab { $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); + $widthofpopup = 200; $tabsname = $moretabssuffix; if (empty($tabsname)) { $tabsname = str_replace("@", "", $picto); } $out .= '
'; - $out .= ''.$langs->trans("More").'... ('.$nbintab.')'; - $out .= '
'; + $out .= ''.$langs->trans("More").'... ('.$nbintab.')'; // Do not use "reposition" class in the "More". + $out .= '
'; $out .= $outmore; $out .= '
'; $out .= '
'; $out .= "
\n"; $out .= ""; } diff --git a/htdocs/includes/jquery/plugins/multiselect/jquery.multi-select.js b/htdocs/includes/jquery/plugins/multiselect/jquery.multi-select.js new file mode 100644 index 00000000000..ee62d1f588d --- /dev/null +++ b/htdocs/includes/jquery/plugins/multiselect/jquery.multi-select.js @@ -0,0 +1,360 @@ +// jquery.multi-select.js +// by mySociety +// https://github.com/mysociety/jquery-multi-select + +;(function($) { + + "use strict"; + + var pluginName = "multiSelect", + defaults = { + 'containerHTML': '
', + 'menuHTML': '
', + 'buttonHTML': '', + 'menuItemsHTML': '
', + 'menuItemHTML': '