From e4b5ec122eee2f6a9f1017c92b5d226466af0a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 2 Jan 2021 16:38:19 +0100 Subject: [PATCH 01/59] syntax error --- htdocs/contrat/card.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index d07b8dcc60e..74d3436c453 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -373,8 +373,7 @@ if (empty($reshook)) $action = 'create'; } } - } elseif ($action == 'classin' && $user->rights->contrat->creer) - { + } elseif ($action == 'classin' && $user->rights->contrat->creer) { $object->setProject(GETPOST('projectid')); } @@ -385,7 +384,7 @@ if (empty($reshook)) $predef = ''; $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $price_ht = price2num(GETPOST('price_ht'), 'MU'); - $price_ht_devise = price2num(GETPOST('multicurrency_price_ht', 'CR'); + $price_ht_devise = price2num(GETPOST('multicurrency_price_ht', 'CR')); if (GETPOST('prod_entry_mode', 'alpha') == 'free') { $idprod = 0; From ade0e008e9c8c80c2db310eb6c0c82bb489dd5e1 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sat, 2 Jan 2021 17:42:33 +0100 Subject: [PATCH 02/59] Some debug on Shipments. Wrong object status on list paging. Parameter error on link contact. nbr Linked files not shown in tab badge. --- htdocs/core/lib/sendings.lib.php | 2 +- htdocs/expedition/contact.php | 2 +- htdocs/expedition/list.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index cf1d1793a88..0bb0db6afd1 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -81,7 +81,7 @@ function shipping_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id; diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index c6b10bd6967..ffdd395cffc 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -80,7 +80,7 @@ if ($action == 'addcontact' && $user->rights->expedition->creer) { if ($result > 0 && $id > 0) { - $result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["type"], $_POST["source"]); + $result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["typecontact"], $_POST["source"]); } if ($result >= 0) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index eaae2438b55..4494db8c21d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -340,7 +340,7 @@ if ($resql) if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); - if ($search_status != '') $param .= '&viewstatut='.urlencode($search_status); + if ($search_status != '') $param .= '&search_status='.urlencode($search_status); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From 96411ed49126c77c141a525efc614a2ee7cdc83e Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 2 Jan 2021 18:05:18 +0100 Subject: [PATCH 03/59] Fix use dolGetButton in templates --- .../template/class/myobject.class.php | 2 +- .../modulebuilder/template/myobject_card.php | 30 ++++--------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index a15f0f67fe9..e33aa866b8e 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -697,7 +697,7 @@ class MyObject extends CommonObject return -1; }*/ - return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MYOBJECT_CLOSE'); + return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MYOBJECT_CANCEL'); } /** diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index cc6630c5a01..84fa7594e11 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -466,7 +466,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { // Send if (empty($user->socid)) { - print ''.$langs->trans('SendMail').''."\n"; + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle'); } // Back to draft @@ -476,30 +476,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - // Modify - if ($permissiontoadd) { - print ''.$langs->trans("Modify").''."\n"; - } else { - print ''.$langs->trans('Modify').''."\n"; - } + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', $permissiontoadd); // Validate if ($object->status == $object::STATUS_DRAFT) { - if ($permissiontoadd) { - if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) - { - print ''.$langs->trans("Validate").''; - } else { - $langs->load("errors"); - print ''.$langs->trans("Validate").''; - } - } + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', $permissiontoadd); } // Clone - if ($permissiontoadd) { - print ''.$langs->trans("ToClone").''."\n"; - } + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', $permissiontoadd); /* if ($permissiontoadd) @@ -521,12 +506,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea */ // Delete (need delete permission, or if draft, just need create/modify permission) - if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) - { - print ''.$langs->trans('Delete').''."\n"; - } else { - print ''.$langs->trans('Delete').''."\n"; - } + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); } print ''."\n"; } From 799927432c349653c566f45164c5fe9d347fb587 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 3 Jan 2021 10:53:48 +0100 Subject: [PATCH 04/59] regression for user type on shipment contact --- htdocs/expedition/contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index ffdd395cffc..09559a64a2c 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -80,7 +80,7 @@ if ($action == 'addcontact' && $user->rights->expedition->creer) { if ($result > 0 && $id > 0) { - $result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["typecontact"], $_POST["source"]); + $result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), GETPOST('type') ? GETPOST('type') : GETPOST('typecontact'), GETPOST('source')); } if ($result >= 0) From cbf6fe1f6282e69fe04dd550cae646af3cade65c Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 3 Jan 2021 11:42:11 +0100 Subject: [PATCH 05/59] Clean code --- htdocs/expedition/contact.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 09559a64a2c..c5d74a2f39d 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -80,7 +80,9 @@ if ($action == 'addcontact' && $user->rights->expedition->creer) { if ($result > 0 && $id > 0) { - $result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), GETPOST('type') ? GETPOST('type') : GETPOST('typecontact'), GETPOST('source')); + $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); + $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); + $result = $objectsrc->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); } if ($result >= 0) From 50d2e2d16153345ac88e21892be2b50f0f1a7eb1 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 3 Jan 2021 12:21:20 +0100 Subject: [PATCH 06/59] Debug reception contacts and list --- htdocs/reception/contact.php | 9 +++------ htdocs/reception/list.php | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 908f7a441be..ad8811a4e1f 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -67,11 +67,6 @@ if ($id > 0 || !empty($ref)) $objectsrc = new CommandeFournisseur($db); $objectsrc->fetch($object->$typeobject->id); } - if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) - { - $objectsrc = new Propal($db); - $objectsrc->fetch($object->$typeobject->id); - } } @@ -83,7 +78,9 @@ if ($action == 'addcontact' && $user->rights->reception->creer) { if ($result > 0 && $id > 0) { - $result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["type"], $_POST["source"]); + $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); + $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); + $result = $objectsrc->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); } if ($result >= 0) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index ec08c7ba94a..30d31291a74 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -505,7 +505,7 @@ if ($resql) if ($search_town) $param .= "&search_town=".urlencode($search_town); if ($search_zip) $param .= "&search_zip=".urlencode($search_zip); if ($search_state) $param .= "&search_state=".urlencode($search_state); - if ($search_status) $param .= "&search_status=".urlencode($search_status); + if ($search_status != '') $param .= "&search_status=".urlencode($search_status); if ($search_country) $param .= "&search_country=".urlencode($search_country); if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); if ($search_ref_supplier) $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); From 236ff2d4e47ceb37c683031caabb0eb5769f8839 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 3 Jan 2021 12:26:10 +0100 Subject: [PATCH 07/59] indent --- htdocs/expedition/contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index c5d74a2f39d..d15e267b285 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -80,7 +80,7 @@ if ($action == 'addcontact' && $user->rights->expedition->creer) { if ($result > 0 && $id > 0) { - $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); + $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); $result = $objectsrc->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); } From 3cdcaa70d833d53285c6f762c79cbd55f0ee7986 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jan 2021 14:29:22 +0100 Subject: [PATCH 08/59] Fix warning --- scripts/contracts/email_expire_services_to_customers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index 596a5794d70..802f0b14434 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -155,7 +155,7 @@ if ($resql) { if ($targettype == 'contacts') { $oldcid = $obj->cid; } - $oldlang = $obj->lang; + $oldlang = $obj->default_lang; $oldtarget = (empty($obj->cfirstname) && empty($obj->clastname)) ? $obj->name : ($obj->clastname." ".$obj->cfirstname); $message = ''; $total = 0; From 156e08894b2a8576f1519a26e89203812bd2dc89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jan 2021 14:32:10 +0100 Subject: [PATCH 09/59] Missing module --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index dfeb209bfc3..7b8fa4546b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -403,8 +403,9 @@ script: php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log # Enable modules not enabled into original dump - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP > $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT > $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE > $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log echo $? cd - set +e From f462f68056dcc1dd443244854e8f15bdd3f24a88 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jan 2021 15:10:33 +0100 Subject: [PATCH 10/59] Code comment --- htdocs/core/db/DoliDB.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 837946ce706..8f2a9dc315e 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -89,7 +89,7 @@ abstract class DoliDB implements Database */ public function idate($param) { - // TODO GMT $param should be gmt, so we should add tzouptut to 'gmt' + // TODO $param should be gmt, so we should add tzouptut to 'gmt' instead of default 'tzserver' return dol_print_date($param, "%Y-%m-%d %H:%M:%S"); } @@ -285,7 +285,7 @@ abstract class DoliDB implements Database */ public function jdate($string, $gm = false) { - // TODO GMT must set param gm to true by default + // TODO $string should be converted into a GMT timestamp, so param gm should be set to true by default instead of false if ($string == 0 || $string == "0000-00-00 00:00:00") return ''; $string = preg_replace('/([^0-9])/i', '', $string); $tmp = $string.'000000'; From 8ad5dc81de8268eea6ed4e299a5fe4088712abc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jan 2021 15:13:29 +0100 Subject: [PATCH 11/59] GETPOST --- htdocs/comm/action/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 0709a2571ad..fcb33bd544a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -445,8 +445,8 @@ if (empty($reshook) && $action == 'update') $object->fetch_userassigned(); $object->oldcopy = clone $object; - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); - $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); + $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); + $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->label = GETPOST("label", "alphanohtml"); From e190b010d3aae2aa6c501d37003f6a921a36a924 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 3 Jan 2021 16:05:04 +0100 Subject: [PATCH 12/59] Fix dict contact type element list --- htdocs/core/lib/admin.lib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 7b3d66f9003..1bae8d0224f 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1382,7 +1382,14 @@ function complete_elementList_with_modules(&$elementList) if (!empty($objMod->module_parts['contactelement'])) { - $elementList[$objMod->name] = $langs->trans($objMod->name); + if(is_array($objMod->module_parts['contactelement'])) { + foreach ($objMod->module_parts['contactelement'] as $elem => $title) { + $elementList[$elem] = $langs->trans($title); + } + } + else { + $elementList[$objMod->name] = $langs->trans($objMod->name); + } } $j++; From b0738643fbfccdeede96fbc620fd524e78950398 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jan 2021 18:42:45 +0100 Subject: [PATCH 13/59] FIX Solve problem with TZ --- htdocs/comm/action/card.php | 14 ++++---- htdocs/comm/action/document.php | 2 +- htdocs/comm/action/index.php | 50 ++++++++++++++++----------- htdocs/comm/action/pertype.php | 38 ++++++++------------ htdocs/comm/action/peruser.php | 42 +++++++++------------- htdocs/contact/card.php | 41 +++------------------- htdocs/core/class/conf.class.php | 4 +++ htdocs/core/class/html.form.class.php | 25 +++++++++----- htdocs/core/lib/date.lib.php | 13 ++++--- htdocs/core/lib/functions.lib.php | 33 +++++++++++++----- htdocs/core/lib/functions2.lib.php | 32 ++++++++--------- htdocs/theme/eldy/global.inc.php | 2 +- 12 files changed, 141 insertions(+), 155 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index b1fb2d0b014..6499db671cb 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -462,10 +462,10 @@ if (empty($reshook) && $action == 'update') if (empty($cancel)) { $fulldayevent = GETPOST('fullday'); - $aphour = GETPOST('aphour'); - $apmin = GETPOST('apmin'); - $p2hour = GETPOST('p2hour'); - $p2min = GETPOST('p2min'); + $aphour = GETPOST('aphour', 'int'); + $apmin = GETPOST('apmin', 'int'); + $p2hour = GETPOST('p2hour', 'int'); + $p2min = GETPOST('p2min', 'int'); $percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status // Clean parameters @@ -1324,8 +1324,8 @@ if ($id > 0) { $percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); - $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); + $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); + $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->label = GETPOST("label", "alphanohtml"); @@ -1431,7 +1431,7 @@ if ($id > 0) // Full day event print ''.$langs->trans("EventOnFullDay").'fulldayevent ? ' checked' : '').'>'; - // Date start + // Date start - end print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart'); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 613ac76380e..5b4cc58bb08 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -208,7 +208,7 @@ if ($object->id > 0) if (!empty($object->userassigned)) // Now concat assigned users { // Restore array with key with same value than param 'id' - $tmplist1 = $object->userassigned; $tmplist2 = array(); + $tmplist1 = $object->userassigned; foreach ($tmplist1 as $key => $val) { if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']] = $val; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f5822669bba..b37762a644a 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -272,17 +272,17 @@ if (empty($action) || $action == 'show_month') $next_year = $next['year']; $next_month = $next['month']; - $max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year)); // Nb of days in previous month + $max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) - $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, true)) + 2; // date('w') is 0 fo sunday + $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 fo sunday $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1); if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) - $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year); + $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year, 'gmt'); $next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7; if ($next_day < 6) $next_day += 7; - $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year); + $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'gmt'); } if ($action == 'show_week') { @@ -303,7 +303,7 @@ if ($action == 'show_week') $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) - $firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year); + $firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt'); $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd'); $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); @@ -322,8 +322,8 @@ if ($action == 'show_day') $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) - $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year); - $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year); + $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year, 'gmt'); + $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'gmt'); } //print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day; //print 'xx'.$next_year.'-'.$next_month.'-'.$next_day; @@ -399,13 +399,14 @@ $param .= '&year='.$year.'&month='.$month.($day ? '&day='.$day : ''); -$tabactive = ''; +/*$tabactive = ''; if ($action == 'show_month') $tabactive = 'cardmonth'; if ($action == 'show_week') $tabactive = 'cardweek'; if ($action == 'show_day') $tabactive = 'cardday'; if ($action == 'show_list') $tabactive = 'cardlist'; if ($action == 'show_pertuser') $tabactive = 'cardperuser'; if ($action == 'show_pertype') $tabactive = 'cardpertype'; +*/ $paramnoaction = preg_replace('/action=[a-z_]+/', '', $param); @@ -704,9 +705,7 @@ if ($resql) } // Check values - if ($event->date_end_in_calendar < $firstdaytoshow || - $event->date_start_in_calendar >= $lastdaytoshow) - { + if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) { // This record is out of visible range } else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar = $firstdaytoshow; @@ -714,13 +713,15 @@ if ($resql) // Add an entry in actionarray for each day $daycursor = $event->date_start_in_calendar; - $annee = date('Y', $daycursor); - $mois = date('m', $daycursor); - $jour = date('d', $daycursor); + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); + //var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt')); + //var_dump($annee.'-'.$mois.'-'.$jour); // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); do { //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
'; @@ -787,9 +788,9 @@ if ($showbirthday) // Add an entry in actionarray for each day $daycursor = $event->date_start_in_calendar; - $annee = date('Y', $daycursor); - $mois = date('m', $daycursor); - $jour = date('d', $daycursor); + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); $loop = true; $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); @@ -870,9 +871,11 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) $event->label = $obj->lastname; } - $annee = date('Y', $event->date_start_in_calendar); - $mois = date('m', $event->date_start_in_calendar); - $jour = date('d', $event->date_start_in_calendar); + $daycursor = $event->date_start_in_calendar; + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); do { @@ -1530,6 +1533,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $annee = date('Y', $daykey); $mois = date('m', $daykey); $jour = date('d', $daykey); + if ($day == $jour && $month == $mois && $year == $annee) { foreach ($eventarray[$daykey] as $index => $event) @@ -1696,6 +1700,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $tmpyearend = date('Y', $event->date_end_in_calendar); $tmpmonthend = date('m', $event->date_end_in_calendar); $tmpdayend = date('d', $event->date_end_in_calendar); + /*var_dump($tmpyearstart.' '.$tmpmonthstart.' '.$tmpdaystart); + var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend); + var_dump($annee.' '.$mois.' '.$jour);*/ + // Hour start if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) { diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index c5f81e358cc..29b86b96868 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -265,13 +265,13 @@ $next_month = $month; $next_day = $day; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) -$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year); +$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt'); $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd'); //print $firstday.'-'.$first_month.'-'.$first_year; //print dol_print_date($firstdaytoshow,'dayhour'); //print dol_print_date($lastdaytoshow,'dayhour'); -$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); +$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt')); $tmpday = $first_day; $picto = 'calendarweek'; @@ -291,14 +291,6 @@ $param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='. //print 'x'.$param; -$tabactive = ''; -if ($action == 'show_month') $tabactive = 'cardmonth'; -if ($action == 'show_week') $tabactive = 'cardweek'; -if ($action == 'show_day') $tabactive = 'cardday'; -if ($action == 'show_list') $tabactive = 'cardlist'; -if ($action == 'show_peruser') $tabactive = 'cardperuser'; -if ($action == 'show_pertype') $tabactive = 'cardpertype'; - $paramnoaction = preg_replace('/action=[a-z_]+/', '', $param); $head = calendars_prepare_head($paramnoaction); @@ -598,13 +590,13 @@ if ($resql) // Add an entry in actionarray for each day $daycursor = $event->date_start_in_calendar; - $annee = date('Y', $daycursor); - $mois = date('m', $daycursor); - $jour = date('d', $daycursor); + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); do { //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
'; @@ -735,7 +727,7 @@ foreach ($typeofevents as $typeofevent) if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) $today = 1; if ($today) $style = 'cal_today_peruser'; - show_day_events_pertype($typeofevent, $tmpday, $tmpmonth, $tmpyear, $mont, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); + show_day_events_pertype($typeofevent, $tmpday, $tmpmonth, $tmpyear, 0, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); $i++; } @@ -848,8 +840,6 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $cases1 = array(); // Color first half hour $cases2 = array(); // Color second half hour - $curtime = dol_mktime(0, 0, 0, $month, $day, $year, false, 0); - $i = 0; $nummytasks = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array(); $ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day); @@ -859,16 +849,16 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s // We are in a particular day for $username, now we scan all events foreach ($eventarray as $daykey => $notused) { - $annee = date('Y', $daykey); - $mois = date('m', $daykey); - $jour = date('d', $daykey); - //print $annee.'-'.$mois.'-'.$jour.' '.$year.'-'.$month.'-'.$day."
\n"; + $annee = dol_print_date($daykey, '%Y', 'gmt'); + $mois = dol_print_date($daykey, '%m', 'gmt'); + $jour = dol_print_date($daykey, '%d', 'gmt'); if ($day == $jour && $month == $mois && $year == $annee) // Is it the day we are looking for when calling function ? { // Scan all event for this date foreach ($eventarray[$daykey] as $index => $event) { + //print $daykey.' '.$year.'-'.$month.'-'.$day.' -> '.$event->id.' '.$index.' '.$annee.'-'.$mois.'-'.$jour."
\n"; //var_dump($event); $keysofuserassigned = array_keys($event->userassigned); @@ -932,9 +922,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $newcolor = ''; //init if (empty($event->fulldayevent)) { - $a = dol_mktime((int) $h, 0, 0, $month, $day, $year, false, 0); - $b = dol_mktime((int) $h, 30, 0, $month, $day, $year, false, 0); - $c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, false, 0); + $a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'auto', 0); + $b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'auto', 0); + $c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'auto', 0); $dateendtouse = $event->date_end_in_calendar; if ($dateendtouse == $event->date_start_in_calendar) $dateendtouse++; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 3ddea1c0cbf..55e6725ba8d 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -268,7 +268,7 @@ $next_month = $next['month']; $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) -$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year); +$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt'); $nb_weeks_to_show = (!empty($conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER)) ? ((int) $conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER * 7) : 7; $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, $nb_weeks_to_show, 'd'); @@ -276,7 +276,7 @@ $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, $nb_weeks_to_show, 'd'); //print dol_print_date($firstdaytoshow,'dayhour'); //print dol_print_date($lastdaytoshow,'dayhour'); -$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); +$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt')); $tmpday = $first_day; $picto = 'calendarweek'; @@ -296,15 +296,6 @@ $param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='. //print 'x'.$param; - -$tabactive = ''; -if ($action == 'show_month') $tabactive = 'cardmonth'; -if ($action == 'show_week') $tabactive = 'cardweek'; -if ($action == 'show_day') $tabactive = 'cardday'; -if ($action == 'show_list') $tabactive = 'cardlist'; -if ($action == 'show_peruser') $tabactive = 'cardperuser'; -if ($action == 'show_pertype') $tabactive = 'cardpertype'; - $paramnoaction = preg_replace('/action=[a-z_]+/', '', $param); $head = calendars_prepare_head($paramnoaction); @@ -605,13 +596,13 @@ if ($resql) // Add an entry in actionarray for each day $daycursor = $event->date_start_in_calendar; - $annee = date('Y', $daycursor); - $mois = date('m', $daycursor); - $jour = date('d', $daycursor); + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); do { //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
'; @@ -680,7 +671,7 @@ while ($currentdaytoshow < $lastdaytoshow) { // Filter on hours print img_picto('', 'clock', 'class="fawidth30 inline-block paddingleft"'); print ''.$langs->trans("Hours").''; - print "\n".'
'; + print "\n".'
'; print ''; if (empty($conf->dol_use_jmobile)) print ' - '; else print '
'; @@ -852,6 +843,7 @@ while ($currentdaytoshow < $lastdaytoshow) { $tmpday = $tmparray['mday']; $tmpmonth = $tmparray['mon']; $tmpyear = $tmparray['year']; + //var_dump($curtime.' '.$tmpday.' '.$tmpmonth.' '.$tmpyear); $style = 'cal_current_month'; if ($iter_day == 6) $style .= ' cal_other_month'; @@ -859,7 +851,7 @@ while ($currentdaytoshow < $lastdaytoshow) { if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) $today = 1; if ($today) $style = 'cal_today_peruser'; - show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); + show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, 0, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); $i++; } @@ -977,8 +969,6 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases1 = array(); // Color first half hour $cases2 = array(); // Color second half hour - $curtime = dol_mktime(0, 0, 0, $month, $day, $year, false, 0); - $i = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array(); $ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day); @@ -989,16 +979,16 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & // We are in a particular day for $username, now we scan all events foreach ($eventarray as $daykey => $notused) { - $annee = date('Y', $daykey); - $mois = date('m', $daykey); - $jour = date('d', $daykey); - //print $annee.'-'.$mois.'-'.$jour.' '.$year.'-'.$month.'-'.$day."
\n"; + $annee = dol_print_date($daykey, '%Y', 'gmt'); + $mois = dol_print_date($daykey, '%m', 'gmt'); + $jour = dol_print_date($daykey, '%d', 'gmt'); if ($day == $jour && $month == $mois && $year == $annee) // Is it the day we are looking for when calling function ? { // Scan all event for this date foreach ($eventarray[$daykey] as $index => $event) { + //print $daykey.' '.$year.'-'.$month.'-'.$day.' -> '.$event->id.' '.$index.' '.$annee.'-'.$mois.'-'.$jour."
\n"; //var_dump($event); $keysofuserassigned = array_keys($event->userassigned); @@ -1088,9 +1078,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $newcolor = ''; //init if (empty($event->fulldayevent)) { - $a = dol_mktime((int) $h, 0, 0, $month, $day, $year, false, 0); - $b = dol_mktime((int) $h, 30, 0, $month, $day, $year, false, 0); - $c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, false, 0); + $a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'auto', 0); + $b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'auto', 0); + $c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'auto', 0); $dateendtouse = $event->date_end_in_calendar; if ($dateendtouse == $event->date_start_in_calendar) $dateendtouse++; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 752bdc4d642..0726e2c33e2 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -638,7 +638,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; } else { print ''; - print $form->select_company($socid, 'socid', '', 'SelectThirdParty'); + print img_picto('', 'company').$form->select_company($socid, 'socid', '', 'SelectThirdParty'); print ''; } } @@ -818,7 +818,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { print ''.$form->editfieldkey('Categories', 'contcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1); - print $form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%'); + print img_picto('', 'category').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%'); print ""; } @@ -965,7 +965,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; - print $form->select_company(GETPOST('socid', 'int') ?GETPOST('socid', 'int') : ($object->socid ? $object->socid : -1), 'socid', '', $langs->trans("SelectThirdParty")); + print img_picto('', 'company').$form->select_company(GETPOST('socid', 'int') ?GETPOST('socid', 'int') : ($object->socid ? $object->socid : -1), 'socid', '', $langs->trans("SelectThirdParty")); print ''; print ''; } @@ -1087,39 +1087,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } } } - // if (! empty($conf->socialnetworks->enabled)) - // { - // // Jabber ID - // if (! empty($conf->global->SOCIALNETWORKS_JABBER)) - // { - // print ''; - // print 'jabberid).'">'; - // } - // // Skype - // if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) - // { - // print ''; - // print 'skype).'">'; - // } - // // Twitter - // if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) - // { - // print ''; - // print 'twitter).'">'; - // } - // // Facebook - // if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - // { - // print ''; - // print 'facebook).'">'; - // } - // // LinkedIn - // if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) - // { - // print ''; - // print 'linkedin).'">'; - // } - // } // Visibility print ''; @@ -1155,7 +1122,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) foreach ($cats as $cat) { $arrayselected[] = $cat->id; } - print $form->multiselectarray('contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print img_picto('', 'category').$form->multiselectarray('contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); print ""; } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index a1800e03980..3191e5edd47 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -102,6 +102,8 @@ class Conf public $liste_limit; + public $tzuserinputkey = 'tzserver'; // Use 'tzuserrel' to always store date in GMT and show date in time zone of user. + /** * Constructor @@ -693,6 +695,8 @@ class Conf if (defined('MAIN_ANTIVIRUS_COMMAND')) $this->global->MAIN_ANTIVIRUS_COMMAND = constant('MAIN_ANTIVIRUS_COMMAND'); if (defined('MAIN_ANTIVIRUS_PARAM')) $this->global->MAIN_ANTIVIRUS_PARAM = constant('MAIN_ANTIVIRUS_PARAM'); + if (!empty($this->global->MAIN_TZUSERINPUTKEY)) $this->tzuserinputkey = $this->global->MAIN_TZUSERINPUTKEY; // 'tzserver' or 'tzuserrel' + // For backward compatibility if (isset($this->product)) $this->produit = $this->product; if (isset($this->facture)) $this->invoice = $this->facture; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4ed39694720..ed0511a8e1d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5531,13 +5531,18 @@ class Form * @param int $stepminutes Specify step for minutes between 1 and 30 * @param string $labeladddateof Label to use for the $adddateof parameter. * @param string $placeholder Placeholder + * @param mixed $gm 'auto', 'gmt' or 'tzserver' or 'tzuserrel' * @return string Html for selectDate * @see form_date(), select_month(), select_year(), select_dayofweek() */ - public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '', $placeholder = '') + public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '', $placeholder = '', $gm = 'auto') { global $conf, $langs; + if ($gm == 'auto') { + $gm = $conf->tzuserinputkey; + } + $retstring = ''; if ($prefix == '') $prefix = 're'; @@ -5553,7 +5558,11 @@ class Form if ($set_time === '' && $emptydate == 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $set_time = dol_now('tzuser') - (getServerTimeZoneInt('now') * 3600); // set_time must be relative to PHP server timezone + if ($gm == 'tzuser' || $gm == 'tzuserrel') { + $set_time = dol_now($gm); + } else { + $set_time = dol_now('tzuser') - (getServerTimeZoneInt('now') * 3600); // set_time must be relative to PHP server timezone + } } // Analysis of the pre-selection date @@ -5569,14 +5578,14 @@ class Form } elseif (strval($set_time) != '' && $set_time != -1) { // set_time est un timestamps (0 possible) - $syear = dol_print_date($set_time, "%Y"); - $smonth = dol_print_date($set_time, "%m"); - $sday = dol_print_date($set_time, "%d"); + $syear = dol_print_date($set_time, "%Y", $gm); + $smonth = dol_print_date($set_time, "%m", $gm); + $sday = dol_print_date($set_time, "%d", $gm); if ($orig_set_time != '') { - $shour = dol_print_date($set_time, "%H"); - $smin = dol_print_date($set_time, "%M"); - $ssec = dol_print_date($set_time, "%S"); + $shour = dol_print_date($set_time, "%H", $gm); + $smin = dol_print_date($set_time, "%M", $gm); + $ssec = dol_print_date($set_time, "%S", $gm); } else { $shour = ''; $smin = ''; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 163f6d85b6d..3a889367dc1 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -465,9 +465,10 @@ function dol_get_next_week($day, $week, $month, $year) * * @param int $year Year * @param int $month Month - * @param mixed $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. - * Exemple: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, a dol_print_date on it will return 1970-01-01 00:00:00 - * Exemple: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, a dol_print_date on it will return 1970-01-01 00:00:00 + * @param mixed $gm False or 0 or 'tzserver' = Return date to compare with server TZ, + * True or 1 or 'gmt' to compare with GMT date. + * Example: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, a dol_print_date on it will return 1970-01-01 00:00:00 + * Example: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, a dol_print_date on it will return 1970-01-01 00:00:00 * @return int Date for first day, '' if error */ function dol_get_first_day($year, $month = 1, $gm = false) @@ -481,7 +482,8 @@ function dol_get_first_day($year, $month = 1, $gm = false) * * @param int $year Year * @param int $month Month - * @param boolean $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. + * @param mixed $gm False or 0 or 'tzserver' = Return date to compare with server TZ, + * True or 1 or 'gmt' to compare with GMT date. * @return int Date for first day, '' if error */ function dol_get_last_day($year, $month = 12, $gm = false) @@ -529,7 +531,8 @@ function dol_get_first_hour($date) * @param int $day Day * @param int $month Month * @param int $year Year - * @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. + * @param mixed $gm False or 0 or 'tzserver' = Return date to compare with server TZ, + * True or 1 or 'gmt' to compare with GMT date. * @return array year,month,week,first_day,first_month,first_year,prev_day,prev_month,prev_year */ function dol_get_first_day_week($day, $month, $year, $gm = false) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ecfb46dc589..e1d64da77f1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1971,10 +1971,14 @@ function dol_strftime($fmt, $ts = false, $is_gmt = false) * * @see dol_mktime(), dol_stringtotime(), dol_getdate() */ -function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlangs = '', $encodetooutput = false) +function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = '', $encodetooutput = false) { global $conf, $langs; + if ($tzoutput == 'auto') { + $tzoutput = $conf->tzuserinputkey; + } + // Clean parameters $to_gmt = false; $offsettz = $offsetdst = 0; @@ -2184,17 +2188,23 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '') * @param int $year Year * @param mixed $gm True or 1 or 'gmt'=Input informations are GMT values * False or 0 or 'tzserver' = local to server TZ - * 'tzuser' = local to user TZ + * 'auto' + * 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented. + * 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user. * 'tz,TimeZone' = use specified timezone * @param int $check 0=No check on parameters (Can use day 32, etc...) * @return int|string Date as a timestamp, '' or false if error * @see dol_print_date(), dol_stringtotime(), dol_getdate() */ -function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'tzserver', $check = 1) +function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'auto', $check = 1) { global $conf; //print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -"; + if ($gm == 'auto') { + $gm = $conf->tzuserinputkey; + } + // Clean parameters if ($hour == -1 || empty($hour)) $hour = 0; if ($minute == -1 || empty($minute)) $minute = 0; @@ -2215,7 +2225,7 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'tzserve { $default_timezone = @date_default_timezone_get(); // Example 'Europe/Berlin' $localtz = new DateTimeZone($default_timezone); - } elseif ($gm === 'user' || $gm === 'tzuser') + } elseif ($gm === 'user' || $gm === 'tzuser' || $gm === 'tzuserrel') { // We use dol_tz_string first because it is more reliable. $default_timezone = (empty($_SESSION["dol_tz_string"]) ? @date_default_timezone_get() : $_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' @@ -2254,16 +2264,21 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'tzserve /** * Return date for now. In most cases, we use this function without parameters (that means GMT time). * - * @param string $mode 'gmt' => we return GMT timestamp, + * @param string $mode 'auto' + * 'gmt' => we return GMT timestamp, * 'tzserver' => we add the PHP server timezone - * 'tzref' => we add the company timezone - * 'tzuser' => we add the user timezone + * 'tzref' => we add the company timezone. Not implemented. + * 'tzuser' or 'tzuserrel' => we add the user timezone * @return int $date Timestamp */ -function dol_now($mode = 'gmt') +function dol_now($mode = 'auto') { $ret = 0; + if ($mode == 'auto') { + $mode = 'tzserver'; + } + if ($mode == 'gmt') $ret = time(); // Time for now at greenwich. elseif ($mode == 'tzserver') // Time for now with PHP server timezone added { @@ -2276,7 +2291,7 @@ function dol_now($mode = 'gmt') $tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time $ret=dol_now('gmt')+($tzsecond*3600); }*/ - elseif ($mode == 'tzuser') // Time for now with user timezone added + elseif ($mode == 'tzuser' || $mode == 'tzuserrel') // Time for now with user timezone added { //print 'time: '.time(); $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index a77f38f8f66..ffc79b8f4b4 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -246,8 +246,8 @@ function dol_print_object_info($object, $usetable = 0) print $langs->trans("DateCreation"); if ($usetable) print ''; else print ': '; - print dol_print_date($object->date_creation, 'dayhour'); - if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_creation + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); + print dol_print_date($object->date_creation, 'dayhour', 'tzserver'); + if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_creation, "dayhour", "tzuserrel").'  '.$langs->trans("ClientHour"); if ($usetable) print ''; else print '
'; } @@ -280,8 +280,8 @@ function dol_print_object_info($object, $usetable = 0) print $langs->trans("DateLastModification"); if ($usetable) print ''; else print ': '; - print dol_print_date($object->date_modification, 'dayhour'); - if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_modification + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); + print dol_print_date($object->date_modification, 'dayhour', 'tzserver'); + if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_modification, "dayhour", "tzuserrel").'  '.$langs->trans("ClientHour"); if ($usetable) print ''; else print '
'; } @@ -314,8 +314,8 @@ function dol_print_object_info($object, $usetable = 0) print $langs->trans("DateValidation"); if ($usetable) print ''; else print ': '; - print dol_print_date($object->date_validation, 'dayhour'); - if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_validation + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); + print dol_print_date($object->date_validation, 'dayhour', 'tzserver'); + if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_validation, "dayhour", 'tzserver').'  '.$langs->trans("ClientHour"); if ($usetable) print ''; else print '
'; } @@ -348,8 +348,8 @@ function dol_print_object_info($object, $usetable = 0) print $langs->trans("DateApprove"); if ($usetable) print ''; else print ': '; - print dol_print_date($object->date_approve, 'dayhour'); - if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_approve + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); + print dol_print_date($object->date_approve, 'dayhour', 'tzserver'); + if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_approve, "dayhour", 'tzserver').'  '.$langs->trans("ClientHour"); if ($usetable) print ''; else print '
'; } @@ -376,8 +376,8 @@ function dol_print_object_info($object, $usetable = 0) print $langs->trans("DateApprove2"); if ($usetable) print ''; else print ': '; - print dol_print_date($object->date_approve2, 'dayhour'); - if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_approve2 + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); + print dol_print_date($object->date_approve2, 'dayhour', 'tzserver'); + if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_approve2, "dayhour", 'tzserver').'  '.$langs->trans("ClientHour"); if ($usetable) print ''; else print '
'; } @@ -412,8 +412,8 @@ function dol_print_object_info($object, $usetable = 0) print $langs->trans("DateClosing"); if ($usetable) print ''; else print ': '; - print dol_print_date($object->date_closing, 'dayhour'); - if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_closing + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); + print dol_print_date($object->date_closing, 'dayhour', 'tzserver'); + if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_closing, "dayhour", 'tzserver').'  '.$langs->trans("ClientHour"); if ($usetable) print ''; else print '
'; } @@ -446,8 +446,8 @@ function dol_print_object_info($object, $usetable = 0) print $langs->trans("DateConciliating"); if ($usetable) print ''; else print ': '; - print dol_print_date($object->date_rappro, 'dayhour'); - if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_rappro + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); + print dol_print_date($object->date_rappro, 'dayhour', 'tzserver'); + if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_rappro, "dayhour", 'tzserver').'  '.$langs->trans("ClientHour"); if ($usetable) print ''; else print '
'; } @@ -459,8 +459,8 @@ function dol_print_object_info($object, $usetable = 0) print $langs->trans("DateLastSend"); if ($usetable) print ''; else print ': '; - print dol_print_date($object->date_envoi, 'dayhour'); - if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_envoi + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); + print dol_print_date($object->date_envoi, 'dayhour', 'tzserver'); + if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_envoi, "dayhour", 'tzserver').'  '.$langs->trans("ClientHour"); if ($usetable) print ''; else print '
'; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 1c807b7b2b1..79e327dd818 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -35,7 +35,7 @@ --oddevencolor: #202020; --colorboxstatsborder: #e0e0e0; --dolgraphbg: rgba(255,255,255,0); - --fieldrequiredcolor: #700040; + --fieldrequiredcolor: #400030; --colortextbacktab: #; --colorboxiconbg: #eee; --refidnocolor:#444; From 5792995b1fc67b3c00116af7057c9da77c60171c Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 3 Jan 2021 22:52:36 +0100 Subject: [PATCH 14/59] Fix function call --- htdocs/modulebuilder/template/myobject_card.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 84fa7594e11..8f482d5f6f2 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -471,20 +471,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Back to draft if ($object->status == $object::STATUS_VALIDATED) { - if ($permissiontoadd) { - print ''.$langs->trans("SetToDraft").''; - } + print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd); } - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', $permissiontoadd); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd); // Validate if ($object->status == $object::STATUS_DRAFT) { - print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', $permissiontoadd); + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd); } // Clone - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', $permissiontoadd); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', '', $permissiontoadd); /* if ($permissiontoadd) @@ -506,7 +504,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea */ // Delete (need delete permission, or if draft, just need create/modify permission) - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); } print '
'."\n"; } From e5fbb963a397cf1a2c0accd15ed1565cb1fa6008 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 3 Jan 2021 22:53:04 +0100 Subject: [PATCH 15/59] Fix picto in template --- htdocs/modulebuilder/template/myobject_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 8db58b7ad4e..541d971013f 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -158,7 +158,7 @@ if ($object->id > 0) $head = myobjectPrepareHead($object); - print dol_get_fiche_head($head, 'agenda', $langs->trans("MyObject"), -1, 'object_'.$object->picto); + print dol_get_fiche_head($head, 'agenda', $langs->trans("MyObject"), -1, $object->picto); // Object card // ------------------------------------------------------------ From 433ddd61a7a02ca7c8cfdc389bdf4d0ce3093425 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 4 Jan 2021 06:57:10 +0100 Subject: [PATCH 16/59] FIX: Loan - Missing fk_bank when we add payment with schedule --- htdocs/loan/payment/payment.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 1793854631e..8eb8f1b61fc 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -155,11 +155,12 @@ if ($action == 'add_payment') $payment->chid = $chid; $payment->datep = $datepaid; $payment->label = $loan->label; - $payment->amount_capital = $pay_amount_capital; - $payment->amount_insurance = $pay_amount_interest; - $payment->amount_interest = $pay_amount_insurance; + $payment->amount_capital = $pay_amount_capital; + $payment->amount_insurance = $pay_amount_interest; + $payment->amount_interest = $pay_amount_insurance; + $payment->fk_bank = GETPOST('accountid', 'int'); $payment->paymenttype = GETPOST('paymenttype', 'int'); - $payment->num_payment = GETPOST('num_payment'); + $payment->num_payment = GETPOST('num_payment'); $payment->note_private = GETPOST('note_private', 'restricthtml'); $payment->note_public = GETPOST('note_public', 'restricthtml'); From 8f4fc046ec3d9221175e30cd80b899adc8e80da1 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 4 Jan 2021 06:57:56 +0100 Subject: [PATCH 17/59] FIX: Loan - amount insurance / interest is inverted --- htdocs/loan/payment/payment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 8eb8f1b61fc..8a6e1e9c9ba 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -156,8 +156,8 @@ if ($action == 'add_payment') $payment->datep = $datepaid; $payment->label = $loan->label; $payment->amount_capital = $pay_amount_capital; - $payment->amount_insurance = $pay_amount_interest; - $payment->amount_interest = $pay_amount_insurance; + $payment->amount_insurance = $pay_amount_insurance; + $payment->amount_interest = $pay_amount_interest; $payment->fk_bank = GETPOST('accountid', 'int'); $payment->paymenttype = GETPOST('paymenttype', 'int'); $payment->num_payment = GETPOST('num_payment'); From d892d8c3c792f1bc29db570b02f17c629b5d9ea4 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Mon, 4 Jan 2021 10:59:45 +0100 Subject: [PATCH 18/59] FIX: Bad dates filtering in the ticket list causes sql error --- htdocs/ticket/list.php | 63 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 8e3b73346b7..90cd1fd1ec9 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2013-2018 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2018 Regis Houssin - * Copyright (C) 2019 Juanjo Menent + * Copyright (C) 2019-2021 Juanjo Menent * Copyright (C) 2019-2020 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -57,6 +57,14 @@ $project_ref = GETPOST('project_ref', 'alpha'); $search_societe = GETPOST('search_societe', 'alpha'); $search_fk_project = GETPOST('search_fk_project', 'int') ?GETPOST('search_fk_project', 'int') : GETPOST('projectid', 'int'); $search_fk_status = GETPOST('search_fk_statut', 'array'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_dateread_start = dol_mktime(0, 0, 0, GETPOST('search_dateread_startmonth', 'int'), GETPOST('search_dateread_startday', 'int'), GETPOST('search_dateread_startyear', 'int')); +$search_dateread_end = dol_mktime(23, 59, 59, GETPOST('search_dateread_endmonth', 'int'), GETPOST('search_dateread_endday', 'int'), GETPOST('search_dateread_endyear', 'int')); +$search_dateclose_start = dol_mktime(0, 0, 0, GETPOST('search_dateclose_startmonth', 'int'), GETPOST('search_dateclose_startday', 'int'), GETPOST('search_dateclose_startyear', 'int')); +$search_dateclose_end = dol_mktime(23, 59, 59, GETPOST('search_dateclose_endmonth', 'int'), GETPOST('search_dateclose_endday', 'int'), GETPOST('search_dateclose_endyear', 'int')); + + $mode = GETPOST('mode', 'alpha'); // Load variable for pagination @@ -178,6 +186,12 @@ if (empty($reshook)) } $toselect = ''; $search_array_options = array(); + $search_date_start = ''; + $search_date_end = ''; + $search_dateread_start = ''; + $search_dateread_end = ''; + $search_dateclose_start = ''; + $search_dateclose_end = ''; } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) @@ -356,6 +370,14 @@ foreach ($search as $key => $val) if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2); +if ($search_date_start) $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'"; +if ($search_date_end) $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'"; +if ($search_dateread_start) $sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'"; +if ($search_dateread_end) $sql .= " AND t.date_read <= '".$db->idate($search_dateread_end)."'"; +if ($search_dateclose_start) $sql .= " AND t.date_close >= '".$db->idate($search_dateclose_start)."'"; +if ($search_dateclose_end) $sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'"; + + if (!$user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { $sql .= " AND (t.fk_user_assign = ".$user->id; if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql .= " OR t.fk_user_create = ".$user->id; @@ -549,6 +571,13 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; if ($socid) $param .= '&socid='.urlencode($socid); if ($projectid) $param .= '&projectid='.urlencode($projectid); +if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); +if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); +if ($search_dateread_start) $param .= '&search_dateread_start='.urlencode($search_dateread_start); +if ($search_dateread_end) $param .= '&search_dateread_end='.urlencode($search_dateread_end); +if ($search_dateclose_start) $param .= '&search_dateclose_start='.urlencode($search_dateclose_start); +if ($search_dateclose_end) $param .= '&search_dateclose_end='.urlencode($search_dateclose_end); + // List of mass actions available $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), @@ -667,6 +696,38 @@ foreach ($object->fields as $key => $val) { print ''; } + elseif ($key == "datec" || $key == 'date_read' || $key == 'date_close'){ + print ''; + print '
'; + print $langs->trans('From').' '; + + switch ($key){ + case 'datec': + print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1); + break; + case 'date_read': + print $form->selectDate($search_dateread_start ?: -1, 'search_dateread_start', 0, 0, 1); + break; + case 'date_close': + print $form->selectDate($search_dateclose_start ?: -1, 'search_dateclose_start', 0, 0, 1); + } + + print '
'; + print '
'; + print $langs->trans('to').' '; + switch ($key){ + case 'datec': + print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1); + break; + case 'date_read': + print $form->selectDate($search_dateread_end ?: -1, 'search_dateread_end', 0, 0, 1); + break; + case 'date_close': + print $form->selectDate($search_dateclose_end ?: -1, 'search_dateclose_end', 0, 0, 1); + } + print '
'; + print ''; + } else { print ''; } From 82395d578be2a305937a18bed883392b95900d16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jan 2021 11:56:56 +0100 Subject: [PATCH 19/59] Update myobject_card.php --- htdocs/modulebuilder/template/myobject_card.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 8f482d5f6f2..aab8f2609b5 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -478,7 +478,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Validate if ($object->status == $object::STATUS_DRAFT) { - print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd); + if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd); + } else { + $langs->load("errors"); + //print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0); + print ''.$langs->trans("Validate").''; + } } // Clone From 30cd0412095c536ff70ca0af8ffe197e9318f40d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 4 Jan 2021 10:57:18 +0000 Subject: [PATCH 20/59] Fixing style errors. --- htdocs/modulebuilder/template/myobject_card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index aab8f2609b5..ef7a6da8d66 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -478,13 +478,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Validate if ($object->status == $object::STATUS_DRAFT) { - if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { + if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd); - } else { - $langs->load("errors"); + } else { + $langs->load("errors"); //print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0); - print ''.$langs->trans("Validate").''; - } + print ''.$langs->trans("Validate").''; + } } // Clone From bb22f2ccaf18b8f50abe25a9477ff1f8188a4320 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jan 2021 12:02:41 +0100 Subject: [PATCH 21/59] Update admin.lib.php --- htdocs/core/lib/admin.lib.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 1bae8d0224f..8fddc46cca3 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1380,14 +1380,12 @@ function complete_elementList_with_modules(&$elementList) $dirmod[$i] = $dir; //print "x".$modName." ".$orders[$i]."\n
"; - if (!empty($objMod->module_parts['contactelement'])) - { - if(is_array($objMod->module_parts['contactelement'])) { + if (!empty($objMod->module_parts['contactelement'])) { + if (is_array($objMod->module_parts['contactelement'])) { foreach ($objMod->module_parts['contactelement'] as $elem => $title) { $elementList[$elem] = $langs->trans($title); } - } - else { + } else { $elementList[$objMod->name] = $langs->trans($objMod->name); } } From 66bd040d2cc02a2764705c910c02138d1d2d97a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jan 2021 12:08:14 +0100 Subject: [PATCH 22/59] Fix regression --- htdocs/core/db/DoliDB.class.php | 2 +- htdocs/core/db/pgsql.class.php | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 307864fcf81..e900af925f4 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -90,7 +90,7 @@ abstract class DoliDB implements Database */ public function idate($param, $gm = 'tzserver') { - // TODO $param should be gmt, so we should add tzouptut to 'gmt' instead of default 'tzserver' + // TODO $param should be gmt, so we should add $gm to 'gmt' instead of default 'tzserver' return dol_print_date($param, "%Y-%m-%d %H:%M:%S", $gm); } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index b393945eeb3..fe80f1ad28e 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -685,18 +685,6 @@ class DoliDBPgsql extends DoliDB return pg_escape_string($stringtoencode); } - /** - * Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field. - * Function to use to build INSERT, UPDATE or WHERE predica - * - * @param string $param Date TMS to convert - * @return string Date in a string YYYY-MM-DD HH:MM:SS - */ - public function idate($param) - { - return dol_print_date($param, "%Y-%m-%d %H:%M:%S"); - } - /** * Format a SQL IF * From 8df5928e9c5b92e6574352ce847fe226c7b3e52d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jan 2021 13:32:43 +0100 Subject: [PATCH 23/59] Fix selection must depends on enabled modules --- htdocs/compta/accounting-files.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 734d21b1c87..02098e986ba 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -549,16 +549,17 @@ if (!empty($conf->multicompany->enabled) && is_object($mc)) print '
'; $listofchoices = array( - 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills'), - 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills'), - 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips'), - 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'), - 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'), - 'selectsocialcontributions'=>array('label'=>'SocialContributions'), - 'selectvariouspayment'=>array('label'=>'VariousPayment'), - 'selectloanspayment'=>array('label'=>'PaymentLoan'), + 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => !empty($conf->facture->enabled)), + 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled)), + 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !empty($conf->expensereport->enabled)), + 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled)), + 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => !empty($conf->tax->enabled)), + 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries', 'enabled' => !empty($conf->salaries->enabled)), + 'selectvariouspayment'=>array('label'=>'VariousPayment', 'enabled' => !empty($conf->banque->enabled)), + 'selectloanspayment'=>array('label'=>'PaymentLoan', 'enabled' => !empty($conf->loan->enabled)), ); foreach ($listofchoices as $choice => $val) { + if (empty($val['enabled'])) continue; // list not qualified $checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : ''); print '
'; } From ef76c067e07334f746a1c727ea79c7270fe9b9ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jan 2021 13:37:21 +0100 Subject: [PATCH 24/59] Add limit to 25000 --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e1d64da77f1..3bf47b7da7a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4615,7 +4615,7 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be } if ((int) $limit > 0 && empty($hideselectlimit)) { - $pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000'; + $pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000,25000:25000'; //$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported //$pagesizechoices.=',2:2'; if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES; From 7141fa315ea7968e885bee55a4674435342bc192 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jan 2021 15:32:18 +0100 Subject: [PATCH 25/59] Debug v13 --- htdocs/compta/paiement.php | 6 +++--- htdocs/core/tpl/object_discounts.tpl.php | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index a03fd03ffef..83393a52cb6 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -710,10 +710,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Price print ''.price($sign * $objp->total_ttc).''; - // Received or paid back + // Received + already paid print ''.price($sign * $paiement); - if ($creditnotes) print '+'.price($creditnotes); - if ($deposits) print '+'.price($deposits); + if ($creditnotes) print '+'.price($creditnotes).''; + if ($deposits) print '+'.price($deposits).''; print ''; // Remain to take or to pay back diff --git a/htdocs/core/tpl/object_discounts.tpl.php b/htdocs/core/tpl/object_discounts.tpl.php index 7bc98d12278..293ea333682 100644 --- a/htdocs/core/tpl/object_discounts.tpl.php +++ b/htdocs/core/tpl/object_discounts.tpl.php @@ -62,7 +62,11 @@ if ($absolute_discount > 0) { $text .= ' ('.$addabsolutediscount.')'; } - print '
'.$text.'
'; + if ($isNewObject) { + print '
'.$text; + } else { + print '
'.$text.'
'; + } } else { // Discount available of type fixed amount (not credit note) $more = '('.$addabsolutediscount.')'; @@ -85,7 +89,11 @@ if ($absolute_creditnote > 0) { $text .= '('.$addabsolutediscount.')'; } - print '
'.$text.'
'; + if ($isNewObject) { + print '
'.$text; + } else { + print '
'.$text.'
'; + } } else { // We can add a credit note on a down payment or standard invoice or situation invoice // There is credit notes discounts available $more = $isInvoice && !$isNewObject ? ' ('.$viewabsolutediscount.')' : ''; From c58451dbb6aeaea9833d66365e475e2dec250a67 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jan 2021 16:07:54 +0100 Subject: [PATCH 26/59] Code comment --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 47c025b0c0a..af0a625875f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6845,6 +6845,7 @@ abstract class CommonObject break; } + // Output value of the current field if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { $extrafields_collapse_num = ''; From f8fe7b5a0e2305060722fe2e377ffce465a3e3d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jan 2021 16:38:09 +0100 Subject: [PATCH 27/59] FIX #15851 --- htdocs/user/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index e7a8a31af4e..9a1a06f5a17 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -345,7 +345,7 @@ if ($catid > 0) $sql .= " AND cu.fk_categorie = ".((int) $catid); if ($catid == -2) $sql .= " AND cu.fk_categorie IS NULL"; if ($search_categ > 0) $sql .= " AND cu.fk_categorie = ".$db->escape($search_categ); if ($search_categ == -2) $sql .= " AND cu.fk_categorie IS NULL"; -if ($mode == 'employee' && empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")"; +if ($mode == 'employee' && empty($user->rights->salaries->readall)) $sql .= " AND u.fk_user IN (".join(',', $childids).")"; // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks From 9cea8b82440536c0c5ed548ef1ce2dca693bd711 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 4 Jan 2021 16:07:47 +0100 Subject: [PATCH 28/59] FIX: Loan - Payment in not integrate in bank due to a problem with the type of payment --- htdocs/loan/class/paymentloan.class.php | 2 +- htdocs/loan/payment/payment.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index dc6d72094b2..34acb06f9ce 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -475,7 +475,7 @@ class PaymentLoan extends CommonObject // Insert payment into llx_bank $bank_line_id = $acc->addline( $this->datep, - $this->fk_typepayment, // Payment mode ID or code ("CHQ or VIR for example") + $this->paymenttype, // Payment mode ID or code ("CHQ or VIR for example") $label, $total, $this->num_payment, diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 8a6e1e9c9ba..0c0574c15b4 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -152,7 +152,7 @@ if ($action == 'add_payment') // Create a line of payments $payment = new PaymentLoan($db); - $payment->chid = $chid; + $payment->chid = $chid; $payment->datep = $datepaid; $payment->label = $loan->label; $payment->amount_capital = $pay_amount_capital; @@ -176,7 +176,7 @@ if ($action == 'add_payment') if (!$error) { - $result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', ''); + $result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', $payment->fk_bank, '', ''); if (!$result > 0) { setEventMessages($payment->error, $payment->errors, 'errors'); From 40645ea24da8006409cad9246280d42b9a05b653 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jan 2021 10:39:53 +0100 Subject: [PATCH 29/59] Fix load lang --- htdocs/core/boxes/box_fournisseurs.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 44e2682585e..7d1c72b3036 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -137,10 +137,13 @@ class box_fournisseurs extends ModeleBoxes $line++; } - if ($num == 0) $this->info_box_contents[$line][0] = array( - 'td' => 'class="center opacitymedium"', - 'text'=>$langs->trans("NoRecordedSuppliers"), - ); + if ($num == 0) { + $langs->load("suppliers"); + $this->info_box_contents[$line][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoRecordedSuppliers"), + ); + } $this->db->free($result); } else { From 5e92ed0dcdcc6d1002015e6acedf38ff6ea1a627 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jan 2021 10:44:28 +0100 Subject: [PATCH 30/59] Fix load lang --- htdocs/commande/list.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5fa4a3adfaa..885081e84a1 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page -$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks')); +$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products')); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 4494db8c21d..28c0673ef17 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills')); +$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills', 'products')); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index e680e55868a..2b77801fee3 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -$langs->loadLangs(array("orders", "sendings", 'deliveries', 'companies', 'compta', 'bills', 'projects', 'suppliers')); +$langs->loadLangs(array("orders", "sendings", 'deliveries', 'companies', 'compta', 'bills', 'projects', 'suppliers', 'products')); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); From 2e04aa4e0352a86901c28f969ce297d5ce6daacf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jan 2021 11:29:40 +0100 Subject: [PATCH 31/59] Fix warning --- scripts/invoices/email_unpaid_invoices_to_customers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index a569a34d0fa..5d4d3ff3e64 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -153,7 +153,7 @@ if ($resql) { if ($targettype == 'contacts') { $oldcid = $obj->cid; } - $oldlang = $obj->lang; + $oldlang = $obj->default_lang; $oldtarget = (empty($obj->cfirstname) && empty($obj->clastname)) ? $obj->name : ($obj->clastname." ".$obj->cfirstname); $message = ''; $total = 0; From 4b45c5e72365aa61eab5ab4487fd0df2d5f25bac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jan 2021 12:29:13 +0100 Subject: [PATCH 32/59] Trans --- htdocs/core/lib/project.lib.php | 8 +++++--- htdocs/langs/en_US/projects.lang | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 74e624ca7cb..3c8a79a9249 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2526,13 +2526,15 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '') if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) { $badgeClass .= 'badge-danger'; - if (empty($tooltip)) $tooltip = $task->progress.'% < '.$langs->trans("Expected").' '.$progressCalculated.'%'; + if (empty($tooltip)) { + $tooltip = $task->progress.'% < '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%'; + } } elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10% $badgeClass .= 'badge-warning'; - if (empty($tooltip)) $tooltip = $task->progress.'% < '.$langs->trans("Expected").' '.$progressCalculated.'%'; + if (empty($tooltip)) $tooltip = $task->progress.'% < '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%'; } else { $badgeClass .= 'badge-success'; - if (empty($tooltip)) $tooltip = $task->progress.'% >= '.$langs->trans("Expected").' '.$progressCalculated.'%'; + if (empty($tooltip)) $tooltip = $task->progress.'% >= '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%'; } } } diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index f5f6bf3dd9d..2aedbd53377 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -85,6 +85,7 @@ ProgressCalculated=Progress on consumption WhichIamLinkedTo=which I'm linked to WhichIamLinkedToProject=which I'm linked to project Time=Time +TimeConsumed=Consumed ListOfTasks=List of tasks GoToListOfTimeConsumed=Go to list of time consumed GanttView=Gantt View From 8dc4e5929c694cf712aa4a0b215081d2b17464a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jan 2021 12:43:57 +0100 Subject: [PATCH 33/59] Fix var not defined --- htdocs/comm/action/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index b37762a644a..dc0ada64eb3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -214,6 +214,7 @@ llxHeader('', $langs->trans("Agenda"), $help_url); $form = new Form($db); $companystatic = new Societe($db); $contactstatic = new Contact($db); +$userstatic = new User($db); $now = dol_now(); $nowarray = dol_getdate($now); @@ -1071,7 +1072,6 @@ if (count($listofextcals)) { $event->id = $icalevent['UID']; $event->ref = $event->id; - $userId = $userstatic->findUserIdByEmail($namecal); if (!empty($userId) && $userId > 0) { From 9764f086d30c5cd29292ffe5a8ae3c16a56bedd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jan 2021 14:27:42 +0100 Subject: [PATCH 34/59] Fix Field code is mandatory but not field note in tax dictionary --- htdocs/admin/dict.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d06f8a2ce31..05149030f9e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -692,7 +692,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position' if ((!GETPOSTISSET($value) || GETPOST($value) == '') && (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory - && (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 + && ($id != 10 || ($listfield[$f] != 'code' && $listfield[$f] != 'note')) // Field code and note is not mandatory for dictionary table 10 ) ) { $ok = 0; @@ -757,9 +757,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"] = ''; // If empty, we force to null if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"] = ''; // If empty, we force to null if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - if ($id == 10 && GETPOSTISSET("code")) // Spaces are not allowed into code + if ($id == 10 && GETPOSTISSET("code")) // Spaces are not allowed into code for tax dictionary { - $_POST["code"] = preg_replace('/\s/', '', $_POST["code"]); + $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', $_POST["code"]); } // If check ok and action add, add the line @@ -826,8 +826,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $result = $db->query($sql); if ($result) // Add is ok { - setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); - $_POST = array('id'=>$id); // Clean $_POST array, we keep only + setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); + + // Clean $_POST array, we keep only id of dictionary + if ($id == 10 && GETPOST('country', 'int') > 0) { + $search_country_id = GETPOST('country', 'int'); + } + $_POST = array('id'=>$id); } else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); From ca6899c1386201c479fea276f44364e08d9e2d3b Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 5 Jan 2021 16:11:46 +0100 Subject: [PATCH 35/59] FIX right to show VAT rate in product list --- htdocs/product/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index cc12bc73349..2478e75057c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -180,7 +180,7 @@ $arrayfields = array( 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire))), 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), - 'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), + 'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), 'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), @@ -332,7 +332,7 @@ if ($search_label) $sql .= natural_search('p.label', $search_label); if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode); if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell != -1) $sql .= " AND p.tosell = ".$db->escape($search_tosell); if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy != -1) $sql .= " AND p.tobuy = ".$db->escape($search_tobuy); -if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate); +if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate, 1); if (dol_strlen($canvas) > 0) $sql .= " AND p.canvas = '".$db->escape($canvas)."'"; if ($catid > 0) $sql .= " AND cp.fk_categorie = ".$catid; if ($catid == -2) $sql .= " AND cp.fk_categorie IS NULL"; @@ -774,7 +774,7 @@ if ($resql) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['p.tva_tx']['checked'])) { - print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], 'p.tva_tx', "", $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['p.pmp']['checked'])) { print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); From a370ba1bbc57d234c52cd8a9282e70ed75e94e65 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 5 Jan 2021 18:09:59 +0100 Subject: [PATCH 36/59] Update check.php $arrayphpminversionwarning = array(5, 6, 0); --- htdocs/install/check.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 93b99680b92..06e9e5147e9 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -77,7 +77,7 @@ if (!empty($useragent)) // Check PHP version $arrayphpminversionerror = array(5, 5, 0); -$arrayphpminversionwarning = array(5, 5, 0); +$arrayphpminversionwarning = array(5, 6, 0); if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) // Minimum to use (error if lower) { print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); @@ -105,7 +105,7 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) // We must keep $_GE } -// Check if sessions enabled +// Check if session_id is enabled if (!function_exists("session_id")) { print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions")."
\n"; @@ -115,7 +115,7 @@ if (!function_exists("session_id")) } -// Check if GD supported (we need GD for image conversion) +// Check if GD is supported (we need GD for image conversion) if (!function_exists("imagecreate")) { $langs->load("errors"); @@ -126,7 +126,7 @@ if (!function_exists("imagecreate")) } -// Check if Curl supported +// Check if Curl is supported if (!function_exists("curl_init")) { $langs->load("errors"); @@ -145,7 +145,7 @@ if (!function_exists("easter_date")) } -// Check if UTF8 supported +// Check if UTF8 is supported if (!function_exists("utf8_encode")) { $langs->load("errors"); @@ -201,7 +201,7 @@ if ($memmaxorig != '') } -// If config file present and filled +// If that config file is present and filled clearstatcache(); if (is_readable($conffile) && filesize($conffile) > 8) { From 346bddf32f44fbb4e334ecb6c31f028340e75600 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 5 Jan 2021 17:41:24 +0100 Subject: [PATCH 37/59] Update ChangeLog some minor changings add info #15180 sorting add info #14725 --- ChangeLog | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b3b3c97157..322372ab8a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,7 +16,7 @@ NEW: Accountancy - add options to disable binding on sales, purchases & expense NEW: Accountancy balance - add a menu entry to show subtotal by group NEW: Accountancy - change menu disposition NEW: Accountancy - on transfers, select the periodicity by default -NEW: Accountancy - Add export for Gestinum (v3 & v5) +NEW: Accountancy - Add export for Gestinum (v3 & v5) #15180 NEW: new currency rate editor NEW: Solve blocking feature. Can increase stock of a Kit without changing subproduct stock. NEW: add a widget to show the customers with outstanding limits reached @@ -163,7 +163,7 @@ NEW: Support for Samba4 AD NEW: TakePOS connector compatibility with RECEIPT PRINTERS module NEW: TakePOS Gift Receipt NEW: TakePOS Multicurrency compatibility -NEW: the global header of a website can also have dynamic content +NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725 NEW: Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late NEW: ticket classification on create from email collector @@ -173,11 +173,11 @@ NEW: VAT rate for Angola #15606 NEW: VAT and juridical status for Algeria NEW: VAT report - Invert constant to show by default zero VAT in reports NEW: website page fields selection -NEW: Weighing Scale compatibility with TakePOS connector +NEW: website - global header of a website can also have dynamic content NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user -NEW: add clone button on miscellaneous payment -NEW: #15065 Add option to put the product label in bold in the PDF templates if configured -NEW: Add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF." +NEW: add clone button on miscellaneous payment +NEW: add option to put the product label in bold in the PDF templates if configured #15065 +NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF." For developers: From 7161ca9e70d00dd4f55294df753f4b01892fb77f Mon Sep 17 00:00:00 2001 From: quentin Date: Wed, 6 Jan 2021 09:54:02 +0100 Subject: [PATCH 38/59] FIX issue 15659 : Missing test if conf is enabled --- htdocs/societe/card.php | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ea121acc4c7..052d681b0a0 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1542,12 +1542,12 @@ else //} // Supplier - //if ($object->fournisseur) { - print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); - print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%"); - print ""; - //} + if (!empty($conf->fournisseur->enabled)) { + print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); + print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%"); + print ""; + } } // Multicurrency @@ -2180,17 +2180,19 @@ else print ""; // Supplier - print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; - print ''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); - $c = new Categorie($db); - $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); - $arrayselected = array(); - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; + if (!empty($conf->fournisseur->enabled)) { + print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; + print ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); + $arrayselected = array(); + foreach($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print ""; } - print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); - print ""; } // Multicurrency @@ -2560,7 +2562,7 @@ else } // Supplier - if ($object->fournisseur) { + if (!empty($conf->fournisseur->enabled) && $object->fournisseur) { print ''.$langs->trans("SuppliersCategoriesShort").''; print ''; print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); From 2f932330d3d4ed6561385d089189de4bd4be5aa1 Mon Sep 17 00:00:00 2001 From: quentin Date: Wed, 6 Jan 2021 10:10:39 +0100 Subject: [PATCH 39/59] FIX wrong name for search status param --- htdocs/expedition/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 999bde3fb32..a7f44bf483e 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -340,7 +340,7 @@ if ($resql) if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); - if ($search_status != '') $param .= '&viewstatut='.urlencode($search_status); + if ($search_status != '') $param .= '&search_status='.urlencode($search_status); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From 6f15683709893d12fcc0e0a78259f91230534c9f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 6 Jan 2021 10:42:48 +0100 Subject: [PATCH 40/59] FIX create ticket : thirdparty/contact notification #15629 --- ...terface_50_modTicket_TicketEmail.class.php | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 6bd33c5b2f9..22ad6415b40 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -251,11 +251,21 @@ class InterfaceTicketEmail extends DolibarrTriggers if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { $sendto = ''; - if (empty($user->socid) && empty($user->email)) { - $object->fetch_thirdparty(); - $sendto = $object->thirdparty->email; - } else { - $sendto = $user->email; + + //if contact selected send to email's contact else send to email's thirdparty + + $contactid = GETPOST('contactid', 'alpha'); + + if(!empty($contactid)) { + $contact = new Contact($this->db); + $res = $contact->fetch($contactid); + } + + if($res > 0 && !empty($contact->email) && !empty($contact->statut)) { + $sendto = $contact->email; + } elseif (!empty($object->fk_soc)) { + $object->fetch_thirdparty(); + $sendto = $object->thirdparty->email; } if ($sendto) { From 92a4314779f7c33994779670820dfe33849b75ba Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 6 Jan 2021 10:45:54 +0100 Subject: [PATCH 41/59] Fix security mecanism generating data loss --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c6fd80f72d0..fccb019a730 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -602,6 +602,7 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti $out = trim($out); // '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '../' is dangerous because it allows dir transversals + $out = str_replace('"', "''", trim($out)); if (preg_match('/"/', $out)) $out = ''; elseif (preg_match('/\.\.\//', $out)) $out = ''; $out = dol_string_nohtmltag($out); From 4b9bb824d0bd9e8af3d857dc451d4770cf8fb7c4 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 6 Jan 2021 11:16:51 +0100 Subject: [PATCH 42/59] FIX balance starting and ending fiscal month #14197 --- htdocs/accountancy/bookkeeping/balance.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 375b17e3b96..5550c837812 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -87,6 +87,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) } else { $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $year_start = dol_print_date(dol_now(), '%Y'); + if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year $year_end = $year_start + 1; $month_end = $month_start - 1; if ($month_end < 1) From 50b5226d10547030c0a2cb151935251bb6ec6937 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 6 Jan 2021 12:40:38 +0100 Subject: [PATCH 43/59] FIX #15465 External user sees last 5 shipments to other customers in the dashboard --- htdocs/core/boxes/box_shipments.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index 4603450b482..dfd726ade22 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -103,10 +103,11 @@ class box_shipments extends ModeleBoxes $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sc.fk_user = ".$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id; else $sql .= " ORDER BY e.date_delivery, e.ref DESC "; $sql .= $this->db->plimit($max, 0); From 19ee163f31e29857e611b7c57268a968d2203ddd Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 6 Jan 2021 13:54:51 +0100 Subject: [PATCH 44/59] Fix add ticket on elementList --- htdocs/admin/dict.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index cce441c4052..92675cbc883 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -577,6 +577,7 @@ if ($id == 11) // 'contract' => $langs->trans('Contract'), 'project' => $langs->trans('Project'), 'project_task' => $langs->trans('Task'), + 'ticket' => $langs->trans('Ticket'), 'agenda' => $langs->trans('Agenda'), 'dolresource' => $langs->trans('Resource'), // old deprecated @@ -1454,6 +1455,7 @@ if ($id) foreach ($fieldlist as $field => $value) { //var_dump($fieldlist); + $class = ''; $showfield = 1; $valuetoshow = $obj->{$fieldlist[$field]}; From e44b14364a30f116cdebec4bc2453b096c00163b Mon Sep 17 00:00:00 2001 From: quentin Date: Wed, 6 Jan 2021 14:17:06 +0100 Subject: [PATCH 45/59] FIX useless tracking number displayed on pdf if empty --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 506e72ba1b0..7fc3d622254 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -373,14 +373,15 @@ class pdf_rouget extends ModelePdfExpedition $tab_top_alt = $tab_top; $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); - $tab_top_alt = $pdf->GetY(); //$tab_top_alt += 1; // Tracking number if (!empty($object->tracking_number)) { + $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); + $tab_top_alt = $pdf->GetY(); + $object->getUrlTrackingStatus($object->tracking_number); if (!empty($object->tracking_url)) { From ca557cfacd7ba5e4adad85c8ff9254de8020848d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 6 Jan 2021 13:22:35 +0000 Subject: [PATCH 46/59] Fixing style errors. --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 7fc3d622254..af2cbbca8cc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -381,7 +381,7 @@ class pdf_rouget extends ModelePdfExpedition { $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); $tab_top_alt = $pdf->GetY(); - + $object->getUrlTrackingStatus($object->tracking_number); if (!empty($object->tracking_url)) { From 6f05ba4db9be54f88986b99f387e5748e4b39e55 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 6 Jan 2021 14:26:40 +0100 Subject: [PATCH 47/59] NEW : Added of doActions hooks in bank/line.php and bank/transfer.php --- htdocs/compta/bank/line.php | 6 +++++- htdocs/compta/bank/transfer.php | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 33f7f3a0352..467f6b7b78b 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -58,11 +58,15 @@ if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype); if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) accessforbidden(); +$hookmanager->initHooks(array('bankline')); + /* * Actions */ - +$parameters = array('socid' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($cancel) { if ($backtopage) diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 7e1b7fd0567..5aeec4f444c 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -40,11 +40,14 @@ if (!$user->rights->banque->transfer) $action = GETPOST('action', 'aZ09'); $error = 0; +$hookmanager->initHooks(array('banktransfer')); /* * Actions */ - +$parameters = array('socid' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($action == 'add') { $langs->load("errors"); From e8ba4de83248206d4f2fb6116d5e8c816ae360b9 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 6 Jan 2021 14:46:56 +0100 Subject: [PATCH 48/59] Fix #14353 --- 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 ef8bd79b519..c063e636a91 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1107,7 +1107,7 @@ if (empty($reshook)) $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); - if (GETPOST('price_ht') != '') + if (GETPOST('price_ht') != '' || GETPOST('multicurrency_subprice') != '') { $up = price2num(GETPOST('price_ht')); $price_base_type = 'HT'; From 5164a96aa0e52adaeeab3c8f414c8cba955b68da Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 6 Jan 2021 15:35:33 +0100 Subject: [PATCH 49/59] Fix #15829 --- htdocs/societe/class/societe.class.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ee91363dba1..bc808391562 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3650,7 +3650,7 @@ class Societe extends CommonObject public function create_from_member(Adherent $member, $socname = '', $socalias = '', $customercode = '') { // phpcs:enable - global $user, $langs; + global $conf, $user, $langs; dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); @@ -3683,6 +3683,22 @@ class Societe extends CommonObject $result = $this->create($user); if ($result >= 0) { + // Auto-create contact on thirdparty creation + if (!empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT)) + { + // Fill fields needed by contact + $this->name_bis = $member->lastname; + $this->firstname = $member->firstname; + $this->civility_id = $member->civility_id; + dol_syslog("We ask to create a contact/address too", LOG_DEBUG); + $result = $this->create_individual($user); + if ($result < 0) + { + setEventMessages($this->error, $this->errors, 'errors'); + return -1; + } + } + $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; $sql .= " SET fk_soc=".$this->id; $sql .= " WHERE rowid=".$member->id; From 99b977a08e892e240f167837d8ff2a39538bc729 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 6 Jan 2021 15:38:30 +0100 Subject: [PATCH 50/59] add categories params on llxHeader filter --- htdocs/product/list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 5e50925fbbe..dc56f607841 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -466,7 +466,11 @@ if ($resql) } } - llxHeader('', $title, $helpurl, ''); + foreach ($searchCategoryProductList as $searchCategoryProduct) { + $paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); + } + llxHeader('', $title, $helpurl, '',0,0,"","",$paramsCat); + // Displays product removal confirmation if (GETPOST('delprod')) { From f9ae8acbc76d11749d43d899181936aef4bbeba0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 6 Jan 2021 14:47:54 +0000 Subject: [PATCH 51/59] Fixing style errors. --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index dc56f607841..b3b4e3be2dd 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -469,7 +469,7 @@ if ($resql) foreach ($searchCategoryProductList as $searchCategoryProduct) { $paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); } - llxHeader('', $title, $helpurl, '',0,0,"","",$paramsCat); + llxHeader('', $title, $helpurl, '', 0, 0, "", "", $paramsCat); // Displays product removal confirmation From cf324f75d734f8dc7a83e0d54e16902331656f1a Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 6 Jan 2021 16:01:19 +0100 Subject: [PATCH 52/59] Fix bom line unit display #13831 --- htdocs/bom/tpl/objectline_create.tpl.php | 1 - htdocs/bom/tpl/objectline_edit.tpl.php | 1 - htdocs/bom/tpl/objectline_view.tpl.php | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index eeffb625381..20d523ff512 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -116,7 +116,6 @@ if ($conf->global->PRODUCT_USE_UNITS) { $coldisplay++; print ''; - print $form->selectUnits($line->fk_unit, "units"); print ''; } diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 3840f495dea..31a4b1ee008 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -112,7 +112,6 @@ if ($conf->global->PRODUCT_USE_UNITS) { $coldisplay++; print ''; - print $form->selectUnits($line->fk_unit, "units"); print ''; } diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index e1e94dc2076..c9770465458 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -82,7 +82,7 @@ print ''; if ($conf->global->PRODUCT_USE_UNITS) { print ''; - $label = $line->getLabelOfUnit('short'); + $label = $tmpproduct->getLabelOfUnit('short'); if ($label !== '') { print $langs->trans($label); } From 2be2cdaadf67bdebb3b09e40fdfbeace137dba98 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 6 Jan 2021 16:06:03 +0100 Subject: [PATCH 53/59] fix style errors --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index dc56f607841..b3b4e3be2dd 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -469,7 +469,7 @@ if ($resql) foreach ($searchCategoryProductList as $searchCategoryProduct) { $paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); } - llxHeader('', $title, $helpurl, '',0,0,"","",$paramsCat); + llxHeader('', $title, $helpurl, '', 0, 0, "", "", $paramsCat); // Displays product removal confirmation From 7372a1828325be5d0e3880a0fe3989f374349ecc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jan 2021 19:56:49 +0100 Subject: [PATCH 54/59] Update box_shipments.php --- htdocs/core/boxes/box_shipments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index dfd726ade22..2621ab3637c 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -106,7 +106,7 @@ class box_shipments extends ModeleBoxes if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1"; - if($user->socid) $sql.= " AND s.rowid = ".$user->socid; + if ($user->socid > 0) $sql.= " AND s.rowid = ".$user->socid; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id; else $sql .= " ORDER BY e.date_delivery, e.ref DESC "; $sql .= $this->db->plimit($max, 0); From 170814c718cfdad0615753029853f72f6e0442e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jan 2021 20:21:22 +0100 Subject: [PATCH 55/59] Fix missing rollback --- htdocs/societe/class/societe.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2fcfaecb19e..8de2ab23baf 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3699,6 +3699,7 @@ class Societe extends CommonObject if ($result < 0) { setEventMessages($this->error, $this->errors, 'errors'); + $this->db->rollback(); return -1; } } From ef8021467b337bd0a117264c3f3c7b14a3ff4ff8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jan 2021 20:41:40 +0100 Subject: [PATCH 56/59] FIX #15892 #15017 --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3bf47b7da7a..054d932a1f1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -680,7 +680,8 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = if (!is_array($out)) { // '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '../' is dangerous because it allows dir transversals - $out = str_replace(array('"', '"', '../'), '', trim($out)); + $out = str_replace(array('"', '"'), "''", trim($out)); + $out = str_replace(array('../'), '', trim($out)); // keep lines feed $out = dol_string_nohtmltag($out, 0); } From 123bd8172192a6771374178525450c73f167919e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jan 2021 20:42:18 +0100 Subject: [PATCH 57/59] Trim no more required --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 054d932a1f1..4ded311f7ed 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -681,7 +681,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = // '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '../' is dangerous because it allows dir transversals $out = str_replace(array('"', '"'), "''", trim($out)); - $out = str_replace(array('../'), '', trim($out)); + $out = str_replace(array('../'), '', $out); // keep lines feed $out = dol_string_nohtmltag($out, 0); } From ca11ea98399e74e564ab28ba9a9bbd69476be475 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jan 2021 20:47:57 +0100 Subject: [PATCH 58/59] Fix phpunit Signed-off-by: Laurent Destailleur --- test/phpunit/SecurityTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 3eda8354113..d2405e9609d 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -294,20 +294,20 @@ class SecurityTest extends PHPUnit\Framework\TestCase $result=GETPOST("param1", 'int'); print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, 222); + $this->assertEquals($result, 222, 'Test on param1 with no 3rd param'); $result=GETPOST("param1", 'int', 2); print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, 333); + $this->assertEquals($result, 333, 'Test on param1 with 3rd param = 2'); // Test alpha $result=GETPOST("param2", 'alpha'); print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, $_GET["param2"]); + $this->assertEquals($result, $_GET["param2"], 'Test on param2'); $result=GETPOST("param3", 'alpha'); // Must return string sanitized from char " print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, 'na/b#e(pr)qq-rr\cc'); + $this->assertEquals($result, '\'\'na/b#e(pr)qq-rr\cc', 'Test on param3'); $result=GETPOST("param4", 'alpha'); // Must return string sanitized from ../ print __METHOD__." result=".$result."\n"; @@ -346,7 +346,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase // With alphanohtml, we must convert the html entities like n $result=GETPOST("param8", 'alphanohtml'); print __METHOD__." result=".$result."\n"; - $this->assertEquals("HackerassertEquals("Hacker Date: Wed, 6 Jan 2021 21:29:58 +0100 Subject: [PATCH 59/59] FIX #15388 #15891 --- htdocs/bom/bom_card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 591e9a69d88..b28cf459094 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -185,6 +185,8 @@ if (empty($reshook)) unset($_POST['disable_stock_change']); $object->fetchLines(); + + $object->calculateCosts(); } } } @@ -227,6 +229,8 @@ if (empty($reshook)) unset($_POST['disable_stock_change']); $object->fetchLines(); + + $object->calculateCosts(); } } }