Merge branch 'develop_NEW_Service_DefaultWorkstation' of github.com:atm-lena/dolibarr into develop_NEW_Service_DefaultWorkstation
This commit is contained in:
commit
c66489e2e0
@ -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();
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user