diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index cba4756fdd0..5ae9c3d4742 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/categories/index.php b/htdocs/categories/index.php index 95b5125f9e2..35420759ded 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -67,7 +67,6 @@ $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.$moreparam).$moreparam); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index a8ce07a2867..92975aafec0 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/comm/propal/list.php b/htdocs/comm/propal/list.php index 3396cd6270b..dde38d98489 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 = ''; - 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, '', $user->rights->propal->creer); // Fields title search print '
'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 875b72a8dd2..921e1de185b 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 = ''; - 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, '', $contextpage == 'orderlist' && $user->rights->commande->creer); // Lines of title fields print ''; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index ace8a327768..5cdd4711871 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/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 89a9899e197..54216f06358 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -253,11 +253,9 @@ if ($result) if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); - $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, '', $user->rights->banque->modifier); print ''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index b4bfa70a287..c144b388093 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -674,10 +674,12 @@ if ($resql) if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $newcardbutton = ''; - if ($user->rights->facture->creer && $contextpage != 'poslist') + // Show the new button only when this page is not opend from the Extended POS + if ($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, '', $user->rights->facture->creer); } $i = 0; @@ -756,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 '
'; @@ -1562,7 +1565,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 { @@ -1593,6 +1596,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/compta/localtax/list.php b/htdocs/compta/localtax/list.php index a8b37c3ef93..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 = ''; -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, '', $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 e76936c71fd..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 = ''; - 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, '', $user->rights->banque->cheque); print '
'; if ($optioncss != '') print ''; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index ea0d7fe637b..82829fca12e 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 = ''; - 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, '', $user->rights->tax->charges->creer); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 1332bc5e100..0f4f01a0916 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/contrat/list.php b/htdocs/contrat/list.php index 531642f81f7..608fc6c0d81 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 = ''; -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, '', $user->rights->contrat->creer); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 77796fc9bc1..3f9de5533fc 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -359,11 +359,11 @@ if ($resql) if (in_array($massaction, array('presend'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $newcardbutton = ''; - if ($user->rights->expedition->creer) - { - $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 549f5f93fe6..0a264c59a2a 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -372,11 +372,9 @@ if ($resql) } else { $title = $langs->trans("ListTripsAndExpenses"); - $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, '', $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 23711a5730d..e9814ce481c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -320,7 +320,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; + $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 c900431d910..6be60c04249 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 = ''; - 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, '', $user->rights->fournisseur->commande->creer); // Fields title search print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index bbc4f45e4b2..f893b0e2e72 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 = ''; - 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, '', $user->rights->fournisseur->facture->creer); $i = 0; print ''."\n"; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 9ea0aa70180..ca83d9341f2 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=create'); - } + $newcardbutton = dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $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/loan/list.php b/htdocs/loan/list.php index 168e603099e..82ef8ed9407 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 = ''; - 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, '', $user->rights->loan->write); print ''."\n"; if ($optioncss != '') print ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 060da5dc78f..a0bfa073afa 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -541,21 +541,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/list.php b/htdocs/projet/list.php index 8a7645941d5..c73a68b98ee 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 = ''; -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, '', $user->rights->projet->creer); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 20d917b2ae8..7d1a8354bb3 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 ''; diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index e26a97521f3..9341599ba70 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 = ''; - 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, '', $user->rights->salaries->write); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ad9813c4fec..ea0b3a55d8e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -598,26 +598,28 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete'] = 'selectMassAction('', $arrayofmassactions); -$newcardbutton = ''; -if ($user->rights->societe->creer && $contextpage != 'poslist') -{ - $typefilter = ''; - $label = 'MenuNewThirdParty'; +$typefilter = ''; +$label = 'MenuNewThirdParty'; - if (!empty($type)) - { - $typefilter = '&type='.$type; - if ($type == 'p') $label = 'MenuNewProspect'; - if ($type == 'c') $label = 'MenuNewCustomer'; - if ($type == 'f') $label = 'NewSupplier'; - } - - $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter); -} elseif ($user->rights->societe->creer && $contextpage == 'poslist') +if (!empty($type)) { + $typefilter = '&type='.$type; + if ($type == 'p') $label = 'MenuNewProspect'; + if ($type == 'c') $label = 'MenuNewCustomer'; + if ($type == 'f') $label = 'NewSupplier'; +} + +// 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') +{ + $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); +} elseif ($user->rights->societe->creer) { + $url = DOL_URL_ROOT.'/societe/card.php?action=create&type=c&contextpage=poslist&optioncss=print&backtopage='.$_SERVER["PHP_SELF"].'?contextpage=poslist&nomassaction=1&optioncss=print&place='.urlencode($place); $label = 'MenuNewCustomer'; - - $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&type=c&contextpage=poslist&optioncss=print&backtopage='.$_SERVER["PHP_SELF"].'?contextpage=poslist&nomassaction=1&optioncss=print&place='.urlencode($place)); + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url); } print ''; @@ -701,6 +703,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 ''; @@ -1308,7 +1311,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 { diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 1340dce3b3b..b0f8bf40609 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 = ''; - 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, '', $user->rights->supplier_proposal->creer); // Fields title search print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 9fc1357f817..12dd4c37058 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -568,8 +568,9 @@ print ''; 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, '', $user->rights->ticket->write); $picto = 'ticket'; if ($socid > 0) $picto = ''; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 92826eac19e..406401bdf38 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -301,11 +301,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $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, '', $canadduser); print ''."\n"; if ($optioncss != '') print '';