Merge branch 'develop_NEW_Service_DefaultWorkstation' of github.com:atm-lena/dolibarr into develop_NEW_Service_DefaultWorkstation

This commit is contained in:
atm-lena 2022-07-21 14:34:14 +02:00
commit c66489e2e0
3 changed files with 5 additions and 5 deletions

View File

@ -71,7 +71,7 @@ if ($action == 'getDurationUnitByProduct') {
$res = $product->fetch($idproduct);
$cUnit = new CUnits($db);
$fk_unit = $cUnit->getUnitFromCode($product->duration_unit, 'short_label','time');
$fk_unit = $cUnit->getUnitFromCode($product->duration_unit, 'short_label', 'time');
echo json_encode($fk_unit);
exit();

View File

@ -162,7 +162,7 @@ if ($filtertype != 1) {
$coldisplay++;
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
$cUnit = new CUnits($this->db);
$fk_unit_default = $cUnit->getUnitFromCode('h', 'short_label','time');
$fk_unit_default = $cUnit->getUnitFromCode('h', 'short_label', 'time');
print '<td class="bordertop nobottom nowrap linecolunit right">';
print $formproduct->selectMeasuringUnits("fk_unit", "time", $fk_unit_default, 0, 0);
print '</td>';

View File

@ -423,13 +423,13 @@ class CUnits // extends CommonObject
* @param string $unit_type weight,size,surface,volume,qty,time...
* @return int <0 if KO, Id of code if OK
*/
public function getUnitFromCode($code, $mode = 'code', $unit_type='')
public function getUnitFromCode($code, $mode = 'code', $unit_type = '')
{
if ($mode == 'short_label') {
return dol_getIdFromCode($this->db, $code, 'c_units', 'short_label', 'rowid',0, ' AND unit_type = "'.$unit_type.'"');
return dol_getIdFromCode($this->db, $code, 'c_units', 'short_label', 'rowid', 0, ' AND unit_type = "'.$unit_type.'"');
} elseif ($mode == 'code') {
return dol_getIdFromCode($this->db, $code, 'c_units', 'code', 'rowid',0, ' AND unit_type = "'. $unit_type .'"');
return dol_getIdFromCode($this->db, $code, 'c_units', 'code', 'rowid', 0, ' AND unit_type = "'. $unit_type .'"');
}
return $code;