FIX Stock qty hidden without permission to see stock
This commit is contained in:
parent
e17cc5b2e5
commit
5cb9434bb4
@ -2416,10 +2416,12 @@ class Form
|
|||||||
|
|
||||||
// Units
|
// Units
|
||||||
$outvalUnits = '';
|
$outvalUnits = '';
|
||||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||||
if (!empty($objp->unit_short)) {
|
if (!empty($objp->unit_short)) {
|
||||||
$outvalUnits .= ' - ' . $objp->unit_short;
|
$outvalUnits .= ' - ' . $objp->unit_short;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (! empty($conf->global->PRODUCT_SHOW_DIMENSIONS_IN_COMBO)) {
|
||||||
if (!empty($objp->weight) && $objp->weight_units!==null) {
|
if (!empty($objp->weight) && $objp->weight_units!==null) {
|
||||||
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
|
||||||
$outvalUnits .= ' - ' . $unitToShow;
|
$outvalUnits .= ' - ' . $unitToShow;
|
||||||
@ -2436,6 +2438,7 @@ class Form
|
|||||||
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
|
||||||
$outvalUnits .= ' - ' . $unitToShow;
|
$outvalUnits .= ' - ' . $unitToShow;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($outdurationvalue && $outdurationunit) {
|
if ($outdurationvalue && $outdurationunit) {
|
||||||
$da = array(
|
$da = array(
|
||||||
'h' => $langs->trans('Hour'),
|
'h' => $langs->trans('Hour'),
|
||||||
@ -2447,7 +2450,6 @@ class Form
|
|||||||
if (isset($da[$outdurationunit])) {
|
if (isset($da[$outdurationunit])) {
|
||||||
$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
|
$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$opt = '<option value="'.$objp->rowid.'"';
|
$opt = '<option value="'.$objp->rowid.'"';
|
||||||
@ -2458,9 +2460,11 @@ class Form
|
|||||||
}
|
}
|
||||||
if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)))
|
if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)))
|
||||||
{
|
{
|
||||||
|
if (! empty($user->rights->stock->lire)) {
|
||||||
if ($objp->stock > 0) $opt.= ' class="product_line_stock_ok"';
|
if ($objp->stock > 0) $opt.= ' class="product_line_stock_ok"';
|
||||||
elseif ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"';
|
elseif ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$opt.= '>';
|
$opt.= '>';
|
||||||
$opt.= $objp->ref;
|
$opt.= $objp->ref;
|
||||||
if ($outbarcode) $opt.=' ('.$outbarcode.')';
|
if ($outbarcode) $opt.=' ('.$outbarcode.')';
|
||||||
@ -2602,6 +2606,7 @@ class Form
|
|||||||
|
|
||||||
if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)))
|
if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)))
|
||||||
{
|
{
|
||||||
|
if (! empty($user->rights->stock->lire)) {
|
||||||
$opt.= ' - '.$langs->trans("Stock").':'.$objp->stock;
|
$opt.= ' - '.$langs->trans("Stock").':'.$objp->stock;
|
||||||
|
|
||||||
if ($objp->stock > 0) {
|
if ($objp->stock > 0) {
|
||||||
@ -2634,6 +2639,7 @@ class Form
|
|||||||
unset($tmpproduct);
|
unset($tmpproduct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$opt.= "</option>\n";
|
$opt.= "</option>\n";
|
||||||
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit);
|
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user