Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0

Conflicts:
	htdocs/product/stock/class/entrepot.class.php
This commit is contained in:
Laurent Destailleur 2020-07-24 01:53:24 +02:00
commit e0d22b739d
3 changed files with 13 additions and 5 deletions

View File

@ -1542,8 +1542,11 @@ if ($action == 'create')
} }
if ($subj == 0) // Line not shown yet, we show it if ($subj == 0) // Line not shown yet, we show it
{ {
print '<!-- line not shown yet, we show it -->'; $warehouse_selected_id = GETPOST('entrepot_id', 'int');
print '<tr class="oddeven"><td colspan="3" ></td><td class="center">';
print '<!-- line not shown yet, we show it -->';
print '<tr class="oddeven"><td colspan="3"></td><td class="center">';
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
{ {
$disabled = ''; $disabled = '';
@ -1551,6 +1554,9 @@ if ($action == 'create')
{ {
$disabled = 'disabled="disabled"'; $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 '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> '; print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> ';
} }
else else
@ -1562,7 +1568,6 @@ if ($action == 'create')
print '<td class="left">'; print '<td class="left">';
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) 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) if ($warehouse_selected_id > 0)
{ {
$warehouseObject = new Entrepot($db); $warehouseObject = new Entrepot($db);

View File

@ -114,6 +114,7 @@ class Entrepot extends CommonObject
*/ */
public $fields = array( public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), '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), '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), '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), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35),
@ -456,6 +457,7 @@ class Entrepot extends CommonObject
} }
$sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax"; $sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax";
$sql .= ", entity";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
if ($id) if ($id)
{ {
@ -475,6 +477,7 @@ class Entrepot extends CommonObject
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->fk_parent = $obj->fk_parent; $this->fk_parent = $obj->fk_parent;
$this->ref = $obj->label; $this->ref = $obj->label;
$this->label = $obj->label; $this->label = $obj->label;

View File

@ -226,13 +226,13 @@ if (!empty($conf->categorie->enabled))
} }
foreach ($search as $key => $val) 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); $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) { if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') $search[$key] = ''; if ($search[$key] == '-1') $search[$key] = '';
$mode_search = 2; $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); if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
// Add where from extra fields // Add where from extra fields