diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 3f1be6c7e4c..81b5f858c9b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -520,7 +520,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; // Common attributes - $keyforbreak = 'efficiency'; + $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Other attributes diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index ddfb5e78d17..dd0ff4977d7 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -95,7 +95,7 @@ class BOM extends CommonObject 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), - 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + //'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'), 'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>102), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,), @@ -1056,7 +1056,7 @@ class BOMLine extends CommonObjectLine 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',), 'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'), 'disable_stock_change' => array('type'=>'smallint', 'label'=>'DisableStockChange', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>108, 'css'=>'maxwidth50imp', 'help'=>'DisableStockChangeHelp'), - //'efficiency' => array('type'=>'double(24,8)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfEfficiencyConsumedMeans'), + 'efficiency' => array('type'=>'double(24,8)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfEfficiencyConsumedMeans'), 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), ); diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index b027b5f397d..445466a27a1 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -98,11 +98,11 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } else { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } echo ''; @@ -128,11 +128,10 @@ $coldisplay++; print ''; -//$coldisplay++; -//print ''; - +$coldisplay++; +print ''; $coldisplay += $colspan; print ''; -//$coldisplay++; -//print ''; +$coldisplay++; +print ''; $coldisplay+=$colspan; print ''; // Efficiency -//print ''; +print ''; print ''; // No width to allow autodim diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 97221d531ad..16aa5382f53 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -98,10 +98,10 @@ $coldisplay++; echo $line->disable_stock_change ? yn($line->disable_stock_change) : ''; // Yes, it is a quantity, not a price, but we just want the formating role of function price print ''; -//print ''; +print ''; if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' ) { print ''; print ''; - print ''; + print ''; print ''; print ''; //print ''; @@ -1337,7 +1337,7 @@ class Mo extends CommonObject $this->tpl['qty'] = $line->qty; $this->tpl['qty_frozen'] = $line->qty_frozen; $this->tpl['disable_stock_change'] = $line->disable_stock_change; - //$this->tpl['efficiency'] = $line->efficiency; + $this->tpl['efficiency'] = $line->efficiency; $tpl = DOL_DOCUMENT_ROOT.'/mrp/tpl/originproductline.tpl.php'; $res = include $tpl; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 39da2051ed6..572b5d8a2f7 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -287,7 +287,7 @@ if ($action == 'create') print ''; if (GETPOST('fk_bom', 'int') > 0) { - print load_fiche_titre($langs->trans("ToConsume").' ('.$langs->trans("ForAQuantityOf1").')'); + print load_fiche_titre($langs->trans("ToConsume")); print '
'; print '
'; print ''; -//print ''; -//print ''; +print ''; +print ''; diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 10c3ee01e4b..04c84f9c1b0 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -124,9 +124,9 @@ $coldisplay++; print 'disable_stock_change?' checked="checked"':'')).'">'; print ''; -//print ''; +print ''; diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index 706f71af7ec..138a0b9aa58 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -66,7 +66,7 @@ print ''.$form->textwithpicto($langs->trans('QtyFro print ''.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).''.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('XXX')).''.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).''; -//$coldisplay++; -//echo $line->efficiency; -//print ''; +$coldisplay++; +echo $line->efficiency; +print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4ab0bc44d9d..b31607c1d60 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2400,9 +2400,10 @@ class Form * @param string $selected Preselected value * @param int $hidepriceinlabel Hide price in label * @param string $filterkey Filter key to highlight + * @param int $novirtualstock Do not load virtual stock, even if slow option STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO is on. * @return void */ - protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '') + protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '', $novirtualstock = 0) { global $langs, $conf, $user, $db; @@ -2639,7 +2640,7 @@ class Form } $outval .= $langs->transnoentities("Stock").':'.$objp->stock; $outval .= ''; - if (!empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation + if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation { $langs->load("stocks"); diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 9a756ba3a79..41be1d993b8 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -24,7 +24,9 @@ WatermarkOnDraftMOs=Watermark on draft MO ConfirmCloneBillOfMaterials=Are you sure you want to clone the bill of material %s ? ConfirmCloneMo=Are you sure you want to clone the Manufacturing Order %s ? ManufacturingEfficiency=Manufacturing efficiency +ConsumptionEfficiency=Consumption efficiency ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the production +ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss of produced product DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Material? diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index d7f4384c5cd..320d33b23e2 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -648,7 +648,7 @@ class Mo extends CommonObject if ($line->qty_frozen) { $moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce } else { - $moline->qty = round($line->qty * $this->qty / $bom->efficiency, 2); + $moline->qty = round($line->qty * $this->qty / $line->efficiency, 2); } if ($moline->qty <= 0) { $error++; @@ -1268,7 +1268,7 @@ class Mo extends CommonObject print '
'.$langs->trans('Ref').''.$langs->trans('Qty').''.$langs->trans('Qty').' ('.$langs->trans("ForAQuantityOf1").')'.$langs->trans('QtyFrozen').''.$langs->trans('DisableStockChange').''.$langs->trans('Efficiency').'
'; diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 88240e21efb..9fb0616087f 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -23,13 +23,14 @@ if (empty($conf) || ! is_object($conf)) exit; } +if (! is_object($form)) $form = new Form($db); ?> tpl['strike'])?'':' strikefordisabled').'">'; print ''; -print ''; +print ''; print ''; print ''; //print ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bffc941a35c..1e73b31d502 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4775,6 +4775,8 @@ class Product extends CommonObject $stock_reception_fournisseur = 0; $stock_inproduction = 0; + //dol_syslog("load_virtual_stock"); + if (!empty($conf->commande->enabled)) { $result = $this->load_stats_commande(0, '1,2', 1);
'.$this->tpl['label'].''.$this->tpl['qty'].''.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")) . ' = ' . round($this->tpl['qty'] / $this->tpl['efficiency'], 2) : '').''.($this->tpl['qty_frozen'] ? yn($this->tpl['qty_frozen']) : '').''.($this->tpl['disable_stock_change'] ? yn($this->tpl['disable_stock_change']) : '').''.$this->tpl['efficiency'].'