diff --git a/htdocs/mrp/ajax/interface.php b/htdocs/mrp/ajax/interface.php
new file mode 100644
index 00000000000..b91cfc34c13
--- /dev/null
+++ b/htdocs/mrp/ajax/interface.php
@@ -0,0 +1,86 @@
+ 0) $sql .= " AND fk_entrepot = '" . $warehouse_id . "'";
+ $sql .= " ORDER BY e.ref, pb.batch";
+
+ $resql = $db->query($sql);
+
+ if ($resql) {
+ while ($obj = $db->fetch_object($resql)) {
+ $TRes[$obj->batch] += $obj->qty;
+ }
+ }
+
+ print json_encode($TRes);
+} elseif($action == 'updateselectwarehousebybatch'){
+
+ $res = 0;
+
+ $sql = "SELECT pb.batch, pb.rowid, ps.fk_entrepot, e.ref, pb.qty";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "product_batch as pb";
+ $sql .= " JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.rowid = pb.fk_product_stock";
+ $sql .= " JOIN " . MAIN_DB_PREFIX . "entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")";
+ $sql .= " WHERE ps.fk_product = '" . $fk_product . "'";
+ if ($batch_id > 0) $sql.= " AND pb.batch = '" . $batch_id . "'";
+ $sql .= " ORDER BY e.ref, pb.batch";
+
+ $resql = $db->query($sql);
+
+ if($resql){
+ if($db->num_rows($resql) == 1){
+ $obj = $db->fetch_object($resql);
+ $res = $obj->fk_entrepot;
+ }
+ }
+
+ print json_encode($res);
+
+}
+
+
+
diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php
index a9d56c1a850..cfb1616e751 100644
--- a/htdocs/mrp/mo_production.php
+++ b/htdocs/mrp/mo_production.php
@@ -1027,8 +1027,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($tmpproduct->status_batch) {
$preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : '');
print '';
- print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 1, $line->fk_product, '');
-// print $formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 0, '', $line->fk_product);
+ print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', '');// print $formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 0, '', $line->fk_product);
}
print '';
}
@@ -1357,7 +1356,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}).done(function (data) {
selectbatch.empty();
- $('input[name*='+selectbatch_name+']').val('');
var data = JSON.parse(data);
@@ -1381,11 +1379,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
selectbatch.append(option);
-
});
-
});
-
});
}
@@ -1420,14 +1415,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}).done(function (data) {
- console.log(data);
var data = JSON.parse(data);
if(data != 0){
selectwarehouse.val(data).change();
}
});
-
});
}
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index da10faa4f34..b9a01af1666 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -659,7 +659,7 @@ class FormProduct
if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) {
$label = $arraytypes['entrepot_label'].' - ';
$label .= $arraytypes['batch'];
- $out .= '';
+ $out .= '';
}
}
}