NEW Dynamic choice of warehouse and batch in MO production.
This commit is contained in:
parent
0365af4fe6
commit
86445cdd83
@ -672,7 +672,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
print '<div class="center'.(in_array($action, array('consumeorproduce', 'consumeandproduceall')) ? ' formconsumeproduce' : '').'">';
|
print '<div class="center'.(in_array($action, array('consumeorproduce', 'consumeandproduceall')) ? ' formconsumeproduce' : '').'">';
|
||||||
print '<div class="opacitymedium hideonsmartphone paddingbottom">'.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'<br></div>';
|
print '<div class="opacitymedium hideonsmartphone paddingbottom">'.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'<br></div>';
|
||||||
print '<span class="fieldrequired">'.$langs->trans("InventoryCode").':</span> <input type="text" class="minwidth200 maxwidth250" name="inventorycode" value="'.$defaultstockmovementcode.'"> ';
|
print '<span class="fieldrequired">'.$langs->trans("InventoryCode").':</span> <input type="text" class="minwidth150 maxwidth200" name="inventorycode" value="'.$defaultstockmovementcode.'"> ';
|
||||||
print '<span class="clearbothonsmartphone"></span>';
|
print '<span class="clearbothonsmartphone"></span>';
|
||||||
print $langs->trans("MovementLabel").': <input type="text" class="minwidth300" name="inventorylabel" value="'.$defaultstockmovementlabel.'"><br><br>';
|
print $langs->trans("MovementLabel").': <input type="text" class="minwidth300" name="inventorylabel" value="'.$defaultstockmovementlabel.'"><br><br>';
|
||||||
print '<input type="checkbox" id="autoclose" name="autoclose" value="1"'.(GETPOSTISSET('inventorylabel') ? (GETPOST('autoclose') ? ' checked="checked"' : '') : ' checked="checked"').'> <label for="autoclose">'.$langs->trans("AutoCloseMO").'</label><br>';
|
print '<input type="checkbox" id="autoclose" name="autoclose" value="1"'.(GETPOSTISSET('inventorylabel') ? (GETPOST('autoclose') ? ' checked="checked"' : '') : ' checked="checked"').'> <label for="autoclose">'.$langs->trans("AutoCloseMO").'</label><br>';
|
||||||
@ -1080,7 +1080,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
if ($tmpproduct->status_batch) {
|
if ($tmpproduct->status_batch) {
|
||||||
$preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : '');
|
$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 '<input type="text" class="width75" name="batch-'.$line->id.'-'.$i.'" value="'.$preselected.'" list="batch-'.$line->id.'-'.$i.'">';
|
||||||
print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', '');
|
print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', '');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1458,7 +1458,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
if ($tmpproduct->status_batch) {
|
if ($tmpproduct->status_batch) {
|
||||||
$preselected = (GETPOSTISSET('batchtoproduce-'.$line->id.'-'.$i) ? GETPOST('batchtoproduce-'.$line->id.'-'.$i) : '');
|
$preselected = (GETPOSTISSET('batchtoproduce-'.$line->id.'-'.$i) ? GETPOST('batchtoproduce-'.$line->id.'-'.$i) : '');
|
||||||
print '<input type="text" class="width50" name="batchtoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'">';
|
print '<input type="text" class="width75" name="batchtoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Batch number in same column than the stock movement picto
|
// Batch number in same column than the stock movement picto
|
||||||
@ -1510,9 +1510,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
});
|
});
|
||||||
|
|
||||||
function updateselectbatchbywarehouse() {
|
function updateselectbatchbywarehouse() {
|
||||||
var element = $("select[name*='idwarehouse']");
|
$(document).on('change', "select[name*='idwarehouse']", function () {
|
||||||
|
console.log("We change warehouse so we update the list of possible batch number");
|
||||||
element.change(function () {
|
|
||||||
|
|
||||||
var selectwarehouse = $(this);
|
var selectwarehouse = $(this);
|
||||||
|
|
||||||
@ -1529,13 +1528,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
action: "updateselectbatchbywarehouse",
|
action: "updateselectbatchbywarehouse",
|
||||||
permissiontoproduce: <?php echo $permissiontoproduce ?>,
|
permissiontoproduce: <?php echo $permissiontoproduce ?>,
|
||||||
warehouse_id: $(this).val(),
|
warehouse_id: $(this).val(),
|
||||||
|
token: '<?php echo currentToken(); ?>',
|
||||||
product_id: $("input[name='" + product_element_name + "']").val()
|
product_id: $("input[name='" + product_element_name + "']").val()
|
||||||
}
|
}
|
||||||
}).done(function (data) {
|
}).done(function (data) {
|
||||||
|
|
||||||
selectbatch.empty();
|
selectbatch.empty();
|
||||||
|
|
||||||
var data = JSON.parse(data);
|
if (typeof data == "object") {
|
||||||
|
console.log("data is already type object, no need to parse it");
|
||||||
|
} else {
|
||||||
|
console.log("data is type "+(typeof data));
|
||||||
|
data = JSON.parse(data);
|
||||||
|
}
|
||||||
|
|
||||||
selectbatch.append($('<option>', {
|
selectbatch.append($('<option>', {
|
||||||
value: '',
|
value: '',
|
||||||
@ -1562,8 +1567,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateselectwarehousebybatch() {
|
function updateselectwarehousebybatch() {
|
||||||
|
|
||||||
$(document).on('change', 'input[name*=batch]', function(){
|
$(document).on('change', 'input[name*=batch]', function(){
|
||||||
|
console.log("We change batch so we update the list of possible warehouses");
|
||||||
|
|
||||||
var selectbatch = $(this);
|
var selectbatch = $(this);
|
||||||
|
|
||||||
@ -1584,11 +1589,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
action: "updateselectwarehousebybatch",
|
action: "updateselectwarehousebybatch",
|
||||||
permissiontoproduce: <?php echo $permissiontoproduce ?>,
|
permissiontoproduce: <?php echo $permissiontoproduce ?>,
|
||||||
batch: $(this).val(),
|
batch: $(this).val(),
|
||||||
|
token: '<?php echo currentToken(); ?>',
|
||||||
product_id: $("input[name='" + product_element_name + "']").val()
|
product_id: $("input[name='" + product_element_name + "']").val()
|
||||||
}
|
}
|
||||||
}).done(function (data) {
|
}).done(function (data) {
|
||||||
|
|
||||||
var data = JSON.parse(data);
|
if (typeof data == "object") {
|
||||||
|
console.log("data is already type object, no need to parse it");
|
||||||
|
} else {
|
||||||
|
console.log("data is type "+(typeof data));
|
||||||
|
data = JSON.parse(data);
|
||||||
|
}
|
||||||
|
|
||||||
if(data != 0){
|
if(data != 0){
|
||||||
selectwarehouse.val(data).change();
|
selectwarehouse.val(data).change();
|
||||||
|
|||||||
@ -791,6 +791,8 @@ class FormProduct
|
|||||||
*/
|
*/
|
||||||
public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array())
|
public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array())
|
||||||
{
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::selectLotDataList $htmlname, $empty, $fk_product, $fk_entrepot", LOG_DEBUG);
|
dol_syslog(get_class($this)."::selectLotDataList $htmlname, $empty, $fk_product, $fk_entrepot", LOG_DEBUG);
|
||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user