Better error management

This commit is contained in:
Laurent Destailleur 2020-10-06 16:48:48 +02:00
parent a744abce94
commit 663f149982
7 changed files with 12 additions and 10 deletions

View File

@ -51,7 +51,7 @@ $maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->glob
llxHeader("", $langs->trans("CustomersInvoicesArea"), "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes");
print load_fiche_titre($langs->trans("CustomersInvoicesArea"), '', 'invoicing');
print load_fiche_titre($langs->trans("CustomersInvoicesArea"), '', 'bill');
print '<div class="fichecenter">';

View File

@ -220,7 +220,7 @@ if ($resql)
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
// Type
print '<td class="liste_titre" align="left">';
$formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone');
$formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone', 1);
print '</td>';
// Ref Project
if (!empty($conf->projet->enabled)) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>';

View File

@ -59,17 +59,18 @@ class FormSocialContrib
* @param int $maxlen Max length of text in combo box
* @param int $help Add or not the admin help picto
* @param string $morecss Add more CSS on select
* @param int $noerrorifempty No print error if list is empty for the country
* @return void
*/
public function select_type_socialcontrib($selected = '', $htmlname = 'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss = 'minwidth300')
public function select_type_socialcontrib($selected = '', $htmlname = 'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss = 'minwidth300', $noerrorifempty = 0)
{
// phpcs:enable
global $conf, $db, $langs, $user, $mysoc;
if (empty($mysoc->country_id) && empty($mysoc->country_code))
{
dol_print_error('', 'Call to select_type_socialcontrib with mysoc country not yet defined');
exit;
print $langs->trans("ErrorSetupOfCountryMustBeDone");
return;
}
if (!empty($mysoc->country_id))
@ -110,7 +111,7 @@ class FormSocialContrib
if ($user->admin && $help) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
if (!empty($conf->use_javascript_ajax)) print ajax_combobox($htmlname);
} else {
print $langs->trans("ErrorNoSocialContributionForSellerCountry", $mysoc->country_code);
if (empty($noerrorifempty)) print $langs->trans("ErrorNoSocialContributionForSellerCountry", $mysoc->country_code);
}
} else {
dol_print_error($this->db);

View File

@ -51,7 +51,7 @@ $maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->glob
llxHeader("", $langs->trans("SupplierInvoicesArea"), 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores');
print load_fiche_titre($langs->trans("SupplierInvoicesArea"), '', 'invoicing');
print load_fiche_titre($langs->trans("SupplierInvoicesArea"), '', 'bill');
print '<div class="fichecenter">';

View File

@ -448,7 +448,7 @@ print '<input type="hidden" name="addtimemonth" value="'.$tmp['mon'].'">';
print '<input type="hidden" name="addtimeday" value="'.$tmp['mday'].'">';
$head = project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputperday', $langs->trans('TimeSpent'), -1, 'task');
dol_fiche_head($head, 'inputperday', $langs->trans('TimeSpent'), -1, 'projecttask');
// Show description of content
print '<div class="hideonsmartphone opacitymedium">';

View File

@ -373,7 +373,7 @@ print '<input type="hidden" name="month" value="'.$month.'">';
print '<input type="hidden" name="year" value="'.$year.'">';
$head = project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputpermonth', $langs->trans('TimeSpent'), -1, 'task');
dol_fiche_head($head, 'inputpermonth', $langs->trans('TimeSpent'), -1, 'projecttask');
// Show description of content
print '<div class="hideonsmartphone opacitymedium">';

View File

@ -158,6 +158,7 @@ $search_array_options_task = $extrafields->getOptionalsFromPost('projet_task', '
/*
* Actions
*/
$parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -465,7 +466,7 @@ print '<input type="hidden" name="month" value="'.$month.'">';
print '<input type="hidden" name="year" value="'.$year.'">';
$head = project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputperweek', $langs->trans('TimeSpent'), -1, 'task');
dol_fiche_head($head, 'inputperweek', $langs->trans('TimeSpent'), -1, 'projecttask');
// Show description of content
print '<div class="hideonsmartphone opacitymedium">';