From b2252106c3c31c3a2c3983d2b7b0a0c1a648885d Mon Sep 17 00:00:00 2001 From: henrynopo Date: Fri, 20 Aug 2021 10:43:34 +0800 Subject: [PATCH 001/119] Added function - using list of location_incoterms Added function to call for list of location_incoterms from the existing order records or table of location_incoterms. Accordingly, an dditional ajex file namely "locationincoterms.php" and a database table namely c_location_incoterms are required. --- htdocs/core/class/html.form.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 07abdb4b465..b78dc7d17a2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1055,8 +1055,12 @@ class Form } } $out .= ''; - - $out .= ''; + + if ($conf->use_javascript_ajax && empty($disableautocomplete = 0)) { + $out .= ajax_multiautocompleter('location_incoterms', '', DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; + $moreattrib .= ' autocomplete="off"'; + } + $out .= ''."\n"; if (!empty($page)) { $out .= ''; From 0933b6c39ff8d6baaf39badec5c9d5c0031e80bf Mon Sep 17 00:00:00 2001 From: henrynopo Date: Fri, 20 Aug 2021 20:04:53 +0800 Subject: [PATCH 002/119] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b78dc7d17a2..5d919f160f4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1056,7 +1056,7 @@ class Form } $out .= ''; - if ($conf->use_javascript_ajax && empty($disableautocomplete = 0)) { + if ($conf->use_javascript_ajax && empty($disableautocomplete)) { $out .= ajax_multiautocompleter('location_incoterms', '', DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; $moreattrib .= ' autocomplete="off"'; } From 4efe2a0e09f53d03ee1d7d3899e1430e7134842b Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 24 Aug 2021 08:20:40 +0200 Subject: [PATCH 003/119] FIX invoice fetch not found syslog debug level instead of error --- htdocs/compta/facture/class/facture.class.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ea41bd4842a..1d68747b1a5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1625,10 +1625,10 @@ class Facture extends CommonInvoice } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - if ($this->db->num_rows($result)) { - $obj = $this->db->fetch_object($result); + $resql = $this->db->query($sql); + if ($resql) { + if ($this->db->num_rows($resql)) { + $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; $this->entity = $obj->entity; @@ -1730,14 +1730,17 @@ class Facture extends CommonInvoice $this->error = $this->db->error(); return -3; } + + $this->db->free($resql); + return 1; } else { - $this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; - dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); + dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_DEBUG); return 0; } } else { - $this->error = $this->db->error(); + $this->error = $this->db->lasterror(); + dol_syslog(__METHOD__ . ' Error : ' . $this->error, LOG_ERR); return -1; } } From a4a44faa7ff9bb00d8bafcb6e3d4a2b5cc730565 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 24 Aug 2021 16:21:55 +0200 Subject: [PATCH 004/119] FIX change LOG_DEBUG with LOG_WARNING in syslog and remove sql error in syslog (already done) --- htdocs/compta/facture/class/facture.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1d68747b1a5..4e6e6827231 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1735,12 +1735,11 @@ class Facture extends CommonInvoice return 1; } else { - dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_DEBUG); + dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_WARNING); return 0; } } else { $this->error = $this->db->lasterror(); - dol_syslog(__METHOD__ . ' Error : ' . $this->error, LOG_ERR); return -1; } } From 07dd9d90f55db58b755f2f8789718e2a76db780c Mon Sep 17 00:00:00 2001 From: GurvanKervern Date: Wed, 25 Aug 2021 17:29:29 +0800 Subject: [PATCH 005/119] Fix undef vars To remove PHP8 warnings --- htdocs/blockedlog/admin/blockedlog_list.php | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 385101c7468..2a15aa0965b 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -47,11 +47,17 @@ if ($search_showonlyerrors < 0) { $search_showonlyerrors = 0; } +$search_startyear = GETPOST('search_startyear', 'int'); +$search_startmonth = GETPOST('search_startmonth', 'int'); +$search_startday = GETPOST('search_startday', 'int'); +$search_endyear = GETPOST('search_endyear', 'int'); +$search_endmonth = GETPOST('search_endmonth', 'int'); +$search_endday = GETPOST('search_endday', 'int'); $search_id = GETPOST('search_id', 'alpha'); $search_fk_user = GETPOST('search_fk_user', 'intcomma'); $search_start = -1; -if (GETPOST('search_startyear') != '') { - $search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear')); +if ($search_startyear != '') { + $search_start = dol_mktime(0, 0, 0, $search_startmonth, $search_startday, $search_startyear); } $search_end = -1; if (GETPOST('search_endyear') != '') { @@ -321,22 +327,22 @@ if ($search_fk_user > 0) { $param .= '&search_fk_user='.urlencode($search_fk_user); } if ($search_startyear > 0) { - $param .= '&search_startyear='.urlencode(GETPOST('search_startyear', 'int')); + $param .= '&search_startyear='.urlencode($search_startyear); } if ($search_startmonth > 0) { - $param .= '&search_startmonth='.urlencode(GETPOST('search_startmonth', 'int')); + $param .= '&search_startmonth='.urlencode($search_startmonth); } if ($search_startday > 0) { - $param .= '&search_startday='.urlencode(GETPOST('search_startday', 'int')); + $param .= '&search_startday='.urlencode($search_startday); } if ($search_endyear > 0) { - $param .= '&search_endyear='.urlencode(GETPOST('search_endyear', 'int')); + $param .= '&search_endyear='.urlencode($search_endyear); } if ($search_endmonth > 0) { - $param .= '&search_endmonth='.urlencode(GETPOST('search_endmonth', 'int')); + $param .= '&search_endmonth='.urlencode($search_endmonth); } if ($search_endday > 0) { - $param .= '&search_endday='.urlencode(GETPOST('search_endday', 'int')); + $param .= '&search_endday='.urlencode($search_endday); } if ($search_showonlyerrors > 0) { $param .= '&search_showonlyerrors='.urlencode($search_showonlyerrors); From d34e44e55c67ea6f44e22c0cd4e595d7c5fb0902 Mon Sep 17 00:00:00 2001 From: GurvanKervern Date: Wed, 25 Aug 2021 18:02:57 +0800 Subject: [PATCH 006/119] Fix undef vars 3 To remove PHP8 warnings --- htdocs/comm/action/peruser.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 413de33db1f..38a316f4357 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -470,6 +470,9 @@ $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { $tmpforcreatebutton = dol_getdate(dol_now(), true); + if(empty($newparam)) { + $newparam = ''; + } $newparam .= '&month='.urlencode(str_pad($month, 2, "0", STR_PAD_LEFT)).'&year='.urlencode($tmpforcreatebutton['year']); if ($begin_h !== '') { $newparam .= '&begin_h='.urlencode($begin_h); @@ -489,6 +492,9 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction $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 : ''))); } +if(empty($num)) { + $num = ''; +} print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.''.$newcardbutton, '', $limit, 1, 0, 1, $viewmode); $link = ''; @@ -505,6 +511,9 @@ $s = $newtitle; print $s; print '
'; +if(empty($search_status)) { + $search_status = ''; +} print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); print '
'; @@ -1378,10 +1387,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $ids1 = ''; $ids2 = ''; - if (is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) { + if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) { $ids1 = join(',', array_keys($cases1[$h])); } - if (is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) { + if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) { $ids2 = join(',', array_keys($cases2[$h])); } @@ -1390,7 +1399,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } else { echo ''; } - if (is_array($cases1[$h]) && count($cases1[$h]) == 1) { // only 1 event + if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) == 1) { // only 1 event $output = array_slice($cases1[$h], 0, 1); $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); if ($output[0]['string']) { @@ -1399,12 +1408,12 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($output[0]['color']) { $color1 = $output[0]['color']; } - } elseif (is_array($cases1[$h]) && count($cases1[$h]) > 1) { + } elseif (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) > 1) { $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); $color1 = '222222'; } - if (is_array($cases2[$h]) && count($cases2[$h]) == 1) { // only 1 event + if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) == 1) { // only 1 event $output = array_slice($cases2[$h], 0, 1); $title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : ''); if ($output[0]['string']) { @@ -1413,7 +1422,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($output[0]['color']) { $color2 = $output[0]['color']; } - } elseif (is_array($cases2[$h]) && count($cases2[$h]) > 1) { + } elseif (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) > 1) { $title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : ''); $color2 = '222222'; } From 628bfc9963aa65c1447967e67949f21388ad569c Mon Sep 17 00:00:00 2001 From: GurvanKervern Date: Wed, 25 Aug 2021 18:15:32 +0800 Subject: [PATCH 007/119] Fix undef vars 4 To remove PHP8 warnings --- htdocs/ticket/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index c79a75e851c..b1922cf4aac 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -390,7 +390,7 @@ foreach ($search as $key => $val) { } continue; } - $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + $mode_search = ((!empty($object->fields[$key]) && $object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ($search[$key] != '') { $sql .= natural_search($key, $search[$key], $mode_search); } @@ -897,7 +897,7 @@ print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine = 0; -if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { +if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { if (preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object From 8c992916382d1db535697f838400f4d784a0fc33 Mon Sep 17 00:00:00 2001 From: GurvanKervern Date: Wed, 25 Aug 2021 18:28:32 +0800 Subject: [PATCH 008/119] Fix undef vars 5 To remove PHP8 warnings --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e1d3c5b14f6..78b78185ca0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1397,7 +1397,7 @@ class Form if ($resql) { if (!$forcecombo) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); + $out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT")); } // Construct $out and $outarray @@ -1678,7 +1678,7 @@ class Form if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); + $out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT")); } if ($htmlname != 'none' && !$options_only) { From 7161b1ba59b235d1a6bfc30a72b9611dc8d5811e Mon Sep 17 00:00:00 2001 From: GurvanKervern Date: Wed, 25 Aug 2021 18:45:40 +0800 Subject: [PATCH 009/119] Fix undef vars 6 To remove PHP8 warnings --- htdocs/core/menus/standard/eldy.lib.php | 54 ++++++++++++------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 26aa5df16ad..7f8c2ba7072 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -85,9 +85,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 10, 'id' => $id, 'idsel' => 'home', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => '', - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 0 : 1), 'loadLangs' => array(), 'submenus' => array(), ); @@ -110,9 +110,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 18, 'id' => $id, 'idsel' => 'members', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'member', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 0 : 1), 'loadLangs' => array(), 'submenus' => array(), ); @@ -139,9 +139,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 20, 'id' => $id, 'idsel' => 'companies', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'company', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 0 : 1), 'loadLangs' => array("companies", "suppliers"), 'submenus' => array(), ); @@ -166,9 +166,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 30, 'id' => $id, 'idsel' => 'products', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'product', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 0 : 1), 'loadLangs' => array("products"), 'submenus' => array(), ); @@ -191,9 +191,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 31, 'id' => $id, 'idsel' => 'mrp', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mrp") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'mrp', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mrp") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 0 : 1), 'loadLangs' => array("mrp"), 'submenus' => array(), ); @@ -216,9 +216,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 35, 'id' => $id, 'idsel' => 'project', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'project', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 0 : 1), 'loadLangs' => array("projects"), 'submenus' => array(), ); @@ -265,9 +265,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 40, 'id' => $id, 'idsel' => 'commercial', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'contract', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 0 : 1), 'loadLangs' => array("commercial"), 'submenus' => array(), ); @@ -299,9 +299,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 50, 'id' => $id, 'idsel' => 'billing', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'bill', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 0 : 1), 'loadLangs' => array("compta"), 'submenus' => array(), ); @@ -324,9 +324,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 52, 'id' => $id, 'idsel' => 'bank', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'bank_account', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 0 : 1), 'loadLangs' => array("compta", "banks"), 'submenus' => array(), ); @@ -349,9 +349,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 54, 'id' => $id, 'idsel' => 'accountancy', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'accountancy', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 0 : 1), 'loadLangs' => array("compta", "accountancy", "assets", "intracommreport"), 'submenus' => array(), ); @@ -375,9 +375,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 80, 'id' => $id, 'idsel' => 'hrm', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'hrm', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 0 : 1), 'loadLangs' => array("holiday"), 'submenus' => array(), ); @@ -400,9 +400,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 88, 'id' => $id, 'idsel' => 'ticket', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "ticket") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'ticket', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "ticket") ? 0 : 1), + 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 0 : 1), 'loadLangs' => array("other"), 'submenus' => array(), ); @@ -425,9 +425,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 90, 'id' => $id, 'idsel' => 'tools', - 'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'tools', 'class="fa-fw paddingright"'), - 'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools") ? 0 : 1), 'loadLangs' => array("other"), 'submenus' => array(), ); @@ -1567,7 +1567,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Cash Control if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled)) { - $permtomakecashfence = ($user->rights->cashdesk->run || $user->rights->takepos->run); + $permtomakecashfence = ($user->hasRight('cashdesk', 'run')|| $user->hasRight('takepos', 'run')); $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="pictofixedwidth"')); $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence); $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence); From 03b04bea089d3f1460ca4d0fb3bab6937f93df83 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 25 Aug 2021 12:46:56 +0200 Subject: [PATCH 010/119] NEW: date filter on project list and task list From->To --- htdocs/projet/list.php | 120 +++++++++++++++++++++++++++++++++-- htdocs/projet/tasks.php | 116 +++++++++++++++++++++++++++++++-- htdocs/projet/tasks/list.php | 70 ++++++++++++++++++-- 3 files changed, 294 insertions(+), 12 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 43f5bd6ff2f..0df6c88a5a6 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -120,6 +120,26 @@ $search_eday = GETPOST('search_eday', 'int'); $search_emonth = GETPOST('search_emonth', 'int'); $search_eyear = GETPOST('search_eyear', 'int'); + +$search_date_start_startmonth = GETPOST('search_date_start_startmonth', 'int'); +$search_date_start_startyear = GETPOST('search_date_start_startyear', 'int'); +$search_date_start_startday = GETPOST('search_date_start_startday', 'int'); +$search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear); // Use tzserver +$search_date_start_endmonth = GETPOST('search_date_start_endmonth', 'int'); +$search_date_start_endyear = GETPOST('search_date_start_endyear', 'int'); +$search_date_start_endday = GETPOST('search_date_start_endday', 'int'); +$search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear); // Use tzserver + +$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int'); +$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int'); +$search_date_end_startday = GETPOST('search_date_end_startday', 'int'); +$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver +$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int'); +$search_date_end_endyear = GETPOST('search_date_end_endyear', 'int'); +$search_date_end_endday = GETPOST('search_date_end_endday', 'int'); +$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver + + if ($search_status == '') { $search_status = -1; // -1 or 1 } @@ -237,6 +257,22 @@ if (empty($reshook)) { $search_eday = ""; $search_emonth = ""; $search_eyear = ""; + $search_date_start_startmonth = ""; + $search_date_start_startyear = ""; + $search_date_start_startday = ""; + $search_date_start_start = ""; + $search_date_start_endmonth = ""; + $search_date_start_endyear = ""; + $search_date_start_endday = ""; + $search_date_start_end = ""; + $search_date_end_startmonth = ""; + $search_date_end_startyear = ""; + $search_date_end_startday = ""; + $search_date_end_start = ""; + $search_date_end_endmonth = ""; + $search_date_end_endyear = ""; + $search_date_end_endday = ""; + $search_date_end_end = ""; $search_usage_opportunity = ''; $search_usage_task = ''; $search_usage_bill_time = ''; @@ -408,6 +444,22 @@ if ($search_opp_percent) { } $sql .= dolSqlDateFilter('p.dateo', $search_sday, $search_smonth, $search_syear); $sql .= dolSqlDateFilter('p.datee', $search_eday, $search_emonth, $search_eyear); + + +if ($search_date_start_start) { + $sql .= " AND p.dateo >= '".$db->idate($search_date_start_start)."'"; +} +if ($search_date_start_end) { + $sql .= " AND p.dateo <= '".$db->idate($search_date_start_end)."'"; +} + +if ($search_date_end_start) { + $sql .= " AND p.datee >= '".$db->idate($search_date_end_start)."'"; +} +if ($search_date_end_end) { + $sql .= " AND p.datee <= '".$db->idate($search_date_end_end)."'"; +} + if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } @@ -558,6 +610,54 @@ if ($search_emonth) { if ($search_eyear) { $param .= '&search_eyear='.urlencode($search_eyear); } +if ($search_date_start_startmonth) { + $param .= '&search_date_start_startmonth='.urlencode($search_date_start_startmonth); +} +if ($search_date_start_startyear) { + $param .= '&search_date_start_startyear='.urlencode($search_date_start_startyear); +} +if ($search_date_start_startday) { + $param .= '&search_date_start_startday='.urlencode($search_date_start_startday); +} +if ($search_date_start_start) { + $param .= '&search_date_start_start='.urlencode($search_date_start_start); +} +if ($search_date_start_endmonth) { + $param .= '&search_date_start_endmonth='.urlencode($search_date_start_endmonth); +} +if ($search_date_start_endyear) { + $param .= '&search_date_start_endyear='.urlencode($search_date_start_endyear); +} +if ($search_date_start_endday) { + $param .= '&search_date_start_endday='.urlencode($search_date_start_endday); +} +if ($search_date_start_end) { + $param .= '&search_date_start_end='.urlencode($search_date_start_end); +} +if ($search_date_end_startmonth) { + $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); +} +if ($search_date_end_startyear) { + $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); +} +if ($search_date_end_startday) { + $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); +} +if ($search_date_end_start) { + $param .= '&search_date_end_start='.urlencode($search_date_end_start); +} +if ($search_date_end_endmonth) { + $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); +} +if ($search_date_end_endyear) { + $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); +} +if ($search_date_end_endday) { + $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); +} +if ($search_date_end_end) { + $param .= '&search_date_end_end=' . urlencode($search_date_end_end); +} if ($socid) { $param .= '&socid='.urlencode($socid); } @@ -769,21 +869,33 @@ if (!empty($arrayfields['commercial']['checked'])) { // Start date if (!empty($arrayfields['p.dateo']['checked'])) { print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { + /*if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print ''; } print ''; - $formother->select_year($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + $formother->select_year($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ + print '
'; + print $form->selectDate($search_date_start_start ? $search_date_start_start : -1, 'search_date_start_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_start_end ? $search_date_start_end : -1, 'search_date_start_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } // End date if (!empty($arrayfields['p.datee']['checked'])) { print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { + /*if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print ''; } print ''; - $formother->select_year($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + $formother->select_year($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ + print '
'; + print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } if (!empty($arrayfields['p.public']['checked'])) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 367f7a27681..aec790b9240 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -83,6 +83,24 @@ $search_timespend = GETPOST('search_timespend'); $search_progresscalc = GETPOST('search_progresscalc'); $search_progressdeclare = GETPOST('search_progressdeclare'); +$search_date_start_startmonth = GETPOST('search_date_start_startmonth', 'int'); +$search_date_start_startyear = GETPOST('search_date_start_startyear', 'int'); +$search_date_start_startday = GETPOST('search_date_start_startday', 'int'); +$search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear); // Use tzserver +$search_date_start_endmonth = GETPOST('search_date_start_endmonth', 'int'); +$search_date_start_endyear = GETPOST('search_date_start_endyear', 'int'); +$search_date_start_endday = GETPOST('search_date_start_endday', 'int'); +$search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear); // Use tzserver + +$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int'); +$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int'); +$search_date_end_startday = GETPOST('search_date_end_startday', 'int'); +$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver +$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int'); +$search_date_end_endyear = GETPOST('search_date_end_endyear', 'int'); +$search_date_end_endday = GETPOST('search_date_end_endday', 'int'); +$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver + $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'projecttasklist'; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects @@ -188,6 +206,22 @@ if (empty($reshook)) { $search_progressdeclare = ''; $toselect = ''; $search_array_options = array(); + $search_date_start_startmonth = ""; + $search_date_start_startyear = ""; + $search_date_start_startday = ""; + $search_date_start_start = ""; + $search_date_start_endmonth = ""; + $search_date_start_endyear = ""; + $search_date_start_endday = ""; + $search_date_start_end = ""; + $search_date_end_startmonth = ""; + $search_date_end_startyear = ""; + $search_date_end_startday = ""; + $search_date_end_start = ""; + $search_date_end_endmonth = ""; + $search_date_end_endyear = ""; + $search_date_end_endday = ""; + $search_date_end_end = ""; } // Mass actions @@ -219,6 +253,20 @@ if ($moresql) { $morewherefilterarray[] = $moresql; } +if ($search_date_start_start) { + $morewherefilterarray[] = " t.dateo >= '".$db->idate($search_date_start_start)."'"; +} +if ($search_date_start_end) { + $morewherefilterarray[] = " t.dateo <= '".$db->idate($search_date_start_end)."'"; +} + +if ($search_date_end_start) { + $morewherefilterarray[] = " t.datee >= '".$db->idate($search_date_end_start)."'"; +} +if ($search_date_end_end) { + $morewherefilterarray[] = " t.datee <= '".$db->idate($search_date_end_end)."'"; +} + if (!empty($search_planedworkload)) { $morewherefilterarray[] = natural_search('t.planned_workload', $search_planedworkload, 1, 1); } @@ -416,6 +464,54 @@ if ($id > 0 || !empty($ref)) { if ($search_dtendyear) { $param .= '&search_dtendyear='.urlencode($search_dtendyear); } + if ($search_date_start_startmonth) { + $param .= '&search_date_start_startmonth='.urlencode($search_date_start_startmonth); + } + if ($search_date_start_startyear) { + $param .= '&search_date_start_startyear='.urlencode($search_date_start_startyear); + } + if ($search_date_start_startday) { + $param .= '&search_date_start_startday='.urlencode($search_date_start_startday); + } + if ($search_date_start_start) { + $param .= '&search_date_start_start='.urlencode($search_date_start_start); + } + if ($search_date_start_endmonth) { + $param .= '&search_date_start_endmonth='.urlencode($search_date_start_endmonth); + } + if ($search_date_start_endyear) { + $param .= '&search_date_start_endyear='.urlencode($search_date_start_endyear); + } + if ($search_date_start_endday) { + $param .= '&search_date_start_endday='.urlencode($search_date_start_endday); + } + if ($search_date_start_end) { + $param .= '&search_date_start_end='.urlencode($search_date_start_end); + } + if ($search_date_end_startmonth) { + $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); + } + if ($search_date_end_startyear) { + $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); + } + if ($search_date_end_startday) { + $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); + } + if ($search_date_end_start) { + $param .= '&search_date_end_start='.urlencode($search_date_end_start); + } + if ($search_date_end_endmonth) { + $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); + } + if ($search_date_end_endyear) { + $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); + } + if ($search_date_end_endday) { + $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); + } + if ($search_date_end_end) { + $param .= '&search_date_end_end=' . urlencode($search_date_end_end); + } if ($search_planedworkload) { $param .= '&search_planedworkload='.urlencode($search_planedworkload); } @@ -777,17 +873,29 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third if (!empty($arrayfields['t.dateo']['checked'])) { print ''; - print ''; + /*print ''; print ''; - $formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5); + $formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5);*/ + print '
'; + print $form->selectDate($search_date_start_start ? $search_date_start_start : -1, 'search_date_start_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_start_end ? $search_date_start_end : -1, 'search_date_start_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } if (!empty($arrayfields['t.datee']['checked'])) { print ''; - print ''; + /*print ''; print ''; - $formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5); + $formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5);*/ + print '
'; + print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 8dc369b6a0a..8ffbcf7d609 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -78,6 +78,24 @@ $search_eday = GETPOST('search_eday', 'int'); $search_emonth = GETPOST('search_emonth', 'int'); $search_eyear = GETPOST('search_eyear', 'int'); +$search_date_start_startmonth = GETPOST('search_date_start_startmonth', 'int'); +$search_date_start_startyear = GETPOST('search_date_start_startyear', 'int'); +$search_date_start_startday = GETPOST('search_date_start_startday', 'int'); +$search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear); // Use tzserver +$search_date_start_endmonth = GETPOST('search_date_start_endmonth', 'int'); +$search_date_start_endyear = GETPOST('search_date_start_endyear', 'int'); +$search_date_start_endday = GETPOST('search_date_start_endday', 'int'); +$search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear); // Use tzserver + +$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int'); +$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int'); +$search_date_end_startday = GETPOST('search_date_end_startday', 'int'); +$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver +$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int'); +$search_date_end_endyear = GETPOST('search_date_end_endyear', 'int'); +$search_date_end_endday = GETPOST('search_date_end_endday', 'int'); +$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver + // Initialize context for list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'tasklist'; @@ -197,6 +215,22 @@ if (empty($reshook)) { $search_eday = ''; $search_emonth = ''; $search_eyear = ''; + $search_date_start_startmonth = ""; + $search_date_start_startyear = ""; + $search_date_start_startday = ""; + $search_date_start_start = ""; + $search_date_start_endmonth = ""; + $search_date_start_endyear = ""; + $search_date_start_endday = ""; + $search_date_start_end = ""; + $search_date_end_startmonth = ""; + $search_date_end_startyear = ""; + $search_date_end_startday = ""; + $search_date_end_start = ""; + $search_date_end_endmonth = ""; + $search_date_end_endyear = ""; + $search_date_end_endday = ""; + $search_date_end_end = ""; $toselect = ''; $search_array_options = array(); } @@ -372,8 +406,24 @@ if ($search_task_progress) { if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } + $sql .= dolSqlDateFilter('t.dateo', $search_sday, $search_smonth, $search_syear); $sql .= dolSqlDateFilter('t.datee', $search_eday, $search_emonth, $search_eyear); + +if ($search_date_start_start) { + $sql .= " AND t.dateo >= '".$db->idate($search_date_start_start)."'"; +} +if ($search_date_start_end) { + $sql .= " AND t.dateo <= '".$db->idate($search_date_start_end)."'"; +} + +if ($search_date_end_start) { + $sql .= " AND t.datee >= '".$db->idate($search_date_end_start)."'"; +} +if ($search_date_end_end) { + $sql .= " AND t.datee <= '".$db->idate($search_date_end_end)."'"; +} + if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } @@ -647,21 +697,33 @@ if (!empty($arrayfields['t.description']['checked'])) { // Start date if (!empty($arrayfields['t.dateo']['checked'])) { print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { + /*if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print ''; } print ''; - print $formother->selectyear($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'valignmiddle width75', 1); + print $formother->selectyear($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'valignmiddle width75', 1);*/ + print '
'; + print $form->selectDate($search_date_start_start ? $search_date_start_start : -1, 'search_date_start_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_start_end ? $search_date_start_end : -1, 'search_date_start_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } // End date if (!empty($arrayfields['t.datee']['checked'])) { print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { + /*if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print ''; } print ''; - print $formother->selectyear($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'valignmiddle width75', 1); + print $formother->selectyear($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'valignmiddle width75', 1);*/ + print '
'; + print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } if (!empty($arrayfields['p.ref']['checked'])) { From 5e795e74d7de87af9b07315e5f202ac24b3c3939 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 25 Aug 2021 12:48:32 +0200 Subject: [PATCH 011/119] NEW: date filter on project list and task list From->To --- htdocs/projet/tasks/list.php | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 8ffbcf7d609..26e6a6f17ac 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -522,6 +522,54 @@ if ($search_emonth) { if ($search_eyear) { $param .= '&search_eyear='.urlencode($search_eyear); } +if ($search_date_start_startmonth) { + $param .= '&search_date_start_startmonth='.urlencode($search_date_start_startmonth); +} +if ($search_date_start_startyear) { + $param .= '&search_date_start_startyear='.urlencode($search_date_start_startyear); +} +if ($search_date_start_startday) { + $param .= '&search_date_start_startday='.urlencode($search_date_start_startday); +} +if ($search_date_start_start) { + $param .= '&search_date_start_start='.urlencode($search_date_start_start); +} +if ($search_date_start_endmonth) { + $param .= '&search_date_start_endmonth='.urlencode($search_date_start_endmonth); +} +if ($search_date_start_endyear) { + $param .= '&search_date_start_endyear='.urlencode($search_date_start_endyear); +} +if ($search_date_start_endday) { + $param .= '&search_date_start_endday='.urlencode($search_date_start_endday); +} +if ($search_date_start_end) { + $param .= '&search_date_start_end='.urlencode($search_date_start_end); +} +if ($search_date_end_startmonth) { + $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); +} +if ($search_date_end_startyear) { + $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); +} +if ($search_date_end_startday) { + $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); +} +if ($search_date_end_start) { + $param .= '&search_date_end_start='.urlencode($search_date_end_start); +} +if ($search_date_end_endmonth) { + $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); +} +if ($search_date_end_endyear) { + $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); +} +if ($search_date_end_endday) { + $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); +} +if ($search_date_end_end) { + $param .= '&search_date_end_end=' . urlencode($search_date_end_end); +} if ($socid) { $param .= '&socid='.urlencode($socid); } From 15445e9bbae5c725d6ff627cd595fcd2d04fa418 Mon Sep 17 00:00:00 2001 From: GurvanKervern Date: Wed, 25 Aug 2021 18:50:05 +0800 Subject: [PATCH 012/119] Fix undef vars 7 To remove PHP8 warnings --- htdocs/projet/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 43f5bd6ff2f..50e4cfc0094 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -42,7 +42,7 @@ if (!empty($conf->categorie->enabled)) { // Load translation files required by the page $langs->loadLangs(array('projects', 'companies', 'commercial')); -if ($conf->eventorganization->enabled) { +if (!empty($conf->eventorganization->enabled) && $conf->eventorganization->enabled) { $langs->loadLangs(array('eventorganization')); } @@ -56,7 +56,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'pro $title = $langs->trans("Projects"); // Security check -$socid = (is_numeric($_GET["socid"]) ? $_GET["socid"] : 0); +$socid = (!empty($_GET["socid"]) && is_numeric($_GET["socid"]) ? $_GET["socid"] : 0); //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if ($socid > 0) { $soc = new Societe($db); @@ -108,7 +108,7 @@ $search_price_registration = GETPOST("search_price_registration", 'alpha'); $search_price_booth = GETPOST("search_price_booth", 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); -$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0; +$mine = (!empty($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0; if ($mine) { $search_project_user = $user->id; $mine = 0; } @@ -365,7 +365,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as p"; if (!empty($conf->categorie->enabled)) { $sql .= Categorie::getFilterJoinQuery(Categorie::TYPE_PROJECT, "p.rowid"); } -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty( $extrafields->attributes[$object->table_element]['label']) &&is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; @@ -561,7 +561,7 @@ if ($search_eyear) { if ($socid) { $param .= '&socid='.urlencode($socid); } -if ($search_categ) { +if (!empty($search_categ)) { $param .= '&search_categ='.urlencode($search_categ); } if ($search_ref != '') { From 601cc865fb47077a5b89bd37092e8bb0dc081a51 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 25 Aug 2021 10:54:09 +0000 Subject: [PATCH 013/119] Fixing style errors. --- htdocs/comm/action/peruser.php | 14 +++++++------- htdocs/projet/list.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 38a316f4357..7370eac03ed 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -470,9 +470,9 @@ $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { $tmpforcreatebutton = dol_getdate(dol_now(), true); - if(empty($newparam)) { - $newparam = ''; - } + if (empty($newparam)) { + $newparam = ''; + } $newparam .= '&month='.urlencode(str_pad($month, 2, "0", STR_PAD_LEFT)).'&year='.urlencode($tmpforcreatebutton['year']); if ($begin_h !== '') { $newparam .= '&begin_h='.urlencode($begin_h); @@ -492,8 +492,8 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction $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 : ''))); } -if(empty($num)) { - $num = ''; +if (empty($num)) { + $num = ''; } print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.''.$newcardbutton, '', $limit, 1, 0, 1, $viewmode); @@ -511,8 +511,8 @@ $s = $newtitle; print $s; print '
'; -if(empty($search_status)) { - $search_status = ''; +if (empty($search_status)) { + $search_status = ''; } print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); print '
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 50e4cfc0094..9440a284a6d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -365,7 +365,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as p"; if (!empty($conf->categorie->enabled)) { $sql .= Categorie::getFilterJoinQuery(Categorie::TYPE_PROJECT, "p.rowid"); } -if (!empty( $extrafields->attributes[$object->table_element]['label']) &&is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) &&is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; From 236554948c018f4af92364fc23be24db2dde79d8 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Wed, 25 Aug 2021 19:40:58 +0800 Subject: [PATCH 014/119] Add files via upload --- htdocs/core/ajax/locationincoterms.php | 110 +++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 htdocs/core/ajax/locationincoterms.php diff --git a/htdocs/core/ajax/locationincoterms.php b/htdocs/core/ajax/locationincoterms.php new file mode 100644 index 00000000000..04e4a27b2a8 --- /dev/null +++ b/htdocs/core/ajax/locationincoterms.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2011-2014 Laurent Destailleur + * Copyright (C) 2021 Henry Guo + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/ajax/locationincoterms.php + * \ingroup core + * \brief File to return Ajax response on location_incoterms request + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', 1); // Disables token renewal +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} +if (!defined('NOREQUIRESOC')) { + define('NOREQUIRESOC', '1'); +} +if (!defined('NOCSRFCHECK')) { + define('NOCSRFCHECK', '1'); +} + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; + + +/* + * View + */ + +// Ajout directives pour resoudre bug IE +//header('Cache-Control: Public, must-revalidate'); +//header('Pragma: public'); + +//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header. +top_httphead(); + +//print ''."\n"; + +dol_syslog('location_incoterms call with MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY='.(empty($conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY) ? '' : $conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY)); +//var_dump($_GET); + +// Generation of list of zip-town +if (GETPOST('location_incoterms')) { + $return_arr = array(); + + // Define filter on text typed + $location_incoterms = GETPOST('location_incoterms'); + + if (!empty($conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY)) { // Use location_incoterms + $sql = "SELECT z.location as location_incoterms, z.label as label"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_location_incoterms as z"; + $sql .= " WHERE z.active = 1 AND UPPER(z.location) LIKE UPPER('%".$db->escape($location_incoterms)."%')"; + $sql .= " ORDER BY z.location"; + $sql .= $db->plimit(100); // Avoid pb with bad criteria + } else // Use table of commande + { + $sql = "SELECT DISTINCT s.location_incoterms FROM ".MAIN_DB_PREFIX.'commande as s'; + $sql .= " WHERE UPPER(s.location_incoterms) LIKE UPPER('%".$db->escape($location_incoterms)."%')"; + + //Todo: merge with data from table of supplier order + /* $sql .=" UNION"; + $sql .= " SELECT DISTINCT p.location_incoterms FROM ".MAIN_DB_PREFIX.'commande_fournisseur as p'; + $sql .= " WHERE UPPER(p.location_incoterms) LIKE UPPER('%".$db->escape($location_incoterms)."%')"; + */ + $sql .= " ORDER BY s.location_incoterms"; + $sql .= $db->plimit(100); // Avoid pb with bad criteria + } + + //print $sql; + $resql = $db->query($sql); + //var_dump($db); + if ($resql) { + while ($row = $db->fetch_array($resql)) { + $row_array['label'] = $row['location_incoterms'].($row['label']?' - '.$row['label'] : ''); + if ($location_incoterms) { + $row_array['value'] = $row['location_incoterms']; + } + // TODO Use a cache here to avoid to make select_state in each pass (this make a SQL and lot of logs) + + array_push($return_arr, $row_array); + } + } + + echo json_encode($return_arr); +} + +$db->close(); From 951286191336aeb131aecdb7721e50461376319f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 25 Aug 2021 11:43:32 +0000 Subject: [PATCH 015/119] Fixing style errors. --- htdocs/core/ajax/locationincoterms.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/ajax/locationincoterms.php b/htdocs/core/ajax/locationincoterms.php index 04e4a27b2a8..3a508a07057 100644 --- a/htdocs/core/ajax/locationincoterms.php +++ b/htdocs/core/ajax/locationincoterms.php @@ -65,7 +65,7 @@ dol_syslog('location_incoterms call with MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY // Generation of list of zip-town if (GETPOST('location_incoterms')) { $return_arr = array(); - + // Define filter on text typed $location_incoterms = GETPOST('location_incoterms'); @@ -79,13 +79,13 @@ if (GETPOST('location_incoterms')) { { $sql = "SELECT DISTINCT s.location_incoterms FROM ".MAIN_DB_PREFIX.'commande as s'; $sql .= " WHERE UPPER(s.location_incoterms) LIKE UPPER('%".$db->escape($location_incoterms)."%')"; - - //Todo: merge with data from table of supplier order - /* $sql .=" UNION"; + + //Todo: merge with data from table of supplier order + /* $sql .=" UNION"; $sql .= " SELECT DISTINCT p.location_incoterms FROM ".MAIN_DB_PREFIX.'commande_fournisseur as p'; $sql .= " WHERE UPPER(p.location_incoterms) LIKE UPPER('%".$db->escape($location_incoterms)."%')"; - */ - $sql .= " ORDER BY s.location_incoterms"; + */ + $sql .= " ORDER BY s.location_incoterms"; $sql .= $db->plimit(100); // Avoid pb with bad criteria } @@ -94,7 +94,7 @@ if (GETPOST('location_incoterms')) { //var_dump($db); if ($resql) { while ($row = $db->fetch_array($resql)) { - $row_array['label'] = $row['location_incoterms'].($row['label']?' - '.$row['label'] : ''); + $row_array['label'] = $row['location_incoterms'].($row['label']?' - '.$row['label'] : ''); if ($location_incoterms) { $row_array['value'] = $row['location_incoterms']; } From a5bb833a0afdcdd423dd6f23cc558789e9c39967 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 17:39:23 +0200 Subject: [PATCH 016/119] Update peruser.php --- htdocs/comm/action/peruser.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 7370eac03ed..57bebf4fc16 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -466,13 +466,11 @@ if (empty($reshook)) { } +$newparam = ''; $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { $tmpforcreatebutton = dol_getdate(dol_now(), true); - if (empty($newparam)) { - $newparam = ''; - } $newparam .= '&month='.urlencode(str_pad($month, 2, "0", STR_PAD_LEFT)).'&year='.urlencode($tmpforcreatebutton['year']); if ($begin_h !== '') { $newparam .= '&begin_h='.urlencode($begin_h); From 5fd0e6ac28407bf7efc49695d4165654022178fb Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Sun, 29 Aug 2021 00:50:00 +0800 Subject: [PATCH 017/119] Update eldy.lib.php --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7f8c2ba7072..f1c66caae42 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -87,7 +87,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'idsel' => 'home', 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => '', - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 0 : 1), 'loadLangs' => array(), 'submenus' => array(), ); From 39fcc53fa746160cef9fca66e793b84152fb81b7 Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Sun, 29 Aug 2021 00:51:01 +0800 Subject: [PATCH 018/119] Update peruser.php --- htdocs/comm/action/peruser.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 57bebf4fc16..dbda8f0ae46 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -490,9 +490,8 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction $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 : ''))); } -if (empty($num)) { - $num = ''; -} +$num = ''; + print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.''.$newcardbutton, '', $limit, 1, 0, 1, $viewmode); $link = ''; From 8ab9c96b7e072b247e80a0c5e4d7a310599fdb33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 18:53:57 +0200 Subject: [PATCH 019/119] Fix 0 insert instead of null --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 69ddecdaebe..494459b66d2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3410,7 +3410,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", pu_ttc = ".price2num($this->pu_ttc); $sql .= ", qty = ".price2num($this->qty); $sql .= ", remise_percent = ".price2num($this->remise_percent); - if ($this->fk_remise_except) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); + if ($this->fk_remise_except > 0) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); else $sql .= ", fk_remise_except=null"; $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; $sql .= ", tva_tx = ".price2num($this->tva_tx); @@ -3423,7 +3423,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", total_localtax1= ".price2num($this->total_localtax1); $sql .= ", total_localtax2= ".price2num($this->total_localtax2); $sql .= ", total_ttc = ".price2num($this->total_ttc); - $sql .= ", fk_product = ".((int) $fk_product); + $sql .= ", fk_product = ".($fk_product > 0 ? (int) $fk_product : 'null'); $sql .= ", product_type = ".((int) $this->product_type); $sql .= ", info_bits = ".((int) $this->info_bits); $sql .= ", fk_unit = ".($fk_unit > 0 ? (int) $fk_unit : 'null'); From feb2e71f0c4cfe94dd5e1ed4e2de5546b3f8836a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 18:59:12 +0200 Subject: [PATCH 020/119] Fix regression --- htdocs/fourn/class/fournisseur.facture.class.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 494459b66d2..fd393445187 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3387,20 +3387,11 @@ class SupplierInvoiceLine extends CommonObjectLine $this->multicurrency_total_ttc = 0; } + $fk_product = (int) $this->fk_product; + $fk_unit = (int) $this->fk_unit; + $this->db->begin(); - if (empty($this->fk_product)) { - $fk_product = "null"; - } else { - $fk_product = (int) $this->fk_product; - } - - if (empty($this->fk_unit)) { - $fk_unit = "null"; - } else { - $fk_unit = (int) $this->fk_unit; - } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; $sql .= " description ='".$this->db->escape($this->description)."'"; $sql .= ", ref ='".$this->db->escape($this->ref_supplier ? $this->ref_supplier : $this->ref)."'"; From 81a8efd856acad862c1689780316a161b2645356 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 20:14:23 +0200 Subject: [PATCH 021/119] Restore error message --- htdocs/compta/facture/class/facture.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index deb57ebbfac..6859a510e93 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1735,7 +1735,9 @@ class Facture extends CommonInvoice return 1; } else { - dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_WARNING); + $this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; + + dol_syslog(__METHOD__ . $this->error, LOG_WARNING); return 0; } } else { From 38a225a03529be64f92c7275115bd8abb2c95bcb Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Sat, 28 Aug 2021 20:28:09 +0200 Subject: [PATCH 022/119] fix product nature on create --- htdocs/product/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 44c7fd9ca51..5107ed14b0a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1268,8 +1268,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { // Nature print ''.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; - $statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1); + print $formproduct->selectProductNature('finished', $object->finished); print ''; } } From 71f6b472e34be43e3e3599013d078b9780ea3cf5 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Sun, 29 Aug 2021 07:51:29 +0800 Subject: [PATCH 023/119] Update stocks.lang --- htdocs/langs/en_US/stocks.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 78b095d9f11..39617f34344 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -12,7 +12,7 @@ AddWarehouse=Create warehouse AddOne=Add one DefaultWarehouse=Default warehouse WarehouseTarget=Target warehouse -ValidateSending=Delete sending +ValidateSending=Confirm sending CancelSending=Cancel sending DeleteSending=Delete sending Stock=Stock From c9db6bfdf64e1a0ed7e4e6acc924b5791a20e388 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Sun, 29 Aug 2021 08:51:02 +0800 Subject: [PATCH 024/119] Update remx.php --- htdocs/comm/remx.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 42a5ee42e16..e9419480ed6 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -709,8 +709,8 @@ if ($socid > 0) { //$sql.= " UNION "; // Discount linked to invoices $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; - $sql2 .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; - $sql2 .= " rc.fk_facture_source,"; + $sql2 .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql2 .= " rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,"; $sql2 .= " u.login, u.rowid as user_id,"; $sql2 .= " f.rowid as invoiceid, f.ref,"; $sql2 .= " fa.ref as invoice_source_ref, fa.type as type"; @@ -850,7 +850,7 @@ if ($socid > 0) { // Discount linked to invoice lines $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; - $sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; + $sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,"; $sql .= " rc.fk_invoice_supplier_source,"; $sql .= " u.login, u.rowid as user_id,"; $sql .= " f.rowid as invoiceid, f.ref as ref,"; @@ -869,7 +869,8 @@ if ($socid > 0) { //$sql.= " UNION "; // Discount linked to invoices $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; - $sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; + $sql2 .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier,"; $sql2 .= " rc.fk_invoice_supplier_source,"; $sql2 .= " u.login, u.rowid as user_id,"; $sql2 .= " f.rowid as invoiceid, f.ref as ref,"; From 66d1e5c74d7c065394d9c911127799f408922bec Mon Sep 17 00:00:00 2001 From: Gurvan Kervern Date: Sun, 29 Aug 2021 18:15:09 +0800 Subject: [PATCH 025/119] Update eldy.lib.php --- htdocs/core/menus/standard/eldy.lib.php | 48 ++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f1c66caae42..ca6a736d755 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -85,7 +85,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 10, 'id' => $id, 'idsel' => 'home', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => '', 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 0 : 1), 'loadLangs' => array(), @@ -110,9 +110,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 18, 'id' => $id, 'idsel' => 'members', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'member', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 0 : 1), 'loadLangs' => array(), 'submenus' => array(), ); @@ -139,9 +139,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 20, 'id' => $id, 'idsel' => 'companies', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'company', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 0 : 1), 'loadLangs' => array("companies", "suppliers"), 'submenus' => array(), ); @@ -166,9 +166,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 30, 'id' => $id, 'idsel' => 'products', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'product', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 0 : 1), 'loadLangs' => array("products"), 'submenus' => array(), ); @@ -191,9 +191,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 31, 'id' => $id, 'idsel' => 'mrp', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'mrp', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 0 : 1), 'loadLangs' => array("mrp"), 'submenus' => array(), ); @@ -216,9 +216,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 35, 'id' => $id, 'idsel' => 'project', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'project', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 0 : 1), 'loadLangs' => array("projects"), 'submenus' => array(), ); @@ -265,9 +265,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 40, 'id' => $id, 'idsel' => 'commercial', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'contract', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 0 : 1), 'loadLangs' => array("commercial"), 'submenus' => array(), ); @@ -299,9 +299,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 50, 'id' => $id, 'idsel' => 'billing', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'bill', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 0 : 1), 'loadLangs' => array("compta"), 'submenus' => array(), ); @@ -324,9 +324,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 52, 'id' => $id, 'idsel' => 'bank', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'bank_account', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 0 : 1), 'loadLangs' => array("compta", "banks"), 'submenus' => array(), ); @@ -349,9 +349,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 54, 'id' => $id, 'idsel' => 'accountancy', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'accountancy', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 0 : 1), 'loadLangs' => array("compta", "accountancy", "assets", "intracommreport"), 'submenus' => array(), ); @@ -375,9 +375,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 80, 'id' => $id, 'idsel' => 'hrm', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'hrm', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 0 : 1), 'loadLangs' => array("holiday"), 'submenus' => array(), ); @@ -400,9 +400,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 88, 'id' => $id, 'idsel' => 'ticket', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'ticket', 'class="fa-fw paddingright"'), - 'session' => ((!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 0 : 1), + 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 0 : 1), 'loadLangs' => array("other"), 'submenus' => array(), ); @@ -425,7 +425,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'position' => 90, 'id' => $id, 'idsel' => 'tools', - 'classname' => $classname = (!isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools") ? 'class="tmenusel"' : 'class="tmenu"', + 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'tools', 'class="fa-fw paddingright"'), 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools") ? 0 : 1), 'loadLangs' => array("other"), From daf32e9f141cbb82117b1435243c8daa55d5e09d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Aug 2021 20:36:08 +0200 Subject: [PATCH 026/119] Fix modules disabled in demo must remains disabled --- htdocs/admin/modules.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 77c070ad573..af7d5397e24 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -588,6 +588,10 @@ if ($mode == 'common' || $mode == 'commonkanban') { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } + if (!empty($_SESSION["disablemodules"])) { + $disabled_modules = explode(',', $_SESSION["disablemodules"]); + } + // Show list of modules $oldfamily = ''; $foundoneexternalmodulewithupdate = 0; @@ -613,6 +617,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { continue; } + $modulenameshort = strtolower(preg_replace('/^mod/i', '', get_class($objMod))); $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); // Check filters @@ -754,6 +759,11 @@ if ($mode == 'common' || $mode == 'commonkanban') { $codeenabledisable = ''; $codetoconfig = ''; + // Force disable of module disabled into session (for demo for example) + if (in_array($modulenameshort, $disabled_modules)) { + $objMod->disabled = true; + } + // Activate/Disable and Setup (2 columns) if (!empty($conf->global->$const_name)) { // If module is already activated // Set $codeenabledisable @@ -761,6 +771,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { if (!empty($arrayofwarnings[$modName])) { $codeenabledisable .= ''."\n"; } + if (!empty($objMod->disabled)) { $codeenabledisable .= $langs->trans("Disabled"); } elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) { From 47b96e07b767205ca39702538d53f7ad673c159d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Aug 2021 20:36:54 +0200 Subject: [PATCH 027/119] Fix init --- htdocs/admin/modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index af7d5397e24..e746faec8a5 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -760,6 +760,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { $codetoconfig = ''; // Force disable of module disabled into session (for demo for example) + $disabled_modules = array(); if (in_array($modulenameshort, $disabled_modules)) { $objMod->disabled = true; } From 74ad0586a903d4c59b2a89f62fe5ebb8c36d855d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Aug 2021 20:42:14 +0200 Subject: [PATCH 028/119] Fix disabled --- htdocs/admin/modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index e746faec8a5..dd6b22f7634 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -588,6 +588,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } + $disabled_modules = array(); if (!empty($_SESSION["disablemodules"])) { $disabled_modules = explode(',', $_SESSION["disablemodules"]); } @@ -760,7 +761,6 @@ if ($mode == 'common' || $mode == 'commonkanban') { $codetoconfig = ''; // Force disable of module disabled into session (for demo for example) - $disabled_modules = array(); if (in_array($modulenameshort, $disabled_modules)) { $objMod->disabled = true; } From 359dae6af876c8b970e0db79c54436b787539823 Mon Sep 17 00:00:00 2001 From: lainwir3d Date: Sun, 29 Aug 2021 23:13:41 +0400 Subject: [PATCH 029/119] FIX #18542 REST API: set global $user variable to DolibarrApiAccess::user. --- htdocs/api/class/api_access.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 99582b62047..eaaa29d7aa1 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -80,7 +80,7 @@ class DolibarrApiAccess implements iAuthenticate public function __isAllowed() { // phpcs:enable - global $conf, $db; + global $conf, $db, $user; $login = ''; $stored_key = ''; @@ -149,6 +149,7 @@ class DolibarrApiAccess implements iAuthenticate } $fuser->getrights(); static::$user = $fuser; + $user = $fuser; if ($fuser->socid) { static::$role = 'external'; From 4381f67a64bc90c2c2df6b8a8084c169e5aef7e5 Mon Sep 17 00:00:00 2001 From: lainwir3d Date: Mon, 30 Aug 2021 00:08:43 +0400 Subject: [PATCH 030/119] FIX #18544 Shipment REST API: load thirdparty object into the shipment before validating. --- htdocs/commande/class/api_orders.class.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 745fea5ab76..f5e9aea75bd 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -716,7 +716,9 @@ class Orders extends DolibarrApi if (!$result) { throw new RestException(404, 'Order not found'); } - + + $result = $this->commande->fetch_thirdparty(); // do not check result, as failure is not fatal (used only for mail notification substitutes) + if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -729,13 +731,6 @@ class Orders extends DolibarrApi throw new RestException(500, 'Error when validating Order: '.$this->commande->error); } $result = $this->commande->fetch($id); - if (!$result) { - throw new RestException(404, 'Order not found'); - } - - if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } $this->commande->fetchObjectLinked(); From 01a44760a868b8d2099f058738d4ed79bde68257 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 29 Aug 2021 20:14:19 +0000 Subject: [PATCH 031/119] Fixing style errors. --- htdocs/commande/class/api_orders.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index f5e9aea75bd..b550139cd94 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -716,9 +716,9 @@ class Orders extends DolibarrApi if (!$result) { throw new RestException(404, 'Order not found'); } - + $result = $this->commande->fetch_thirdparty(); // do not check result, as failure is not fatal (used only for mail notification substitutes) - + if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } From 7bf6daaca7704e891198c385da7c5f0adcf1f433 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Mon, 30 Aug 2021 15:33:26 +0800 Subject: [PATCH 032/119] Update card.php --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6cf2f27844a..a784431c841 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -538,7 +538,7 @@ if (empty($reshook)) { } // If some payments were already done, we change the amount to pay using same prorate - if (!empty($conf->global->SUPPLIER_INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) { + if (!empty($conf->global->SUPPLIER_INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) && $object->type == FactureFournisseur::TYPE_CREDIT_NOTE) { $alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded. if ($alreadypaid && abs($alreadypaid) < abs($object->total_ttc)) { $ratio = abs(($object->total_ttc - $alreadypaid) / $object->total_ttc); From 3240a3652dbd3959239b0e832f206b3353c41627 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Mon, 30 Aug 2021 15:34:59 +0800 Subject: [PATCH 033/119] Update card.php --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3deb7b346c5..a09bc6853d0 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -834,7 +834,7 @@ if (empty($reshook)) { } // If some payments were already done, we change the amount to pay using same prorate - if (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) { + if (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) && $object->type == Facture::TYPE_CREDIT_NOTE) { $alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded. if ($alreadypaid && abs($alreadypaid) < abs($object->total_ttc)) { $ratio = abs(($object->total_ttc - $alreadypaid) / $object->total_ttc); From 0132788266aee6f63ee101aa20228c2b1e2765f0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 30 Aug 2021 13:56:31 +0200 Subject: [PATCH 034/119] NEW Invoice list - Use complete country select field with EEC or not --- htdocs/compta/facture/list.php | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index a54797323a3..9c247f4e146 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -106,7 +106,7 @@ $search_pos_source = GETPOST('search_pos_source', 'alpha'); $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); -$search_country = GETPOST("search_country", 'int'); +$search_country = GETPOST("search_country", 'alpha'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); @@ -652,8 +652,26 @@ if ($search_zip) { if ($search_state) { $sql .= natural_search("state.nom", $search_state); } -if ($search_country) { - $sql .= " AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).')'; +if (strlen(trim($search_country))) { + $arrayofcode = getCountriesInEEC(); + $country_code_in_EEC = $country_code_in_EEC_without_me = ''; + foreach ($arrayofcode as $key => $value) { + $country_code_in_EEC .= ($country_code_in_EEC ? "," : "")."'".$value."'"; + if ($value != $mysoc->country_code) { + $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'"; + } + } + if ($search_country == 'special_allnotme') { + $sql .= " AND country.code <> '".$db->escape($mysoc->country_code)."'"; + } elseif ($search_country == 'special_eec') { + $sql .= " AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).")"; + } elseif ($search_country == 'special_eecnotme') { + $sql .= " AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).")"; + } elseif ($search_country == 'special_noteec') { + $sql .= " AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).")"; + } else { + $sql .= natural_search("country.code", $search_country); + } } if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') { $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; @@ -941,6 +959,9 @@ if ($resql) { if ($search_zip) { $param .= '&search_zip='.urlencode($search_zip); } + if ($search_country) { + $param .= "&search_country=".urlencode($search_country); + } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } @@ -1259,7 +1280,7 @@ if ($resql) { // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; - print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); + print $form->select_country($search_country, 'search_country', '', 0, 'minwidth150imp maxwidth150', 'code2', 1, 0, 1, null, 1); print ''; } // Company type From 31abb98a9137d7516f87827fcc64d1c3288f957b Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 30 Aug 2021 14:38:36 +0200 Subject: [PATCH 035/119] Fix : KnowledgeManagement menu permission --- htdocs/core/modules/modKnowledgeManagement.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index 5957158e893..c3be87963c8 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -317,7 +317,7 @@ class modKnowledgeManagement extends DolibarrModules // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->knowledgemanagement->enabled', // Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules - 'perms'=>'1', + 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read', 'target'=>'', // 0=Menu for internal users, 1=external users, 2=both 'user'=>2, @@ -337,7 +337,7 @@ class modKnowledgeManagement extends DolibarrModules // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->knowledgemanagement->enabled', // Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules - 'perms'=>'1', + 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read', 'target'=>'', // 0=Menu for internal users, 1=external users, 2=both 'user'=>2, @@ -357,7 +357,7 @@ class modKnowledgeManagement extends DolibarrModules // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->knowledgemanagement->enabled', // Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules - 'perms'=>'1', + 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->write', 'target'=>'', // 0=Menu for internal users, 1=external users, 2=both 'user'=>2 From d2f3d134dfb5bb89440462aa9c0a1fc4bf341866 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 16:54:45 +0200 Subject: [PATCH 036/119] Code comment. Better _checkFilters --- htdocs/api/class/api.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index ab65576811a..b4e1abdbadb 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -310,14 +310,23 @@ class DolibarrApi } if ($tmp[$i] == ')') { $counter--; + + // TODO: After a closing ), only a " or " or " and " or end of string is allowed. } if ($counter < 0) { - $error = "Bad sqlfilters=".$sqlfilters; + $error = "Bad sqlfilters (too many closing parenthesis) = ".$sqlfilters; dol_syslog($error, LOG_WARNING); return false; } $i++; } + + if ($counter > 0) { + $error = "Bad sqlfilters (too many opening parenthesis) = ".$sqlfilters; + dol_syslog($error, LOG_WARNING); + return false; + } + return true; } @@ -327,7 +336,8 @@ class DolibarrApi * Function to forge a SQL criteria * * @param array $matches Array of found string by regex search. - * Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL" or "t.nature:isnot:NULL" + * Each entry is 1 and only 1 criteria. + * Example: "t.ref:like:'SO-%'", "t.date_creation:<:'20160101'", "t.date_creation:<:'2016-01-01 12:30:00'", "t.nature:is:NULL", "t.field2:isnot:NULL" * @return string Forged criteria. Example: "t.field like 'abc%'" */ protected static function _forge_criteria_callback($matches) From 9c3ba22b025150ae28a5ae577e349ba45cea3bc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 18:38:31 +0200 Subject: [PATCH 037/119] Fix label of company of a thirdparty --- htdocs/adherents/list.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index f7c4d5e4d36..b700da148df 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -919,9 +919,13 @@ while ($i < min($num, $limit)) { if (!empty($obj->fk_soc)) { $memberstatic->fetch_thirdparty(); - $companyname = $memberstatic->thirdparty->name; + if ($memberstatic->thirdparty->id > 0) { + $companyname = $memberstatic->thirdparty->name; + $companynametoshow = $memberstatic->thirdparty->getNomUrl(1); + } } else { $companyname = $obj->company; + $companynametoshow = $obj->company; } $memberstatic->company = $companyname; @@ -984,7 +988,7 @@ while ($i < min($num, $limit)) { // Company if (!empty($arrayfields['d.company']['checked'])) { print ''; - print $companyname; + print $companynametoshow; print "\n"; } // Login From 9db5f85d4e9b5db027df383312cc35f9366e3cc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 18:42:41 +0200 Subject: [PATCH 038/119] Fix responsive --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index b700da148df..d1af54d7168 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -1098,7 +1098,7 @@ while ($i < min($num, $limit)) { } // EMail if (!empty($arrayfields['d.email']['checked'])) { - print "".dol_print_email($obj->email, 0, 0, 1)."\n"; + print ''.dol_print_email($obj->email, 0, 0, 1)."\n"; } // End of subscription date $datefin = $db->jdate($obj->datefin); From b78771f8c4df90d955134ed20d14d65e67b0b04d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 18:56:52 +0200 Subject: [PATCH 039/119] Fix select empty value for thirdparties select combo --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4ff3dacb537..98807af1858 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1413,7 +1413,7 @@ class Form } } if ($showempty) { - $out .= '
').'">'.$textifempty.''."\n"; + $out .= '
').'">'.$textifempty.''."\n"; } $num = $this->db->num_rows($resql); From 3c029d0ccf2c9e4ae8875821fe2734c54db5ccd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 18:57:41 +0200 Subject: [PATCH 040/119] Fix sort on company on member list. --- htdocs/adherents/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index d1af54d7168..ca62d0a4cc3 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -317,6 +317,7 @@ $sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.p $sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; $sql .= " d.note_private, d.note_public,"; $sql .= " s.nom,"; +$sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,"; $sql .= " t.libelle as type, t.subscription,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; // Add fields from extrafields @@ -832,7 +833,7 @@ if (!empty($arrayfields['d.gender']['checked'])) { print_liste_field_titre($arrayfields['d.gender']['label'], $_SERVER['PHP_SELF'], 'd.gender', $param, "", "", $sortfield, $sortorder); } if (!empty($arrayfields['d.company']['checked'])) { - print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'd.societe', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'companyname', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['d.login']['checked'])) { print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], 'd.login', '', $param, '', $sortfield, $sortorder); From 18e7a5efa960e0ccee8578cd43e563aa41c46bc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:00:15 +0200 Subject: [PATCH 041/119] Trans --- htdocs/langs/en_US/members.lang | 2 +- htdocs/langs/en_US/users.lang | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 2c4409caa88..b193e1f34b6 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -155,7 +155,7 @@ DescADHERENT_CARD_TEXT_RIGHT=Text printed on member cards (align on right) DescADHERENT_CARD_FOOTER_TEXT=Text printed on bottom of member cards ShowTypeCard=Show type '%s' HTPasswordExport=htpassword file generation -NoThirdPartyAssociatedToMember=No third party associated to this member +NoThirdPartyAssociatedToMember=No third party associated with this member MembersAndSubscriptions= Members and Subscriptions MoreActions=Complementary action on recording MoreActionsOnSubscription=Complementary action, suggested by default when recording a subscription diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 841ee0f3daf..888c9f52161 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -62,8 +62,8 @@ ListOfUsersInGroup=List of users in this group ListOfGroupsForUser=List of groups for this user LinkToCompanyContact=Link to third party / contact LinkedToDolibarrMember=Link to member -LinkedToDolibarrUser=Link to Dolibarr user -LinkedToDolibarrThirdParty=Link to Dolibarr third party +LinkedToDolibarrUser=Link to user +LinkedToDolibarrThirdParty=Link to third party CreateDolibarrLogin=Create a user CreateDolibarrThirdParty=Create a third party LoginAccountDisableInDolibarr=Account disabled in Dolibarr. From d1ef4bdbd18a3bcd2793dd36c90cae054050870d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:10:43 +0200 Subject: [PATCH 042/119] Fix missing login in tooltip --- htdocs/adherents/class/adherent.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2d5eae90938..df9e35651c2 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2185,6 +2185,9 @@ class Adherent extends CommonObject if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; } + if (!empty($this->login)) { + $label .= '
'.$langs->trans('Login').': '.$this->login; + } if (!empty($this->firstname) || !empty($this->lastname)) { $label .= '
'.$langs->trans('Name').': '.$this->getFullName($langs); } From d9bfd72c29f7777f7b7fc4d9efdd8adfd58fe0b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:13:02 +0200 Subject: [PATCH 043/119] Fix missing login in tooltip --- htdocs/adherents/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index ca62d0a4cc3..761a6502d0b 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -906,6 +906,7 @@ while ($i < min($num, $limit)) { $memberstatic->id = $obj->rowid; $memberstatic->ref = $obj->ref; $memberstatic->civility_id = $obj->civility; + $memberstatic->login = $obj->login; $memberstatic->lastname = $obj->lastname; $memberstatic->firstname = $obj->firstname; $memberstatic->gender = $obj->gender; From 7c9909ee120eee528b8c0f2e2464c2596eff9093 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:21:52 +0200 Subject: [PATCH 044/119] Fix label of list of members --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 761a6502d0b..61226097d5c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -492,7 +492,7 @@ if (GETPOSTISSET("search_status")) { if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } - if ($search_status == Adherent::STATUS_RESILIATED) { + if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is '' $titre = $langs->trans("MembersListResiliated"); } if ($search_status == Adherent::STATUS_EXCLUDED) { From 5549186e3a500180a91ed1806ab33cab782751ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:28:49 +0200 Subject: [PATCH 045/119] Fix link --- htdocs/adherents/card.php | 2 +- htdocs/adherents/subscription.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 32a324ce4d6..3ac82b893a7 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1825,7 +1825,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Show link to invoices $tmparray = $company->getOutstandingBills('customer'); if (!empty($tmparray['refs'])) { - print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").': '.count($tmparray['refs']); + print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").' ('.count($tmparray['refs']).')'; // TODO Add alert if warning on at least one invoice late print ''; } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 3a967677e17..4da534161d6 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -612,7 +612,7 @@ if ($rowid > 0) { // Show link to invoices $tmparray = $company->getOutstandingBills('customer'); if (!empty($tmparray['refs'])) { - print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").': '.count($tmparray['refs']); + print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").' ('.count($tmparray['refs']).')'; // TODO Add alert if warning on at least one invoice late print ''; } From 3e443e91464fd2dcd886901dade57a4aaba237c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:47:44 +0200 Subject: [PATCH 046/119] Fix partnership module --- htdocs/partnership/admin/setup.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index 25567b137db..100dc7027a3 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -65,8 +65,10 @@ if ($action == 'setting') { $error += $partnership->delete_menus(); $error += $partnership->insert_menus(); - if (GETPOST("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", 'int')) + if (GETPOSTISSET("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL")) { dolibarr_set_const($db, "PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", GETPOST("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", 'int'), 'chaine', 0, '', $conf->entity); + } + dolibarr_set_const($db, "PARTNERSHIP_BACKLINKS_TO_CHECK", GETPOST("PARTNERSHIP_BACKLINKS_TO_CHECK"), 'chaine', 0, '', $conf->entity); } @@ -131,16 +133,16 @@ print ''.$langs->trans("partnershipforthirdparty print ''; -if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { - print ''.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; - print ''; - $dnbdays = '15'; - $backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; - print ''; - print ''; - print ''.$dnbdays.''; - print ''; -} +//if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { +print ''.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; +print ''; +$dnbdays = '30'; +$backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; +print ''; +print ''; +print ''.$dnbdays.''; +print ''; +//} print ''; print ''; From 8639956b79b7124fab5708f559c978883569d9eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 21:22:00 +0200 Subject: [PATCH 047/119] Fix position of information on lines of documents --- htdocs/core/tpl/objectline_view.tpl.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 3e8ef7ea411..b50ca83c6f6 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -79,6 +79,7 @@ if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && in_array($obje $sign = -1; } + $coldisplay = 0; ?> @@ -163,32 +164,33 @@ if (($line->info_bits & 2) == 2) { // Show date range if ($line->element == 'facturedetrec') { if ($line->date_start_fill || $line->date_end_fill) { - print '
'; + print '

'; } if ($line->date_start_fill) { - print $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); + print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); } if ($line->date_start_fill && $line->date_end_fill) { print ' - '; } if ($line->date_end_fill) { - print $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); + print ''.$langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); } if ($line->date_start_fill || $line->date_end_fill) { print '
'; } } else { if ($line->date_start || $line->date_end) { - print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; } //print get_date_range($line->date_start, $line->date_end, $format); } // Add description in form if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) { - print (!empty($line->description) && $line->description != $line->product_label) ? '
'.dol_htmlentitiesbr($line->description) : ''; + print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '
').'
'.dol_htmlentitiesbr($line->description) : ''; } - //Line extrafield + + // Line extrafield if (!empty($extrafields)) { $temps = $line->showOptionals($extrafields, 'view', array(), '', '', 1, 'line'); if (!empty($temps)) { From 426894f6a616f7e4f77f1697cad2632e9bab0611 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 21:44:09 +0200 Subject: [PATCH 048/119] Fix not null column --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 032504dfa61..d50b6991261 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -459,7 +459,7 @@ CREATE TABLE llx_partnership( fk_soc integer, fk_member integer, date_partnership_start date NOT NULL, - date_partnership_end date NOT NULL, + date_partnership_end date NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id, 0 = all reason_decline_or_cancel text NULL, date_creation datetime NOT NULL, From 60832c6e87b78d960cf9fe2a83aa20ae57c839dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 21:48:46 +0200 Subject: [PATCH 049/119] css --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f6a5ba93d61..161b0fb92bb 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1157,7 +1157,7 @@ class ExtraFields } else { $checked = ' value="1" '; } - $out = ''; + $out = ''; } else { $out .= $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1); } From b29fc5552d478bfe01c3b0761d63e63bf4d80033 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 22:10:26 +0200 Subject: [PATCH 050/119] Fix id in link --- htdocs/core/tpl/extrafields_view.tpl.php | 6 ++++-- htdocs/societe/partnership.php | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index e87d6df18dc..3f2ab773b06 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -199,11 +199,13 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra])) && $permok && $enabled != 5 && ($action != 'edit_extras' || GETPOST('attribute') != $tmpkeyextra) && empty($extrafields->attributes[$object->table_element]['computed'][$tmpkeyextra])) { - $fieldid = 'id'; + $fieldid = empty($forcefieldid) ? 'id' : $forcefieldid; + $valueid = empty($forceobjectid) ? $object->id : $forceobjectid; if ($object->table_element == 'societe') { $fieldid = 'socid'; } - print ''.img_edit().''; + + print ''.img_edit().''; } print ''; print ''; diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index b1f0f24fbe1..a5393e500e3 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -245,7 +245,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $socid = $object->id; - // TODO Replace this card with the list of all partnerships. + // TODO Replace this card with a table of list of all partnerships. $object = new Partnership($db); $partnershipid = $object->fetch(0, '', 0, $socid); @@ -257,10 +257,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; // Common attributes - //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field - //unset($object->fields['fk_project']); // Hide field already shown in banner - //unset($object->fields['fk_member']); // Hide field already shown in banner + unset($object->fields['fk_soc']); // Hide field already shown in banner include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + $forcefieldid = 'socid'; + $forceobjectid = $object->fk_soc; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'; print '
'; From 0ae4e721c42bdd06e09e01537941c10def9f62f5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 30 Aug 2021 23:50:33 +0200 Subject: [PATCH 051/119] merge --- htdocs/projet/tasks/list.php | 48 ------------------------------------ 1 file changed, 48 deletions(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 5e1f3d26ee5..e6d8e5c6dfa 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -521,54 +521,6 @@ if ($search_datelimit_endmonth) { if ($search_datelimit_endyear) { $param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear); } -if ($search_date_start_startmonth) { - $param .= '&search_date_start_startmonth='.urlencode($search_date_start_startmonth); -} -if ($search_date_start_startyear) { - $param .= '&search_date_start_startyear='.urlencode($search_date_start_startyear); -} -if ($search_date_start_startday) { - $param .= '&search_date_start_startday='.urlencode($search_date_start_startday); -} -if ($search_date_start_start) { - $param .= '&search_date_start_start='.urlencode($search_date_start_start); -} -if ($search_date_start_endmonth) { - $param .= '&search_date_start_endmonth='.urlencode($search_date_start_endmonth); -} -if ($search_date_start_endyear) { - $param .= '&search_date_start_endyear='.urlencode($search_date_start_endyear); -} -if ($search_date_start_endday) { - $param .= '&search_date_start_endday='.urlencode($search_date_start_endday); -} -if ($search_date_start_end) { - $param .= '&search_date_start_end='.urlencode($search_date_start_end); -} -if ($search_date_end_startmonth) { - $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); -} -if ($search_date_end_startyear) { - $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); -} -if ($search_date_end_startday) { - $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); -} -if ($search_date_end_start) { - $param .= '&search_date_end_start='.urlencode($search_date_end_start); -} -if ($search_date_end_endmonth) { - $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); -} -if ($search_date_end_endyear) { - $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); -} -if ($search_date_end_endday) { - $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); -} -if ($search_date_end_end) { - $param .= '&search_date_end_end=' . urlencode($search_date_end_end); -} if ($socid) { $param .= '&socid='.urlencode($socid); } From 009fa41762b507e24405b57f51acd6405d8f8b43 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 31 Aug 2021 09:10:57 +0200 Subject: [PATCH 052/119] add checkbox to ask detail on line desc --- htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/tasks/time.php | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index e6a84ad9736..6709a1de200 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -274,6 +274,7 @@ NewInter=New intervention OneLinePerTask=One line per task OneLinePerPeriod=One line per period OneLinePerTimeSpentLine=One line for each time spent declaration +AddDetailDateAndDuration=With date and duration into line description RefTaskParent=Ref. Parent Task ProfitIsCalculatedWith=Profit is calculated using AddPersonToTask=Add also to tasks diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 634b3c136d9..338962c1e74 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -449,6 +449,7 @@ if ($action == 'confirm_generateinvoice') { } } elseif ($generateinvoicemode == 'onelineperperiod') { // One line for each time spent line $arrayoftasks = array(); + $withdetail=GETPOST('detail_time_duration', 'alpha'); foreach ($toselect as $key => $value) { // Get userid, timepent $object->fetchTimeSpent($value); @@ -462,7 +463,7 @@ if ($action == 'confirm_generateinvoice') { $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; $arrayoftasks[$object->timespent_id]['note'] = $ftask->ref.' - '.$ftask->label.' - '.$username.($object->timespent_note ? ' - '.$object->timespent_note : ''); // TODO Add user name in note - if (!empty($conf->global->PROJECT_TIME_SPENT_INTO_INVOICE_ADD_TIME_DT)) { + if (!empty($withdetail)) { $arrayoftasks[$object->timespent_id]['note'] .= "\n"; if (!empty($object->timespent_withhour)) { $arrayoftasks[$object->timespent_id]['note'] .= $langs->trans("Date") . ': ' . dol_print_date($object->timespent_datehour); @@ -1103,6 +1104,25 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { 'onelineperperiod'=>'OneLinePerTimeSpentLine', ); print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); + print "\n".''."\n"; + print ''; print ''; print ''; From 673852c7399faabd92857c833543a82d7e1f7d7b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 31 Aug 2021 09:24:41 +0200 Subject: [PATCH 053/119] better line desc --- htdocs/projet/tasks/time.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 338962c1e74..71219be4e57 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -464,7 +464,12 @@ if ($action == 'confirm_generateinvoice') { $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; $arrayoftasks[$object->timespent_id]['note'] = $ftask->ref.' - '.$ftask->label.' - '.$username.($object->timespent_note ? ' - '.$object->timespent_note : ''); // TODO Add user name in note if (!empty($withdetail)) { - $arrayoftasks[$object->timespent_id]['note'] .= "\n"; + if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { + $arrayoftasks[$object->timespent_id]['note'] .= "
"; + } else { + $arrayoftasks[$object->timespent_id]['note'] .= "\n"; + } + if (!empty($object->timespent_withhour)) { $arrayoftasks[$object->timespent_id]['note'] .= $langs->trans("Date") . ': ' . dol_print_date($object->timespent_datehour); } else { From cd47bede37717dc18fc915f79a073d1537f42ad9 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Tue, 31 Aug 2021 09:26:00 +0200 Subject: [PATCH 054/119] FournisseurCommandDispatch extends CommonObjectLine instead of CommonObject --- htdocs/fourn/class/fournisseur.commande.dispatch.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index cd1ff267fb7..b2c4d101b74 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT."/reception/class/reception.class.php"; /** * Class to manage table commandefournisseurdispatch */ -class CommandeFournisseurDispatch extends CommonObject +class CommandeFournisseurDispatch extends CommonObjectLine { /** * @var DoliDB Database handler. From cceba665a267f49110b78564c22598fdd894be66 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Aug 2021 12:29:14 +0200 Subject: [PATCH 055/119] NEW Option "Add a link on the PDF to make the online payment" --- htdocs/admin/pdf.php | 12 ++++ .../modules/facture/doc/pdf_crabe.modules.php | 60 ++++++++++++++----- .../facture/doc/pdf_sponge.modules.php | 55 ++++++++++------- htdocs/langs/en_US/admin.lang | 1 + 4 files changed, 92 insertions(+), 36 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 5030c487537..4d02a2ddb7a 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -104,6 +104,8 @@ if ($action == 'update') { if (GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE')) dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('SHOW_SUBPRODUCT_REF_IN_PDF')) dolibarr_set_const($db, "SHOW_SUBPRODUCT_REF_IN_PDF", GETPOST('SHOW_SUBPRODUCT_REF_IN_PDF', 'alpha'), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('PDF_SHOW_LINK_TO_ONLINE_PAYMENT')) dolibarr_set_const($db, "PDF_SHOW_LINK_TO_ONLINE_PAYMENT", GETPOST('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', 'alpha'), 'chaine', 0, '', $conf->entity); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); @@ -463,6 +465,16 @@ print ''.$langs->trans("ShowDetailsInPDFPageFoot").'selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)); print ''; +// Show online payment link on invoices + +print ''.$langs->trans("PDF_SHOW_LINK_TO_ONLINE_PAYMENT").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PDF_SHOW_LINK_TO_ONLINE_PAYMENT'); +} else { + print $form->selectyesno('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) ? $conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT : 0, 1); +} +print ''; + print ''; print ''; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 4cd2699a3d4..13d83dbd3f1 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -248,6 +248,14 @@ class pdf_crabe extends ModelePDFFactures // Load translation files required by the page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); + global $outputlangsbis; + $outputlangsbis = null; + if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + $outputlangsbis = new Translate('', $conf); + $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); + $outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies")); + } + $nblines = count($object->lines); // Loop on each lines to detect if there is at least one image to show @@ -761,10 +769,10 @@ class pdf_crabe extends ModelePDFFactures } // Display info area - $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); + $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs, $outputlangsbis); // Display total area - $posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs, $outputlangsbis); // Display Payments area if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) { @@ -1014,9 +1022,10 @@ class pdf_crabe extends ModelePDFFactures * @param Facture $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object - * @return void + * @param Translate $outputlangsbis Object lang for output bis + * @return int Pos y */ - protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) + protected function _tableau_info(&$pdf, $object, $posy, $outputlangs, $outputlangsbis) { // phpcs:enable global $conf, $mysoc; @@ -1053,7 +1062,7 @@ class pdf_crabe extends ModelePDFFactures $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); - $posy = $pdf->GetY() + 3; + $posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions } if ($object->type != 2) { @@ -1078,7 +1087,7 @@ class pdf_crabe extends ModelePDFFactures } // Show payment mode - if ($object->mode_reglement_code + if (!empty($object->mode_reglement_code) && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') { $pdf->SetFont('', 'B', $default_font_size - 2); @@ -1091,9 +1100,25 @@ class pdf_crabe extends ModelePDFFactures $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); - // Show online payment link - $useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)); - if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) { + $posy = $pdf->GetY(); + } + + // Show online payment link + if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') { + $useonlinepayment = 0; + if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) { + if (!empty($conf->paypal->enabled)) { + $useonlinepayment++; + } + if (!empty($conf->stripe->enabled)) { + $useonlinepayment++; + } + if (!empty($conf->paybox->enabled)) { + $useonlinepayment++; + } + } + + if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) { require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; @@ -1102,11 +1127,11 @@ class pdf_crabe extends ModelePDFFactures $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; - $pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1); + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); } - - $posy = $pdf->GetY() + 2; + $posy = $pdf->GetY() + 1; } // Show payment mode CHQ @@ -1181,12 +1206,13 @@ class pdf_crabe extends ModelePDFFactures * @param int $deja_regle Amount already paid (in the currency of invoice) * @param int $posy Position depart * @param Translate $outputlangs Objet langs + * @param Translate $outputlangsbis Object lang for output bis * @return int Position pour suite */ - protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) + protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis) { // phpcs:enable - global $conf, $mysoc; + global $conf, $mysoc, $hookmanager; $sign = 1; if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) { @@ -1253,7 +1279,8 @@ class pdf_crabe extends ModelePDFFactures $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : ''); + $totalvat .= ' '; $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1285,7 +1312,8 @@ class pdf_crabe extends ModelePDFFactures $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); + $totalvat .= ' '; $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index be458fcdd1a..2bd8fb2ecec 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -906,10 +906,10 @@ class pdf_sponge extends ModelePDFFactures } // Display infos area - $posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); + $posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs, $outputlangsbis); // Display total zone - $posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs, $outputlangsbis); // Display payment area if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) { @@ -1104,9 +1104,10 @@ class pdf_sponge extends ModelePDFFactures * @param Facture $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object + * @param Translate $outputlangsbis Object lang for output bis * @return int Pos y */ - protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs) + protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlangsbis) { global $conf, $mysoc; @@ -1118,7 +1119,11 @@ class pdf_sponge extends ModelePDFFactures if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) { $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } $posy = $pdf->GetY() + 4; } @@ -1138,7 +1143,7 @@ class pdf_sponge extends ModelePDFFactures $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); - $posy = $pdf->GetY() + 3; + $posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions } if ($object->type != 2) { @@ -1163,7 +1168,7 @@ class pdf_sponge extends ModelePDFFactures } // Show payment mode - if ($object->mode_reglement_code + if (!empty($object->mode_reglement_code) && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') { $pdf->SetFont('', 'B', $default_font_size - 2); @@ -1176,9 +1181,25 @@ class pdf_sponge extends ModelePDFFactures $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); - // Show online payment link - $useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)); - if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) { + $posy = $pdf->GetY(); + } + + // Show online payment link + if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') { + $useonlinepayment = 0; + if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) { + if (!empty($conf->paypal->enabled)) { + $useonlinepayment++; + } + if (!empty($conf->stripe->enabled)) { + $useonlinepayment++; + } + if (!empty($conf->paybox->enabled)) { + $useonlinepayment++; + } + } + + if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) { require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; @@ -1187,10 +1208,11 @@ class pdf_sponge extends ModelePDFFactures $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; - $pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1); + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); } - $posy = $pdf->GetY() + 2; + $posy = $pdf->GetY() + 1; } // Show payment mode CHQ @@ -1263,9 +1285,10 @@ class pdf_sponge extends ModelePDFFactures * @param int $deja_regle Amount already paid (in the currency of invoice) * @param int $posy Position depart * @param Translate $outputlangs Objet langs + * @param Translate $outputlangsbis Object lang for output bis * @return int Position pour suite */ - protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs) + protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis) { global $conf, $mysoc, $hookmanager; @@ -1276,14 +1299,6 @@ class pdf_sponge extends ModelePDFFactures $default_font_size = pdf_getPDFFontSize($outputlangs); - $outputlangsbis = null; - if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { - $outputlangsbis = new Translate('', $conf); - $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); - $outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal")); - $default_font_size--; - } - $tab2_top = $posy; $tab2_hl = 4; $pdf->SetFont('', '', $default_font_size - 1); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 454df4ed28e..76dd117dbd8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2163,3 +2163,4 @@ APIsAreNotEnabled=APIs modules are not enabled YouShouldSetThisToOff=You should set this to 0 or off InstallAndUpgradeLockedBy=Install and upgrades are locked by the file %s OldImplementation=Old implementation +PDF_SHOW_LINK_TO_ONLINE_PAYMENT=If some online payment modules are enabled (Paypal, Stripe, ...), add a link on the PDF to make the online payment \ No newline at end of file From 19587fb88bb66d9a0edd1eb8dbdd377dfba41b59 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Tue, 31 Aug 2021 12:25:36 +0200 Subject: [PATCH 056/119] Regroup BILL_SUPPLIER_VALIDATE triggers under the same condition --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 7b669578a53..993c4136660 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -209,7 +209,6 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } } - return $ret; } // Second classify billed the proposal. From a3f4ba11aaf4368a94a5f110bb8c1befdebcce1e Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Tue, 31 Aug 2021 12:25:50 +0200 Subject: [PATCH 057/119] regroup BILL_SUPPLIER_VALIDATE actions --- ...e_20_modWorkflow_WorkflowManager.class.php | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 993c4136660..b410cdb3f54 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -206,6 +206,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['order_supplier'] as $element) { $ret = $element->classifyBilled($user); + if ($ret < 0) { + return $ret; + } } } } @@ -225,11 +228,34 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach ($object->linkedObjects['supplier_proposal'] as $element) { $ret = $element->classifyBilled($user); + if ($ret < 0) { + return $ret; + } } } } - return $ret; } + + // classify billed reception + if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { + $object->fetchObjectLinked('', 'reception', $object->id, $object->element); + if (!empty($object->linkedObjects)) { + $totalonlinkedelements = 0; + foreach ($object->linkedObjects['reception'] as $element) { + if ($element->statut == Reception::STATUS_VALIDATED) $totalonlinkedelements += $element->total_ht; + } + dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); + if ($totalonlinkedelements == $object->total_ht) { + foreach ($object->linkedObjects['reception'] as $element) { + $ret = $element->set_billed(); + if ($ret < 0) { + return $ret; + } + } + } + } + } + return $ret; } // Invoice classify billed order @@ -324,30 +350,6 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } - // classify billed reception - if ($action == 'BILL_SUPPLIER_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG); - - if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { - $object->fetchObjectLinked('', 'reception', $object->id, $object->element); - if (!empty($object->linkedObjects)) { - $totalonlinkedelements = 0; - foreach ($object->linkedObjects['reception'] as $element) { - if ($element->statut == Reception::STATUS_VALIDATED) { - $totalonlinkedelements += $element->total_ht; - } - } - dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); - if ($totalonlinkedelements == $object->total_ht) { - foreach ($object->linkedObjects['reception'] as $element) { - $ret = $element->setBilled(); - } - } - } - return $ret; - } - } - return 0; } From bbf219fd7b64460593f725a640eef8ae98ab2b9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Aug 2021 13:09:52 +0200 Subject: [PATCH 058/119] FIX Export of website generates a package that contains a sql error --- htdocs/website/class/website.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 7e70bfddc6d..3872f9be6eb 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1091,8 +1091,8 @@ class Website extends CommonObject } } - $line .= "\n-- For Dolibarr v14+ --\n"; - $line .= "UPDATE llx_website SET fk_default_lang = '".$this->db->escape($this->fk_default_lang)."' WHERE rowid = __WEBSITE_ID__;\n"; + $line = "\n-- For Dolibarr v14+ --;\n"; + $line .= "UPDATE llx_website SET lang = '".$this->db->escape($this->fk_default_lang)."' WHERE rowid = __WEBSITE_ID__;\n"; $line .= "UPDATE llx_website SET otherlang = '".$this->db->escape($this->otherlang)."' WHERE rowid = __WEBSITE_ID__;\n"; $line .= "\n"; fputs($fp, $line); From c7444865a1e0d1a03e90fefaacac50049b4a4559 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Aug 2021 13:16:37 +0200 Subject: [PATCH 059/119] Fix css --- htdocs/core/class/html.formticket.class.php | 2 +- htdocs/core/tpl/login.tpl.php | 2 +- htdocs/core/tpl/passwordforgotten.tpl.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 76789ebe6de..55f4aa9124d 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -263,7 +263,7 @@ class FormTicket require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 1fd3e062515..1d25249da75 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -212,7 +212,7 @@ if ($captcha) { - " class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" /> + " class="flat input-icon-security width125" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" /> diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 8964145b430..6c6e2ca9dc3 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -150,7 +150,7 @@ if (!empty($captcha)) { - " class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" /> + " class="flat input-icon-security width125" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" /> From d09d036f06acfeb5959c3b4489ceac4008286328 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 31 Aug 2021 16:10:55 +0200 Subject: [PATCH 060/119] Fix supplier invoice pdf generation canelle Thirdparty wrongly fetched was causing errors on mass generation --- .../core/modules/supplier_invoice/pdf/pdf_canelle.modules.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 01f6369055b..3ef1bc45e5e 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -208,7 +208,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices global $user, $langs, $conf, $mysoc, $hookmanager, $nblines; // Get source company - if (!is_object($object->thirdparty)) $object->fetch_thirdparty(); + $object->fetch_thirdparty(); if (!is_object($object->thirdparty)) $object->thirdparty = $mysoc; // If fetch_thirdparty fails, object has no socid (specimen) $this->emetteur = $object->thirdparty; if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined @@ -224,8 +224,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if ($conf->fournisseur->facture->dir_output) { - $object->fetch_thirdparty(); - $deja_regle = $object->getSommePaiement(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); $amount_credit_notes_included = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); $amount_deposits_included = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); From 72131110e789d51f7b656b54e8296fbbd93a846a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Aug 2021 18:03:37 +0200 Subject: [PATCH 061/119] Fix protect public pages --- htdocs/public/cron/cron_run_jobs_by_url.php | 4 +++ htdocs/public/cron/index.html | 0 htdocs/public/cron/index.php | 27 +++++++++++++++++++++ htdocs/public/index.php | 4 +-- htdocs/public/notice.php | 10 ++++---- htdocs/public/ticket/create_ticket.php | 4 +++ htdocs/public/ticket/index.php | 4 +++ htdocs/public/ticket/list.php | 3 +++ htdocs/public/ticket/view.php | 4 +++ 9 files changed, 53 insertions(+), 7 deletions(-) delete mode 100644 htdocs/public/cron/index.html create mode 100644 htdocs/public/cron/index.php diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index 133c5d1b18a..9369a9d78a7 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -67,6 +67,10 @@ global $langs, $conf; // Language Management $langs->loadLangs(array("admin", "cron", "dict")); +// Security check +if (empty($conf->cron->enabled)) { + accessforbidden('', 0, 0, 1); +} diff --git a/htdocs/public/cron/index.html b/htdocs/public/cron/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/public/cron/index.php b/htdocs/public/cron/index.php new file mode 100644 index 00000000000..a62d2d1ba68 --- /dev/null +++ b/htdocs/public/cron/index.php @@ -0,0 +1,27 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/public/cron/index.php + * \ingroup core + * \brief A redirect page to an error + */ + +require '../../master.inc.php'; + +header("Location: ".DOL_URL_ROOT.'/public/error-404.php'); +exit; diff --git a/htdocs/public/index.php b/htdocs/public/index.php index a9de01f35ca..6e80d99430f 100644 --- a/htdocs/public/index.php +++ b/htdocs/public/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2009-2021 Laurent Destailleur * * 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 @@ -18,7 +18,7 @@ /** * \file htdocs/public/index.php * \ingroup core - * \brief A redirect page to an error + * \brief A redirect page to an error page */ require '../master.inc.php'; diff --git a/htdocs/public/notice.php b/htdocs/public/notice.php index c41bf81bea4..d5ac4070ff0 100644 --- a/htdocs/public/notice.php +++ b/htdocs/public/notice.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2021 Laurent Destailleur * * 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 @@ -17,10 +17,10 @@ /** * \file htdocs/public/notice.php - * \brief Dolibarr page to show a notice. - * Default notice is a message to say network connection is off or show another message. - * You can also call this page with URL: - * /public/notice.php?lang=xx_XX&transkey=translation_key (key must be inside file main.lang, error.lang or other.lang) + * \brief Dolibarr public page to show a notice. + * Default notice is a message to say network connection is off. Some parameters can be used to show another message. + * You can call this page with URL: + * /public/notice.php?lang=xx_XX&transkey=translation_key (key must be inside file main.lang, error.lang or other.lang) * /public/notice.php?transphrase=url_encoded_sentence_to_show */ diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index b911e7480d3..70f652ebc05 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -75,6 +75,10 @@ $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); +if (empty($conf->ticket->enabled)) { + accessforbidden('', 0, 0, 1); +} + /* * Actions diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 31ee838f6f5..6abeb5f8b12 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -61,6 +61,10 @@ $langs->loadLangs(array('companies', 'other', 'ticket', 'errors')); $track_id = GETPOST('track_id', 'alpha'); $action = GETPOST('action', 'aZ09'); +if (empty($conf->ticket->enabled)) { + accessforbidden('', 0, 0, 1); +} + /* * View diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 3df9d33eb4a..db5f5d8d754 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -70,6 +70,9 @@ if (isset($_SESSION['email_customer'])) { $object = new Ticket($db); +if (empty($conf->ticket->enabled)) { + accessforbidden('', 0, 0, 1); +} diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 1270ad6c0fa..b914ed0631e 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -68,6 +68,10 @@ if (isset($_SESSION['email_customer'])) { $object = new ActionsTicket($db); +if (empty($conf->ticket->enabled)) { + accessforbidden('', 0, 0, 1); +} + /* * Actions From 6c2cf4377a9253915c14d1a1fa6496f542474132 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 31 Aug 2021 18:14:16 +0200 Subject: [PATCH 062/119] NEW can enable/disable external calendar by default --- htdocs/admin/agenda_extsites.php | 69 +++++++++++++++++++++++++++++--- htdocs/comm/action/index.php | 22 +++++++++- htdocs/langs/en_US/agenda.lang | 3 +- htdocs/langs/fr_FR/agenda.lang | 1 + 4 files changed, 88 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 272da835741..bf6c8bdee2a 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -41,8 +41,7 @@ if (!$user->admin) { $langs->loadLangs(array('agenda', 'admin', 'other')); $def = array(); -$actiontest = GETPOST('test', 'alpha'); -$actionsave = GETPOST('save', 'alpha'); +$action = GETPOST('action', 'alpha'); if (empty($conf->global->AGENDA_EXT_NB)) { $conf->global->AGENDA_EXT_NB = 5; @@ -57,14 +56,57 @@ $colorlist = array('BECEDD', 'DDBECE', 'BFDDBE', 'F598B4', 'F68654', 'CBF654', ' * Actions */ -if ($actionsave) { +$error = 0; +$errors = array(); + +if (preg_match('/set_(.*)/', $action,$reg)) { + $db->begin(); + + $code=$reg[1]; + $value=(GETPOST($code) ? GETPOST($code) : 1); + + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + $errors[] = $db->lasterror(); + } + + if ($error) { + $db->rollback(); + setEventMessages('', $errors, 'errors'); + } else { + $db->commit(); + setEventMessage($langs->trans('SetupSaved')); + header('Location: ' . $_SERVER["PHP_SELF"]); + exit(); + } +} elseif (preg_match('/del_(.*)/', $action,$reg)) { + $db->begin(); + + $code = $reg[1]; + + $res = dolibarr_del_const($db, $code, $conf->entity); + if (!$res > 0) { + $error++; + $errors[] = $db->lasterror(); + } + + if ($error) { + $db->rollback(); + setEventMessages('', $errors, 'errors'); + } else { + $db->commit(); + setEventMessage($langs->trans('SetupSaved')); + header('Location: ' . $_SERVER["PHP_SELF"]); + exit(); + } +} elseif ($action == 'save') { $db->begin(); $disableext = GETPOST('AGENDA_DISABLE_EXT', 'alpha'); $res = dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity); $i = 1; $errorsaved = 0; - $error = 0; // Save agendas while ($i <= $MAXAGENDA) { @@ -159,6 +201,10 @@ print dol_get_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action print ''.$langs->trans("AgendaExtSitesDesc")."
\n"; print "
\n"; + +$selectedvalue=$conf->global->AGENDA_DISABLE_EXT; +if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; + print ""; print ""; @@ -203,6 +249,7 @@ print ""; print "'; print "'; print ''; +print ''; print ""; $i = 1; @@ -213,7 +260,7 @@ while ($i <= $MAXAGENDA) { $offsettz = 'AGENDA_EXT_OFFSETTZ'.$key; $color = 'AGENDA_EXT_COLOR'.$key; $enabled = 'AGENDA_EXT_ENABLED'.$key; - + $default = 'AGENDA_EXT_ACTIVEBYDEFAULT'.$key; print ''; // Nb @@ -229,6 +276,18 @@ while ($i <= $MAXAGENDA) { //print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist); print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key) ?GETPOST("AGENDA_EXT_COLOR".$key) : getDolGlobalString($color)), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset'); print ''; + // Calendar active by default + print ''; print ""; $i++; } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 19aff1699c8..321457445aa 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -265,6 +265,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT)) { $name = 'AGENDA_EXT_NAME'.$i; $offsettz = 'AGENDA_EXT_OFFSETTZ'.$i; $color = 'AGENDA_EXT_COLOR'.$i; + $default = 'AGENDA_EXT_ACTIVEBYDEFAULT'.$i; $buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i; if (!empty($conf->global->$source) && !empty($conf->global->$name)) { // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' @@ -273,6 +274,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT)) { 'name'=>$conf->global->$name, 'offsettz' => (!empty($conf->global->$offsettz) ? $conf->global->$offsettz : 0), 'color'=>$conf->global->$color, + 'default'=>$conf->global->$default, 'buggedfile'=>(isset($conf->global->buggedfile) ? $conf->global->buggedfile : 0) ); } @@ -288,6 +290,7 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) { $offsettz = 'AGENDA_EXT_OFFSETTZ_'.$user->id.'_'.$i; $color = 'AGENDA_EXT_COLOR_'.$user->id.'_'.$i; $enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i; + $default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i; $buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i; if (!empty($user->conf->$source) && !empty($user->conf->$name)) { // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' @@ -296,6 +299,7 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) { 'name'=>$user->conf->$name, 'offsettz' => (!empty($user->conf->$offsettz) ? $user->conf->$offsettz : 0), 'color'=>$user->conf->$color, + 'default'=>$user->conf->$default, 'buggedfile'=>(isset($user->conf->buggedfile) ? $user->conf->buggedfile : 0) ); } @@ -576,6 +580,15 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on if (is_array($showextcals) && count($showextcals) > 0) { $s .= ''."\n"; + // Formulaire de demande - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; @@ -1084,11 +1103,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print dol_get_fiche_end(); - print '
'; - print ''; - print '    '; - print ''; - print '
'; + print $form->buttonsSaveCancel("SendRequestCP"); print ''."\n"; } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6eec5cb956d..12b6d8f32df 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -103,6 +103,8 @@ if ($reshook < 0) { } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/projet/list.php'; + // Cancel if ($cancel) { if (GETPOST("comefromclone") == 1) { @@ -115,11 +117,26 @@ if (empty($reshook)) { setEventMessages($langs->trans("CantRemoveProject", $langs->transnoentitiesnoconv("ProjectOverview")), null, 'errors'); } } - if ($backtopage) { + } + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/projet/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + + if ($cancel) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { header("Location: ".$backtopage); exit; } - $action = ''; } diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 70f652ebc05..e621feb6653 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -93,7 +93,7 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } // Add file in email form -if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) { +if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) { ////$res = $object->fetch('','',GETPOST('track_id')); ////if($res > 0) ////{ @@ -112,7 +112,7 @@ if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) } // Remove file -if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) { +if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alpha')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Set tmp directory @@ -124,7 +124,7 @@ if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha $action = 'create_ticket'; } -if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) { +if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { $error = 0; $origin_email = GETPOST('email', 'alpha'); if (empty($origin_email)) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 65d509854e4..52805d96c42 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -60,6 +60,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel'); $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); $confirm = GETPOST('confirm', 'alpha'); @@ -132,8 +133,23 @@ if ($reshook < 0) { } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/supplier_proposal/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/supplier_proposal/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + if ($cancel) { - if (!empty($backtopage)) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { header("Location: ".$backtopage); exit; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index e2872004323..0e9015ec95f 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -144,17 +144,31 @@ if (empty($reshook)) { $search_agenda_label = ''; } + $backurlforlist = DOL_URL_ROOT.'/ticket/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/ticket/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + if ($cancel) { - if (!empty($backtopage)) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { header("Location: ".$backtopage); exit; } - $action = 'view'; } // Action to add an action (not a message) - if (GETPOST('add', 'alpha') && !empty($user->rights->ticket->write)) { + if (GETPOST('save', 'alpha') && !empty($user->rights->ticket->write)) { $error = 0; if (!GETPOST("subject", 'alphanohtml')) { @@ -276,9 +290,13 @@ if (empty($reshook)) { $db->commit(); if (!empty($backtopage)) { - $url = $backtopage; + if (empty($id)) { + $url = $backtopage; + } else { + $url = 'card.php?track_id='.urlencode($object->track_id); + } } else { - $url = 'card.php?track_id='.$object->track_id; + $url = 'card.php?track_id='.urlencode($object->track_id); } header("Location: ".$url); @@ -342,9 +360,13 @@ if (empty($reshook)) { $action = 'edit'; } else { if (!empty($backtopage)) { - $url = $backtopage; + if (empty($id)) { + $url = $backtopage; + } else { + $url = 'card.php?track_id='.urlencode($object->track_id); + } } else { - $url = 'card.php?track_id='.$object->track_id; + $url = 'card.php?track_id='.urlencode($object->track_id); } header('Location: '.$url); @@ -427,9 +449,13 @@ if (empty($reshook)) { if ($ret > 0) { if (!empty($backtopage)) { - $url = $backtopage; + if (empty($id)) { + $url = $backtopage; + } else { + $url = 'card.php?track_id='.urlencode($object->track_id); + } } else { - $url = 'card.php?action=view&track_id='.$object->track_id; + $url = 'card.php?action=view&track_id='.urlencode($object->track_id); } header("Location: ".$url); @@ -707,6 +733,8 @@ if ($action == 'create' || $action == 'presend') { $formticket->withextrafields = 1; $formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid')); + $formticket->withcancel = 1; + $formticket->showForm(1, 'create', 0); /*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) { $formticket = new FormTicket($db); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index be91f302b97..ee1ebf71493 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -138,6 +138,29 @@ if ($reshook < 0) { } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/user/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/user/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + + if ($cancel) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + $action = ''; + } + if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) { if ($id != $user->id) { // A user can't disable itself $object->fetch($id);
".$langs->trans("Name")."".$langs->trans("ExtSiteUrlAgenda")." (".$langs->trans("Example").': http://yoursite/agenda/agenda.ics)".$form->textwithpicto($langs->trans("FixTZ"), $langs->trans("FillFixTZOnlyIfRequired"), 1).''.$langs->trans("Color").''.$langs->trans("ActiveByDefault").'
'; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT'.$key); + } else { + if (empty($conf->global->{$default})) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } + } + print '