diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 725427e249f..cf8e45b5901 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -231,7 +231,19 @@ class Mo extends CommonObject */ public function create(User $user, $notrigger = false) { - return $this->createCommon($user, $notrigger); + $this->db->begin(); + + $result = $this->createCommon($user, $notrigger); + + // Insert lines in mrp_production table + + if ($result > 0) { + $this->db->commit(); + } else { + $this->db->rollback(); + } + + return $result; } /** diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 67032eea7fe..88240e21efb 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -30,8 +30,8 @@ if (empty($conf) || ! is_object($conf)) print ''; print ''.$this->tpl['label'].''; print ''.$this->tpl['qty'].''; -print ''.yn($this->tpl['qty_frozen']).''; -print ''.yn($this->tpl['disable_stock_change']).''; +print ''.($this->tpl['qty_frozen'] ? yn($this->tpl['qty_frozen']) : '').''; +print ''.($this->tpl['disable_stock_change'] ? yn($this->tpl['disable_stock_change']) : '').''; //print ''.$this->tpl['efficiency'].''; $selected=1;