';
if (!empty($line->fk_bank)) print $langs->trans('Paid');
elseif (!$printed)
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++;
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