FIX Option to manage packaging. FIX size/length/volume of reception

Conflicts:
	htdocs/fourn/class/fournisseur.commande.class.php
	htdocs/install/mysql/migration/14.0.0-15.0.0.sql
	htdocs/langs/en_US/products.lang
	htdocs/reception/card.php
	htdocs/reception/class/reception.class.php
This commit is contained in:
Laurent Destailleur
2022-03-17 18:53:50 +01:00
parent 49e53abf53
commit e46ee982ec
12 changed files with 105 additions and 77 deletions

View File

@@ -254,10 +254,10 @@ if (empty($reshook)) {
$object->origin = $origin;
$object->origin_id = $origin_id;
$object->fk_project = GETPOST('projectid', 'int');
$object->weight = GETPOST('weight', 'int') == '' ? "NULL" : GETPOST('weight', 'int');
$object->sizeH = GETPOST('sizeH', 'int') == '' ? "NULL" : GETPOST('sizeH', 'int');
$object->sizeW = GETPOST('sizeW', 'int') == '' ? "NULL" : GETPOST('sizeW', 'int');
$object->sizeS = GETPOST('sizeS', 'int') == '' ? "NULL" : GETPOST('sizeS', 'int');
$object->weight = GETPOST('weight', 'int') == '' ? null : GETPOST('weight', 'int');
$object->sizeH = GETPOST('sizeH', 'int') == '' ? null : GETPOST('sizeH', 'int');
$object->sizeW = GETPOST('sizeW', 'int') == '' ? null : GETPOST('sizeW', 'int');
$object->sizeS = GETPOST('sizeS', 'int') == '' ? null : GETPOST('sizeS', 'int');
$object->size_units = GETPOST('size_units', 'int');
$object->weight_units = GETPOST('weight_units', 'int');
@@ -1921,15 +1921,16 @@ if ($action == 'create') {
// Warehouse source
if (!empty($conf->stock->enabled)) {
print '<td class="left">';
if ($lines[$i]->fk_entrepot > 0) {
$entrepot = new Entrepot($db);
$entrepot->fetch($lines[$i]->fk_entrepot);
print $entrepot->getNomUrl(1);
}
print '</td>';
print '<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).'">';
print $entrepot->getNomUrl(1);
print '</td>';
} else {
print '<td></td>';
}
}
// Batch number managment

View File

@@ -236,7 +236,6 @@ class Reception extends CommonObject
$this->user = $user;
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."reception (";
@@ -273,12 +272,12 @@ class Reception extends CommonObject
$sql .= ", ".$this->fk_project;
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : "null");
$sql .= ", '".$this->db->escape($this->tracking_number)."'";
$sql .= ", ".$this->weight;
$sql .= ", ".$this->sizeS; // TODO Should use this->trueDepth
$sql .= ", ".$this->sizeW; // TODO Should use this->trueWidth
$sql .= ", ".$this->sizeH; // TODO Should use this->trueHeight
$sql .= ", ".$this->weight_units;
$sql .= ", ".$this->size_units;
$sql .= ", ".(is_null($this->weight) ? "NULL" : ((double) $this->weight));
$sql .= ", ".(is_null($this->sizeS) ? "NULL" : ((double) $this->sizeS)); // TODO Should use this->trueDepth
$sql .= ", ".(is_null($this->sizeW) ? "NULL" : ((double) $this->sizeW)); // TODO Should use this->trueWidth
$sql .= ", ".(is_null($this->sizeH) ? "NULL" : ((double) $this->sizeH)); // TODO Should use this->trueHeight
$sql .= ", ".(is_null($this->weight_units) ? "NULL" : ((double) $this->weight_units));
$sql .= ", ".(is_null($this->size_units) ? "NULL" : ((double) $this->size_units));
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null");
$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
@@ -727,8 +726,14 @@ class Reception extends CommonObject
$line->qty = $qty;
$supplierorderline = new CommandeFournisseurLigne($this->db);
$supplierorderline->fetch($id);
$result = $supplierorderline->fetch($id);
if ($result <= 0) {
$this->error = $supplierorderline->error;
$this->errors = $supplierorderline->errors;
return -1;
}
$fk_product = 0;
if (!empty($conf->stock->enabled) && !empty($supplierorderline->fk_product)) {
$fk_product = $supplierorderline->fk_product;