|
@@ -708,7 +708,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|
|
print '<div class="clearboth"></div>';
|
|
|
|
|
|
$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 '<!-- Enter line to consume -->'."\n";
|
|
|
print '<tr name="batch_'.$line->id.'_'.$i.'">';
|
|
|
+ // Ref
|
|
|
print '<td><span class="opacitymedium">'.$langs->trans("ToConsume").'</span></td>';
|
|
|
$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 '<input type="text" class="width50" name="batch-'.$line->id.'-'.$i.'" value="'.$preselected.'" list="batch-'.$line->id.'-'.$i.'">';
|
|
|
print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', '');
|
|
|
- }
|
|
|
- print '</td>';
|
|
|
- print '<td>';
|
|
|
- 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 '</td>';
|
|
|
}
|
|
@@ -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 '<td class="right">'.$line->qty.'</td>';
|
|
|
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 '<td class="right nowraponall">';
|
|
@@ -1300,19 +1303,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|
|
print '<td class="right"><input type="text" class="width50 right" id="qtytoproduce-'.$line->id.'-'.$i.'" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
|
|
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 '<td class="right"><input type="text" class="width50 right" name="pricetoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
|
|
} else {
|
|
|
- print '<td><input type="hidden" class="width50 right" name="pricetoproduce-'.$line->id.'-'.$i.'" value="'.$manufacturingcost.'"></td>';
|
|
|
+ print '<td><input type="hidden" class="width50 right" name="pricetoproduce-'.$line->id.'-'.$i.'" value="'.($manufacturingcost ? $manufacturingcost : '').'"></td>';
|
|
|
}
|
|
|
}
|
|
|
print '<td></td>';
|