From 6a210945b7d70256f3386bdeca41972cd0eed90d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Nov 2019 20:38:06 +0100 Subject: [PATCH 1/5] Prepare 10.0.4 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 274f1953d40..7c71221ba3c 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION', '10.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION', '10.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO', chr(128)); From 355d7545f62beb5658c948bb2b0f8743ae3e9813 Mon Sep 17 00:00:00 2001 From: altairis Date: Wed, 27 Nov 2019 10:23:01 +0100 Subject: [PATCH 2/5] filter language is an array --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 9411e8bc824..7b885d36a52 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -741,7 +741,7 @@ class FormFile $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); $morecss='maxwidth150'; if ($conf->browser->layout == 'phone') $morecss='maxwidth100'; - $out.= $formadmin->select_language($defaultlang, 'lang_id', 0, 0, 0, 0, 0, $morecss); + $out.= $formadmin->select_language($defaultlang, 'lang_id', 0, null, 0, 0, 0, $morecss); } else { From 425f88082fbd26b1a45c2805add7b9a76c20f75b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Nov 2019 11:53:37 +0100 Subject: [PATCH 3/5] Prepare 10.0.4 --- ChangeLog | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9cb2225cd08..99e70e960c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,31 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + +***** ChangeLog for 10.0.4 compared to 10.0.3 ***** +FIX: The pdf templates were using the large logo making PDF too large (and edition of proposal, order, invoice VERY slow) +FIX: #12258 +FIX: #12319 Restore feature ACCOUNTANCY_AUTOFILL_ACCOUNT_WITH_GENERIC. +FIX: #12356 +FIX: #12372 +FIX: #12385 +FIX: Advisory ID: usd20190053 +FIX: Advisory ID: usd20190067 +FIX: Avoid fatal error when creating thumb from PDF +FIX: compatibility with Multicompany +FIX: display job of contact list +FIX: Extrafields missing in export of expense report +FIX: Hook getAccessForbiddenMessage was missing parameters +FIX: limit 20 prevent to see all products/services +FIX: Search on leave request ref +FIX: security check. A user can see holiday with link without permissions +FIX: Set unpaid of expense report +FIX: shipping extrafields line +FIX: the SELECT examine more than MAX_JOIN_SIZE rows #12305 +FIX: triggers: directories read with opendir() never closed +FIX: we need to be able to recalculate tva only if invoice not in accountancy +FIX: wrong invoice id for fetchObjetctLinked + ***** ChangeLog for 10.0.3 compared to 10.0.2 ***** IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card. The unit were not saved correctly in database making calculation on shipments wrong. From 3acd0bc2ff1231484f2518b0def3ca2dd8b4f85e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Nov 2019 11:32:09 +0100 Subject: [PATCH 4/5] FIX Reduce number of request for list of products --- htdocs/core/lib/product.lib.php | 62 +++++++++++++++++++-------------- htdocs/product/list.php | 14 +++++--- 2 files changed, 46 insertions(+), 30 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 6701a82b31b..f54f39b20f3 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -509,36 +509,46 @@ function measuring_units_string($scale = '', $measuring_style = '', $unit = 0, $ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_short_label = 0) { global $langs, $db; - require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; - $measuringUnits= new CUnits($db); + global $measuring_unit_cache; - if ($scale !== '') + if (empty($measuring_unit_cache[$unit.'_'.$measuring_style.'_'.$scale.'_'.$use_short_label])) { - $arrayforfilter = array( - 't.scale' => $scale, - 't.unit_type' => $measuring_style, - 't.active' => 1 - ); - } - else - { - $arrayforfilter = array( - 't.rowid' => $unit, - 't.unit_type' => $measuring_style, - 't.active' => 1 - ); - } - $result = $measuringUnits->fetchAll('', '', 0, 0, $arrayforfilter); + require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; + $measuringUnits= new CUnits($db); - if ($result<0) { - return -1; - } else { - if (is_array($measuringUnits->records) && count($measuringUnits->records)>0) { - if ($use_short_label) return $measuringUnits->records[key($measuringUnits->records)]->short_label; - else return $langs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label); - } else { - return ''; + if ($scale !== '') + { + $arrayforfilter = array( + 't.scale' => $scale, + 't.unit_type' => $measuring_style, + 't.active' => 1 + ); } + else + { + $arrayforfilter = array( + 't.rowid' => $unit, + 't.unit_type' => $measuring_style, + 't.active' => 1 + ); + } + $result = $measuringUnits->fetchAll('', '', 0, 0, $arrayforfilter); + + if ($result < 0) { + return -1; + } else { + if (is_array($measuringUnits->records) && count($measuringUnits->records)>0) { + if ($use_short_label) $labeltoreturn = $measuringUnits->records[key($measuringUnits->records)]->short_label; + else $labeltoreturn = $langs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label); + } else { + $labeltoreturn = ''; + } + $measuring_unit_cache[$unit.'_'.$measuring_style.'_'.$scale.'_'.$use_short_label] = $labeltoreturn; + return $labeltoreturn; + } + } + else { + return $measuring_unit_cache[$unit.'_'.$measuring_style.'_'.$scale.'_'.$use_short_label]; } } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 6e870c05740..cfa330196d9 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -783,7 +783,7 @@ if ($resql) $obj = $db->fetch_object($resql); // Multilangs - if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active + if (! empty($conf->global->MAIN_MULTILANGS)) // If multilang is enabled { $sql = "SELECT label"; $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; @@ -801,7 +801,8 @@ if ($resql) $product_static->id = $obj->rowid; $product_static->ref = $obj->ref; - $product_static->ref_fourn = $obj->ref_supplier; + $product_static->ref_fourn = $obj->ref_supplier; // deprecated + $product_static->ref_supplier = $obj->ref_supplier; $product_static->label = $obj->label; $product_static->type = $obj->fk_product_type; $product_static->status_buy = $obj->tobuy; @@ -826,15 +827,17 @@ if ($resql) $product_static->surface = $obj->surface; $product_static->surface_units = $obj->surface_units; + // STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock. if ((! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || ! empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock { if ($obj->fk_product_type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Not a service { - $product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock() + $option = 'nobatch'; + if (empty($arrayfields['stock_virtual']['checked'])) $option .= ',novirtual'; + $product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock() } } - print ''; // Ref @@ -845,6 +848,7 @@ if ($resql) print "\n"; if (! $i) $totalarray['nbfield']++; } + // Ref supplier if (! empty($arrayfields['pfp.ref_fourn']['checked'])) { @@ -853,6 +857,7 @@ if ($resql) print "\n"; if (! $i) $totalarray['nbfield']++; } + // Label if (! empty($arrayfields['p.label']['checked'])) { @@ -1120,6 +1125,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } + // Action print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined From a4a805f618f7c440fdad24f55870f4def51b1bab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Nov 2019 11:32:22 +0100 Subject: [PATCH 5/5] Doxygen --- htdocs/product/class/product.class.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ac987d49845..d00cba86e6a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4010,7 +4010,7 @@ class Product extends CommonObject if ($this->type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (! empty($conf->productbatch->enabled)) { - $langs->load("productbatch"); + $langs->load("productbatch"); $label.="
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2); } } @@ -4361,12 +4361,12 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Load information about stock of a product into ->stock_reel, ->stock_warehouse[] (including stock_warehouse[idwarehouse]->detail_batch for batch products) - * This function need a lot of load. If you use it on list, use a cache to execute it once for each product id. - * If ENTREPOT_EXTRA_STATUS set, filtering on warehouse status possible. + * Load information about stock of a product into ->stock_reel, ->stock_warehouse[] (including stock_warehouse[idwarehouse]->detail_batch for batch products) + * This function need a lot of load. If you use it on list, use a cache to execute it once for each product id. + * If ENTREPOT_EXTRA_STATUS set, filtering on warehouse status possible. * - * @param string $option '' = Load all stock info, also from closed and internal warehouses, - * @return int < 0 if KO, > 0 if OK + * @param string $option '' = Load all stock info, also from closed and internal warehouses, 'nobatch', 'novirtual' + * @return int < 0 if KO, > 0 if OK * @see load_virtual_stock(), loadBatchInfo() */ public function load_stock($option = '') @@ -4396,7 +4396,8 @@ class Product extends CommonObject $sql.= " WHERE w.entity IN (".getEntity('stock').")"; $sql.= " AND w.rowid = ps.fk_entrepot"; $sql.= " AND ps.fk_product = ".$this->id; - if ($conf->global->ENTREPOT_EXTRA_STATUS && count($warehouseStatus)) { $sql.= " AND w.statut IN (".$this->db->escape(implode(',', $warehouseStatus)).")"; + if ($conf->global->ENTREPOT_EXTRA_STATUS && count($warehouseStatus)) { + $sql.= " AND w.statut IN (".$this->db->escape(implode(',', $warehouseStatus)).")"; } dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); @@ -4411,7 +4412,8 @@ class Product extends CommonObject $this->stock_warehouse[$row->fk_entrepot] = new stdClass(); $this->stock_warehouse[$row->fk_entrepot]->real = $row->reel; $this->stock_warehouse[$row->fk_entrepot]->id = $row->rowid; - if ((! preg_match('/nobatch/', $option)) && $this->hasbatch()) { $this->stock_warehouse[$row->fk_entrepot]->detail_batch=Productbatch::findAll($this->db, $row->rowid, 1, $this->id); + if ((! preg_match('/nobatch/', $option)) && $this->hasbatch()) { + $this->stock_warehouse[$row->fk_entrepot]->detail_batch=Productbatch::findAll($this->db, $row->rowid, 1, $this->id); } $this->stock_reel+=$row->reel; $i++;