From 2f8968478d9260f9385ec1f866edd3a6447ed33b Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sun, 12 Jul 2020 10:06:04 +0200 Subject: [PATCH 1/5] fix missing entity into fetch wahrehouse --- htdocs/product/stock/class/entrepot.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 0b259018cfc..39fad14c544 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -441,6 +441,7 @@ class Entrepot extends CommonObject } $sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id"; + $sql .= " , entity"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; if ($id) { @@ -460,6 +461,7 @@ class Entrepot extends CommonObject $obj=$this->db->fetch_object($result); $this->id = $obj->rowid; + $this->entity = $obj->entity; $this->fk_parent = $obj->fk_parent; $this->ref = $obj->label; $this->label = $obj->label; From 7b5072a21b49fd4816f8cae72924e29743ae5dfd Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sun, 12 Jul 2020 10:10:46 +0200 Subject: [PATCH 2/5] fix missing entity --- htdocs/product/stock/class/entrepot.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 39fad14c544..f5500812290 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -104,6 +104,7 @@ class Entrepot extends CommonObject */ public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>15), 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35), From 32e4635e84203596db9ebcef85ef78863644e88a Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sun, 12 Jul 2020 21:34:13 +0200 Subject: [PATCH 3/5] fix missing entity into fetch wharehouse --- htdocs/product/stock/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 057735c49cc..9baaeebf90e 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -209,7 +209,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as ccount ON ccount.rowid = t.fk $sql .= " WHERE t.entity IN (".getEntity('stock').")"; foreach ($search as $key => $val) { - if ($key == 'status' && $search[$key] == -1) continue; + if (($key == 'status' && $search[$key] == -1) || $key=='entity') continue; $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if (strpos($object->fields[$key]['type'], 'integer:') === 0) { if ($search[$key] == '-1') $search[$key] = ''; From f4074428f8b8a6bdd2cf8a3b97a9aae6a1918e68 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 14 Jul 2020 09:38:52 +0200 Subject: [PATCH 4/5] fix filter wharehouse list on ref --- htdocs/product/stock/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 057735c49cc..8ccc887641f 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -215,7 +215,7 @@ foreach ($search as $key => $val) if ($search[$key] == '-1') $search[$key] = ''; $mode_search = 2; } - if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : $key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); // Add where from extra fields From 99935ce11fd6019814504f32dab96630c5aa1527 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jul 2020 01:30:34 +0200 Subject: [PATCH 5/5] FIX Should not be able to edit qty on shipment when no stock available --- htdocs/expedition/card.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c362bcfb8ac..a14258e6419 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1524,8 +1524,11 @@ if ($action == 'create') } if ($subj == 0) // Line not shown yet, we show it { - print ''; - print ''; + $warehouse_selected_id = GETPOST('entrepot_id', 'int'); + + print ''; + print ''; + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $disabled = ''; @@ -1533,6 +1536,9 @@ if ($action == 'create') { $disabled = 'disabled="disabled"'; } + if ($warehouse_selected_id <= 0) { // We did not force a given warehouse, so we won't have no warehouse to change qty. + $disabled = 'disabled="disabled"'; + } print ' '; } else @@ -1544,7 +1550,6 @@ if ($action == 'create') print ''; if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $warehouse_selected_id = GETPOST('entrepot_id', 'int'); if ($warehouse_selected_id > 0) { $warehouseObject = new Entrepot($db);