diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 0a953ea869c..d186c6e533b 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -101,7 +101,7 @@ class Mo extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1', 'noteditable'=>1), - 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>'$conf->bom->enabled', 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall'), + 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>'$conf->bom->enabled', 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall', 'picto'=>'bom'), 'mrptype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>34, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1), @@ -1375,13 +1375,13 @@ class Mo extends CommonObject print ''; // Product or sub-bom - print ''.$langs->trans('Description'); + print ''.$langs->trans('Ref'); if (!empty($conf->global->BOM_SUB_BOM)) { print '   '.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'  '; print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; } print ''; - print ''.$langs->trans('Ref').''; + // Qty print ''.$langs->trans('Qty'); if ($this->bom->bomtype == 0) { print ' ('.$langs->trans("ForAQuantityOf", $this->bom->qty).')'; @@ -1395,7 +1395,7 @@ class Mo extends CommonObject print ''.$langs->trans('DisableStockChange').''; print ''.$langs->trans('MoChildGenerate').''; //print ''.$form->showCheckAddButtons('checkforselect', 1).''; - // print ''; + //print ''; print ''; $i = 0; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index f6aba7f2597..d92c595c6ec 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -708,7 +708,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; $url = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addconsumeline&token='.newToken(); - $permissiontoaddaconsumeline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED && $action != 'consumeorproduce' && $action != 'consumeandproduceall'; + $permissiontoaddaconsumeline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED; $parameters = array('morecss'=>'reposition'); $newcardbutton = ''; @@ -996,6 +996,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $i = 1; print ''."\n"; print ''; + // Ref print ''.$langs->trans("ToConsume").''; $preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed)); if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) { @@ -1044,12 +1045,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); print ''; print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', ''); - } - print ''; - print ''; - if ($tmpproduct->status_batch) { + $type = 'batch'; - print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$line->id.', \''.$type.'\', \'qtymissingconsume\')"'); + print ' '.img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.((int) $line->id).', \''.dol_escape_js($type).'\', \'qtymissingconsume\')"'); } print ''; } @@ -1094,10 +1092,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $newcardbutton = ''; $url = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addproduceline&token='.newToken(); - $permissiontoaddaproductline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED && $action != 'consumeorproduce' && $action != 'consumeandproduceall'; + $permissiontoaddaproductline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED; $parameters = array('morecss'=>'reposition'); - if ($nblinetoproduce == 0 || $object->mrptype == 1) { - $newcardbutton = dolGetButtonTitle($langs->trans('AddNewProduceLines'), '', 'fa fa-plus-circle size15x', $url, '', $permissiontoaddaproductline, $parameters); + if ($action != 'consumeorproduce' && $action != 'consumeandproduceall') { + if ($nblinetoproduce == 0 || $object->mrptype == 1) { + $newcardbutton = dolGetButtonTitle($langs->trans('AddNewProduceLines'), '', 'fa fa-plus-circle size15x', $url, '', $permissiontoaddaproductline, $parameters); + } } print load_fiche_titre($langs->trans('Production'), $newcardbutton, '', 0, '', ''); @@ -1196,12 +1196,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$line->qty.''; if ($permissiontoupdatecost) { // Defined $manufacturingcost - $manufacturingcost = $bomcost; - if (empty($manufacturingcost)) { - $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); - } - if (empty($manufacturingcost)) { - $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + $manufacturingcost = 0; + if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble" + $manufacturingcost = $bomcost; + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + } + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + } } print ''; @@ -1300,19 +1303,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; if ($permissiontoupdatecost) { // Defined $manufacturingcost - $manufacturingcost = $bomcost; - if (empty($manufacturingcost)) { - $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); - } - if (empty($manufacturingcost)) { - $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + $manufacturingcost = 0; + if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble" + $manufacturingcost = $bomcost; + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + } + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + } } if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : price($manufacturingcost)); + $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : ($manufacturingcost ? price($manufacturingcost) : '')); print ''; } else { - print ''; + print ''; } } print ''; diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index e641bd142fc..7e0468119bd 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -44,6 +44,7 @@ $res = $tmpbom->fetch($line->fk_bom_child); tpl['strike']) ? '' : ' strikefordisabled').'">'; +// Ref or label print ''; if ($res) { print $tmpproduct->getNomUrl(1); @@ -58,7 +59,7 @@ if ($res) { print $this->tpl['label']; } print ''; -//print ''.$this->tpl['label'].''; +// Qty print ''.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').''; print ''.(empty($this->tpl['stock']) ? 0 : price2num($this->tpl['stock'], 'MS')); if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['stock'] < $this->tpl['seuil_stock_alerte'])) { @@ -78,18 +79,19 @@ $selected = 1; if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) { $selected = 0; } -print ''; -//print ''; -print ''; -if ($tmpbom->id) { +if ($tmpbom->id > 0) { print ''; print ''; print ''; } else { - print ' '; + print ''; } +//print ''; +//print ''; +//print ''; + print ''."\n"; // Select of all the sub-BOM lines