Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	ChangeLog
	htdocs/core/class/html.formfile.class.php
	htdocs/core/lib/product.lib.php
	htdocs/filefunc.inc.php
	htdocs/product/class/product.class.php
	htdocs/product/list.php
This commit is contained in:
Laurent Destailleur 2019-11-29 11:42:08 +01:00
commit 3b9d2abcb2
5 changed files with 80 additions and 39 deletions

View File

@ -207,6 +207,29 @@ Following changes may create regressions for some external modules, but were nec
* The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core. * The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core.
***** 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 ***** ***** 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. IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.

View File

@ -749,7 +749,7 @@ class FormFile
$defaultlang = $codelang ? $codelang : $langs->getDefaultLang(); $defaultlang = $codelang ? $codelang : $langs->getDefaultLang();
$morecss = 'maxwidth150'; $morecss = 'maxwidth150';
if ($conf->browser->layout == 'phone') $morecss = 'maxwidth100'; 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 else
{ {

View File

@ -513,8 +513,12 @@ function measuring_units_string($scale = '', $measuring_style = '', $unit = 0, $
function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_short_label = 0) function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_short_label = 0)
{ {
global $langs, $db; global $langs, $db;
global $measuring_unit_cache;
if (empty($measuring_unit_cache[$unit.'_'.$measuring_style.'_'.$scale.'_'.$use_short_label]))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
$measuringUnits = new CUnits($db); $measuringUnits= new CUnits($db);
if ($scale !== '') if ($scale !== '')
{ {
@ -538,11 +542,17 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho
return -1; return -1;
} else { } else {
if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) { if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) {
if ($use_short_label) return $measuringUnits->records[key($measuringUnits->records)]->short_label; if ($use_short_label) $labeltoreturn = $measuringUnits->records[key($measuringUnits->records)]->short_label;
else return $langs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label); else $labeltoreturn = $langs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
} else { } else {
return ''; $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];
} }
} }

View File

@ -4588,7 +4588,7 @@ class Product extends CommonObject
* This function need a lot of load. If you use it on list, use a cache to execute it once for each product id. * 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. * If ENTREPOT_EXTRA_STATUS set, filtering on warehouse status possible.
* *
* @param string $option '' = Load all stock info, also from closed and internal warehouses, * @param string $option '' = Load all stock info, also from closed and internal warehouses, 'nobatch', 'novirtual'
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
* @see load_virtual_stock(), loadBatchInfo() * @see load_virtual_stock(), loadBatchInfo()
*/ */
@ -4619,7 +4619,8 @@ class Product extends CommonObject
$sql .= " WHERE w.entity IN (".getEntity('stock').")"; $sql .= " WHERE w.entity IN (".getEntity('stock').")";
$sql .= " AND w.rowid = ps.fk_entrepot"; $sql .= " AND w.rowid = ps.fk_entrepot";
$sql .= " AND ps.fk_product = ".$this->id; $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); dol_syslog(get_class($this)."::load_stock", LOG_DEBUG);
@ -4634,7 +4635,8 @@ class Product extends CommonObject
$this->stock_warehouse[$row->fk_entrepot] = new stdClass(); $this->stock_warehouse[$row->fk_entrepot] = new stdClass();
$this->stock_warehouse[$row->fk_entrepot]->real = $row->reel; $this->stock_warehouse[$row->fk_entrepot]->real = $row->reel;
$this->stock_warehouse[$row->fk_entrepot]->id = $row->rowid; $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; $this->stock_reel += $row->reel;
$i++; $i++;

View File

@ -833,7 +833,7 @@ if ($resql)
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
// Multilangs // 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 = "SELECT label";
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang"; $sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
@ -851,7 +851,8 @@ if ($resql)
$product_static->id = $obj->rowid; $product_static->id = $obj->rowid;
$product_static->ref = $obj->ref; $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->label = $obj->label;
$product_static->type = $obj->fk_product_type; $product_static->type = $obj->fk_product_type;
$product_static->status_buy = $obj->tobuy; $product_static->status_buy = $obj->tobuy;
@ -876,15 +877,17 @@ if ($resql)
$product_static->surface = $obj->surface; $product_static->surface = $obj->surface;
$product_static->surface_units = $obj->surface_units; $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 ((!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 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 '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
@ -895,6 +898,7 @@ if ($resql)
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Ref supplier // Ref supplier
if (!empty($arrayfields['pfp.ref_fourn']['checked'])) if (!empty($arrayfields['pfp.ref_fourn']['checked']))
{ {
@ -903,6 +907,7 @@ if ($resql)
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Label // Label
if (!empty($arrayfields['p.label']['checked'])) if (!empty($arrayfields['p.label']['checked']))
{ {
@ -1179,6 +1184,7 @@ if ($resql)
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Action // Action
print '<td class="nowrap center">'; print '<td class="nowrap center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined