From 2aef13c3b4673d16b445281a46f57931d01d2921 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Fri, 13 Aug 2021 11:23:55 +0200 Subject: [PATCH 01/40] Adds global variable 'PRODUCT_GENERATE_REF_AFTER_FORM' to allow product ref generation after the form validation --- htdocs/product/card.php | 61 ++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 4857f35b121..5600365f014 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -71,7 +71,7 @@ $mesg = ''; $error = 0; $errors = array(); $refalreadyexists = 0; $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$ref = (GETPOST('ref', 'alpha') !== '') ? GETPOST('ref', 'alpha') : null; $type = (GETPOST('type', 'int') !== '') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT; $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); $cancel = GETPOST('cancel', 'alpha'); @@ -93,6 +93,18 @@ $label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABEL if (!empty($user->socid)) $socid = $user->socid; +// Load object modCodeProduct +$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard'); +if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php') +{ + $module = substr($module, 0, dol_strlen($module) - 4); +} +$result = dol_include_once('/core/modules/product/'.$module.'.php'); +if ($result > 0) +{ + $modCodeProduct = new $module(); +} + $object = new Product($db); $object->type = $type; // so test later to fill $usercancxxx is correct $extrafields = new ExtraFields($db); @@ -212,9 +224,11 @@ if (empty($reshook)) } if (empty($ref)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Ref')), null, 'errors'); - $action = "create"; - $error++; + if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Ref')), null, 'errors'); + $action = "create"; + $error++; + } } if (!empty($duration_value) && empty($duration_unit)) { @@ -371,6 +385,11 @@ if (empty($reshook)) $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) $error++; + if (!$ref && !empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + // Generate ref... + $ref = $modCodeProduct->getNextValue($object, $type); + } + if (!$error) { $id = $object->create($user); @@ -411,7 +430,9 @@ if (empty($reshook)) { $object->oldcopy = clone $object; - $object->ref = $ref; + if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + $object->ref = $ref; + } $object->label = GETPOST('label', $label_security_check); $object->description = dol_htmlcleanlastbr(GETPOST('desc', 'restricthtml')); $object->url = GETPOST('url'); @@ -995,15 +1016,17 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; - print ''; - $tmpcode = ''; - if (!empty($modCodeProduct->code_auto)) $tmpcode = $modCodeProduct->getNextValue($object, $type); - print ''; + $tmpcode = ''; + if (!empty($modCodeProduct->code_auto)) $tmpcode = $modCodeProduct->getNextValue($object, $type); + print ''; } - print ''; // Label print ''; @@ -2176,18 +2199,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } -// Load object modCodeProduct -$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard'); -if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php') -{ - $module = substr($module, 0, dol_strlen($module) - 4); -} -$result = dol_include_once('/core/modules/product/'.$module.'.php'); -if ($result > 0) -{ - $modCodeProduct = new $module(); -} - $tmpcode = ''; if (!empty($modCodeProduct->code_auto)) $tmpcode = $modCodeProduct->getNextValue($object, $object->type); From b0ea9fed0a9947dff210e230c88062e0fb7eebf1 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Mon, 16 Aug 2021 18:05:29 +0800 Subject: [PATCH 02/40] fix warnings 1 Removing all PHP8 warnings from error logs --- htdocs/comm/action/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index c87af9558e8..7eeda32dfed 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -528,7 +528,7 @@ $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { $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'; From d2e2dcf27e7ae8b98b885aa0f2bffc0008fae29a Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Mon, 16 Aug 2021 18:10:04 +0800 Subject: [PATCH 03/40] fix warnings 2 Fixing PHP8 warnings --- htdocs/main.inc.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e3ada0c6c59..30b92cd82fd 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2016,24 +2016,24 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $dropdownBody .= '
'; if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId1", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).''; + $dropdownBody .= '
'.$langs->transcountry("ProfId1", $mysoc->country_code).': '.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_SIREN")).''; } if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId2", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).''; + $dropdownBody .= '
'.$langs->transcountry("ProfId2", $mysoc->country_code).': '.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_SIRET")).''; } if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId3", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).''; + $dropdownBody .= '
'.$langs->transcountry("ProfId3", $mysoc->country_code).': '.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_APE")).''; } if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId4", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).''; + $dropdownBody .= '
'.$langs->transcountry("ProfId4", $mysoc->country_code).': '.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_RCS")).''; } if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId5", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).''; + $dropdownBody .= '
'.$langs->transcountry("ProfId5", $mysoc->country_code).': '.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_PROFID5")).''; } if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId6", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).''; + $dropdownBody .= '
'.$langs->transcountry("ProfId6", $mysoc->country_code).': '.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_PROFID6")).''; } - $dropdownBody .= '
'.$langs->trans("VATIntraShort").': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).''; + $dropdownBody .= '
'.$langs->trans("VATIntraShort").': '.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_TVAINTRA")).''; $dropdownBody .= '
'; From f9c4ea8f6a9a49066c6a0db16b5c54322fa958db Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Mon, 16 Aug 2021 18:37:39 +0800 Subject: [PATCH 04/40] fix warnings3 Fixing PHP8 warnings --- htdocs/supplier_proposal/list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 3c89be6bfe4..7dc284c3edf 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -202,6 +202,9 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } +//to remove PHP8 warnings down the line +$search_product_category = 0; + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? From 1bd7b4a439bfca557ea7ec8cc0b040d1b7ab495e Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Mon, 16 Aug 2021 18:52:44 +0800 Subject: [PATCH 05/40] fix warnings 4 Fixing PHP8 warnings --- htdocs/contrat/services_list.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 8368bffbab2..82ca1669384 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -412,18 +412,28 @@ if (!empty($filter_op2) && $filter_op2 != -1) { if (!empty($filter_opcloture) && $filter_opcloture != -1) { $param .= '&filter_opcloture='.urlencode($filter_opcloture); } +//removing PHP warnings +$filter_dateouvertureprevue = isset($filter_dateouvertureprevue) ? $filter_dateouvertureprevue : '' ; if ($filter_dateouvertureprevue != '') { $param .= '&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear; } +//removing PHP warnings +$filter_date1 = isset($filter_date1) ? $filter_date1 : ''; if ($filter_date1 != '') { $param .= '&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year; } +//removing PHP8 warnings +$filter_date2 = isset($filter_date2) ? $filter_date2 : ''; if ($filter_date2 != '') { $param .= '&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year; } +//removing PHP8 warnings +$filter_datecloture = isset($filter_datecloture) ? $filter_datecloture : ''; if ($filter_datecloture != '') { $param .= '&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year; } +//removing PHP8 warnings +$optioncss = isset($optioncss) ? $optioncss : ''; if ($optioncss != '') { $param .= '&optioncss='.$optioncss; } @@ -467,7 +477,8 @@ if ($mode == "5") { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, '', '', $limit); -if ($sall) { +//adding isset to remove PHP8 warnings +if (isset($sall)) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); } @@ -475,6 +486,8 @@ if ($sall) { } $morefilter = ''; +//removing PHP8 warnings +$moreforfilter = ''; // If the user can view categories of products if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) { From 031e13d438fd98ba3bba43fcdbae8c60341528fc Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Mon, 16 Aug 2021 18:55:49 +0800 Subject: [PATCH 06/40] fix warnings 5 Removing PHP8 warnings --- htdocs/societe/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index cdbacd5ffca..cb5dc4500ca 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -672,6 +672,8 @@ if (empty($reshook)) { } $sql .= $hookmanager->resPrint; // Add GroupBy from hooks +//removing PHP8 warnings +$all, = isset($all,) ? $all, : ''; $parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall); $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; From 9f1ced1fd01695bf9576c4631d8221ece37dc1c3 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Mon, 16 Aug 2021 19:06:38 +0800 Subject: [PATCH 07/40] fix warnings 6 Removing PHP8 warnings --- htdocs/comm/action/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 245f90edf72..6862296d18b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1187,7 +1187,8 @@ if ($action == 'create') { print img_picto('', 'project', 'class="pictofixedwidth"'); print $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - print ' '; + //duplicating test from line above to remove PHP8 warning + print ' '; print ''; $urloption = '?action=create&donotclearsession=1'; $url = dol_buildpath('comm/action/card.php', 2).$urloption; From af1f29bb16e98d040b12235dbe33515129ab6e40 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 16 Aug 2021 11:22:49 +0000 Subject: [PATCH 08/40] Fixing style errors. --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 6862296d18b..2d513e5477e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1187,7 +1187,7 @@ if ($action == 'create') { print img_picto('', 'project', 'class="pictofixedwidth"'); print $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - //duplicating test from line above to remove PHP8 warning + //duplicating test from line above to remove PHP8 warning print ' '; print ''; $urloption = '?action=create&donotclearsession=1'; From d1858e02b5b799e2e1192c421baa8f705f8b6843 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 17:03:41 +0200 Subject: [PATCH 09/40] Update card.php --- htdocs/product/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5600365f014..48ad41fcc97 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -71,8 +71,8 @@ $mesg = ''; $error = 0; $errors = array(); $refalreadyexists = 0; $id = GETPOST('id', 'int'); -$ref = (GETPOST('ref', 'alpha') !== '') ? GETPOST('ref', 'alpha') : null; -$type = (GETPOST('type', 'int') !== '') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT; +$ref = (GETPOSTISSET('ref', 'alpha') ? GETPOST('ref', 'alpha') : null); +$type = (GETPOSTISSET('type', 'int') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT); $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); From a7cb9b2143817730d1767bf954bc2d2e7fb5fc7b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 17 Aug 2021 21:29:15 +0200 Subject: [PATCH 10/40] NEW Ihm admin - Add tabs --- htdocs/admin/ihm.php | 447 +++++++++++++++++----------------- htdocs/core/lib/admin.lib.php | 41 +++- 2 files changed, 266 insertions(+), 222 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index cf4c250a678..0d26c664cce 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -43,6 +43,13 @@ if (!$user->admin) { $action = GETPOST('action', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search +$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'language'; // 'language', 'template', 'login', 'other' + +$defaultlanguage = GETPOST('defaultlanguage', 'alphanohtml'); +$defaulttemplate = GETPOST('defaulttemplate', 'alphanohtml'); +$defaultlogin = GETPOST('defaultlogin', 'alphanohtml'); +$defaultother = GETPOST('defaultother', 'alphanohtml'); + if (!defined("MAIN_MOTD")) { define("MAIN_MOTD", ""); } @@ -267,6 +274,8 @@ if ($action == 'update') { $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; llxHeader('', $langs->trans("Setup"), $wikihelp); +$param = '&mode='.$mode; + $form = new Form($db); $formother = new FormOther($db); $formadmin = new FormAdmin($db); @@ -274,250 +283,246 @@ $formadmin = new FormAdmin($db); print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup'); print ''.$langs->trans("DisplayDesc")."
\n"; +print "
\n"; + +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); +} +if ($defaultlanguage) { + $param .= '&defaultlanguage='.urlencode($defaultlanguage); +} +if ($defaulttemplate) { + $param .= '&defaulttemplate='.urlencode($defaulttemplate); +} +if ($defaultlogin) { + $param .= '&defaultlogin='.urlencode($defaultlogin); +} +if ($defaultother) { + $param .= '&defaultother='.urlencode($defaultother); +} //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -print '
'; +print ''; print ''; print ''; -print ''; clearstatcache(); -print '
'; -print '
'; -print '
'.$langs->trans("Ref").''; - if ($refalreadyexists) - { - print $langs->trans("RefAlreadyExists"); + if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + print '
'.$langs->trans("Ref").''; + if ($refalreadyexists) + { + print $langs->trans("RefAlreadyExists"); + } + print '
'.$langs->trans("Label").'
'; -print ''; -print ''; +$head = ihm_prepare_head(); -// Default language -print ''; -print ''; +print dol_get_fiche_head($head, $mode, '', -1, ''); -// Multilingual GUI -print ''; -print ''; +if ($mode == 'language') { + print '
'; + print '
'.img_picto('', 'language').' '.$langs->trans("Language").'
'.$langs->trans("DefaultLanguage").''; -print img_picto('', 'language', 'class="pictofixedwidth"'); -print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2); -//print ''; -print '
'.$langs->trans("EnableMultilangInterface").''; -print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0); -print '
'; -print '
'."\n"; -print ''; + // Default language + print ''.$langs->trans("DefaultLanguage").''; + print img_picto('', 'language', 'class="pictofixedwidth"'); + print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2); + //print ''; + print ''; + print ''; -print '
'; -print '
'; -print ''; -print '
'; + // Multilingual GUI + print '' . $langs->trans("EnableMultilangInterface") . ''; + print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0); + print ''; + print ''; -print '

'; - -// Themes and themes options -showSkins(null, 1); -print '
'; -print '
'; -print ''; -print '
'; - -print '

'; - -// Other -print '
'; -print ''; -print ''; -print ''; -print ''; - -// Disable javascript and ajax -print ''; -print ''; -print ''; - -// Max size of lists -print ''; -print ''; -print ''; - -// Max size of short lists on customer card -print ''; -print ''; -print ''; - -// show input border -/* - print ''; - print ''; - print ''; - */ - -// First day for weeks -print ''; -print ''; -print ''; - -// DefaultWorkingDays -print ''; -print ''; -print ''; - -// DefaultWorkingHours -print ''; -print ''; -print ''; - -// Firstname/Name -print ''; -print ''; -print ''; - -// Hide unauthorized menus -print ''; -print ''; -print ''; - -// Hide unauthorized button -print ''; -print ''; -print ''; - -// Hide version link -/* - -print ''; -print ''; -print ''; -*/ - -// Show bugtrack link -print ''; -print ''; -print ''; - -// Hide wiki link on login page -$pictohelp = ''; -print ''; -print ''; -print ''; - -// Message of the day on home page -$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount')); -complete_substitutions_array($substitutionarray, $langs); - -print '
'.$langs->trans("Miscellaneous").' '; -print '
'.$langs->trans("DisableJavascript").''; -print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0); -print '     '.$langs->trans("DisableJavascriptNote").''; -print ''; -print '
'.$langs->trans("DefaultMaxSizeList").' 
'.$langs->trans("DefaultMaxSizeShortList").' 
'.$langs->trans("showInputBorder").''; - print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); - print ' 
'.$langs->trans("WeekStartOnDay").''; -print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0); -print ' 
'.$langs->trans("DefaultWorkingDays").''; -print ''; -print ' 
'.$langs->trans("DefaultWorkingHours").''; -print ''; -print ' 
'.$langs->trans("FirstnameNamePosition").''; -$array = array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); -print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0)); -print ' 
'.$langs->trans("HideUnauthorizedMenu").''; -//print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1); -print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); -print ' 
'.$langs->trans("ButtonHideUnauthorized").''; -//print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1); -print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); -print ' 
'.$langs->trans("HideVersionLink").''; -print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); -print ' 
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; -print ''; -print ' 
'.str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')).''; -print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0); -//print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); -print ' 
'; -$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'
'; -foreach ($substitutionarray as $key => $val) { - $texthelp .= $key.'
'; + print '
' . "\n"; + print '
'; } -print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); -print ''; - -$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); -$doleditor->Create(); - -print ''."\n"; - -print ''."\n"; -print ''; - -print '
'; - -print '
'; -print ''; -print '
'; - -print '

'; - -// Other -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; - -// Hide helpcenter link on login page -print ''; -print ''; -print ''; - -// Message on login page -$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user')); -complete_substitutions_array($substitutionarray, $langs); -print ''."\n"; -// Background -print '' . "\n"; + + print '
'.$langs->trans("LoginPage").' 
'.$langs->trans("DisableLinkToHelpCenter").''; -print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0); -print ' 
'; -$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'
'; -foreach ($substitutionarray as $key => $val) { - $texthelp .= $key.'
'; +if ($mode == 'template') { + // Themes and themes options + showSkins(null, 1); } -print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin'); -print '
'; -$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); -$doleditor->Create(); -print '
'; -print '
'; -$disabled = ''; -if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { - $disabled = ' disabled="disabled"'; -} -print ''; -if ($disabled) { - print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') '; -} -if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) { - print ''.img_delete($langs->trans("Delete")).''; - if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) { - print '   '; - print ''; +if ($mode == 'other') { + // Other + print '
'; + print ''; + + // Disable javascript and ajax + print ''; + print ''; + print ''; + + // Max size of lists + print ''; + print ''; + print ''; + + // Max size of short lists on customer card + print ''; + print ''; + print ''; + + // show input border + /* + print ''; + print ''; + print ''; + */ + + // First day for weeks + print ''; + print ''; + print ''; + + // DefaultWorkingDays + print ''; + print ''; + print ''; + + // DefaultWorkingHours + print ''; + print ''; + print ''; + + // Firstname/Name + print ''; + print ''; + print ''; + + // Hide unauthorized menus + print ''; + print ''; + print ''; + + // Hide unauthorized button + print ''; + print ''; + print ''; + + // Hide version link + /* + + print ''; + print ''; + print ''; + */ + + // Show bugtrack link + print ''; + print ''; + print ''; + + // Hide wiki link on login page + $pictohelp = ''; + print ''; + print ''; + print ''; + + // Message of the day on home page + $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount')); + complete_substitutions_array($substitutionarray, $langs); + + print ''; + print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); -print '
' . $langs->trans("DisableJavascript") . ''; + print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0); + print '     ' . $langs->trans("DisableJavascriptNote") . ''; + print ''; + print '
' . $langs->trans("DefaultMaxSizeList") . ' 
' . $langs->trans("DefaultMaxSizeShortList") . ' 
'.$langs->trans("showInputBorder").''; + print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); + print ' 
' . $langs->trans("WeekStartOnDay") . ''; + print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0); + print ' 
' . $langs->trans("DefaultWorkingDays") . ''; + print ''; + print ' 
' . $langs->trans("DefaultWorkingHours") . ''; + print ''; + print ' 
' . $langs->trans("FirstnameNamePosition") . ''; + $array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname")); + print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0)); + print ' 
' . $langs->trans("HideUnauthorizedMenu") . ''; + //print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1); + print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); + print ' 
' . $langs->trans("ButtonHideUnauthorized") . ''; + //print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1); + print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); + print ' 
'.$langs->trans("HideVersionLink").''; + print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); + print ' 
' . $langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")) . ''; + print ''; + print ' 
' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . ''; + print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); + print ' 
'; + $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '
'; + foreach ($substitutionarray as $key => $val) { + $texthelp .= $key . '
'; } -} else { - print ''; -} -print ''; -print '
'."\n"; -print '
'; + print '
'; + + $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); + $doleditor->Create(); + + print '
' . "\n"; + print '
'; +} + +if ($mode == 'login') { + // Other + print '
'; + print ''; + + // Hide helpcenter link on login page + print ''; + print ''; + print ''; + + // Message on login page + $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user')); + complete_substitutions_array($substitutionarray, $langs); + print '' . "\n"; + + // Background + print ''; + + print '
' . $langs->trans("DisableLinkToHelpCenter") . ''; + print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0); + print ' 
'; + $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '
'; + foreach ($substitutionarray as $key => $val) { + $texthelp .= $key . '
'; + } + print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin'); + print '
'; + $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); + $doleditor->Create(); + print '
'; + print '
'; + $disabled = ''; + if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { + $disabled = ' disabled="disabled"'; + } + print ''; + if ($disabled) { + print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') '; + } + if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) { + print '' . img_delete($langs->trans("Delete")) . ''; + if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) { + print '   '; + print ''; + } + } else { + print ''; + } + print '
'; + print '
' . "\n"; + print '
'; +} print '
'; print '
'; -print ''; +print ''; print '
'; print ''; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 683b92fb8d9..4e504797795 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -636,7 +636,7 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0, /** * Prepare array with list of tabs * - * @param int $nbofactivatedmodules Number f oactivated modules + * @param int $nbofactivatedmodules Number if activated modules * @param int $nboftotalmodules Nb of total modules * @return array Array of tabs to show */ @@ -679,6 +679,45 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules) return $head; } +/** + * Prepare array with list of tabs + * + * @return array Array of tabs to show + */ +function ihm_prepare_head() +{ + global $langs, $conf, $user; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=language"; + $head[$h][1] = $langs->trans("DefaultLanguage"); + $head[$h][2] = 'language'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=template"; + $head[$h][1] = $langs->trans("DefaultSkin"); + $head[$h][2] = 'template'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=login"; + $head[$h][1] = $langs->trans("LoginPage"); + $head[$h][2] = 'login'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=other"; + $head[$h][1] = $langs->trans("Miscellaneous"); + $head[$h][2] = 'other'; + $h++; + + complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin'); + + complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin', 'remove'); + + + return $head; +} + /** * Prepare array with list of tabs From 73dc98ed82704072c346aa4ba9fff138e5ed5c22 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 18 Aug 2021 04:36:37 +0200 Subject: [PATCH 11/40] NEW Ihm admin - Add tabs --- htdocs/admin/ihm.php | 333 +++++++++++++++++++++---------------------- 1 file changed, 160 insertions(+), 173 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 0d26c664cce..d7b64955a73 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -45,17 +45,10 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adm $mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'language'; // 'language', 'template', 'login', 'other' -$defaultlanguage = GETPOST('defaultlanguage', 'alphanohtml'); -$defaulttemplate = GETPOST('defaulttemplate', 'alphanohtml'); -$defaultlogin = GETPOST('defaultlogin', 'alphanohtml'); -$defaultother = GETPOST('defaultother', 'alphanohtml'); - if (!defined("MAIN_MOTD")) { define("MAIN_MOTD", ""); } - - /* * Action */ @@ -101,168 +94,178 @@ if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKG } if ($action == 'update') { - dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); - //dolibarr_set_const($db, "MAIN_MULTILANGS", GETPOST("MAIN_MULTILANGS"), 'chaine', 0, '', $conf->entity); + $error = 0; - dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity); - - /*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE'); - if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity); - else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/ - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity); + if ($mode == 'language') { + dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int)$conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_MULTILANGS", GETPOST("MAIN_MULTILANGS"), 'chaine', 0, '', $conf->entity); } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity); + if ($mode == 'template') { + dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity); + + /*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE'); + if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity); + else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/ + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity); + } + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity); + } + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity); + } else { + dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity); + } else { + dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity); + } } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity); + if ($mode == 'other') { + dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity); + + //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity); } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity); - } + if ($mode == 'login') { + dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity); - } + $varforimage = 'imagebackground'; + $dirforimage = $conf->mycompany->dir_output . '/logos/'; + if ($_FILES[$varforimage]["tmp_name"]) { + $reg = array(); + if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) { + $original_file = $reg[1]; - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity); - } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity); - } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity); - } else { - dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity); - } else { - dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity); - } - - dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity); - - //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity); - //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); - //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity); - //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities - - $varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/'; - if ($_FILES[$varforimage]["tmp_name"]) { - $reg = array(); - if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) { - $original_file = $reg[1]; - - $isimage = image_format_supported($original_file); - if ($isimage >= 0) { - dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); - if (!is_dir($dirforimage)) { - dol_mkdir($dirforimage); - } - $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); - if ($result > 0) { - dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity); - } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { - $error++; - $langs->load("errors"); - $tmparray = explode(':', $result); - setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); + $isimage = image_format_supported($original_file); + if ($isimage >= 0) { + dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file); + if (!is_dir($dirforimage)) { + dol_mkdir($dirforimage); + } + $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']); + if ($result > 0) { + dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity); + } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { + $error++; + $langs->load("errors"); + $tmparray = explode(':', $result); + setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); + } else { + $error++; + setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + } } else { $error++; - setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + $langs->load("errors"); + setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); } - } else { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); } } } + $_SESSION["mainmenu"] = ""; // The menu manager may have changed - - $_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(GETPOSTISSET('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : '')); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : '')); exit; } @@ -274,8 +277,6 @@ if ($action == 'update') { $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; llxHeader('', $langs->trans("Setup"), $wikihelp); -$param = '&mode='.$mode; - $form = new Form($db); $formother = new FormOther($db); $formadmin = new FormAdmin($db); @@ -285,35 +286,21 @@ print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup'); print ''.$langs->trans("DisplayDesc")."
\n"; print "
\n"; -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); -} -if ($defaultlanguage) { - $param .= '&defaultlanguage='.urlencode($defaultlanguage); -} -if ($defaulttemplate) { - $param .= '&defaulttemplate='.urlencode($defaulttemplate); -} -if ($defaultlogin) { - $param .= '&defaultlogin='.urlencode($defaultlogin); -} -if ($defaultother) { - $param .= '&defaultother='.urlencode($defaultother); -} - //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -print '
'; +print ''; print ''; print ''; - -clearstatcache(); +print ''; +print ''; $head = ihm_prepare_head(); print dol_get_fiche_head($head, $mode, '', -1, ''); +clearstatcache(); + if ($mode == 'language') { print '
'; print ''; From 062e66587402f742e2ae2690dbf2263d18c4e3b1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 18 Aug 2021 02:45:29 +0000 Subject: [PATCH 12/40] Fixing style errors. --- htdocs/admin/ihm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index d7b64955a73..5b9a11dcf5f 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -98,7 +98,7 @@ if ($action == 'update') { if ($mode == 'language') { dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int)$conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); //dolibarr_set_const($db, "MAIN_MULTILANGS", GETPOST("MAIN_MULTILANGS"), 'chaine', 0, '', $conf->entity); } From b51ac49f902640294cd920c3357af7de95806e04 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 18 Aug 2021 07:15:05 +0000 Subject: [PATCH 13/40] Fixing style errors. --- htdocs/product/card.php | 44 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 261d55948a8..ede9be76ef7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -114,14 +114,12 @@ if (!empty($user->socid)) { // Load object modCodeProduct $module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard'); -if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php') -{ - $module = substr($module, 0, dol_strlen($module) - 4); +if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php') { + $module = substr($module, 0, dol_strlen($module) - 4); } $result = dol_include_once('/core/modules/product/'.$module.'.php'); -if ($result > 0) -{ - $modCodeProduct = new $module(); +if ($result > 0) { + $modCodeProduct = new $module(); } $object = new Product($db); @@ -259,11 +257,11 @@ if (empty($reshook)) { $error++; } if (empty($ref)) { - if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Ref')), null, 'errors'); - $action = "create"; - $error++; - } + if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Ref')), null, 'errors'); + $action = "create"; + $error++; + } } if (!empty($duration_value) && empty($duration_unit)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Unit')), null, 'errors'); @@ -1099,18 +1097,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print dol_get_fiche_head(''); print '
'; - - if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { - print ''; - $tmpcode = ''; - if (!empty($modCodeProduct->code_auto)) { - $tmpcode = $modCodeProduct->getNextValue($object, $type); - } - print ''; + + if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + print ''; + $tmpcode = ''; + if (!empty($modCodeProduct->code_auto)) { + $tmpcode = $modCodeProduct->getNextValue($object, $type); + } + print ''; } // Label From 925303400733f02b54c44debd368b04094fba5f4 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Wed, 18 Aug 2021 17:43:45 +0800 Subject: [PATCH 14/40] Update list.php --- htdocs/supplier_proposal/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 7dc284c3edf..6b5ba8c7506 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -202,7 +202,6 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -//to remove PHP8 warnings down the line $search_product_category = 0; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; From 66495f3a9dd997d1327cfe34edd522edc0969fe6 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Wed, 18 Aug 2021 17:47:59 +0800 Subject: [PATCH 15/40] Update services_list.php --- htdocs/contrat/services_list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 82ca1669384..ce9d0aa47a4 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -291,6 +291,11 @@ if ($socid > 0) { $sql .= " AND s.rowid = ".((int) $socid); } +$filter_dateouvertureprevue = ''; +$filter_date1 = ''; +$filter_date2 = ''; +$filter_opcloture = ''; + $filter_dateouvertureprevue_start = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear); $filter_dateouvertureprevue_end = dol_mktime(23, 59, 59, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear); if ($filter_dateouvertureprevue_start != '' && $filter_opouvertureprevue == -1) { @@ -422,18 +427,15 @@ $filter_date1 = isset($filter_date1) ? $filter_date1 : ''; if ($filter_date1 != '') { $param .= '&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year; } -//removing PHP8 warnings -$filter_date2 = isset($filter_date2) ? $filter_date2 : ''; + if ($filter_date2 != '') { $param .= '&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year; } -//removing PHP8 warnings -$filter_datecloture = isset($filter_datecloture) ? $filter_datecloture : ''; + if ($filter_datecloture != '') { $param .= '&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year; } -//removing PHP8 warnings -$optioncss = isset($optioncss) ? $optioncss : ''; + if ($optioncss != '') { $param .= '&optioncss='.$optioncss; } @@ -477,7 +479,6 @@ if ($mode == "5") { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, '', '', $limit); -//adding isset to remove PHP8 warnings if (isset($sall)) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); @@ -486,7 +487,6 @@ if (isset($sall)) { } $morefilter = ''; -//removing PHP8 warnings $moreforfilter = ''; // If the user can view categories of products From 3cde9a27abf31f9f424f3d0b4bb49b6236df9050 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Wed, 18 Aug 2021 17:50:10 +0800 Subject: [PATCH 16/40] Update list.php --- htdocs/societe/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index cb5dc4500ca..160440c2394 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -672,9 +672,7 @@ if (empty($reshook)) { } $sql .= $hookmanager->resPrint; // Add GroupBy from hooks -//removing PHP8 warnings -$all, = isset($all,) ? $all, : ''; -$parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall); +$parameters = array('fieldstosearchall' => $fieldstosearchall); $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; From 2d35106e0b38261eaef9de6e5f8347c5321a8ce6 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Wed, 18 Aug 2021 17:52:21 +0800 Subject: [PATCH 17/40] Update card.php --- htdocs/comm/action/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 2d513e5477e..e5a83348db3 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1187,7 +1187,6 @@ if ($action == 'create') { print img_picto('', 'project', 'class="pictofixedwidth"'); print $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - //duplicating test from line above to remove PHP8 warning print ' '; print ''; $urloption = '?action=create&donotclearsession=1'; From ab95c5f463ca6537aef8c0b1bfbb5750e0df5aa5 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Wed, 18 Aug 2021 21:55:00 +0800 Subject: [PATCH 18/40] Update index.php --- htdocs/comm/action/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 7eeda32dfed..8f23d472dbb 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -528,7 +528,12 @@ $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { $tmpforcreatebutton = dol_getdate(dol_now(), true); - $newparam = 'month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; + if(isset($newparam)) { + $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; + } + else { + $newparam = 'month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; + } //$param='month='.$monthshown.'&year='.$year; $hourminsec = '100000'; From 88b0408e420d3f66a9504039312f8fdc1246a695 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 18 Aug 2021 13:57:19 +0000 Subject: [PATCH 19/40] Fixing style errors. --- htdocs/comm/action/index.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 8f23d472dbb..2610f8a51c8 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -528,10 +528,9 @@ $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { $tmpforcreatebutton = dol_getdate(dol_now(), true); - if(isset($newparam)) { + if (isset($newparam)) { $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; - } - else { + } else { $newparam = 'month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; } From 526ea1a9b34c7da3bb910ccb950e532e116ab13a Mon Sep 17 00:00:00 2001 From: henrynopo Date: Wed, 18 Aug 2021 22:30:28 +0800 Subject: [PATCH 20/40] Added China into the list of country using State / province in address --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 365fa4af6bf..627318b2674 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2130,7 +2130,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs global $conf, $langs; $ret = ''; - $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS + $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR', 'CN'); // See also MAIN_FORCE_STATE_INTO_ADDRESS // See format of addresses on https://en.wikipedia.org/wiki/Address // Address @@ -2138,7 +2138,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs $ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : (empty($object->address) ? '' : $object->address)); } // Zip/Town/State - if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { + if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US', 'CN')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { // US: title firstname name \n address lines \n town, state, zip \n country $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town)); $ret .= ($ret ? $sep : '').$town; From e4aafcf91e73c88fe4f309211e415dbd2e0dd352 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Aug 2021 18:43:33 +0200 Subject: [PATCH 21/40] Code comment --- htdocs/product/class/product.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9bc127fdf14..773a10164ca 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2228,7 +2228,7 @@ class Product extends CommonObject * @param string $ref Ref of product/service to load * @param string $ref_ext Ref ext of product/service to load * @param string $barcode Barcode of product/service to load - * @param int $ignore_expression Ignores the math expression for calculating price and uses the db value instead + * @param int $ignore_expression When module dynamicprices is on, ignores the math expression for calculating price and uses the db value instead * @param int $ignore_price_load Load product without loading prices arrays (when we are sure we don't need them) * @param int $ignore_lang_load Load product without loading language arrays (when we are sure we don't need them) * @return int <0 if KO, 0 if not found, >0 if OK @@ -2446,8 +2446,8 @@ class Product extends CommonObject $sql .= " WHERE entity IN (".getEntity('productprice').")"; $sql .= " AND price_level=".((int) $i); $sql .= " AND fk_product = ".((int) $this->id); - $sql .= " ORDER BY date_price DESC, rowid DESC"; - $sql .= " LIMIT 1"; + $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line + $sql .= " LIMIT 1"; // Only the first one $resql = $this->db->query($sql); if ($resql) { $result = $this->db->fetch_array($resql); From ee6a2f73dbba2c6f29e6b4ccace7a9d3c333e7b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Aug 2021 19:32:07 +0200 Subject: [PATCH 22/40] css install --- htdocs/core/lib/admin.lib.php | 39 +++++++++++------------------------ htdocs/install/default.css | 6 ++++-- htdocs/install/step5.php | 2 +- htdocs/install/upgrade.php | 28 ++++++++++++++----------- htdocs/install/upgrade2.php | 2 +- 5 files changed, 34 insertions(+), 43 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index ef5b3eab061..8cc3fc28c9e 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -160,9 +160,10 @@ function versiondolibarrarray() * @param int $linelengthlimit Limit for length of each line (Use 0 if unknown, may be faster if defined) * @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0) * @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value + * @param int $colspan 2=Add a colspan=2 on td * @return int <=0 if KO, >0 if OK */ -function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0) +function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0, $colspan = 0) { global $db, $conf, $langs, $user; @@ -282,13 +283,9 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle } } else { if (!$silent) { - print '"; - } - if (!$silent) { - print ''; + print ''; } $error++; break; @@ -337,7 +334,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle // Add log of request if (!$silent) { - print '\n"; + print '\n"; } dol_syslog('Admin.lib::run_sql Request '.($i + 1), LOG_DEBUG); $sqlmodified = 0; @@ -371,13 +368,9 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle $cursor = $reg[1]; if (empty($listofinsertedrowid[$cursor])) { if (!$silent) { - print '"; - } - if (!$silent) { - print ''; + print ''; } $error++; break; @@ -437,22 +430,14 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle // Is it an error we accept if (!in_array($errno, $okerrors)) { if (!$silent) { - print '"; - } - if (!$silent) { - print ''."\n"; + print ''."\n"; } dol_syslog('Admin.lib::run_sql Request '.($i + 1)." Error ".$db->errno()." ".$newsql."
".$db->error(), LOG_ERR); $error++; } } - - if (!$silent) { - print ''."\n"; - } } } diff --git a/htdocs/install/default.css b/htdocs/install/default.css index 88967664ad8..664dfd78d89 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -59,10 +59,12 @@ table.main-inside { margin-top: 10px; color: #000000; border-top: 1px solid #ccc; - /* border-bottom: 1px solid #ccc; */ line-height: 22px; } - +table.main-inside-borderbottom { + border-bottom: 1px solid #ccc; +} + table.main { padding-left: 6px; padding-right: 6px; diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index b841edb12ac..0958ef7bb3b 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -114,7 +114,7 @@ if ($action == "set") { $morehtml = ''; -pHeader($langs->trans("SetupEnd"), "step5"); +pHeader($langs->trans("SetupEnd"), "step5", 'set', '', '', 'main-inside main-inside-borderbottom'); print '
'; // Test if we can run a first install process diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 70257bba79e..e349317b0c4 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -102,7 +102,7 @@ if (!$versionfrom && !$versionto) { } -pHeader('', "upgrade2", GETPOST('action', 'aZ09'), 'versionfrom='.$versionfrom.'&versionto='.$versionto); +pHeader('', "upgrade2", GETPOST('action', 'aZ09'), 'versionfrom='.$versionfrom.'&versionto='.$versionto, '', 'main-inside main-inside-borderbottom'); $actiondone = 0; @@ -348,9 +348,10 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ print ''."\n"; // Run sql script - $ok = run_sql($dir.$file, 0, '', 1); + $ok = run_sql($dir.$file, 0, '', 1, '', 'default', 32768, 0, 0, 2); $listoffileprocessed[$dir.$file] = $dir.$file; + // Scan if there is migration scripts that depends of Dolibarr version // for modules htdocs/module/sql or htdocs/custom/module/sql (files called "dolibarr_x.y.z-a.b.c.sql") $modulesfile = array(); @@ -369,17 +370,20 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ } } - foreach ($modulesfile as $modulefilelong => $modulefileshort) { - if (in_array($modulefilelong, $listoffileprocessed)) { - continue; + if (count($modulesfile)) { + print ''; + + foreach ($modulesfile as $modulefilelong => $modulefileshort) { + if (in_array($modulefilelong, $listoffileprocessed)) { + continue; + } + + print ''."\n"; + + // Run sql script + $okmodule = run_sql($modulefilelong, 0, '', 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not. + $listoffileprocessed[$modulefilelong] = $modulefilelong; } - - print ''; - print ''."\n"; - - // Run sql script - $okmodule = run_sql($modulefilelong, 0, '', 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not. - $listoffileprocessed[$modulefilelong] = $modulefilelong; } } } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index a11de7c447e..62822bec9ee 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -113,7 +113,7 @@ if ((!$versionfrom || preg_match('/version/', $versionfrom)) && (!$versionto || exit; } -pHeader('', 'step5', GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'upgrade', 'versionfrom='.$versionfrom.'&versionto='.$versionto); +pHeader('', 'step5', GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'upgrade', 'versionfrom='.$versionfrom.'&versionto='.$versionto, '', 'main-inside main-inside-borderbottom'); if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ09'))) { From 13e64d2f79df129e8fad1749c51e91f9e710fbe1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Aug 2021 19:46:37 +0200 Subject: [PATCH 23/40] Fix replace file_get_contents with getURLContent --- htdocs/blockedlog/ajax/check_signature.php | 19 ++++++++++++------- htdocs/core/class/google.class.php | 6 ++++-- htdocs/printing/index.php | 3 ++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/htdocs/blockedlog/ajax/check_signature.php b/htdocs/blockedlog/ajax/check_signature.php index ba164e3e715..4d59b56a981 100644 --- a/htdocs/blockedlog/ajax/check_signature.php +++ b/htdocs/blockedlog/ajax/check_signature.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/blockedlog/ajax/block-info.php + * \file htdocs/blockedlog/ajax/check_signature.php * \ingroup blockedlog - * \brief block-info + * \brief This page is not used yet. */ @@ -38,13 +38,15 @@ if (!defined('NOREQUIREHTML')) { require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; +require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php'; + if (empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { exit('BLOCKEDLOG_AUTHORITY_URL not set'); } -require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; -require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php'; $auth = new BlockedLogAuthority($db); $auth->syncSignatureWithAuthority(); @@ -63,8 +65,11 @@ if (is_array($bocks)) { $hash = $auth->getBlockchainHash(); -$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$auth->signature.'&h='.$hash; +// Call external authority +$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.urlencode($auth->signature).'&h='.urlencode($hash); + +$resarray = getURLContent($url, 'GET', '', 1, array(), array(), 2); +$res = $resarray['content']; -$res = file_get_contents($url); //echo $url; -echo $res; +echo dol_escape_htmltag($res); diff --git a/htdocs/core/class/google.class.php b/htdocs/core/class/google.class.php index ee122ff7cb5..4a91d548122 100644 --- a/htdocs/core/class/google.class.php +++ b/htdocs/core/class/google.class.php @@ -66,10 +66,12 @@ class GoogleAPI $i = 0; // Desired address - $urladdress = "https://maps.google.com/maps/geo?q=".urlencode($address)."&output=xml&key=".$this->key; + $urladdress = "https://maps.google.com/maps/geo?q=".urlencode($address)."&output=xml&key=".urlencode($this->key); // Retrieve the URL contents - $page = file_get_contents($urladdress); + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + $pagearray = getURLContent($urladdress, 'GET'); + $page = $pagearray['content']; $code = strstr($page, ''); $code = strstr($code, '>'); diff --git a/htdocs/printing/index.php b/htdocs/printing/index.php index 84132c784f4..2d20db4ddf7 100644 --- a/htdocs/printing/index.php +++ b/htdocs/printing/index.php @@ -58,7 +58,8 @@ foreach ($result as $driver) { $classname = 'printing_'.$driver; $langs->load($driver); $printer = new $classname($db); - if ($conf->global->{$printer->active}) { + $keyforprinteractive = $printer->active; + if ($keyforprinteractive && $conf->global->$keyforprinteractive) { //$printer->listJobs('commande'); $result = $printer->listJobs(); print $printer->resprint; From fa3ba05a23773e922af85420464077708517ee21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Aug 2021 21:31:54 +0200 Subject: [PATCH 24/40] Update card.php --- htdocs/product/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index ede9be76ef7..3f2833fde52 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -88,8 +88,8 @@ $mesg = ''; $error = 0; $errors = array(); $refalreadyexists = 0; $id = GETPOST('id', 'int'); -$ref = (GETPOSTISSET('ref', 'alpha') ? GETPOST('ref', 'alpha') : null); -$type = (GETPOSTISSET('type', 'int') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT); +$ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : null); +$type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT); $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); From c03b71dff3a552e2d7a4d318f60218d30b190786 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 18 Aug 2021 21:41:11 +0200 Subject: [PATCH 25/40] NEW Supplier proposal - Add From/to input on search date --- htdocs/supplier_proposal/list.php | 143 +++++++++++++++++++++--------- 1 file changed, 103 insertions(+), 40 deletions(-) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 3c89be6bfe4..4a4698fdd07 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -1,16 +1,17 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2010-2019 Philippe Grand - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2018 Charlene Benke +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2019 Philippe Grand + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2021 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,6 +66,22 @@ $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); $search_country = GETPOST("search_country", 'int'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_date_valid_startday = GETPOST('search_date_valid_startday', 'int'); +$search_date_valid_startmonth = GETPOST('search_date_valid_startmonth', 'int'); +$search_date_valid_startyear = GETPOST('search_date_valid_startyear', 'int'); +$search_date_valid_endday = GETPOST('search_date_valid_endday', 'int'); +$search_date_valid_endmonth = GETPOST('search_date_valid_endmonth', 'int'); +$search_date_valid_endyear = GETPOST('search_date_valid_endyear', 'int'); +$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver +$search_date_valid_end = dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_montant_ht = GETPOST('search_montant_ht', 'alpha'); $search_montant_vat = GETPOST('search_montant_vat', 'alpha'); @@ -83,12 +100,6 @@ $search_remove_btn = GETPOST('button_removefilter', 'alpha'); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); -$year = GETPOST("year"); -$month = GETPOST("month"); -$day = GETPOST("day"); -$yearvalid = GETPOST("yearvalid"); -$monthvalid = GETPOST("monthvalid"); -$dayvalid = GETPOST("dayvalid"); $optioncss = GETPOST('optioncss', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -227,12 +238,22 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_type = ''; $search_country = ''; $search_type_thirdparty = ''; - $yearvalid = ''; - $monthvalid = ''; - $dayvalid = ''; - $year = ''; - $month = ''; - $day = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_date_valid_startday = ''; + $search_date_valid_startmonth = ''; + $search_date_valid_startyear = ''; + $search_date_valid_endday = ''; + $search_date_valid_endmonth = ''; + $search_date_valid_endyear = ''; + $search_date_valid_start = ''; + $search_date_valid_end = ''; $search_status = ''; $object_statut = ''; } @@ -376,8 +397,18 @@ if ($socid) { if ($search_status >= 0 && $search_status != '') { $sql .= ' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).')'; } -$sql .= dolSqlDateFilter("sp.date_livraison", $day, $month, $year); -$sql .= dolSqlDateFilter("sp.date_valid", $dayvalid, $monthvalid, $yearvalid); +if ($search_date_start) { + $sql .= " AND sp.date_livraison >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND sp.date_livraison <= '".$db->idate($search_date_end)."'"; +} +if ($search_date_valid_start) { + $sql .= " AND sp.date_valid >= '".$db->idate($search_date_valid_start)."'"; +} +if ($search_date_valid_end) { + $sql .= " AND sp.date_valid <= '".$db->idate($search_date_valid_end)."'"; +} if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); } @@ -446,11 +477,41 @@ if ($resql) { if ($sall) { $param .= '&sall='.urlencode($sall); } - if ($month) { - $param .= '&month='.urlencode($month); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($year) { - $param .= '&year='.urlencode($year); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + } + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); + } + if ($search_date_valid_startday) { + $param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday); + } + if ($search_date_valid_startmonth) { + $param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth); + } + if ($search_date_valid_startyear) { + $param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear); + } + if ($search_date_valid_endday) { + $param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday); + } + if ($search_date_valid_endmonth) { + $param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth); + } + if ($search_date_valid_endyear) { + $param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -641,21 +702,23 @@ if ($resql) { // Date if (!empty($arrayfields['sp.date_valid']['checked'])) { print ''; } // Date if (!empty($arrayfields['sp.date_livraison']['checked'])) { print ''; } From 1df2aeb23357c472235ebc1ca99bb5fd24535a78 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Aug 2021 22:01:53 +0200 Subject: [PATCH 26/40] Update card.php --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index e5a83348db3..b9586e1b1bb 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1185,7 +1185,7 @@ if ($action == 'create') { print ''; // Duration - Time spent - print '
'.$langs->trans("Ref").''; - if ($refalreadyexists) { - print $langs->trans("RefAlreadyExists"); - } - print '
'.$langs->trans("Ref").''; + if ($refalreadyexists) { + print $langs->trans("RefAlreadyExists"); + } + print '
'; - } - if (!$silent) { - print '
'.$langs->trans("Failed to get max rowid for ".$table)."
'; + print '
'.$langs->trans("Failed to get max rowid for ".$table)."
"; + print '
'.$langs->trans("Request").' '.($i + 1)." sql='".dol_htmlentities($newsql, ENT_NOQUOTES)."'
'.$langs->trans("Request").' '.($i + 1)." sql='".dol_htmlentities($newsql, ENT_NOQUOTES)."'
'; - } - if (!$silent) { - print '
'.$langs->trans("FileIsNotCorrect")."
'; + print '
'.$langs->trans("FileIsNotCorrect")."
"; + print '
'; - } - if (!$silent) { - print '
'.$langs->trans("Error")." ".$db->errno().": ".$newsql."
".$db->error()."
'; + print '
'.$langs->trans("Error")." ".$db->errno().": ".$newsql."
".$db->error()."
"; + print '
'.$langs->trans("ChoosedMigrateScript").''.$file.'

'.$langs->trans("ChoosedMigrateScript").' (external modules)'.$modulefileshort.'

'.$langs->trans("ChoosedMigrateScript").' (external modules)'.$modulefileshort.'
'; - //print $langs->trans('Month').': '; - print ''; - //print ' '.$langs->trans('Year').': '; - $syearvalid = $yearvalid; - $formother->select_year($syearvalid, 'yearvalid', 1, 20, 5); + print '
'; + print $form->selectDate($search_date_valid_start ? $search_date_valid_start : -1, 'search_date_valid_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_valid_end ? $search_date_valid_end : -1, 'search_date_valid_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print '
'; - //print $langs->trans('Month').': '; - print ''; - //print ' '.$langs->trans('Year').': '; - $syear = $year; - $formother->select_year($syear, 'year', 1, 20, 5); + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print '
'.$langs->trans("Project").''; print img_picto('', 'project', 'class="pictofixedwidth"'); - print $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print $formproject->select_projects((empty($societe->id) ? '' : $societe->id), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); print ' '; print ''; From 7af265db8a2ea7a7a8ff31eb36b8aa3c418f35d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Aug 2021 22:03:16 +0200 Subject: [PATCH 27/40] Update card.php --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index b9586e1b1bb..97a573ce86f 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1187,7 +1187,7 @@ if ($action == 'create') { print img_picto('', 'project', 'class="pictofixedwidth"'); print $formproject->select_projects((empty($societe->id) ? '' : $societe->id), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - print ' '; + print ' '; print ''; $urloption = '?action=create&donotclearsession=1'; $url = dol_buildpath('comm/action/card.php', 2).$urloption; From 60c9a882f1cfcf76756ae9fe2a309b4fecd7a9d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Aug 2021 22:15:20 +0200 Subject: [PATCH 28/40] Code comment --- htdocs/takepos/css/pos.css.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index e180dc33b3e..66c65edb622 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -21,8 +21,8 @@ */ /** - * \file htdocs/theme/eldy/style.css.php - * \brief File for CSS style sheet Eldy + * \file htdocs/takepos/css/pos.css.php + * \brief File for CSS style for TakePOS */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language From 4d20ba2e4ede30fd0926a56f73e259e9b1511206 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Thu, 19 Aug 2021 04:29:09 +0800 Subject: [PATCH 29/40] Update services_list.php --- htdocs/contrat/services_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index ce9d0aa47a4..24b6e643b51 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -479,7 +479,7 @@ if ($mode == "5") { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, '', '', $limit); -if (isset($sall)) { +if (!empty($sall)) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); } From 4e4c8a9cb56496cfcb25cbdb64fc7e5f788964b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Aug 2021 01:55:00 +0200 Subject: [PATCH 30/40] Prepare 14.0.1 --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/ChangeLog b/ChangeLog index b54d8df615e..224e919d526 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,45 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 14.0.1 compared to 14.0.0 ***** + +FIX: $conf->task used but it does not exist, use $conf->projet instead +FIX: #18181 +FIX: #18212 : Add url field +FIX: #18267 +FIX: #18289 #18294 +FIX: #18341 lang not loaded +FIX: #18389 Accountancy - Bug on LDcompta10 export for supplier invoice +FIX: #18399 Fix shipment validation email template override. +FIX: Accountancy - Debug Export Sage50 / CIEL Compta / CIEL Compta Evo (Format XIMPORT) +FIX: Accountancy - Rules to delete & modify transaction not applied in ledger & subledger +FIX: Accountancy - Search date on journal +FIX: Accountancy - SQL error on select journal on journal +FIX: Accountancy - SQL error when insert a manuel transaction +FIX: add include missing file '/core/actions_dellink.inc.php' in project card +FIX: avoid to have link to create bookmark on page to create bookmark +FIX: bad approver shown on holiday once approved +FIX: bad closing div on error message +FIX: cannot add time spentd when column ref is not displayed +FIX: Can't remove a permission of a group +FIX: Can't set cost price when product is not on purchase +FIX: compatibility postgresql +FIX: filter on status Draft in modulebuilder +FIX: holiday card: hooks uninitialized +FIX: Invoice - Missing button to reopen an abandoned situation invoice +FIX: Link of download main doc on vat list +FIX: look and field v14 +FIX: Missing column Date validation in ledger & subledger +FIX: on admin/pdf.php (with javascript enabled) if you set some boolean confs then click on "save", all boolean values are reset +FIX: on supplier order, JOIN with product fourn price table must be done with fk_soc too to avoid display several times a same line (because of same supplier product ref) +FIX: postgresql filter select search extrafield +FIX: shipping validation workflow: 'ORDER_NEW' trigger called from wrong object +FIX: show info of company into user dropdown +FIX: totalDayAll hours in tasks +FIX: update product lot +FIX: using Tulip, deposit mask was not saved +FIX: #yogosha6907 + ***** ChangeLog for 14.0.0 compared to 13.0.0 ***** From 9b5a6f4298f8ffe89527d68f1274ba6a2b461d86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Aug 2021 02:48:45 +0200 Subject: [PATCH 31/40] Fix signature file must be zip if possible --- build/generate_filelist_xml.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index f5d9f64e518..e5f83e42cfc 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -48,17 +48,16 @@ $includecustom=0; $includeconstants=array(); if (empty($argv[1])) { - print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n"; + print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value] [buildzip=1]\n"; print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n"; exit -1; } -parse_str($argv[1]); $i=0; while ($i < $argc) { if (! empty($argv[$i])) { - parse_str($argv[$i]); + parse_str($argv[$i]); // set all params $release, $includecustom, $includeconstant, $buildzip ... } if (preg_match('/includeconstant=/', $argv[$i])) { $tmp=explode(':', $includeconstant, 3); // $includeconstant has been set with previous parse_str() @@ -237,6 +236,11 @@ fputs($fp, ''."\n"); fputs($fp, ''."\n"); fclose($fp); -print "File ".$outputfile." generated\n"; +if (empty($buildzip)) { + print "File ".$outputfile." generated\n"; +} else { + dol_compress_file($outputfile, $outputfile.'.zip'); + print "File ".$outputfile.".zip generated\n"; +} exit(0); From 6d4aa1ad08e848a67f317d3d3b059716fc91d627 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Aug 2021 02:51:24 +0200 Subject: [PATCH 32/40] Fix deletion of old signature file --- build/generate_filelist_xml.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index e5f83e42cfc..dd9fe83a4b3 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -124,8 +124,8 @@ print "\n"; //$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml'; $outputdir=dirname(dirname(__FILE__)).'/htdocs/install'; -print 'Delete current files '.$outputdir.'/filelist*.xml'."\n"; -dol_delete_file($outputdir.'/filelist*.xml', 0, 1, 1); +print 'Delete current files '.$outputdir.'/filelist*.xml*'."\n"; +dol_delete_file($outputdir.'/filelist*.xml*', 0, 1, 1); $checksumconcat=array(); From 8f1b4df5f4fd1b482dccbf8d94528d38c352f51b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Aug 2021 02:54:58 +0200 Subject: [PATCH 33/40] Fix deletion of old file --- build/generate_filelist_xml.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index dd9fe83a4b3..8e7ef3ef46c 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -239,8 +239,11 @@ fclose($fp); if (empty($buildzip)) { print "File ".$outputfile." generated\n"; } else { - dol_compress_file($outputfile, $outputfile.'.zip'); - print "File ".$outputfile.".zip generated\n"; + $result = dol_compress_file($outputfile, $outputfile.'.zip'); + if ($result > 0) { + dol_delete_file($outputfile); + print "File ".$outputfile.".zip generated\n"; + } } exit(0); From 4a4018df02164e425cbb9596b2dad86097f7d61a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Aug 2021 04:02:36 +0200 Subject: [PATCH 34/40] Test --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 186b20a051d..6b651234788 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,4 +2,4 @@ open_collective: dolibarr custom: https://wiki.dolibarr.org/index.php/Subscribe -# github: [eldy] \ No newline at end of file +github: [eldy] \ No newline at end of file From 0d4badb50bad734729709c5741c1d7517d6c1491 Mon Sep 17 00:00:00 2001 From: Klaas Oldenburger Date: Thu, 19 Aug 2021 08:26:37 +0200 Subject: [PATCH 35/40] Update main.lang Change date format to Dutch standards --- htdocs/langs/nl_NL/main.lang | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/langs/nl_NL/main.lang b/htdocs/langs/nl_NL/main.lang index 9c0fcdfa791..de6a6af689c 100644 --- a/htdocs/langs/nl_NL/main.lang +++ b/htdocs/langs/nl_NL/main.lang @@ -8,21 +8,21 @@ FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=, SeparatorThousand=Space -FormatDateShort=%m/%d/%Y -FormatDateShortInput=%m/%d/%Y -FormatDateShortJava=MM/dd/yyyy -FormatDateShortJavaInput=MM/dd/yyyy -FormatDateShortJQuery=mm/dd/yy -FormatDateShortJQueryInput=mm/dd/yy +FormatDateShort=%d-%m-%Y +FormatDateShortInput=%d-%m-%Y +FormatDateShortJava=dd-MM-yyyy +FormatDateShortJavaInput=dd-MM-yyyy +FormatDateShortJQuery=dd-mm-yy +FormatDateShortJQueryInput=dd-mm-yy FormatHourShortJQuery=HH:MI FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M -FormatDateTextShort=%b %d, %Y -FormatDateText=%B %d, %Y -FormatDateHourShort=%m/%d/%Y %I:%M %p -FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p -FormatDateHourTextShort=%b %d, %Y, %I:%M %p -FormatDateHourText=%B %d, %Y, %I:%M %p +FormatDateTextShort=%d %b, %Y +FormatDateText=%d %B, %Y +FormatDateHourShort=%d-%m-%Y %I:%M %p +FormatDateHourSecShort=%d-%m-%Y %I:%M:%S %p +FormatDateHourTextShort=%d %m, %Y, %I:%M %p +FormatDateHourText=%d %B, %Y, %I:%M %p DatabaseConnection=Databaseverbinding NoTemplateDefined=Geen sjabloon beschikbaar voor dit e-mailtype AvailableVariables=Beschikbare substitutievariabelen From 223637317b429685f7ffef8ac0620c9c2b7e4816 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 19 Aug 2021 09:51:09 +0200 Subject: [PATCH 36/40] fix: missing tocken CRCSF --- htdocs/product/traduction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 0cae81e36c7..2bd92f40e78 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -231,9 +231,9 @@ $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $obj if (empty($reshook)) { if ($action == '') { if ($user->rights->produit->creer || $user->rights->service->creer) { - print '' . $langs->trans("Add") . ''; + print '' . $langs->trans("Add") . ''; if ($cnt_trans > 0) { - print '' . $langs->trans("Update") . ''; + print '' . $langs->trans("Update") . ''; } } } From 476dfc289e30ed738a9c6021bdd9b1497b88b741 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Thu, 19 Aug 2021 18:16:47 +0800 Subject: [PATCH 37/40] Update index.php --- htdocs/comm/action/index.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2610f8a51c8..4100cd6dd22 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -59,6 +59,8 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { $filtert = $user->id; } +$newparam = ''; + $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -527,13 +529,9 @@ $viewmode .= ''; // To add a space before t $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { $tmpforcreatebutton = dol_getdate(dol_now(), true); - - if (isset($newparam)) { - $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; - } else { - $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'; $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 : ''))); From 172b6724375421cee9bdaa8a36fe6953cd51dcae Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 19 Aug 2021 10:19:25 +0000 Subject: [PATCH 38/40] Fixing style errors. --- htdocs/comm/action/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 4100cd6dd22..8c514c0989b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -529,9 +529,9 @@ $viewmode .= ''; // To add a space before t $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { $tmpforcreatebutton = dol_getdate(dol_now(), true); - + $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; - + //$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 : ''))); From e1dc5b51882d76bcdab7b1b5989eb9f44d181c4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Aug 2021 16:12:13 +0200 Subject: [PATCH 39/40] css --- htdocs/projet/tasks/time.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 0daf5439dc0..48ee75df62e 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1221,7 +1221,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { print ''; + print ''; $durationtouse = ($_POST['timespent_duration'] ? $_POST['timespent_duration'] : ''); if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin')) { $durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60); @@ -1488,7 +1488,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { // Time spent if (!empty($arrayfields['t.task_duration']['checked'])) { - print ''; + print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { print ''; print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e384007262f..58e19d36a22 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1382,6 +1382,7 @@ table[summary="list_of_modules"] .fa-cog { .width400 { width: 400px; } .width500 { width: 500px; } .maxwidth25 { max-width: 25px; } +.maxwidth40 { max-width: 40px; } .maxwidth50 { max-width: 50px; } .maxwidth75 { max-width: 75px; } .maxwidthdate { max-width: 80px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index dfa8b00f9eb..ef7e69c0538 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1427,6 +1427,7 @@ table[summary="list_of_modules"] .fa-cog { .width400 { width: 400px; } .width500 { width: 500px; } .maxwidth25 { max-width: 25px; } +.maxwidth40 { max-width: 40px; } .maxwidth50 { max-width: 50px; } .maxwidth75 { max-width: 75px; } .maxwidth100 { max-width: 100px; } From 10ddd621ca3e99b817e525f3c14fde2139399cf2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Aug 2021 12:38:44 +0200 Subject: [PATCH 40/40] Fix escape error message --- htdocs/core/lib/security2.lib.php | 2 +- htdocs/core/login/functions_dolibarr.php | 8 ++++---- htdocs/core/login/functions_empty.php | 2 +- htdocs/core/login/functions_http.php | 4 ++-- htdocs/core/login/functions_ldap.php | 12 ++++++------ htdocs/core/login/functions_openid.php | 14 +++++++------- htdocs/core/tpl/login.tpl.php | 2 +- htdocs/main.inc.php | 8 ++++---- htdocs/user/passwordforgotten.php | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 4408e2ccd52..e015313ad15 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -111,7 +111,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Load translation files required by the page $langs->loadLangs(array('other', 'main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorFailedToLoadLoginFileForMode", $mode); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode); } } } diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index 1b01a3eb782..6daea1f2c68 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -76,13 +76,13 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes if ($obj->datestartvalidity && $db->jdate($obj->datestartvalidity) > $now) { // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorLoginDateValidity"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); return '--bad-login-validity--'; } if ($obj->dateendvalidity && $db->jdate($obj->dateendvalidity) < dol_get_first_hour($now)) { // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorLoginDateValidity"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); return '--bad-login-validity--'; } @@ -129,7 +129,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorBadLoginPassword"); } // We must check entity @@ -153,7 +153,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorBadLoginPassword"); } } else { dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO db error for '".$usertotest."' error=".$db->lasterror(), LOG_ERR); diff --git a/htdocs/core/login/functions_empty.php b/htdocs/core/login/functions_empty.php index c23f401f8f3..66688ee52ec 100644 --- a/htdocs/core/login/functions_empty.php +++ b/htdocs/core/login/functions_empty.php @@ -38,7 +38,7 @@ function check_user_password_empty($usertotest, $passwordtotest, $entitytotest) dol_syslog("functions_empty::check_user_password_empty usertotest=".$usertotest); $login = ''; - $_SESSION["dol_loginmesg"] = $langs->trans("FailedToLogin"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("FailedToLogin"); return $login; } diff --git a/htdocs/core/login/functions_http.php b/htdocs/core/login/functions_http.php index 92b5af438d8..a23047c8f1c 100644 --- a/htdocs/core/login/functions_http.php +++ b/htdocs/core/login/functions_http.php @@ -50,13 +50,13 @@ function check_user_password_http($usertotest, $passwordtotest, $entitytotest) if ($tmpuser->datestartvalidity && $db->jdate($tmpuser->datestartvalidity) >= $now) { // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorLoginDateValidity"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); return '--bad-login-validity--'; } if ($tmpuser->dateendvalidity && $db->jdate($tmpuser->dateendvalidity) <= dol_get_first_hour($now)) { // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorLoginDateValidity"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); return '--bad-login-validity--'; } } diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 0f3927709eb..6b11474995b 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -59,7 +59,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) // Load translation files required by the page $langs->loadLangs(array('main', 'other')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->trans("TryAnotherConnectionMode"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->transnoentitiesnoconv("TryAnotherConnectionMode"); return; } @@ -123,7 +123,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) $ldap->close(); sleep(1); $langs->load('ldap'); - $_SESSION["dol_loginmesg"] = $langs->trans("YouMustChangePassNextLogon", $usertotest, $ldap->domainFQDN); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("YouMustChangePassNextLogon", $usertotest, $ldap->domainFQDN); return ''; } } else { @@ -169,14 +169,14 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) $ldap->close(); // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorLoginDateValidity"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); return '--bad-login-validity--'; } if ($tmpuser->dateendvalidity && $db->jdate($tmpuser->dateendvalidity) <= dol_get_first_hour($now)) { $ldap->close(); // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorLoginDateValidity"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); return '--bad-login-validity--'; } @@ -247,7 +247,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) // Load translation files required by the page $langs->loadLangs(array('main', 'other')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorBadLoginPassword"); } } else { /* Login failed. Return false, together with the error code and text from @@ -268,7 +268,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) // Load translation files required by the page $langs->loadLangs(array('main', 'other', 'errors')); - $_SESSION["dol_loginmesg"] = ($ldap->error ? $ldap->error : $langs->trans("ErrorBadLoginPassword")); + $_SESSION["dol_loginmesg"] = ($ldap->error ? $ldap->error : $langs->transnoentitiesnoconv("ErrorBadLoginPassword")); } $ldap->close(); diff --git a/htdocs/core/login/functions_openid.php b/htdocs/core/login/functions_openid.php index 3f77eca1326..0591a1baddf 100644 --- a/htdocs/core/login/functions_openid.php +++ b/htdocs/core/login/functions_openid.php @@ -45,11 +45,11 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) // Get identity from user and redirect browser to OpenID Server if (GETPOSTISSET('username')) { $openid = new SimpleOpenID(); - $openid->SetIdentity($_POST['username']); + $openid->SetIdentity(GETPOST('username')); $protocol = ($conf->file->main_force_https ? 'https://' : 'http://'); $openid->SetTrustRoot($protocol.$_SERVER["HTTP_HOST"]); $openid->SetRequiredFields(array('email', 'fullname')); - $_SESSION['dol_entity'] = $_POST["entity"]; + $_SESSION['dol_entity'] = GETPOST("entity", 'int'); //$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone')); if ($openid->sendDiscoveryRequestToGetXRDS()) { $openid->SetApprovedURL($protocol.$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script @@ -62,15 +62,15 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) } elseif ($_GET['openid_mode'] == 'id_res') { // Perform HTTP Request to OpenID server to validate key $openid = new SimpleOpenID(); - $openid->SetIdentity($_GET['openid_identity']); + $openid->SetIdentity(GETPOST('openid_identity')); $openid_validation_result = $openid->ValidateWithServer(); if ($openid_validation_result === true) { // OK HERE KEY IS VALID $sql = "SELECT login, entity, datestartvalidity, dateendvalidity"; $sql .= " FROM ".MAIN_DB_PREFIX."user"; - $sql .= " WHERE openid = '".$db->escape($_GET['openid_identity'])."'"; - $sql .= " AND entity IN (0,".($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1).")"; + $sql .= " WHERE openid = '".$db->escape(GETPOST('openid_identity'))."'"; + $sql .= " AND entity IN (0,".($_SESSION["dol_entity"] ? ((int) $_SESSION["dol_entity"]) : 1).")"; dol_syslog("functions_openid::check_user_password_openid", LOG_DEBUG); $resql = $db->query($sql); @@ -81,13 +81,13 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) if ($obj->datestartvalidity && $db->jdate($obj->datestartvalidity) > $now) { // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorLoginDateValidity"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); return '--bad-login-validity--'; } if ($obj->dateendvalidity && $db->jdate($obj->dateendvalidity) < dol_get_first_hour($now)) { // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorLoginDateValidity"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); return '--bad-login-validity--'; } diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index e668d1e6d58..1fd3e062515 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -332,7 +332,7 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->fil if (!empty($_SESSION['dol_loginmesg'])) { ?> loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadValueForCode"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorBadValueForCode"); $test = false; // Call trigger for the "security events" log @@ -745,7 +745,7 @@ if (!defined('NOLOGIN')) { // Bad password. No authmode has found a good password. // We set a generic message if not defined inside function checkLoginPassEntity or subfunctions if (empty($_SESSION["dol_loginmesg"])) { - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword"); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorBadLoginPassword"); } // Call trigger for the "security events" log @@ -798,7 +798,7 @@ if (!defined('NOLOGIN')) { // Load translation files required by page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorCantLoadUserFromDolibarrDatabase", $login); $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; } @@ -862,7 +862,7 @@ if (!defined('NOLOGIN')) { // Load translation files required by page $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorCantLoadUserFromDolibarrDatabase", $login); $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; } diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 32fa93cb8a6..5da92482785 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -97,7 +97,7 @@ if (empty($reshook)) { if ($edituser->pass_temp && dol_verifyHash($edituser->pass_temp.'-'.$edituser->id.'-'.$dolibarr_main_instance_unique_id, $passworduidhash)) { // Clear session unset($_SESSION['dol_login']); - $_SESSION['dol_loginmesg'] = $langs->trans('NewPasswordValidated'); // Save message for the session page + $_SESSION['dol_loginmesg'] = $langs->transnoentitiesnoconv('NewPasswordValidated'); // Save message for the session page $newpassword = $edituser->setPassword($user, $edituser->pass_temp, 0); dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");