Skip to content

Commit

Permalink
Fix #11256
Browse files Browse the repository at this point in the history
  • Loading branch information
AXeL-dev committed Jun 1, 2019
1 parent 7e678f3 commit d2c853c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion htdocs/core/class/html.form.class.php
Expand Up @@ -1914,6 +1914,16 @@ public function select_produits($selected = '', $htmlname = 'productid', $filter
$selected_input_value=$producttmpselect->ref;
unset($producttmpselect);
}
// handle case where product or service module is disabled + no filter specified
if (empty($filtertype))
{
if (empty($conf->product->enabled)) { // when product module is disabled, show services only
$filtertype = 1;
}
elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
$filtertype = 0;
}
}
// mode=1 means customers products
$urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
//Price by customer
Expand Down Expand Up @@ -2165,7 +2175,14 @@ public function select_produits_list($selected = '', $htmlname = 'productid', $f
{
$sql.= " AND p.tosell = ".$status;
}
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype;
// Filter by product type
if (strval($filtertype) != '') $sql.= " AND p.fk_product_type = ".$filtertype;
elseif (empty($conf->product->enabled)) { // when product module is disabled, show services only
$sql.= " AND p.fk_product_type = 1";
}
elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
$sql.= " AND p.fk_product_type = 0";
}
// Add criteria on ref/label
if ($filterkey != '')
{
Expand Down

0 comments on commit d2c853c

Please sign in to comment.