|
@@ -1369,16 +1369,14 @@ class BOM extends CommonObject
|
|
|
$unit = measuringUnitString($line->fk_unit, '', '', 1);
|
|
|
$qty = convertDurationtoHour($line->qty, $unit);
|
|
|
|
|
|
- if ($conf->workstation->enabled) {
|
|
|
- if ($tmpproduct->fk_default_workstation) {
|
|
|
- $workstation = new Workstation($this->db);
|
|
|
- $res = $workstation->fetch($tmpproduct->fk_default_workstation);
|
|
|
-
|
|
|
- if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT');
|
|
|
- else {
|
|
|
- $this->error = $workstation->error;
|
|
|
+ if ($conf->workstation->enabled && !empty($tmpproduct->fk_default_workstation)) {
|
|
|
+ $workstation = new Workstation($this->db);
|
|
|
+ $res = $workstation->fetch($tmpproduct->fk_default_workstation);
|
|
|
+
|
|
|
+ if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT');
|
|
|
+ else {
|
|
|
+ $this->error = $workstation->error;
|
|
|
return -3;
|
|
|
- }
|
|
|
}
|
|
|
} else {
|
|
|
$line->total_cost = price2num($qty * $tmpproduct->cost_price, 'MT');
|