Merge pull request #13087 from ptibogxiv/patch-304
Fix netmeasure update and display
This commit is contained in:
commit
3a9125b097
@ -504,7 +504,7 @@ function measuring_units_string($scale = '', $measuring_style = '', $unit = 0, $
|
||||
* Return translation label of a unit key
|
||||
*
|
||||
* @param int $unit ID of unit (rowid in llx_c_units table)
|
||||
* @param string $measuring_style Style of unit: weight, volume,...
|
||||
* @param string $measuring_style Style of unit: 'weight', 'volume', ..., '' = 'net_measure' for option PRODUCT_ADD_NET_MEASURE
|
||||
* @param string $scale Scale of unit: '0', '-3', '6', ...
|
||||
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
|
||||
* @return string Unit string
|
||||
@ -520,7 +520,14 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
||||
$measuringUnits= new CUnits($db);
|
||||
|
||||
if ($scale !== '')
|
||||
if ($measuring_style == '' && $scale == '')
|
||||
{
|
||||
$arrayforfilter = array(
|
||||
't.rowid' => $unit,
|
||||
't.active' => 1
|
||||
);
|
||||
}
|
||||
elseif ($scale !== '')
|
||||
{
|
||||
$arrayforfilter = array(
|
||||
't.scale' => $scale,
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
|
||||
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2019-2020 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1513,7 +1513,7 @@ else
|
||||
// Net Measure
|
||||
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
|
||||
print '<input name="net_measure" size="5" value="'.$object->net_measure.'"> ';
|
||||
print $formproduct->selectMeasuringUnits($object->net_measure_units, '', 0, 0, 0);
|
||||
print $formproduct->selectMeasuringUnits("net_measure_units", "", $object->net_measure_units, 0, 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@ -1955,7 +1955,7 @@ else
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NetMeasure").'</td><td colspan="2">';
|
||||
if ($object->net_measure != '')
|
||||
{
|
||||
print $object->net_measure." ".measuringUnitString(0, "weight", $object->net_measure_units);
|
||||
print $object->net_measure." ".measuringUnitString($object->net_measure_units);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user