FIX #11861
This commit is contained in:
parent
981c5c877a
commit
fd37a81e19
@ -485,19 +485,33 @@ function show_stats_for_company($product, $socid)
|
|||||||
*
|
*
|
||||||
* @param int $unit ID of unit (rowid in llx_c_units table)
|
* @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,...
|
||||||
|
* @param string $scale Scale of unit: '0', '-3', '6', ...
|
||||||
* @return string Unit string
|
* @return string Unit string
|
||||||
* @see formproduct->selectMeasuringUnits
|
* @see formproduct->selectMeasuringUnits
|
||||||
*/
|
*/
|
||||||
function measuring_units_string($unit, $measuring_style = '')
|
function measuring_units_string($unit, $measuring_style = '', $scale = '')
|
||||||
{
|
{
|
||||||
global $langs, $db;
|
global $langs, $db;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
||||||
$measuringUnits= new CUnits($db);
|
$measuringUnits= new CUnits($db);
|
||||||
$result = $measuringUnits->fetchAll('', '', 0, 0, array(
|
|
||||||
|
if ($scale !== '')
|
||||||
|
{
|
||||||
|
$arrayforfilter = array(
|
||||||
|
't.scale' => $scale,
|
||||||
|
't.unit_type' => $measuring_style,
|
||||||
|
't.active' => 1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$arrayforfilter = array(
|
||||||
't.rowid' => $unit,
|
't.rowid' => $unit,
|
||||||
't.unit_type' => $measuring_style,
|
't.unit_type' => $measuring_style,
|
||||||
't.active' => 1
|
't.active' => 1
|
||||||
));
|
);
|
||||||
|
}
|
||||||
|
$result = $measuringUnits->fetchAll('', '', 0, 0, $arrayforfilter);
|
||||||
|
|
||||||
if ($result<0) {
|
if ($result<0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user