diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 9d4f4b68370..f007d4f8299 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -247,11 +247,10 @@ if ($resql) print ''; print ''; - $newcardbutton = '' . $langs->trans("Addanaccount").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create'); - print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); + + print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); // Box to select active chart of account print $langs->trans("Selectchartofaccounts") . " : "; diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index df2dec9d3b1..725dddf1339 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -111,14 +111,9 @@ if ($result) $i = 0; - if (! empty($user->rights->accounting->fiscalyear)) - { - $addbutton = '' . $langs->trans("NewFiscalYear") .''; - } - else - { - $addbutton = '' . $langs->trans("NewFiscalYear") .''; - } + + $addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear); + $title = $langs->trans('AccountingPeriods'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 207ea3464d8..073d180cd16 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -443,19 +443,18 @@ print ''; print ''; $listofformat=AccountancyExport::getType(); -$button = ''; -if (count($filter)) $button.= $langs->trans("ExportFilteredList"); -else $button.= $langs->trans("ExportList"); -//$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')'; -$button.= ''; + +if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList"); +else $buttonLabel = $langs->trans("ExportList"); + +$newcardbutton = dolGetButtonTitle($buttonLabel, '', 'fa fa-file-export', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'')); + +$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-object-group', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); + +$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create'); -$groupby = ' ' . $langs->trans("GroupByAccountAccounting") . ''; -$newcardbutton = ''.$langs->trans("NewAccountingMvt").''; -$newcardbutton.= ''; -$newcardbutton.= ''; - -print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$newcardbutton, '', $limit); +print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 38dc49c5bf6..a2cf4864df8 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -256,10 +256,8 @@ if ($action == 'delbookkeepingyear') { print '
'; -$viewflat = ' ' . $langs->trans("ViewFlatList") . ''; -$newcardbutton = ''.$langs->trans("NewAccountingMvt").''; -$newcardbutton.= ''; -$newcardbutton.= ''; +$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); +$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create'); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index f6c178f2e4d..5b2c3e912dd 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -151,9 +151,7 @@ if ($object->id > 0) $newcardbutton = ''; if (! empty($conf->agenda->enabled)) { - $newcardbutton.=''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id); } if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 0da7a2b0ea4..13b231f15d6 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -365,9 +365,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->adherent->creer) { - $newcardbutton=''.$langs->trans('NewMember').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create'); } print ''; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 2e46262398f..574f061b25d 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -247,9 +247,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->adherent->cotisation->creer) { - $newcardbutton=''.$langs->trans('NewSubscription').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1'); } print ''; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 089d817ac94..1a5c368f177 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -236,10 +236,8 @@ if (! $rowid && $action != 'create' && $action != 'edit') $newcardbutton=''; if ($user->rights->adherent->configurer) { - $newcardbutton=''.$langs->trans('NewMemberType').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); + } print ''; if ($optioncss != '') print ''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 05357c9ceb9..d67936edfb5 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -322,9 +322,7 @@ print ''; $newcardbutton=''; //if ($user->rights->emailcollector->creer) //{ -$newcardbutton=''.$langs->trans('New').''; -$newcardbutton.= ''; -$newcardbutton.= ''; +$newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'])); //} print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 310322aa44c..d1b56d51cee 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -256,9 +256,7 @@ if ($action == 'delete') $newcardbutton=''; if ($user->admin) { - $newcardbutton=''.$langs->trans('New').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'&backtopage='.urlencode($_SERVER['PHP_SELF'])); } print ''; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 17e23f0cadb..844443244cd 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -82,12 +82,8 @@ $userstatic=new User($db); llxHeader('', $langs->trans("ListOfBookmarks")); $newcardbutton=''; -if ($user->rights->bookmark->creer) -{ - $newcardbutton=''.$langs->trans('NewBookmark').''; - $newcardbutton.= ''; - $newcardbutton.= ''; -} +$newcardbutton.= dolGetButtonTitle($langs->trans('NewBookmark'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer)); + print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton); diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 971fcd30f0c..d804cced41c 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -65,9 +65,7 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css') llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss); -$newcardbutton = ''.$langs->trans("NewCategory").''; -$newcardbutton.= ''; -$newcardbutton.= ''; +$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)); print load_fiche_titre($title, $newcardbutton); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 9869248a760..28670604b9e 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -435,9 +435,7 @@ if ($resql) //$param='month='.$monthshown.'&year='.$year; $hourminsec='100000'; - $newcardbutton = ''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $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:''))); } print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, $nav.$newcardbutton, '', $limit); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index e5ade3fdf55..754cb736bc9 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -367,9 +367,7 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction //$param='month='.$monthshown.'&year='.$year; $hourminsec='100000'; - $newcardbutton = ''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $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:''))); } $link=''; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 54fdaef111b..7e058819771 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -156,9 +156,7 @@ if ($result) $newcardbutton=''; if ($user->rights->mailing->creer) { - $newcardbutton=''.$langs->trans('NewMailing').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/mailing/card.php?action=create'); } $i = 0; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b02f788f040..ff01690660a 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -441,10 +441,8 @@ if ($resql) $newcardbutton=''; if ($user->rights->propal->creer) { - $newcardbutton=''.$langs->trans('NewPropal').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/propal/card.php?action=create'); + } // Lignes des champs de filtre print ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ad3fd777a5c..f64aadf0e53 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -443,10 +443,8 @@ if ($resql) $newcardbutton=''; if ($contextpage == 'orderlist' && $user->rights->commande->creer) { - $newcardbutton=''.$langs->trans('NewOrder').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/commande/card.php?action=create'); + } // Lines of title fields print ''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index c8c3576f496..68c0ada46df 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -756,34 +756,16 @@ if ($resql) { if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments { - if ($user->rights->banque->modifier) { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } else { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier); } - else // If direct entries is not done using miscellaneous payments + else // If direct entries is not done using miscellaneous payments { - if ($user->rights->banque->modifier) { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } else { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', $user->rights->banque->modifier); } } else { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', -1); } } diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 080cef69778..aeb593f53b9 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -227,9 +227,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->banque->configurer) { - $newcardbutton.=''.$langs->trans("NewFinancialAccount").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create'); } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 05ce6cc3504..d12fc90fd77 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -607,9 +607,7 @@ if ($resql) $newcardbutton=''; if($user->rights->facture->creer) { - $newcardbutton=''.$langs->trans('NewBill').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/facture/card.php?action=create'); } $i = 0; diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 184c9600926..b7f9c307f14 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -45,9 +45,7 @@ $localtax_static = new Localtax($db); $newcardbutton=''; if ($user->rights->tax->charges->creer) { - $newcardbutton=''.$langs->trans('NewLocalTaxPayment', ($ltt+1)).''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt+1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt); } print load_fiche_titre($langs->transcountry($ltt==2?"LT2Payments":"LT1Payments", $mysoc->country_code), $newcardbutton); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 0107ba60383..401d12aec4b 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -138,9 +138,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->banque->cheque) { - $newcardbutton = ''.$langs->trans('NewCheckDeposit').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'); } print ''; diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 49f44af1702..9fcb77d9b42 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -108,9 +108,7 @@ if ($result) $newcardbutton=''; if ($user->rights->prelevement->bons->creer) { - $newcardbutton = ''.$langs->trans('NewStandingOrder').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php'); } // Lines of title fields diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 061008f42a8..1d6b08735a0 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -150,10 +150,8 @@ if ($result) $newcardbutton=''; if ($user->rights->tax->charges->creer) { - $newcardbutton=''.$langs->trans('NewVATPayment').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewVATPayment', ($ltt+1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/tva/card.php?action=create'); + } print ''; if ($optioncss != '') print ''; diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 5b9e84f2d16..6e093a934dd 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -261,9 +261,7 @@ else { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - $newcardbutton.=''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index febc613434d..6749ac0a7f5 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -455,9 +455,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->societe->contact->creer) { - $newcardbutton=''.$langs->trans('NewContactAddress').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewContactAddress'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create'); } print ''; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 36c527ef283..28c4702a5c2 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -376,9 +376,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->contrat->creer) { - $newcardbutton=''.$langs->trans('NewContractSubscription').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contrat/card.php?action=create'); } print ''; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index c9c1bc3d782..31353ea3d10 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -205,9 +205,7 @@ class FormActions $newcardbutton=''; if (! empty($conf->agenda->enabled)) { - $newcardbutton = ''.$langs->trans("AddEvent").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:($socid>0?'&socid='.$socid:'')).($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage)); } print ''."\n"; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d6fe993aa2d..e080cc89796 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -730,9 +730,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel $newcardbutton=''; if (! empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink)) { - $newcardbutton=''.$langs->trans("AddProject").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage)); } print "\n"; @@ -934,9 +932,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') if ($user->rights->societe->contact->creer) { $addcontact = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); - $newcardbutton=''.$addcontact.''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($addcontact, '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage)); } print "\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9b8232bb188..298f35efd48 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8153,3 +8153,117 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = return '
<'.$tag.' '.$compiledAttributes.'>'.$html.'
'; } + + + +/** + * Function dolGetButtonTitle : this kind of buttons are used in title in list + * + * @param string $label label of button + * @param string $helpText optional : content for help tooltip + * @param string $iconClass class for icon element + * @param string $url the url for link + * @param string $id attribute id of button + * @param int $status 0 no user rights, 1 active, -1 Feature Disabled, -2 disable Other reason use helpText as tooltip + * @param array $params various params for future : recommended rather than adding more function arguments + * @return string html button + */ +function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array()) +{ + global $langs, $conf, $user; + + // Actually this conf is used in css too for external module compatibility and smooth transition to this function + if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin) && $status <= 0) { + return ''; + } + + $class = 'btnTitle' ; + + // hidden conf keep during button transition TODO: remove this block + if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){ + $class = 'butActionNew'; + } + + $attr=array( + 'class' => $class + ,'href' => empty($url)?'':$url + ); + + if(!empty($helpText)){ + $attr['title'] = dol_escape_htmltag($helpText); + } + + if($status <= 0){ + $attr['class'] .= ' refused'; + + // hidden conf keep during button transition TODO: remove this block + if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){ + $attr['class'] = 'butActionNewRefused'; + } + + $attr['href'] = ''; + + if($status == -1){ // Not enough permissions + $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled")); + } + elseif($status == 0){ // disable + $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")); + } + } + + if(!empty($attr['title'])){ + $attr['class'] .= ' classfortooltip'; + } + + if(empty($id)){ + $attr['id'] = $id; + } + + // Override attr + if(!empty($params['attr']) && is_array($params['attr'])){ + foreach($params['attr'] as $key => $value){ + if($key == 'class'){ + $attr['class'].= ' '.$value; + } + elseif($key == 'classOverride'){ + $attr['class'] = $value; + } + else{ + $attr[$key] = $value; + } + } + } + + if(isset($attr['href']) && empty($attr['href'])){ + unset($attr['href']); + } + + // TODO : add a hook + + // escape all attribute + $attr = array_map('dol_escape_htmltag', $attr); + + $TCompiledAttr = array(); + foreach($attr as $key => $value){ + $TCompiledAttr[] = $key.'="'.$value.'"'; + } + + $compiledAttributes = !empty($TCompiledAttr)?implode(' ', $TCompiledAttr):''; + + $tag = !empty($attr['href'])?'a':'span'; + + + $button ='<'.$tag.' '.$compiledAttributes.' >'; + $button.= ''; + $button.= ''.$label.''; + $button.= ''; + + // hidden conf keep during button transition TODO: remove this block + if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){ + $button='<'.$tag.' '.$compiledAttributes.' >'.$label.''; + $button.= ''; + $button.= ''; + } + + return $button; +} diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index de321443a6c..6bfa0c025af 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -342,18 +342,8 @@ print ''; // Line with explanation and button new job $newcardbutton=''; -if ($user->rights->cron->create) -{ - $newcardbutton.=''.$langs->trans("CronCreateJob").''; - $newcardbutton.= ''; - $newcardbutton.= ''; -} -else -{ - $newcardbutton.=''.$langs->trans("CronCreateJob").''; - $newcardbutton.= ''; - $newcardbutton.= ''; -} +$newcardbutton.= dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter, '', $user->rights->cron->create); + print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_setup', 0, $newcardbutton, '', $limit); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index e68b4e46399..f5cf23bceb7 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -142,9 +142,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->don->creer) { - $newcardbutton=''.$langs->trans('NewDonation').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create'); } print ''."\n"; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index b60852f205b..f5c111f2268 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -280,10 +280,8 @@ if ($resql) $newcardbutton=''; if ($user->rights->expedition->creer) { - $newcardbutton=''.$langs->trans('NewSending').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expedition/card.php?action=create2'); + } $i = 0; print ''."\n"; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 520972a23e6..94033912a69 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -456,9 +456,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->expensereport->creer) { - $newcardbutton=''.$langs->trans('NewTrip').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expensereport/card.php?action=create'); } print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index 83208ffa020..755c9bc4773 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -50,14 +50,7 @@ print '
'; print '
'; if (count($export->array_export_code)) { - if ($user->rights->export->creer) - { - print ''.$langs->trans("NewExport").''; - } - else - { - print ''.$langs->trans("NewExport").''; - } + print dolGetButtonTitle($langs->trans('NewExport'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/exports/export.php?leftmenu=export', '', $user->rights->export->creer); } print '
'; print '
'; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index b893f6e6511..bff598873ce 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -314,12 +314,7 @@ if ($resql) $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; - if ($user->rights->ficheinter->creer) - { - $newcardbutton=''.$langs->trans('NewIntervention').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $morehtmlcenter.= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fichinter/card.php?action=create', '', $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 e4b71768456..80645e2a486 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -632,10 +632,8 @@ if ($resql) $newcardbutton=''; if($user->rights->fournisseur->commande->creer) { - $newcardbutton=''.$langs->trans('NewOrder').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fourn/commande/card.php?action=create'); + } // Lignes des champs de filtre print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 2415167f8ae..fa13e329b0e 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -466,9 +466,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->fournisseur->facture->creer) { - $newcardbutton=''.$langs->trans('NewBill').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fourn/facture/card.php?action=create'); } $i = 0; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 5497d66e698..a93be6e096d 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -340,10 +340,8 @@ else $newcardbutton=''; if ($user->rights->holiday->write) { - $newcardbutton=''.$langs->trans('MenuAddCP').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=request'); + } print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, $newcardbutton, '', $limit); diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index 6ccb0adcf44..8175dd1ca83 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -92,7 +92,7 @@ if (count($import->array_import_code)) { //if ($user->rights->import->run) //{ - print ''.$langs->trans("NewImport").''; + print dolGetButtonTitle($langs->trans('NewImport'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/imports/import.php?leftmenu=import'); //} //else //{ diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index e4b51c2429a..80d8645293b 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -116,9 +116,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->loan->write) { - $newcardbutton=''.$langs->trans('NewLoan').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/loan/card.php?action=create'); } print ''."\n"; diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 92171ba7188..025f7099577 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -243,18 +243,7 @@ print ''; print ''; $newcardbutton=''; -if (! empty($user->rights->opensurvey->write)) -{ - $newcardbutton=''.$langs->trans('NewSurvey').''; - $newcardbutton.= ''; - $newcardbutton.= ''; -} -else -{ - $newcardbutton=''.$langs->trans('NewSurvey').''; - $newcardbutton.= ''; - $newcardbutton.= ''; -} +$newcardbutton.= dolGetButtonTitle($langs->trans('NewSurvey'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/opensurvey/wizard/index.php', '', $user->rights->opensurvey->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 0d6a0f05174..28b3c06ffa1 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -174,14 +174,8 @@ if ($id > 0 || $ref) $morehtmlcenter=''; if (! empty($conf->agenda->enabled)) { - if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) - { - $morehtmlcenter.=''.$langs->trans("AddAction").''; - } - else - { - $morehtmlcenter.=''.$langs->trans("AddAction").''; - } + $linktocreatetimeBtnStatus = ! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create); + $morehtmlcenter = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', $linktocreatetimeBtnStatus); } if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 07827094394..688fef19654 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -452,10 +452,8 @@ if ($resql) { $label='NewProduct'; if($type == Product::TYPE_SERVICE) $label='NewService'; - $newcardbutton=''.$langs->trans($label).''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type); + } print ''; if ($optioncss != '') print ''; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 18bb2931823..a30fce71ef1 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -194,23 +194,19 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref)) } // Link to create task -if ($user->rights->projet->all->creer || $user->rights->projet->creer) -{ - if ($object->public || $userWrite > 0) - { - $linktocreatetask = ''.$langs->trans('AddTask').''; +$linktocreatetaskParam = array(); +$linktocreatetaskUserRight = false; +if ($user->rights->projet->all->creer || $user->rights->projet->creer) { + if ($object->public || $userWrite > 0){ + $linktocreatetaskUserRight = true; + }else{ + $linktocreatetaskParam['attr']['title'] = $langs->trans("NotOwnerOfProject"); } - else - { - $linktocreatetask = ''.$langs->trans('AddTask').''; - } -} -else -{ - $linktocreatetask = ''.$langs->trans('AddTask').''; } -$linktolist=''.$langs->trans("GoToListOfTasks").''; +$linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); + +$linktolist = dolGetButtonTitle($langs->trans('GoToListOfTasks'), '', 'fa fa-tasks', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id); //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1); print load_fiche_titre($title, $linktolist.'   '.$linktocreatetask, 'title_generic.png'); diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index eb6498a220f..d2b95726aea 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -161,16 +161,8 @@ if ($permok) $morehtmlcenter=''; if (! empty($conf->agenda->enabled)) { - if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) - { - $morehtmlcenter.=''.$langs->trans("AddAction").''; - $morehtmlcenter.=''; - $morehtmlcenter.=''; - } - else - { - $morehtmlcenter.=''.$langs->trans("AddAction").''; - } + $addActionBtnRight = ! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create); + $morehtmlcenter.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); } //print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index f270167bce9..1e8efc15581 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -451,9 +451,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->projet->creer) { - $newcardbutton = ''.$langs->trans('NewProject').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create'); } print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 1375a7a4844..c7053bc7079 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -642,23 +642,18 @@ elseif ($id > 0 || ! empty($ref)) print '
'; - // Link to create task - if ($user->rights->projet->all->creer || $user->rights->projet->creer) - { - if ($object->public || $userWrite > 0) - { - $linktocreatetask = ''.$langs->trans('AddTask').''; - } - else - { - $linktocreatetask = ''.$langs->trans('AddTask').''; - } - } - else - { - $linktocreatetask = ''.$langs->trans('AddTask').''; - } +// Link to create task + $linktocreatetaskParam = array(); + $linktocreatetaskUserRight = false; + if ($user->rights->projet->all->creer || $user->rights->projet->creer) { + if ($object->public || $userWrite > 0){ + $linktocreatetaskUserRight = true; + }else{ + $linktocreatetaskParam['attr']['title'] = $langs->trans("NotOwnerOfProject"); + } + } + $linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); print ''; @@ -672,7 +667,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; $title=$langs->trans("ListOfTasks"); - $linktotasks=''.$langs->trans("GoToGanttView").''; + $linktotasks = dolGetButtonTitle($langs->trans('GoToGanttView'), '', 'fa fa-calendar-minus-o', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1'); //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1); print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'title_generic.png'); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 94ca4d436d5..4a6d2633354 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -425,9 +425,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->projet->creer) { - $newcardbutton = ''.$langs->trans('NewTask').''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create'); } print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index e8d7506c313..f3da816fabd 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -579,31 +579,35 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } // Link to create time + $linktocreatetimeBtnStatus = 0; + $linktocreatetimeUrl = ''; + $linktocreatetimeHelpText = ''; if ($user->rights->projet->all->creer || $user->rights->projet->creer) { if ($projectstatic->public || $userWrite > 0) { + $linktocreatetimeBtnStatus = 1; + if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project { $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); } else // We are on tab 'Time Spent' of task { $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); } } else { - $linktocreatetime = ''.$langs->trans('AddTime').''; + $linktocreatetimeBtnStatus = -2; + $linktocreatetimeHelpText = $langs->trans("NotOwnerOfProject"); } } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - } + + $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus); + } $massactionbutton = ''; if ($projectstatic->bill_time) diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 45cf1e9d997..3e613c3d99c 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -197,10 +197,8 @@ if($ret == -1) { $newcardbutton=''; if ($user->rights->resource->write) { - $newcardbutton=''.$langs->trans('MenuResourceAdd').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('MenuResourceAdd'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/resource/card.php?action=create'); + } print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); } diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 18e1890c485..2bf407ec88d 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -162,9 +162,7 @@ if ($socid > 0) { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - $newcardbutton.=''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index e0309ded815..0cf2ae21790 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2709,9 +2709,7 @@ else $MAXEVENT = 10; - $morehtmlright = ''; - $morehtmlright.= $langs->trans("SeeAll"); - $morehtmlright.= ''; + $morehtmlright.= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt', DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id); // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 42584c5621b..13f179b99cc 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -581,9 +581,7 @@ if ($user->rights->societe->creer && $contextpage != 'poslist') if($type == 'f') $label='NewSupplier'; } - $newcardbutton = ''.$langs->trans($label).''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $newcardbutton.= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter); } print ''; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index e2175142dd4..e37d7caf91f 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -800,7 +800,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $morehtmlright=''; if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { - $morehtmlright=''.$langs->trans("Add").''; + $morehtmlright.= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=createcard'); } print load_fiche_titre($langs->trans('StripePaymentModes').($stripeacc?' (Stripe connection with StripeConnect account '.$stripeacc.')':' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); @@ -1162,7 +1162,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // List of bank accounts print '
'; - $morehtmlright=''.$langs->trans("Add").''; + $morehtmlright= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create'); print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, ''); diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 8f7c83dcef5..6b4a85f28c8 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -230,13 +230,9 @@ dol_fiche_end(); $newcardbutton = ''; if (! empty($conf->website->enabled)) { if (! empty($user->rights->societe->lire)) { - $newcardbutton .= '' . $langs->trans("AddWebsiteAccount").''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } else { - $newcardbutton .= ''.$langs->trans("AddAction").''; - $newcardbutton.= ''; - $newcardbutton.= ''; + $morehtmlright.= dolGetButtonTitle($langs->trans("AddWebsiteAccount"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id)); + } else { + $morehtmlright.= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', 0); } } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index d8e47dcb040..fe010c95e9c 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -388,10 +388,8 @@ if ($resql) $newcardbutton=''; if($user->rights->supplier_proposal->creer) { - $newcardbutton=''.$langs->trans('NewAskPrice').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } + $newcardbutton.= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create'); + } // Lignes des champs de filtre print ''; diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php new file mode 100644 index 00000000000..927c92c5f41 --- /dev/null +++ b/htdocs/theme/eldy/btn.inc.php @@ -0,0 +1,219 @@ + +/*