From 88b5594af31f54bed54d0c89e61930f78c48404e Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 31 Aug 2022 09:59:24 +0200 Subject: [PATCH 001/101] FIX: Preview button position on documents list (case when the file is too long) --- htdocs/core/class/html.formfile.class.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 349b05416aa..6fe10788c54 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -850,6 +850,7 @@ class FormFile // Show file name with link to download $out .= ''; + $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param, 'paddingright')."\n"; $out .= 'trans("File").': '.$file["name"]); $out .= dol_trunc($file["name"], 150); - $out .= ''."\n"; - $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param); + $out .= ''; $out .= ''; // Show file size @@ -1307,6 +1307,11 @@ class FormFile // File name print ''; + // Preview link + if (!$editline) { + print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity), 'paddingright') . "\n"; + } + // Show file name with link to download //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; @@ -2097,9 +2098,10 @@ class FormFile * @param string $relativepath Relative path of docs * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) * @param string $param More param on http links + * @param string $moreclass Add more class to class style * @return string $out Output string with HTML */ - public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '') + public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '', $moreclass = '') { global $langs, $conf; @@ -2107,7 +2109,7 @@ class FormFile if ($conf->browser->layout != 'phone' && !empty($conf->use_javascript_ajax)) { $urladvancedpreview = getAdvancedPreviewUrl($modulepart, $relativepath, 1, $param); // Return if a file is qualified for preview. if (count($urladvancedpreview)) { - $out .= ''; + $out .= ''; //$out.= ''; if (empty($ruleforpicto)) { //$out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); From 30ce816c0cc3b7cab2d2364bf26a6e576cbfcd17 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 1 Sep 2022 17:07:20 +0200 Subject: [PATCH 002/101] Fix: On a not configured personalized accounting group, the group code would be used in the formula. --- htdocs/compta/resultat/result.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 635531ab86b..b6ac4c1b33f 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -405,6 +405,9 @@ if ($modecompta == 'CREANCES-DETTES') { // Set $cpts with array of accounts in the category/group $cpts = $AccCat->getCptsCat($cat['rowid']); + // We should loop over empty $cpts array, else the category _code_ is used in the formula, which leads to wrong result if the code is a number. + if (empty($cpts)) $cpts[] = array(); + $arrayofaccountforfilter = array(); foreach ($cpts as $i => $cpt) { // Loop on each account. @@ -477,7 +480,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Label of group print ''; print dol_escape_htmltag($cat['label']); - if (count($cpts) > 0) { // Show example of 5 first accounting accounts + if (count($cpts) > 0 && !empty($cpts[0])) { // Show example of 5 first accounting accounts $i = 0; foreach ($cpts as $cpt) { if ($i > 5) { From ce78e0164aeb2ca4dd3a77861ce28c2b5fcd9ec3 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 1 Sep 2022 17:19:08 +0200 Subject: [PATCH 003/101] Fix: When a custom compta group would be unactive, its code would stay in the computed formula. This would lead to wrong totals if the code is a number. --- htdocs/accountancy/class/accountancycategory.class.php | 7 ++++--- htdocs/compta/resultat/result.php | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 77d10516daa..5aec2d48fa2 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -785,12 +785,13 @@ class AccountancyCategory // extends CommonObject } /** - * Return list of custom groups that are active + * Return list of custom groups. * * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups + * @param int $active 1= active, 0=not active * @return array|int Array of groups or -1 if error */ - public function getCats($categorytype = -1) + public function getCats($categorytype = -1, $active = 1) { global $conf, $mysoc; @@ -801,7 +802,7 @@ class AccountancyCategory // extends CommonObject $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; - $sql .= " WHERE c.active = 1"; + $sql .= " WHERE c.active = " . (int) $active; $sql .= " AND c.entity = ".$conf->entity; if ($categorytype >= 0) { $sql .= " AND c.category_type = 1"; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index b6ac4c1b33f..93fc7d57203 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -274,6 +274,7 @@ if ($modecompta == 'CREANCES-DETTES') { } elseif ($modecompta == "BOOKKEEPING") { // Get array of all report groups that are active $cats = $AccCat->getCats(); // WARNING: Computed groups must be after group they include + $unactive_cats = $AccCat->getCats(-1, 0); /* $sql = 'SELECT DISTINCT t.numero_compte as nb FROM '.MAIN_DB_PREFIX.'accounting_bookkeeping as t, '.MAIN_DB_PREFIX.'accounting_account as aa'; @@ -325,6 +326,11 @@ if ($modecompta == 'CREANCES-DETTES') { $vars = array(); + // Unactive categories have a total of 0 to be used in the formula. + foreach($unactive_cats as $un_cat) { + $vars[$un_cat['code']] = 0; + } + // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { $vars[$code] = $det['NP']; From f1ce73263915d5d24197fe956ab9d6164006fb49 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 1 Sep 2022 18:06:35 +0200 Subject: [PATCH 004/101] empty commit to re-launch stickler From 16e1c7ea713bbb8bef343b5c784b3722ebc473eb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 2 Sep 2022 10:25:12 +0200 Subject: [PATCH 005/101] Update result.php Fixed Stickler --- htdocs/compta/resultat/result.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 93fc7d57203..378e594c9db 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -327,7 +327,7 @@ if ($modecompta == 'CREANCES-DETTES') { $vars = array(); // Unactive categories have a total of 0 to be used in the formula. - foreach($unactive_cats as $un_cat) { + foreach ($unactive_cats as $un_cat) { $vars[$un_cat['code']] = 0; } From 831420b8e1bf7ab5445adf76837511110788c364 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 2 Sep 2022 10:42:27 +0200 Subject: [PATCH 006/101] FIX: bad bookmark save --- htdocs/bookmarks/bookmarks.lib.php | 45 +++++++++++++++++++----------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index f8daff1cd14..ca0f1486db1 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -36,28 +36,39 @@ function printDropdownBookmarksList() $langs->load("bookmarks"); + $authorized_var=array('page','limit','optioncss','contextpage'); $url = $_SERVER["PHP_SELF"]; - + $url_param=array(); if (!empty($_SERVER["QUERY_STRING"])) { - $url .= (dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''); - } else { - global $sortfield, $sortorder; - $tmpurl = ''; - // No urlencode, all param $url will be urlencoded later - if ($sortfield) { - $tmpurl .= ($tmpurl ? '&' : '').'sortfield='.urlencode($sortfield); - } - if ($sortorder) { - $tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder); - } - if (is_array($_POST)) { - foreach ($_POST as $key => $val) { - if (preg_match('/^search_/', $key) && $val != '') { - $tmpurl .= ($tmpurl ? '&' : '').http_build_query(array($key => $val)); + if (is_array($_GET)) { + foreach ($_GET as $key => $val) { + if ($val != '') { + $url_param[$key]=http_build_query(array($key => $val)); } } } - $url .= ($tmpurl ? '?'.$tmpurl : ''); + } + global $sortfield, $sortorder; + $tmpurl = ''; + // No urlencode, all param $url will be urlencoded later + if ($sortfield) { + $tmpurl .= ($tmpurl ? '&' : '').'sortfield='.urlencode($sortfield); + } + if ($sortorder) { + $tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder); + } + if (is_array($_POST)) { + foreach ($_POST as $key => $val) { + if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var)) + && $val != '' + && !array_key_exists($key, $url_param)) { + $url_param[$key]=http_build_query(array($key => $val)); + } + } + } + $url .= ($tmpurl ? '?'.$tmpurl : ''); + if (!empty($url_param)) { + $url .= '&'.implode('&', $url_param); } $searchForm = ''."\n"; From 8a44b1ab2bfd964e2e2e6b00558b4bc394d0ee05 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 10:55:15 +0200 Subject: [PATCH 007/101] Update bookmarks.lib.php --- htdocs/bookmarks/bookmarks.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index ca0f1486db1..72fc0a9b51e 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -36,7 +36,7 @@ function printDropdownBookmarksList() $langs->load("bookmarks"); - $authorized_var=array('page','limit','optioncss','contextpage'); + $authorized_var=array('limit','optioncss','contextpage'); $url = $_SERVER["PHP_SELF"]; $url_param=array(); if (!empty($_SERVER["QUERY_STRING"])) { From 9d85eb1b7f828e682de7fe100ba7135d53a32500 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 10:57:47 +0200 Subject: [PATCH 008/101] Update bookmarks.lib.php --- htdocs/bookmarks/bookmarks.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 72fc0a9b51e..8eef3396eaa 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -43,7 +43,7 @@ function printDropdownBookmarksList() if (is_array($_GET)) { foreach ($_GET as $key => $val) { if ($val != '') { - $url_param[$key]=http_build_query(array($key => $val)); + $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); } } } @@ -62,7 +62,7 @@ function printDropdownBookmarksList() if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var)) && $val != '' && !array_key_exists($key, $url_param)) { - $url_param[$key]=http_build_query(array($key => $val)); + $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); } } } From 0d9e595f0ef277e7e470f54839e8b1b20c3df477 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 19:43:48 +0200 Subject: [PATCH 009/101] Fix profile to export categories --- htdocs/core/modules/modCategorie.class.php | 42 +++++++++++++--------- htdocs/langs/en_US/categories.lang | 1 + 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index c3b7f256b4b..905392aa996 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -164,8 +164,9 @@ class modCategorie extends DolibarrModules $typeexample .= ($typeexample ? " / " : "")."11=Website page"; } - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel"); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'pcat.label'=>'Text'); + // Definition of vars + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel"); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text'); $this->export_entities_array[$r] = array(); // We define here only fields that use another picto $this->export_help_array[$r] = array('cat.type'=>$typeexample); @@ -181,8 +182,8 @@ class modCategorie extends DolibarrModules $this->export_icon[$r] = $this->picto; $this->export_enabled[$r] = '!empty($conf->product->enabled) || !empty($conf->service->abled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export")); - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label'); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 'p.label'=>'Text'); + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label'); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.label'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'); // We define here only fields that use another picto $keyforselect = 'product'; @@ -192,6 +193,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cp.fk_product'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON extra.fk_object = p.rowid'; @@ -206,7 +208,7 @@ class modCategorie extends DolibarrModules $this->export_enabled[$r] = '!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire")); $this->export_fields_array[$r] = array( - 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", + 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_fournisseur'=>"SupplierCode", 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", @@ -214,7 +216,7 @@ class modCategorie extends DolibarrModules 't.libelle'=>'ThirdPartyType' ); $this->export_TypeFields_array[$r] = array( - 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', + 'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.fournisseur'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_fournisseur'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", @@ -236,6 +238,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cf ON cf.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cf.fk_soc'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object'; @@ -252,7 +255,7 @@ class modCategorie extends DolibarrModules $this->export_enabled[$r] = '!empty($conf->societe->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "export")); $this->export_fields_array[$r] = array( - 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", + 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", @@ -260,7 +263,7 @@ class modCategorie extends DolibarrModules 't.libelle'=>'ThirdPartyType', 'pl.code'=>'ProspectLevel', 'st.code'=>'ProspectStatus' ); $this->export_TypeFields_array[$r] = array( - 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', + 'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", @@ -282,6 +285,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cs.fk_soc'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object'; @@ -299,8 +303,8 @@ class modCategorie extends DolibarrModules $this->export_icon[$r] = $this->picto; $this->export_enabled[$r] = '!empty($conf->adherent->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "export")); - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname'); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname'); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto $keyforselect = 'adherent'; @@ -310,6 +314,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_member as cm ON cm.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'adherent as p ON p.rowid = cm.fk_member'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON cat.rowid = extra.fk_object '; @@ -324,7 +329,7 @@ class modCategorie extends DolibarrModules $this->export_enabled[$r] = '!empty($conf->societe->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "contact", "export")); $this->export_fields_array[$r] = array( - 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", + 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid' => 'ContactId', 'civ.label' => 'UserTitle', 'p.lastname' => 'LastName', 'p.firstname' => 'Firstname', 'p.address' => 'Address', 'p.zip' => 'Zip', 'p.town' => 'Town', 'c.code' => 'CountryCode', 'c.label' => 'Country', 'p.birthday' => 'DateOfBirth', 'p.poste' => 'PostOrFunction', @@ -335,8 +340,8 @@ class modCategorie extends DolibarrModules 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email" ); $this->export_TypeFields_array[$r] = array( - 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', - 'civ.label' => 'List:c_civility:label:label', 'p.lastname' => 'Text', 'p.firstname' => 'Text', + 'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', + 'civ.label' => 'List:c_civility:label:label', 'p.rowid'=>'Numeric', 'p.lastname' => 'Text', 'p.firstname' => 'Text', 'p.address' => 'Text', 'p.zip' => 'Text', 'p.town' => 'Text', 'c.code' => 'Text', 'c.label' => 'List:c_country:label:label', 'p.birthday' => 'Date', 'p.poste' => 'Text', 'p.phone' => 'Text', 'p.phone_perso' => 'Text', 'p.phone_mobile' => 'Text', 'p.fax' => 'Text', 'p.email' => 'Text', @@ -363,6 +368,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_contact as cc ON cc.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'socpeople as p ON p.rowid = cc.fk_socpeople'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; @@ -381,8 +387,8 @@ class modCategorie extends DolibarrModules $this->export_icon[$r] = $this->picto; $this->export_enabled[$r] = '!empty($conf->projet->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("projet", "export")); - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name"); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"List:societe:nom:rowid", 's.nom'=>"Text"); + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name"); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 's.rowid'=>"List:societe:nom:rowid", 's.nom'=>"Text"); $this->export_entities_array[$r] = array('p.rowid'=>'project', 'p.ref'=>'project', 's.rowid'=>"company", 's.nom'=>"company"); // We define here only fields that use another picto $keyforselect = 'projet'; @@ -392,6 +398,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_project as cp ON cp.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'projet as p ON p.rowid = cp.fk_project'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON extra.fk_object = p.rowid'; @@ -406,8 +413,8 @@ class modCategorie extends DolibarrModules $this->export_icon[$r] = $this->picto; $this->export_enabled[$r] = '!empty($conf->user->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("user", "export")); - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'TechnicalID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname'); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'UserID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname'); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'user', 'p.login'=>'user', 'p.lastname'=>'user', 'p.firstname'=>'user'); // We define here only fields that use another picto $keyforselect = 'user'; @@ -417,6 +424,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_user as cu ON cu.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'user as p ON p.rowid = cu.fk_user'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON extra.fk_object = p.rowid'; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index a2d05767cae..5330730ad3a 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -67,6 +67,7 @@ StockCategoriesShort=Warehouse tags/categories ThisCategoryHasNoItems=This category does not contain any items. CategId=Tag/category id ParentCategory=Parent tag/category +ParentCategoryID=ID of parent tag/category ParentCategoryLabel=Label of parent tag/category CatSupList=List of vendors tags/categories CatCusList=List of customers/prospects tags/categories From 7fe9784ddb184d8c7a4438fe5e2291ca5ded2273 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 3 Sep 2022 12:55:54 +0200 Subject: [PATCH 010/101] fix: better global declaration --- htdocs/bookmarks/bookmarks.lib.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 8eef3396eaa..696545f324c 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -29,9 +29,9 @@ */ function printDropdownBookmarksList() { - global $conf, $user, $db, $langs; + global $conf, $user, $db, $langs, $sortfield, $sortorder; - require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; + require_once DOL_DOCUMENT_ROOT.'/boo, kmarks/class/bookmark.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; $langs->load("bookmarks"); @@ -48,7 +48,6 @@ function printDropdownBookmarksList() } } } - global $sortfield, $sortorder; $tmpurl = ''; // No urlencode, all param $url will be urlencoded later if ($sortfield) { From d5665e220e3ed88874fce45921513ba2e57c8112 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 3 Sep 2022 13:00:24 +0200 Subject: [PATCH 011/101] fix: better global declaration --- htdocs/bookmarks/bookmarks.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 696545f324c..f983e25f1da 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -31,7 +31,7 @@ function printDropdownBookmarksList() { global $conf, $user, $db, $langs, $sortfield, $sortorder; - require_once DOL_DOCUMENT_ROOT.'/boo, kmarks/class/bookmark.class.php'; + require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; $langs->load("bookmarks"); From db966495b1b9f28a6e7c1710ec18e793106ebe86 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Mon, 29 Aug 2022 15:57:13 +0200 Subject: [PATCH 012/101] fix #21941 call_trigger better fix #21941 : trigger nearest the code that justify its execution --- htdocs/core/ajax/onlineSign.php | 9 +++++++++ htdocs/public/onlinesign/newonlinesign.php | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 67c3c989a3a..3ec4cfa0f20 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -212,6 +212,15 @@ if ($action == "importSignature") { $db->commit(); $response = "success"; setEventMessages("PropalSigned", null, 'warnings'); + if (method_exists($object, 'call_trigger')) { + //customer is not a user !?! so could we use same user as validation ? + $user = new User($db); + $user->fetch($object->user_valid_id); + $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); + if ($result < 0) { + $error++; + } + } } else { $db->rollback(); $error++; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index a3ad1eaf645..1d90339a0ac 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -168,6 +168,15 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') { $message = 'refused'; setEventMessages("PropalRefused", null, 'warnings'); + if (method_exists($object, 'call_trigger')) { + //customer is not a user !?! so could we use same user as validation ? + $user = new User($db); + $user->fetch($object->user_valid_id); + $result = $object->call_trigger('PROPAL_CLOSE_REFUSED', $user); + if ($result < 0) { + $error++; + } + } } else { $db->rollback(); } @@ -459,6 +468,7 @@ if ($action == "dosign" && empty($cancel)) { print '
'; if ($message == 'refused') { print ''.$langs->trans("PropalRefused").''; + } else { print ''.$langs->trans("PropalAlreadyRefused").''; } From 8e06c988878aa83d10f8f1ad0b47f7afa3cedffc Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 3 Sep 2022 12:02:29 +0000 Subject: [PATCH 013/101] Fixing style errors. --- htdocs/public/onlinesign/newonlinesign.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 1d90339a0ac..e379853ed91 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -468,7 +468,6 @@ if ($action == "dosign" && empty($cancel)) { print '
'; if ($message == 'refused') { print ''.$langs->trans("PropalRefused").''; - } else { print ''.$langs->trans("PropalAlreadyRefused").''; } From c5b3df23baa79aeae32831ae2adb7446b9666aab Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 4 Sep 2022 04:49:09 +0200 Subject: [PATCH 014/101] FIX Dictionary - Display error on >cache_vatrates --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index eab0942ee4e..8ea30ef3b93 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1963,7 +1963,7 @@ if ($id) { } elseif ($value == 'fk_tva') { foreach ($form->cache_vatrates as $key => $Tab) { if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow) { - $valuetoshow = $form->cache_vatrates[$key]['libtva']; + $valuetoshow = $form->cache_vatrates[$key]['label']; break; } } From a542c86bcda2af394670e3bca49b3f0d9f1b8fe2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 4 Sep 2022 04:59:31 +0200 Subject: [PATCH 015/101] FIX Project - on global view, missing display of ref customer --- htdocs/compta/facture/class/facture.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b1eb8656645..d646da3b413 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -15,7 +15,7 @@ * Copyright (C) 2013 Cedric Gross * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018-2022 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2022 Sylvain Legrand * @@ -1671,8 +1671,9 @@ class Facture extends CommonInvoice $this->id = $obj->rowid; $this->entity = $obj->entity; - $this->ref = $obj->ref; - $this->ref_client = $obj->ref_client; + $this->ref = $obj->ref; + $this->ref_client = $obj->ref_client; + $this->ref_customer = $obj->ref_client; $this->ref_ext = $obj->ref_ext; $this->type = $obj->type; $this->date = $this->db->jdate($obj->df); From aff9a423abfef3c223ba236417ba155fababb031 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 5 Sep 2022 12:28:59 +0200 Subject: [PATCH 016/101] FIX : fk_expedition in $line can be usefull for triggers --- htdocs/expedition/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e8bfb0249b1..42214d1165e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -581,6 +581,7 @@ if (empty($reshook)) { for ($i = 0; $i < $num_prod; $i++) { if ($lines[$i]->id == $line_id) { // we have found line to update $line = new ExpeditionLigne($db); + $line->fk_expedition = $object->id; // Extrafields Lines $line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line); From 3e1e37211b90d5b4645ddf919944b4b4b6f0f866 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Mon, 5 Sep 2022 15:48:40 +0200 Subject: [PATCH 017/101] Update mod_codeclient_elephant.php --- .../societe/mod_codeclient_elephant.php | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 6079120a305..4186905f9f6 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -161,31 +161,39 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode */ public function getExample($langs, $objsoc = 0, $type = -1) { + $error = 0; $examplecust = ''; $examplesup = ''; $errmsg = array( "ErrorBadMask", "ErrorCantUseRazIfNoYearInMask", "ErrorCantUseRazInStartedYearIfNoYearMonthInMask", + "ErrorCounterMustHaveMoreThan3Digits", + "ErrorBadMaskBadRazMonth", + "ErrorCantUseRazWithYearOnOneDigit", ); if ($type != 1) { $examplecust = $this->getNextValue($objsoc, 0); if (!$examplecust) { - $examplecust = $langs->trans('NotConfigured'); + $examplecust = '
'.$langs->trans('NotConfigured').'
'; + $error = 1; } if (in_array($examplecust, $errmsg)) { $langs->load("errors"); - $examplecust = $langs->trans($examplecust); + $examplecust = '
'.$langs->trans($examplecust).'
'; + $error = 1; } } if ($type != 0) { $examplesup = $this->getNextValue($objsoc, 1); if (!$examplesup) { - $examplesup = $langs->trans('NotConfigured'); + $examplesup = '
'.$langs->trans('NotConfigured').'
'; + $error = 1; } if (in_array($examplesup, $errmsg)) { $langs->load("errors"); - $examplesup = $langs->trans($examplesup); + $examplesup = '
'.$langs->trans($examplesup).'
'; + $error = 1; } } @@ -194,7 +202,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode } elseif ($type == 1) { return $examplesup; } else { - return $examplecust.'
'.$examplesup; + if ($error == 1) { + return $examplecust.' '.$examplesup; + }else{ + return $examplecust.'
'.$examplesup; + } } } From 46dab68dd0bf9d276defd33ecff5376b475625af Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 5 Sep 2022 13:56:41 +0000 Subject: [PATCH 018/101] Fixing style errors. --- htdocs/core/modules/societe/mod_codeclient_elephant.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 4186905f9f6..e779504edd6 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -170,7 +170,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode "ErrorCantUseRazInStartedYearIfNoYearMonthInMask", "ErrorCounterMustHaveMoreThan3Digits", "ErrorBadMaskBadRazMonth", - "ErrorCantUseRazWithYearOnOneDigit", + "ErrorCantUseRazWithYearOnOneDigit", ); if ($type != 1) { $examplecust = $this->getNextValue($objsoc, 0); @@ -204,7 +204,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode } else { if ($error == 1) { return $examplecust.' '.$examplesup; - }else{ + } else { return $examplecust.'
'.$examplesup; } } From f61ef2948889c07d5b58d56331a5932f5db9ea85 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 6 Sep 2022 00:00:11 +0200 Subject: [PATCH 019/101] FIX #21416 - Filter tag no-categorie in members --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 441ce85ec86..607ef8117f6 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -336,7 +336,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; } -if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) { +if ((!empty($search_categ) && ($search_categ > 0 || $search_categ == -2)) || !empty($catid)) { // We need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; } From c28966864b7b5b74bf1f7c3a7121f6c659317d20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Sep 2022 01:42:48 +0200 Subject: [PATCH 020/101] FIX data integrity for llx_delivery table --- htdocs/delivery/card.php | 7 ++++--- htdocs/expedition/card.php | 6 ++++++ htdocs/install/mysql/migration/repair.sql | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 00975946f6b..8082c654a55 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -256,9 +256,10 @@ llxHeader('', $title, 'Livraison'); $form = new Form($db); $formfile = new FormFile($db); -if ($action == 'create') { // Create. Seems to no be used -} else // View -{ +if ($action == 'create') { + // Create. Seems to no be used +} else { + // View if ($object->id > 0) { // Origin of a 'livraison' (delivery receipt) is ALWAYS 'expedition' (shipment). // However, origin of shipment in future may differs (commande, proposal, ...) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index d16885faa0f..29336772269 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -405,11 +405,17 @@ if (empty($reshook)) { } } elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->delivery->creer) { // Build a receiving receipt + $db->begin(); + $result = $object->create_delivery($user); if ($result > 0) { + $db->commit(); + header("Location: ".DOL_URL_ROOT.'/delivery/card.php?action=create_delivery&id='.$result); exit; } else { + $db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'confirm_valid' && $confirm == 'yes' && diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 4add688b880..86b3da418a0 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -194,11 +194,13 @@ delete from llx_delivery where rowid not in (select fk_target from llx_elemen -- Fix delete element_element orphelins (right side) delete from llx_element_element where targettype='shipping' and fk_target not in (select rowid from llx_expedition); +delete from llx_element_element where targettype='delivery' and fk_target not in (select rowid from llx_delivery); delete from llx_element_element where targettype='propal' and fk_target not in (select rowid from llx_propal); delete from llx_element_element where targettype='facture' and fk_target not in (select rowid from llx_facture); delete from llx_element_element where targettype='commande' and fk_target not in (select rowid from llx_commande); -- Fix delete element_element orphelins (left side) delete from llx_element_element where sourcetype='shipping' and fk_source not in (select rowid from llx_expedition); +delete from llx_element_element where sourcetype='delivery' and fk_source not in (select rowid from llx_delivery); delete from llx_element_element where sourcetype='propal' and fk_source not in (select rowid from llx_propal); delete from llx_element_element where sourcetype='facture' and fk_source not in (select rowid from llx_facture); delete from llx_element_element where sourcetype='commande' and fk_source not in (select rowid from llx_commande); From 9a5927d833bf17fdac2a9bbf982d815ba8c50c13 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 6 Sep 2022 05:30:35 +0200 Subject: [PATCH 021/101] FIX Column label --- htdocs/adherents/class/adherent.class.php | 4 ++-- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/compta/facture/class/facture-rec.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 4 ++-- htdocs/contrat/class/contrat.class.php | 4 ++-- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- htdocs/societe/class/societe.class.php | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b7f2810912b..abc002b4e89 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -327,8 +327,8 @@ class Adherent extends CommonObject 'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135), 'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145), 'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => -1, 'position' => 150), - 'note_private' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155), - 'note_public' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160), + 'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 155), + 'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 160), 'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 175), diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 65a2e60777f..f36b8027461 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -310,8 +310,8 @@ class Propal extends CommonObject 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180), 'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190), diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f02e74687af..54e50baa9f7 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -314,8 +314,8 @@ class Commande extends CommonOrder 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>150), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>150), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160), //'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165), 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170), diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index c3628e12b7c..70f03bc21c8 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -295,7 +295,7 @@ class Account extends CommonObject 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185), diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 6b9837e77bd..8306a5c9c0d 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -184,8 +184,8 @@ class FactureRec extends CommonInvoice 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115), 'date_last_gen' =>array('type'=>'varchar(7)', 'label'=>'Last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>120), 'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'Unit frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>125), diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d646da3b413..4e5f1923297 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -327,8 +327,8 @@ class Facture extends CommonInvoice 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>205), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>210), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225), 'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230), diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index f364e82dd68..309df80605e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -237,8 +237,8 @@ class Contrat extends CommonObject 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 5f671599c50..e78dd9dd02a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -213,8 +213,8 @@ class CommandeFournisseur extends CommonOrder 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>150, 'isameasure'=>1), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>160), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>165), 'fk_input_method' =>array('type'=>'integer', 'label'=>'InputMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>170), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>175), diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 66c441841d1..c4635962368 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -282,8 +282,8 @@ class FactureFournisseur extends CommonInvoice 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateLimReglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>180), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>190), 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>-1, 'position'=>195), diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7c5773363c4..fe72e99e76f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -192,8 +192,8 @@ class Societe extends CommonObject 'tva_intra' =>array('type'=>'varchar(20)', 'label'=>'Tva intra', 'enabled'=>1, 'visible'=>-1, 'position'=>210), 'capital' =>array('type'=>'double(24,8)', 'label'=>'Capital', 'enabled'=>1, 'visible'=>-1, 'position'=>215), 'fk_stcomm' =>array('type'=>'integer', 'label'=>'CommercialStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>225), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>230), 'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>'$conf->global->SOCIETE_USEPREFIX', 'visible'=>-1, 'position'=>235), 'client' =>array('type'=>'tinyint(4)', 'label'=>'Client', 'enabled'=>1, 'visible'=>-1, 'position'=>240), 'fournisseur' =>array('type'=>'tinyint(4)', 'label'=>'Fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>245), From 4d396bbf50b3149daba7310bb23368bfe36cd54c Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 6 Sep 2022 09:48:10 +0200 Subject: [PATCH 022/101] FIX : same thing in deleteline --- htdocs/expedition/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 42214d1165e..8aa54ca8904 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -540,6 +540,7 @@ if (empty($reshook)) { $object->fetch($id); $lines = $object->lines; $line = new ExpeditionLigne($db); + $line->fk_expedition = $object->id; $num_prod = count($lines); for ($i = 0; $i < $num_prod; $i++) { From cdf90a0004a32580b09f1d8eb1ce5e1f673a4614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Sep 2022 22:31:20 +0200 Subject: [PATCH 023/101] Fix missign error message --- htdocs/core/actions_massactions.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index c2d1f7344c4..ddee2ad5fb4 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -815,6 +815,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $lineid = $result; } else { $lineid = 0; + $errors[] = $objecttmp->error; $error++; break; } @@ -959,7 +960,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $action = 'create'; $_GET["origin"] = $_POST["origin"]; $_GET["originid"] = $_POST["originid"]; - setEventMessages("Error", null, 'errors'); + setEventMessages("Error", $errors, 'errors'); $error++; } } From f27a49d30c3aa56663fb99233c8bca82292ae4b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 12:45:43 +0200 Subject: [PATCH 024/101] Fix missing var --- htdocs/compta/facture/class/facture.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d646da3b413..f6ed3468f9c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -137,7 +137,8 @@ class Facture extends CommonInvoice /** * @var string customer ref */ - public $ref_client; + public $ref_client; // deprecated; use ref_customer instead + public $ref_customer; /** * @var int Ref Int From 58d67c0922a3ac86e20f6b0ed547c067bd9b2067 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 8 Sep 2022 11:52:10 +0200 Subject: [PATCH 025/101] fix #22145 : impossible to delete ticket --- htdocs/ticket/class/ticket.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 9ee7d2c81b6..9c95e56870a 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1016,6 +1016,19 @@ class Ticket extends CommonObject } } + // Delete all child tables + + if (!$error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_ticket"; + $sql .= " WHERE fk_ticket = ".(int) $this->id; + + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."ticket"; $sql .= " WHERE rowid=".((int) $this->id); From 5b213b2b1a2aae6d444b47f1b4c5db91df84bb03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 8 Sep 2022 15:18:52 +0200 Subject: [PATCH 026/101] doc --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ec8e4a93b80..2c89a456961 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4903,7 +4903,7 @@ class Facture extends CommonInvoice /** * @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT) - * @return number or -1 if not available + * @return float or -1 if not available */ public function getRetainedWarrantyAmount($rounding = -1) { From 1a3ff13808622cf97d72a6f1631fafdfef2a2aa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 20:52:33 +0200 Subject: [PATCH 027/101] FIX Restore the option MAIN_OPTIMIZEFORTEXTBROWSER --- htdocs/core/lib/usergroups.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index accbd84ba8c..367a4eb087e 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -906,7 +906,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } // Use MAIN_OPTIMIZEFORTEXTBROWSER - if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if ($foruserprofile) { //$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER); $default = $langs->trans('No'); print ''; From 64beee3396d9978ef4483163bb150224e42de903 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 22:04:29 +0200 Subject: [PATCH 028/101] FIX the shipment PDF was using the full size logo instead of small --- .../modules/expedition/doc/pdf_espadon.modules.php | 10 +++++++++- .../core/modules/expedition/doc/pdf_merou.modules.php | 10 +++++++++- .../core/modules/expedition/doc/pdf_rouget.modules.php | 10 +++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 39df041bb51..5280c2b7a1e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -969,8 +969,16 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 9a905422ff1..3646ef515de 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -548,8 +548,16 @@ class pdf_merou extends ModelePdfExpedition //*********************LOGO**************************** $pdf->SetXY(11, 7); - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, 10, 5, 0, $height); // width=0 (auto) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index eededb90d67..b2bacffa901 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -914,8 +914,16 @@ class pdf_rouget extends ModelePdfExpedition $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) From 36b798e9a81986b16b432f05ee1366925274b459 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 22:16:31 +0200 Subject: [PATCH 029/101] Fix responsive --- htdocs/expedition/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2d81c5e0545..9b55ff46c14 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -658,7 +658,7 @@ if (!empty($arrayfields['e.fk_shipping_method']['checked'])) { // Delivery method print ''; $shipment->fetch_delivery_methods(); - print $form->selectarray("search_shipping_method_id", $shipment->meths, $search_shipping_method_id, 1, 0, 0, "", 1); + print $form->selectarray("search_shipping_method_id", $shipment->meths, $search_shipping_method_id, 1, 0, 0, "", 1, 0, 0, '', 'maxwidth150'); print "\n"; } // Tracking number @@ -904,7 +904,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['e.fk_shipping_method']['checked'])) { // Get code using getLabelFromKey $code=$langs->getLabelFromKey($db, $shipment->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); - print ''; + print ''; if ($shipment->shipping_method_id > 0) print $langs->trans("SendingMethod".strtoupper($code)); print ''; } From fa64be5e82ef7093985f5c88aafeb3580c4a5404 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 00:29:45 +0200 Subject: [PATCH 030/101] Fix wrong number of td --- htdocs/compta/resultat/clientfourn.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 936adb482d2..915fa4de771 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1520,15 +1520,17 @@ $hookmanager->initHooks(array('externalbalance')); $reshook = $hookmanager->executeHooks('addBalanceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks print $hookmanager->resPrint; + + // Total print ''; -print ' '; +print ' '; print ''; print ''.$langs->trans("Income").''; if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht_income, 'MT')).''; -} else { +} elseif ($modecompta == 'RECETTES-DEPENSES') { print ''; } print ''.price(price2num($total_ttc_income, 'MT')).''; @@ -1536,7 +1538,7 @@ print ''; print ''.$langs->trans("Outcome").''; if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num(-$total_ht_outcome, 'MT')).''; -} else { +} elseif ($modecompta == 'RECETTES-DEPENSES') { print ''; } print ''.price(price2num(-$total_ttc_outcome, 'MT')).''; @@ -1544,7 +1546,7 @@ print ''; print ''.$langs->trans("Profit").''; if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht, 'MT')).''; -} else { +} elseif ($modecompta == 'RECETTES-DEPENSES') { print ''; } print ''.price(price2num($total_ttc, 'MT')).''; From 5341c7a4a18cb7f12d376e4666c1ecfb1e9ffb53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 01:36:58 +0200 Subject: [PATCH 031/101] Fix sql error --- htdocs/compta/resultat/clientfourn.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 915fa4de771..2c9d467ddc2 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1062,7 +1062,11 @@ if ($modecompta == 'BOOKKEEPING') { $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; } - $sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm"; + if ($modecompta == 'CREANCES-DETTES') { + //No need of GROUP BY + } else { + $sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm"; + } $newsortfield = $sortfield; if ($newsortfield == 's.nom, s.rowid') { $newsortfield = 'p.ref'; From ca8c650feb12668abcd6a67fbc8147e577e68299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Fri, 9 Sep 2022 12:20:47 +0200 Subject: [PATCH 032/101] Fix: status of product suplier price was not recovered --- htdocs/fourn/class/fournisseur.product.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 0ae975a1cbf..ea5dc639a5e 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -578,7 +578,7 @@ class ProductFournisseur extends Product $sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,"; $sql .= " pfp.barcode, pfp.fk_barcode_type, pfp.packaging,"; - $sql .= " p.ref as product_ref"; + $sql .= " p.ref as product_ref, p.tosell as status, p.tobuy as status_buy"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE pfp.rowid = ".(int) $rowid; $sql .= " AND pfp.fk_product = p.rowid"; @@ -594,7 +594,8 @@ class ProductFournisseur extends Product $this->fk_product = $obj->fk_product; $this->product_id = $obj->fk_product; $this->product_ref = $obj->product_ref; - + $this->status = $obj->status; + $this->status_buy = $obj->status_buy; $this->fourn_id = $obj->fk_soc; $this->fourn_ref = $obj->ref_fourn; // deprecated $this->ref_supplier = $obj->ref_fourn; @@ -670,7 +671,7 @@ class ProductFournisseur extends Product // phpcs:enable global $conf; - $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref,"; + $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref, p.tosell as status, p.tobuy as status_buy, "; $sql .= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,"; $sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,"; @@ -699,6 +700,8 @@ class ProductFournisseur extends Product $prodfourn->product_ref = $record["product_ref"]; $prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"]; + $prodfourn->status = $record["status"]; + $prodfourn->status_buy = $record["status_buy"]; $prodfourn->product_fourn_id = $record["product_fourn_id"]; $prodfourn->product_fourn_entity = $record["entity"]; $prodfourn->ref_supplier = $record["ref_fourn"]; From 6b4bd6c09eef238300a87ba418c9b21a6ac34f9c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 9 Sep 2022 15:56:17 +0200 Subject: [PATCH 033/101] FIX #21859 - Don't show html balise on list for private/public note --- htdocs/comm/propal/list.php | 4 ++-- htdocs/commande/list.php | 4 ++-- htdocs/compta/facture/list.php | 4 ++-- htdocs/fichinter/list.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7a8fe187570..037ce5f26f8 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1915,7 +1915,7 @@ if ($resql) { // Note public if (!empty($arrayfields['p.note_public']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_public); + print dol_string_nohtmltag($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1924,7 +1924,7 @@ if ($resql) { // Note private if (!empty($arrayfields['p.note_private']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_private); + print dol_string_nohtmltag($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2033b5626b2..07db0c6077c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1762,7 +1762,7 @@ if ($resql) { // Note public if (!empty($arrayfields['c.note_public']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_public); + print dol_string_nohtmltag($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1772,7 +1772,7 @@ if ($resql) { // Note private if (!empty($arrayfields['c.note_private']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_private); + print dol_string_nohtmltag($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f2cc5943e7a..f847d633ba0 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2103,7 +2103,7 @@ if ($resql) { // Note public if (!empty($arrayfields['f.note_public']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_public); + print dol_string_nohtmltag($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2112,7 +2112,7 @@ if ($resql) { // Note private if (!empty($arrayfields['f.note_private']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_private); + print dol_string_nohtmltag($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 508eb984307..c1e01db6a79 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -698,7 +698,7 @@ if ($resql) { // Note public if (!empty($arrayfields['f.note_public']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_public); + print dol_string_nohtmltag($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -707,7 +707,7 @@ if ($resql) { // Note private if (!empty($arrayfields['f.note_private']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_private); + print dol_string_nohtmltag($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; From de9c12359533023c0ba93dfa0ee41925c95ce985 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 16:40:53 +0200 Subject: [PATCH 034/101] Fix bad var --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 057b32e89ca..ae31004869e 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2917,7 +2917,7 @@ class SupplierProposalLine extends CommonObjectLine $this->product_label = $objp->product_label; $this->product_desc = $objp->product_desc; - $this->ref_fourn = $objp->ref_produit_forun; + $this->ref_fourn = $objp->ref_produit_fourn; // Multicurrency $this->fk_multicurrency = $objp->fk_multicurrency; From 3b62935435beff2de56e78e98b0e8925312c792a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 18:08:43 +0200 Subject: [PATCH 035/101] Fix bad perm --- htdocs/core/lib/product.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 117871b4712..17f5c829cd6 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -59,7 +59,7 @@ function product_prepare_head($object) if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase if ((((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->lire) - || (!empty($conf->margin->enabled) && $user->rights->margin->liretous) + || (!empty($conf->margin->enabled) && $user->rights->margins->liretous) ) { $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id; $head[$h][1] = $langs->trans("BuyingPrices"); From 994603f009a00c6e0eff782e98b30e2a0a7a9dae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2022 12:17:49 +0200 Subject: [PATCH 036/101] FIX Missing token --- htdocs/admin/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 795a0557f16..a1281351176 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -356,7 +356,7 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") { print ' }'; print ' function generatelink(){'; - print ' return "security.php?action=updatepattern&pattern="+getStringArg();'; + print ' return "security.php?action=updatepattern&token='.newToken().'&pattern="+getStringArg();'; print ' }'; print ' function valuePatternChange(){'; From 95e1b97f42350375af61e1d9c45fe9714f163c88 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2022 13:09:21 +0200 Subject: [PATCH 037/101] Fix missing inventory code in reception --- htdocs/fourn/class/fournisseur.commande.class.php | 4 +++- htdocs/fourn/commande/dispatch.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f350c4f3640..08126bf5974 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2006,6 +2006,8 @@ class CommandeFournisseur extends CommonOrder $now = dol_now(); + $inventorycode = $langs->trans("Reception").' '.$this->ref; + if (($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY || $this->statut == self::STATUS_RECEIVED_COMPLETELY)) { $this->db->begin(); @@ -2039,7 +2041,7 @@ class CommandeFournisseur extends CommonOrder // $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on) $mouv->origin = &$this; $mouv->setOrigin($this->element, $this->id); - $result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch); + $result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch, $inventorycode); if ($result < 0) { $this->error = $mouv->error; $this->errors = $mouv->errors; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index a1ddef959a0..acb9766a318 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -221,6 +221,7 @@ if ($action == 'denydispatchline' && $permissiontocontrol) { if ($action == 'dispatch' && $permissiontoreceive) { $error = 0; + $notrigger = 0; $db->begin(); From f48752fc1693c792951a5fd2d194f4ccf9ea1315 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2022 13:25:07 +0200 Subject: [PATCH 038/101] FIX inventory code must be different at each transation --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/mrp/mo_production.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 08126bf5974..ad666573b18 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2006,7 +2006,7 @@ class CommandeFournisseur extends CommonOrder $now = dol_now(); - $inventorycode = $langs->trans("Reception").' '.$this->ref; + $inventorycode = dol_print_date(dol_now(), 'dayhourlog'); if (($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY || $this->statut == self::STATUS_RECEIVED_COMPLETELY)) { $this->db->begin(); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 1c6f3f7ec39..34b9191db94 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -660,8 +660,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); - //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); - $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); + $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : dol_print_date(dol_now(), 'dayhourlog'); print '
'; print '
'.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; From a35d7f8a4b1199add41780d23765ad4e857c996b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2022 14:17:14 +0200 Subject: [PATCH 039/101] Fix must not overwrite the var that is an object of cache --- htdocs/fourn/commande/dispatch.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index acb9766a318..ccf95de4232 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1202,10 +1202,6 @@ if ($id > 0 || !empty($ref)) { while ($i < $num) { $objp = $db->fetch_object($resql); - $tmpproduct->id = $objp->fk_product; - $tmpproduct->ref = $objp->ref; - $tmpproduct->label = $objp->label; - if ($action == 'editline' && $lineid == $objp->dispatchlineid) { print '
From 3c5f3f7b858d57a82be46c08b4999a96cd4ba7a7 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Mon, 12 Sep 2022 16:28:06 +0200 Subject: [PATCH 040/101] fix --- htdocs/projet/tasks/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 4af49c7a3d5..181ae20589d 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -988,7 +988,7 @@ while ($i < min($num, $limit)) { // Description if (!empty($arrayfields['t.description']['checked'])) { print ''; - print dol_escape_htmltag($object->description); + print $object->description; print ''; if (!$i) { $totalarray['nbfield']++; From 527cfadf0f168e61918c1e1a8aa3215cc4236934 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Mon, 12 Sep 2022 16:31:00 +0200 Subject: [PATCH 041/101] nl2br like on the card --- htdocs/projet/tasks/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 181ae20589d..65ceda08242 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -988,7 +988,7 @@ while ($i < min($num, $limit)) { // Description if (!empty($arrayfields['t.description']['checked'])) { print ''; - print $object->description; + print nl2br($object->description); print ''; if (!$i) { $totalarray['nbfield']++; From 77ec9ee669275b8125b49057f8d45a249736409c Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Tue, 13 Sep 2022 11:26:37 +0200 Subject: [PATCH 042/101] FIX : ToOfferALinkForOnlinePayment not translated ToOfferALinkForOnlinePayment is defined on stripe.lang --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 72eb041f873..c47e9fc7c60 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1265,7 +1265,7 @@ class pdf_sponge extends ModelePDFFactures require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; - $langs->loadLangs(array('payment', 'paybox')); + $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; From 4f9c273c644f2ccc157674144ec9a87cd9102db4 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Tue, 13 Sep 2022 14:19:28 +0200 Subject: [PATCH 043/101] retours --- htdocs/projet/tasks/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 65ceda08242..4f7c4bf7a42 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -988,7 +988,7 @@ while ($i < min($num, $limit)) { // Description if (!empty($arrayfields['t.description']['checked'])) { print ''; - print nl2br($object->description); + print dolGetFirstLineOfText($object->description, 5); print ''; if (!$i) { $totalarray['nbfield']++; From 7d4c7e0f6b7090a98838366da9df4049efb27f88 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Tue, 13 Sep 2022 14:28:57 +0200 Subject: [PATCH 044/101] stickler --- htdocs/projet/tasks/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 4f7c4bf7a42..d74b84dd7ba 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -988,7 +988,7 @@ while ($i < min($num, $limit)) { // Description if (!empty($arrayfields['t.description']['checked'])) { print ''; - print dolGetFirstLineOfText($object->description, 5); + print dolGetFirstLineOfText($object->description, 5); print ''; if (!$i) { $totalarray['nbfield']++; From 81ce609b7bba714831e54b8df61f66b09abe6a89 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 13 Sep 2022 16:04:20 +0200 Subject: [PATCH 045/101] FIX no when contains an @ --- htdocs/user/class/user.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 96a614857ba..4b6ee860c74 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -711,6 +711,7 @@ class User extends CommonObject // If module is abc@module, we check permission user->rights->module->abc->permlevel1 $tmp = explode('@', $rightsPath, 2); if (! empty($tmp[1])) { + if (strpos($module, '@') !== false) $module = $tmp[1]; $rightsPath = $tmp[1]; $permlevel2 = $permlevel1; $permlevel1 = $tmp[0]; From cba04c9648eaf5dabb970a4663a07b5cc710bd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 13 Sep 2022 20:48:59 +0200 Subject: [PATCH 046/101] Update bonprelevement.class.php --- .../class/bonprelevement.class.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 18216c1cda6..06b912ec343 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -450,9 +450,6 @@ class BonPrelevement extends CommonObject dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error); } } - //var_dump($paiement->amounts); - //var_dump($thirdpartyid); - //var_dump($cursoramounts); } // Update withdrawal line @@ -1039,15 +1036,15 @@ class BonPrelevement extends CommonObject $account = new Account($this->db); if ($account->fetch($id) > 0) { $this->emetteur_code_banque = $account->code_banque; - $this->emetteur_code_guichet = $account->code_guichet; - $this->emetteur_numero_compte = $account->number; + $this->emetteur_code_guichet = $account->code_guichet; + $this->emetteur_numero_compte = $account->number; $this->emetteur_number_key = $account->cle_rib; - $this->emetteur_iban = $account->iban; - $this->emetteur_bic = $account->bic; + $this->emetteur_iban = $account->iban; + $this->emetteur_bic = $account->bic; - $this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); + $this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); - $this->raison_sociale = $account->proprio; + $this->raison_sociale = $account->proprio; } $this->factures = $factures_prev_id; @@ -1057,8 +1054,6 @@ class BonPrelevement extends CommonObject // This also set the property $this->total with amount that is included into file $result = $this->generate($format, $executiondate, $type); if ($result < 0) { - /*var_dump($this->error); - var_dump($this->invoice_in_error); */ $error++; } } @@ -1684,7 +1679,7 @@ class BonPrelevement extends CommonObject fclose($this->file); if (!empty($conf->global->MAIN_UMASK)) { - @chmod($this->file, octdec($conf->global->MAIN_UMASK)); + @chmod($this->filename, octdec($conf->global->MAIN_UMASK)); } return $result; From 7124b5bf755199b00173d7308a6799fa826942f8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 14 Sep 2022 05:16:50 +0200 Subject: [PATCH 047/101] FIX #22264 Accountancy - Translation on chart of accounts export --- htdocs/core/modules/modAccounting.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index e0bf3a9bbc5..83c1e99183f 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -256,11 +256,11 @@ class modAccounting extends DolibarrModules $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'Chartofaccounts'; - $this->export_icon[$r] = 'accounting'; + $this->export_icon[$r] = 'Accounting'; $this->export_permission[$r] = array(array("accounting", "chartofaccount")); $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa.account_parent'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa.account_parent'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); - $this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa.accountparent'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting"); + $this->export_entities_array[$r] = array(); // We define here only fields that use another picto $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'accounting_account as aa'; From 81e8b872a82279410520665bd3b4bd2b6c86d8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 14 Sep 2022 08:51:22 +0200 Subject: [PATCH 048/101] Update bonprelevement.class.php --- htdocs/compta/prelevement/class/bonprelevement.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 06b912ec343..0db7bc2b2b9 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2175,7 +2175,8 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf;*/ } } else { - fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf); + fputs($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf); + $XML_SEPA_INFO = ''; } return $XML_SEPA_INFO; } From ebf35432bd93e2fa7f7f7942197c93ea09e77b42 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 14 Sep 2022 11:30:57 +0200 Subject: [PATCH 049/101] FIX recruitment linked files --- htdocs/core/lib/files.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 04c3a481d00..b2100f5a693 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2857,6 +2857,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, // Wrapping for import module $accessallowed = $user->rights->import->run; $original_file = $conf->import->dir_temp.'/'.$original_file; + } elseif ($modulepart == 'recruitment' && !empty($conf->recruitment->dir_output)) { + // Wrapping for import module + $accessallowed = $user->rights->recruitment->recruitmentjobposition->read; + $original_file = $conf->recruitment->dir_output.'/'.$original_file; } elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { // Wrapping for wysiwyg editor $accessallowed = 1; From 4437506ef9786a50cee889257043e61e0e64a44f Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 15 Sep 2022 13:53:52 +0200 Subject: [PATCH 050/101] Fix : datetime extrafield behaviour --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index e51409ef81b..8bcf9250bd4 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2090,7 +2090,7 @@ class ExtraFields // values provided as a date pair (start date + end date), each date being broken down as year, month, day, etc. $value_key = array( 'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'tzuserrel'), - 'end' => dol_mktime(GETPOST($dateparamname_end . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel') + 'end' => dol_mktime(GETPOST($dateparamname_end . 'hour', 'int') !='-1' ? GETPOST($dateparamname_end . 'hour', 'int') : '23', GETPOST($dateparamname_end . 'min', 'int') !='-1' ? GETPOST($dateparamname_end . 'min', 'int') : '59', GETPOST($dateparamname_end . 'sec', 'int') !='-1' ? GETPOST($dateparamname_end . 'sec', 'int') : '59', GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel') ); } elseif (GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) { // Clean parameters From 9b515862097a4baef7fe6487b5fecec750b092c8 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 15 Sep 2022 14:13:27 +0200 Subject: [PATCH 051/101] fix style error --- htdocs/core/class/extrafields.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8bcf9250bd4..d5336616d09 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2088,9 +2088,12 @@ class ExtraFields $dateparamname_end = $keysuffix . 'options_' . $key . $keyprefix . '_end'; if (GETPOSTISSET($dateparamname_start . 'year') && GETPOSTISSET($dateparamname_end . 'year')) { // values provided as a date pair (start date + end date), each date being broken down as year, month, day, etc. + $dateparamname_end_hour = GETPOST($dateparamname_end . 'hour', 'int') !='-1' ? GETPOST($dateparamname_end . 'hour', 'int') : '23'; + $dateparamname_end_min = GETPOST($dateparamname_end . 'min', 'int') !='-1' ? GETPOST($dateparamname_end . 'min', 'int') : '59'; + $dateparamname_end_sec = GETPOST($dateparamname_end . 'sec', 'int') !='-1' ? GETPOST($dateparamname_end . 'sec', 'int') : '59'; $value_key = array( 'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'tzuserrel'), - 'end' => dol_mktime(GETPOST($dateparamname_end . 'hour', 'int') !='-1' ? GETPOST($dateparamname_end . 'hour', 'int') : '23', GETPOST($dateparamname_end . 'min', 'int') !='-1' ? GETPOST($dateparamname_end . 'min', 'int') : '59', GETPOST($dateparamname_end . 'sec', 'int') !='-1' ? GETPOST($dateparamname_end . 'sec', 'int') : '59', GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel') + 'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel') ); } elseif (GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) { // Clean parameters From 4906aaf1f6394db3f19b6492fe4bacba721c3e72 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Fri, 16 Sep 2022 11:43:17 +0200 Subject: [PATCH 052/101] FIX : ToOfferALinkForOnlinePayment not translated Link to #22248 I forgot to do it on Crabe also. --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0c89d14992c..bd8bea0499e 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1183,7 +1183,7 @@ class pdf_crabe extends ModelePDFFactures require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; - $langs->loadLangs(array('payment', 'paybox')); + $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; From 9ba2b41aee142316c2f4947ae30981e8f4e8029e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2022 00:31:11 +0200 Subject: [PATCH 053/101] FIX filter lost when sorting on productMargin --- htdocs/margin/productMargins.php | 47 ++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index ac006c042aa..a47ec246aaf 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -74,17 +74,18 @@ if (!$sortfield) { $startdate = $enddate = ''; -if (!empty($_POST['startdatemonth'])) { - $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); +if (GETPOST('startdatemonth')) { + $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); } -if (!empty($_POST['enddatemonth'])) { - $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); +if (GETPOST('enddatemonth')) { + $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear')); } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Product($db); $hookmanager->initHooks(array('marginproductlist')); + /* * View */ @@ -224,13 +225,31 @@ $sql .= $db->order($sortfield, $sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); +$param = '&id='.((int) $id); +if (GETPOST('startdatemonth', 'int')) { + $param .= '&startdateyear='.GETPOST('startdateyear', 'int'); + $param .= '&startdatemonth='.GETPOST('startdatemonth', 'int'); + $param .= '&startdateday='.GETPOST('startdateday', 'int'); +} +if (GETPOST('enddatemonth', 'int')) { + $param .= '&enddateyear='.GETPOST('enddateyear', 'int'); + $param .= '&enddatemonth='.GETPOST('enddatemonth', 'int'); + $param .= '&enddateday='.GETPOST('enddateday', 'int'); +} +$listofcateg = GETPOST('categories', 'array:int'); +if (is_array($listofcateg)) { + foreach ($listofcateg as $val) { + $param .= '&categories[]='.$val; + } +} + dol_syslog('margin::productMargins.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); print '
'; - print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "&id=".$id, $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1); + print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1); //var_dump($conf->global->MARGIN_TYPE); if ($conf->global->MARGIN_TYPE == "1") { @@ -247,20 +266,20 @@ if ($result) { print ''; if ($id > 0) { - print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&id=".$id, '', $sortfield, $sortorder); - print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&id=".$id, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder, 'center '); } else { - print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", "&id=".$id, '', $sortfield, $sortorder); + print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); } - print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", "&id=".$id, '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { - print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } if (!empty($conf->global->DISPLAY_MARK_RATES)) { - print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } print "\n"; From d452d225b6f1cf1d9eca7b6ee6bd0926e14570af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2022 09:24:19 +0200 Subject: [PATCH 054/101] FIX support of array parameters in "add to bookmark" feature. --- htdocs/bookmarks/bookmarks.lib.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 54bd7a41282..26d834fb5d9 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -42,8 +42,12 @@ function printDropdownBookmarksList() if (!empty($_SERVER["QUERY_STRING"])) { if (is_array($_GET)) { foreach ($_GET as $key => $val) { - if ($val != '') { - $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); + if (is_array($val)) { + foreach ($val as $tmpsubval) { + $url_param[] = http_build_query(array(dol_escape_htmltag($key).'[]' => dol_escape_htmltag($tmpsubval))); + } + } elseif ($val != '') { + $url_param[$key] = http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); } } } @@ -61,10 +65,11 @@ function printDropdownBookmarksList() if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var)) && $val != '' && !array_key_exists($key, $url_param)) { - $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); + $url_param[$key] = http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); } } } + $url .= ($tmpurl ? '?'.$tmpurl : ''); if (!empty($url_param)) { $url .= '&'.implode('&', $url_param); From e56362a5debb1c162668d4fb69711dcb9e31973e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2022 09:37:57 +0200 Subject: [PATCH 055/101] FIX filters lost when sorting on customerMargins --- htdocs/margin/customerMargins.php | 54 ++++++++++++++++++++++--------- htdocs/margin/productMargins.php | 3 +- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 290a94908c0..e5f21b5095f 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -43,8 +43,6 @@ $result = restrictedArea($user, 'societe', '', ''); $result = restrictedArea($user, 'margins'); -$mesg = ''; - // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -64,18 +62,18 @@ if (!$sortorder) { } $startdate = $enddate = ''; - -if (!empty($_POST['startdatemonth'])) { - $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); +if (GETPOST('startdatemonth')) { + $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); } -if (!empty($_POST['enddatemonth'])) { - $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); +if (GETPOST('enddatemonth')) { + $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear')); } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Societe($db); $hookmanager->initHooks(array('margincustomerlist')); + /* * View */ @@ -188,7 +186,7 @@ print ''; // Total Margin print ''; // Margin Rate @@ -271,6 +269,30 @@ $sql .= $db->order($sortfield, $sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); +$param = '&socid='.((int) $socid); +if (GETPOST('startdatemonth', 'int')) { + $param .= '&startdateyear='.GETPOST('startdateyear', 'int'); + $param .= '&startdatemonth='.GETPOST('startdatemonth', 'int'); + $param .= '&startdateday='.GETPOST('startdateday', 'int'); +} +if (GETPOST('enddatemonth', 'int')) { + $param .= '&enddateyear='.GETPOST('enddateyear', 'int'); + $param .= '&enddatemonth='.GETPOST('enddatemonth', 'int'); + $param .= '&enddateday='.GETPOST('enddateday', 'int'); +} +$listofproducts = GETPOST('products', 'array:int'); +if (is_array($listofproducts)) { + foreach ($listofproducts as $val) { + $param .= '&products[]='.$val; + } +} +$listofcateg = GETPOST('categories', 'array:int'); +if (is_array($listofcateg)) { + foreach ($listofcateg as $val) { + $param .= '&categories[]='.$val; + } +} + dol_syslog('margin::customerMargins.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -293,19 +315,19 @@ if ($result) { print ''; if (!empty($client)) { - print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&socid=".$socid, '', $sortfield, $sortorder); - print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&socid=".$socid, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, 'align="center"', $sortfield, $sortorder); } else { - print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", "&socid=".$socid, '', $sortfield, $sortorder); + print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); } - print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder); if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { - print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); } if (!empty($conf->global->DISPLAY_MARK_RATES)) { - print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); } print "\n"; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index a47ec246aaf..48e0d50cd4c 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -73,7 +73,6 @@ if (!$sortfield) { } $startdate = $enddate = ''; - if (GETPOST('startdatemonth')) { $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); } @@ -150,7 +149,7 @@ print '
'.$langs->trans("TotalMargin").''; -print ''; // set by jquery (see below) +print ' '.$langs->getCurrencySymbol($conf->currency).''; // set by jquery (see below) print '
'; // Total Margin print ''; // Margin Rate From dd4be90525ace20821ba05adb775df11d00f611f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 14:15:41 +0200 Subject: [PATCH 056/101] Fix warning --- htdocs/core/class/conf.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 60ee78bbff5..6f08ea8f0ae 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -820,7 +820,7 @@ class Conf } // If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined. - if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $this->global->MAIN_FEATURES_LEVEL >= 2) { + if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && isset($this->global->MAIN_FEATURES_LEVEL) && $this->global->MAIN_FEATURES_LEVEL >= 2) { $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1; } From 12ce79ab078d1663fc40a9846b1bfadd93321509 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 14:50:12 +0200 Subject: [PATCH 057/101] Fix rounding --- htdocs/core/lib/price.lib.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 9be293a81ab..ca01317ad5d 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -372,16 +372,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt // If rounding is not using base 10 (rare) if (!empty($conf->global->MAIN_ROUNDING_RULE_TOT)) { if ($price_base_type == 'HT') { - $result[0] = round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; + $result[0] = price2num(round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); $result[2] = price2num($result[0] + $result[1] + $result[9] + $result[10], 'MT'); } else { - $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[2] = round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; + $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[2] = price2num(round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); $result[0] = price2num($result[2] - $result[1] - $result[9] - $result[10], 'MT'); } } From 5d39f7b6a33b4cb8808343c19ee702658b4c1884 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 15:20:17 +0200 Subject: [PATCH 058/101] Try to move to bionic --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92cd2059b15..7e900ebc77b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ # We use dist: xenial to have php 5.6+ available os: linux -dist: xenial -#dist: bionic +#dist: xenial +dist: bionic language: php @@ -20,7 +20,7 @@ services: addons: # Force postgresql to 9.4 (the oldest availablable on xenial) - postgresql: '9.4' + postgresql: '10' apt: sources: # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ @@ -74,6 +74,8 @@ notifications: before_install: - | + echo "Add ondrej PPA" + add-apt-repository -y ppa:ondrej/php echo "Disabling Xdebug for composer" export PHP_VERSION_NAME=$(phpenv version-name) cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini From 48f0a956822b73b50d6b4adabafda6f114e290ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 15:51:00 +0200 Subject: [PATCH 059/101] Try fix travis --- .travis.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e900ebc77b..ebab9b0d017 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ addons: # Let's install Apache with. - apache2 # mod_php is not supported by Travis. Add fcgi. We install FPM later on. - - libapache2-mod-fastcgi + #- libapache2-mod-fastcgi # We need pgloader for import mysql database into pgsql - pgloader @@ -72,6 +72,7 @@ notifications: on_failure: always use_notice: true + before_install: - | echo "Add ondrej PPA" @@ -240,6 +241,10 @@ before_script: - echo "Setting up Apache + FPM" + # setup link for php legacy + - sudo ln -s ~/.phpenv/versions/$(phpenv version-name)/bin/php /bin/php + # install apache web server + - sudo apt-get install apache2 php-fpm php-mysql php-pgsql php-gd php-ldap php-xml php-mbstring libapache2-mod-php # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - | @@ -247,10 +252,11 @@ before_script: # Copy the included pool sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf fi - - sudo a2enmod rewrite actions fastcgi alias + - sudo a2enmod proxy_fcgi rewrite setenvif cgi alias - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - - sudo chown -R travis:travis /var/lib/apache2/fastcgi + #- sudo chown -R travis:travis /var/lib/apache2/fastcgi + # start php-fpm - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm # configure apache virtual hosts - sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf From 1162d858ddfca0f85d7408986265d767a37ac924 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:01:07 +0200 Subject: [PATCH 060/101] Try fix rounding --- htdocs/core/class/commonobject.class.php | 28 +++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 513717b56de..b9b09450642 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3529,10 +3529,11 @@ abstract class CommonObject if (!$resqlfix) { dol_print_error($this->db, 'Failed to update line'); } - $this->total_tva -= $diff; - $this->total_ttc -= $diff; - $total_tva_by_vats[$obj->vatrate] -= $diff; - $total_ttc_by_vats[$obj->vatrate] -= $diff; + + $this->total_tva = (float) price2num($this->total_tva - $diff, '', 1); + $this->total_ttc = (float) price2num($this->total_ttc - $diff, '', 1); + $total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - $diff, '', 1); + $total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - $diff, '', 1); } } @@ -3559,9 +3560,16 @@ abstract class CommonObject } } + // Clean total + $this->total_ht = (float) price2num($this->total_ht); + $this->total_tva = (float) price2num($this->total_tva); + $this->total_localtax1 = (float) price2num($this->total_localtax1); + $this->total_localtax2 = (float) price2num($this->total_localtax2); + $this->total_ttc = (float) price2num($this->total_ttc); + $this->db->free($resql); - // Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* + // Now update global fields total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* $fieldht = 'total_ht'; $fieldtva = 'tva'; $fieldlocaltax1 = 'localtax1'; @@ -3592,11 +3600,11 @@ abstract class CommonObject if (empty($nodatabaseupdate)) { $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.' SET'; - $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht)).","; - $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva)).","; - $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1)).","; - $sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2)).","; - $sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc)); + $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht, 'MT', 1)).","; + $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva, 'MT', 1)).","; + $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1, 'MT', 1)).","; + $sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2, 'MT', 1)).","; + $sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc, 'MT', 1)); $sql .= ", multicurrency_total_ht = ".((float) price2num($this->multicurrency_total_ht, 'MT', 1)); $sql .= ", multicurrency_total_tva = ".((float) price2num($this->multicurrency_total_tva, 'MT', 1)); $sql .= ", multicurrency_total_ttc = ".((float) price2num($this->multicurrency_total_ttc, 'MT', 1)); From 802c06c15e744a70a38f63139145cbb65d389f9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:15:13 +0200 Subject: [PATCH 061/101] Try travis fix --- .travis.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index ebab9b0d017..21b010b3704 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,19 @@ services: - mysql - postgresql + +before_install: +- | + echo "Add ondrej PPA" + sudo add-apt-repository -y ppa:ondrej/php + sudo apt-get update + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + echo $PHP_VERSION_NAME + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + echo + addons: # Force postgresql to 9.4 (the oldest availablable on xenial) postgresql: '10' @@ -25,6 +38,7 @@ addons: sources: # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - pgdg-xenial + - sourceline: 'ppa:ondrej/php' packages: # We need a webserver to test the webservices # Let's install Apache with. @@ -73,16 +87,6 @@ notifications: use_notice: true -before_install: -- | - echo "Add ondrej PPA" - add-apt-repository -y ppa:ondrej/php - echo "Disabling Xdebug for composer" - export PHP_VERSION_NAME=$(phpenv version-name) - cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini - phpenv config-rm xdebug.ini - echo - install: - | echo "Updating Composer" From 5afbfd0a0a96101a221bf9e1f80549ea6025f5d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:20:00 +0200 Subject: [PATCH 062/101] Try fix rounding --- htdocs/core/class/commonobject.class.php | 38 ++++++++++++++---------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4d09b8ae769..c9c7f096fd5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3494,10 +3494,11 @@ abstract class CommonObject if (!$resqlfix) { dol_print_error($this->db, 'Failed to update line'); } - $this->total_tva -= $diff; - $this->total_ttc -= $diff; - $total_tva_by_vats[$obj->vatrate] -= $diff; - $total_ttc_by_vats[$obj->vatrate] -= $diff; + + $this->total_tva = (float) price2num($this->total_tva - $diff, '', 1); + $this->total_ttc = (float) price2num($this->total_ttc - $diff, '', 1); + $total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - $diff, '', 1); + $total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - $diff, '', 1); } } @@ -3524,9 +3525,16 @@ abstract class CommonObject } } + // Clean total + $this->total_ht = (float) price2num($this->total_ht); + $this->total_tva = (float) price2num($this->total_tva); + $this->total_localtax1 = (float) price2num($this->total_localtax1); + $this->total_localtax2 = (float) price2num($this->total_localtax2); + $this->total_ttc = (float) price2num($this->total_ttc); + $this->db->free($resql); - // Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* + // Now update global fields total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* $fieldht = 'total_ht'; $fieldtva = 'tva'; $fieldlocaltax1 = 'localtax1'; @@ -3557,16 +3565,16 @@ abstract class CommonObject if (empty($nodatabaseupdate)) { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET'; - $sql .= " ".$fieldht." = ".price2num($this->total_ht).","; - $sql .= " ".$fieldtva." = ".price2num($this->total_tva).","; - $sql .= " ".$fieldlocaltax1." = ".price2num($this->total_localtax1).","; - $sql .= " ".$fieldlocaltax2." = ".price2num($this->total_localtax2).","; - $sql .= " ".$fieldttc." = ".price2num($this->total_ttc); - $sql .= ", multicurrency_total_ht = ".price2num($this->multicurrency_total_ht, 'MT', 1); - $sql .= ", multicurrency_total_tva = ".price2num($this->multicurrency_total_tva, 'MT', 1); - $sql .= ", multicurrency_total_ttc = ".price2num($this->multicurrency_total_ttc, 'MT', 1); - $sql .= ' WHERE rowid = '.$this->id; - + $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht, 'MT', 1)).","; + $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva, 'MT', 1)).","; + $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1, 'MT', 1)).","; + $sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2, 'MT', 1)).","; + $sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc, 'MT', 1)); + $sql .= ", multicurrency_total_ht = ".((float) price2num($this->multicurrency_total_ht, 'MT', 1)); + $sql .= ", multicurrency_total_tva = ".((float) price2num($this->multicurrency_total_tva, 'MT', 1)); + $sql .= ", multicurrency_total_ttc = ".((float) price2num($this->multicurrency_total_ttc, 'MT', 1)); + $sql .= " WHERE rowid = ".((int) $this->id); + dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql = $this->db->query($sql); From bab7ff256fc862bb2b93a61c739c38ddc2199f7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:35:22 +0200 Subject: [PATCH 063/101] Try fix travis --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21b010b3704..28d8b7004b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,6 @@ services: before_install: - | - echo "Add ondrej PPA" - sudo add-apt-repository -y ppa:ondrej/php - sudo apt-get update echo "Disabling Xdebug for composer" export PHP_VERSION_NAME=$(phpenv version-name) echo $PHP_VERSION_NAME @@ -47,6 +44,8 @@ addons: #- libapache2-mod-fastcgi # We need pgloader for import mysql database into pgsql - pgloader + - php5.6 + - php5.6-pgsql env: global: From d39eca4d50e3deaffb5442baacb5527f038fc1ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:36:29 +0200 Subject: [PATCH 064/101] Fix phpcs --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c9c7f096fd5..5de1744a20d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3574,7 +3574,7 @@ abstract class CommonObject $sql .= ", multicurrency_total_tva = ".((float) price2num($this->multicurrency_total_tva, 'MT', 1)); $sql .= ", multicurrency_total_ttc = ".((float) price2num($this->multicurrency_total_ttc, 'MT', 1)); $sql .= " WHERE rowid = ".((int) $this->id); - + dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql = $this->db->query($sql); From ebc3df35ee47ed860e13f0edb97bd5c4c0aeabc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 17:27:32 +0200 Subject: [PATCH 065/101] Try fix --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 28d8b7004b7..9ddc5fe0379 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,11 +21,17 @@ services: before_install: - | + echo "Add ondrej PPA" + sudo add-apt-repository -y ppa:ondrej/php + sudo apt-get update echo "Disabling Xdebug for composer" export PHP_VERSION_NAME=$(phpenv version-name) echo $PHP_VERSION_NAME + ls ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/ cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini phpenv config-rm xdebug.ini + phpenv rehash + phpenv config-add mysqli echo addons: @@ -46,6 +52,7 @@ addons: - pgloader - php5.6 - php5.6-pgsql + - php5.6-mysqli env: global: From 962018d5c74ba7f4361306c2649f30eb1b5244b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 18:14:34 +0200 Subject: [PATCH 066/101] Try fix --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9ddc5fe0379..a456e92752e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -448,8 +448,8 @@ script: - | echo "Unit testing" - # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. - set -e + # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log and apache error.log file. + set +e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunitresult=$? echo "Phpunit return code = $phpunitresult" @@ -461,6 +461,9 @@ after_script: ls $TRAVIS_BUILD_DIR/documents #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log + echo "After script - Output last lines of apache error.log" + ls /var/log/apache2 + sudo tail -n 50 /var/log/apache2/travis_error_log after_success: - | @@ -469,14 +472,14 @@ after_success: after_failure: - | echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if previous command that fails are enclosed with set +e - # Upgrade log files + # This part of code is executed only if the command that fails are enclosed with set +e + # Show upgrade log files for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` do echo "Debugging informations for file $ficlog" #cat $ficlog done - # Apache log file + # Show Apache log file echo "Debugging informations for file apache error.log" sudo cat /var/log/apache2/travis_error_log if [ "$DEBUG" = true ]; then From 2664f1bce041b142fe56298b4b534cc65d42cc8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 18:45:17 +0200 Subject: [PATCH 067/101] Test --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a456e92752e..5247b051e23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,6 @@ before_install: cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini phpenv config-rm xdebug.ini phpenv rehash - phpenv config-add mysqli echo addons: @@ -53,6 +52,7 @@ addons: - php5.6 - php5.6-pgsql - php5.6-mysqli + - php5.6-xml env: global: From af0c6c0600eb610a6476481265d898d3d5670f3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 19:36:47 +0200 Subject: [PATCH 068/101] Try restore old travis script --- .travis.yml | 57 +++++++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5247b051e23..92cd2059b15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ # We use dist: xenial to have php 5.6+ available os: linux -#dist: xenial -dist: bionic +dist: xenial +#dist: bionic language: php @@ -18,41 +18,21 @@ services: - mysql - postgresql - -before_install: -- | - echo "Add ondrej PPA" - sudo add-apt-repository -y ppa:ondrej/php - sudo apt-get update - echo "Disabling Xdebug for composer" - export PHP_VERSION_NAME=$(phpenv version-name) - echo $PHP_VERSION_NAME - ls ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/ - cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini - phpenv config-rm xdebug.ini - phpenv rehash - echo - addons: # Force postgresql to 9.4 (the oldest availablable on xenial) - postgresql: '10' + postgresql: '9.4' apt: sources: # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - pgdg-xenial - - sourceline: 'ppa:ondrej/php' packages: # We need a webserver to test the webservices # Let's install Apache with. - apache2 # mod_php is not supported by Travis. Add fcgi. We install FPM later on. - #- libapache2-mod-fastcgi + - libapache2-mod-fastcgi # We need pgloader for import mysql database into pgsql - pgloader - - php5.6 - - php5.6-pgsql - - php5.6-mysqli - - php5.6-xml env: global: @@ -92,6 +72,13 @@ notifications: on_failure: always use_notice: true +before_install: +- | + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + echo install: - | @@ -251,10 +238,6 @@ before_script: - echo "Setting up Apache + FPM" - # setup link for php legacy - - sudo ln -s ~/.phpenv/versions/$(phpenv version-name)/bin/php /bin/php - # install apache web server - - sudo apt-get install apache2 php-fpm php-mysql php-pgsql php-gd php-ldap php-xml php-mbstring libapache2-mod-php # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - | @@ -262,11 +245,10 @@ before_script: # Copy the included pool sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf fi - - sudo a2enmod proxy_fcgi rewrite setenvif cgi alias + - sudo a2enmod rewrite actions fastcgi alias - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - #- sudo chown -R travis:travis /var/lib/apache2/fastcgi - # start php-fpm + - sudo chown -R travis:travis /var/lib/apache2/fastcgi - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm # configure apache virtual hosts - sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf @@ -448,8 +430,8 @@ script: - | echo "Unit testing" - # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log and apache error.log file. - set +e + # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. + set -e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunitresult=$? echo "Phpunit return code = $phpunitresult" @@ -461,9 +443,6 @@ after_script: ls $TRAVIS_BUILD_DIR/documents #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log - echo "After script - Output last lines of apache error.log" - ls /var/log/apache2 - sudo tail -n 50 /var/log/apache2/travis_error_log after_success: - | @@ -472,14 +451,14 @@ after_success: after_failure: - | echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if the command that fails are enclosed with set +e - # Show upgrade log files + # This part of code is executed only if previous command that fails are enclosed with set +e + # Upgrade log files for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` do echo "Debugging informations for file $ficlog" #cat $ficlog done - # Show Apache log file + # Apache log file echo "Debugging informations for file apache error.log" sudo cat /var/log/apache2/travis_error_log if [ "$DEBUG" = true ]; then From f53e3e9cce0710a4893123168fddb9b291ddf201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 09:42:44 +0200 Subject: [PATCH 069/101] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1e58f11aeb0..7404f2595e2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -129,22 +129,32 @@ class Facture extends CommonInvoice /** * @var int Date expected for delivery * @deprecated + * @see delivery_date */ - public $date_livraison; // deprecated; Use delivery_date instead. + public $date_livraison; + /** + * @var int Date expected for delivery + */ public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) + /** + * @var string customer ref + * @deprecated + * @see ref_customer + */ + public $ref_client; + /** * @var string customer ref */ - public $ref_client; // deprecated; use ref_customer instead public $ref_customer; /** * @var int Ref Int * @deprecated */ - public $ref_int; // deprecated + public $ref_int; //Check constants for types public $type = self::TYPE_STANDARD; From d2cd06cb8d21e38e7b08662fb2afefc8673cb8eb Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 22 Sep 2022 23:27:13 +0200 Subject: [PATCH 070/101] remove ntoe update --- htdocs/don/card.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 960ff7e7b2d..377352b81b5 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -181,8 +181,6 @@ if (empty($reshook)) { $object->date = $donation_date; $object->public = $public_donation; $object->fk_project = (int) GETPOST("fk_project", 'int'); - $object->note_private = (string) GETPOST("note_private", 'restricthtml'); - $object->note_public = (string) GETPOST("note_public", 'restricthtml'); $object->modepaymentid = (int) GETPOST('modepayment', 'int'); // Fill array 'array_options' with data from add form From 3fdd34400ff56e922ef729135a917b9b38ad3f95 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 23 Sep 2022 05:12:21 +0200 Subject: [PATCH 071/101] FIX #22265 Accountancy - Account number expected in place of a rowid on export --- htdocs/core/modules/modAccounting.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index e0bf3a9bbc5..d294a470041 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -258,14 +258,16 @@ class modAccounting extends DolibarrModules $this->export_label[$r] = 'Chartofaccounts'; $this->export_icon[$r] = 'accounting'; $this->export_permission[$r] = array(array("accounting", "chartofaccount")); - $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa.account_parent'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); - $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa.account_parent'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); - $this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa.accountparent'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting"); + $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa2.account_number'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); + $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"List:accounting_account:account_number", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); + $this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa2.account_number'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting"); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'accounting_account as aa'; $this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_system as ac'; - $this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').') '; + $this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_account as aa2'; + $this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').')'; + $this->export_sql_end[$r] .= ' AND aa2.rowid = aa.account_parent AND aa2.active = 1 AND ac.pcg_version = aa2.fk_pcg_version AND aa2.entity IN ('.getEntity('accounting').')'; // Imports From 7d4b2a664e80b233e172625d3e137681763972fd Mon Sep 17 00:00:00 2001 From: Jean Date: Fri, 23 Sep 2022 16:47:54 +0200 Subject: [PATCH 072/101] FIX #22379 creating events on supplier order --- htdocs/user/class/user.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4b6ee860c74..dd02873489d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -689,6 +689,7 @@ class User extends CommonObject 'inventory' => 'stock', 'invoice' => 'facture', 'invoice_supplier' => 'fournisseur', + 'order_supplier' => 'fournisseur', 'knowledgerecord' => 'knowledgerecord@knowledgemanagement', 'skill@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" From 194d7a2110cdd8324e368bec2840fe7d45780a35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Sep 2022 17:26:28 +0200 Subject: [PATCH 073/101] Update modAccounting.class.php --- htdocs/core/modules/modAccounting.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index d294a470041..6d1c6b1d876 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -259,7 +259,7 @@ class modAccounting extends DolibarrModules $this->export_icon[$r] = 'accounting'; $this->export_permission[$r] = array(array("accounting", "chartofaccount")); $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa2.account_number'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); - $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"List:accounting_account:account_number", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); + $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); $this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa2.account_number'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting"); $this->export_sql_start[$r] = 'SELECT DISTINCT '; From 88ff4ad4bc4bf81c3fa7a8f95346423a71e807ed Mon Sep 17 00:00:00 2001 From: Jean Date: Sat, 24 Sep 2022 09:13:19 +0200 Subject: [PATCH 074/101] FIX #22379 creating events on supplier order --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index dd02873489d..e57fc387bc7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -689,7 +689,7 @@ class User extends CommonObject 'inventory' => 'stock', 'invoice' => 'facture', 'invoice_supplier' => 'fournisseur', - 'order_supplier' => 'fournisseur', + 'order_supplier' => 'fournisseur', 'knowledgerecord' => 'knowledgerecord@knowledgemanagement', 'skill@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" From a919618bf4b324355c15d6c1026c8d8c5d059793 Mon Sep 17 00:00:00 2001 From: Jean Date: Sat, 24 Sep 2022 09:47:56 +0200 Subject: [PATCH 075/101] FIX #22382 Error on length of supplier reference --- htdocs/product/fournisseurs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2fe78f11e99..f18cbc241e7 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -508,9 +508,9 @@ if ($id > 0 || $ref) { print ''; print ''; From fe501f7214935f16a1a6358b6febfd9cd29e583b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Sep 2022 11:42:05 +0200 Subject: [PATCH 076/101] Fix inventorycode --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ad666573b18..c77b8284698 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2041,7 +2041,7 @@ class CommandeFournisseur extends CommonOrder // $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on) $mouv->origin = &$this; $mouv->setOrigin($this->element, $this->id); - $result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch, $inventorycode); + $result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch, '', 0, $inventorycode); if ($result < 0) { $this->error = $mouv->error; $this->errors = $mouv->errors; From 322d0955f20e6cbf7ed93e40649458ae8e197c2a Mon Sep 17 00:00:00 2001 From: Guido Schratzer Date: Sat, 24 Sep 2022 17:58:58 +0300 Subject: [PATCH 077/101] FIX: Issue #16476 on massaction the pdf generation is not using the thirdparty language settings --- htdocs/core/actions_massactions.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ddee2ad5fb4..c673111d0d7 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1388,6 +1388,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { foreach ($toselect as $toselectid) { $result = $objecttmp->fetch($toselectid); if ($result > 0) { + $objecttmp->fetch_thirdparty(); //load lang from thirdparty $outputlangs = $langs; $newlang = ''; From 33291b7cc791ed95ace0c565041607b43eae6303 Mon Sep 17 00:00:00 2001 From: priojk Date: Sat, 24 Sep 2022 17:19:52 +0200 Subject: [PATCH 078/101] FIX #21799 inactive companies cannot be selected --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index cb7e512bc36..c737ea63ebe 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1585,7 +1585,7 @@ if ($action == 'create') { //$warehouse_id = $soc->warehouse_id; } else { print '
'.$langs->trans("TotalMargin").''; -print ''; // set by jquery (see below) +print ' '.$langs->getCurrencySymbol($conf->currency).''; // set by jquery (see below) print '
'.$langs->trans("SupplierRef").''; if ($rowid) { print ''; - print ''; + print ''; } else { - print ''; + print ''; } print '
'; - print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); + print img_picto('', 'company').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); // reload page to retrieve customer informations if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { print '