Fix save of units
Conflicts: htdocs/expedition/card.php htdocs/product/card.php htdocs/product/class/product.class.php
This commit is contained in:
parent
f23804a091
commit
2e573fd794
@ -383,7 +383,7 @@ if (empty($reshook))
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment.
|
||||
$ret=$object->create($user); // This create shipment (like Odoo picking) and lines of shipments. Stock movement will be done when validating shipment.
|
||||
if ($ret <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -998,7 +998,7 @@ if ($action == 'create')
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Weight");
|
||||
print '</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST('weight', 'int').'"> ';
|
||||
$text=$formproduct->selectMeasuringUnits("weight_units", "weight", GETPOST('weight_units', 'int'));
|
||||
$text=$formproduct->selectMeasuringUnits("weight_units", "weight", GETPOST('weight_units', 'int'), 0, 2);
|
||||
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
|
||||
print $form->textwithpicto($text, $htmltext);
|
||||
print '</td></tr>';
|
||||
@ -1009,7 +1009,7 @@ if ($action == 'create')
|
||||
print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH', 'int').'">';
|
||||
print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS', 'int').'">';
|
||||
print ' ';
|
||||
$text=$formproduct->selectMeasuringUnits("size_units", "size");
|
||||
$text=$formproduct->selectMeasuringUnits("size_units", "size", GETPOST('size_units', 'int'), 0, 2);
|
||||
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
|
||||
print $form->textwithpicto($text, $htmltext);
|
||||
print '</td></tr>';
|
||||
@ -2190,6 +2190,7 @@ elseif ($id || $ref)
|
||||
$product_static->id=$lines[$i]->fk_product;
|
||||
$product_static->ref=$lines[$i]->ref;
|
||||
$product_static->status_batch=$lines[$i]->product_tobatch;
|
||||
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.$label;
|
||||
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->description));
|
||||
|
||||
@ -325,8 +325,8 @@ class Expedition extends CommonObject
|
||||
$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>0?$this->weight_units:'NULL');
|
||||
$sql.= ", ".($this->size_units>0?$this->size_units:'NULL');
|
||||
$sql.= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
|
||||
$sql.= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
|
||||
$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");
|
||||
|
||||
@ -181,19 +181,19 @@ class ActionsCardProduct
|
||||
|
||||
// Weight
|
||||
$this->tpl['weight'] = $this->object->weight;
|
||||
$this->tpl['weight_units'] = $formproduct->selectMeasuringUnits("weight_units", "weight", $this->object->weight_units);
|
||||
$this->tpl['weight_units'] = $formproduct->selectMeasuringUnits("weight_units", "weight", $this->object->weight_units, 0, 2);
|
||||
|
||||
// Length
|
||||
$this->tpl['length'] = $this->object->length;
|
||||
$this->tpl['length_units'] = $formproduct->selectMeasuringUnits("length_units", "size", $this->object->length_units);
|
||||
$this->tpl['length_units'] = $formproduct->selectMeasuringUnits("length_units", "size", $this->object->length_units, 0, 2);
|
||||
|
||||
// Surface
|
||||
$this->tpl['surface'] = $this->object->surface;
|
||||
$this->tpl['surface_units'] = $formproduct->selectMeasuringUnits("surface_units", "surface", $this->object->surface_units);
|
||||
$this->tpl['surface_units'] = $formproduct->selectMeasuringUnits("surface_units", "surface", $this->object->surface_units, 0, 2);
|
||||
|
||||
// Volume
|
||||
$this->tpl['volume'] = $this->object->volume;
|
||||
$this->tpl['volume_units'] = $formproduct->selectMeasuringUnits("volume_units", "volume", $this->object->volume_units);
|
||||
$this->tpl['volume_units'] = $formproduct->selectMeasuringUnits("volume_units", "volume", $this->object->volume_units, 0, 2);
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
|
||||
@ -256,11 +256,15 @@ class Product extends CommonObject
|
||||
*/
|
||||
public $url;
|
||||
|
||||
//! Unites de mesure
|
||||
//! Metric of products
|
||||
public $weight;
|
||||
public $weight_units;
|
||||
public $length;
|
||||
public $length_units;
|
||||
public $width;
|
||||
public $width_units;
|
||||
public $height;
|
||||
public $height_units;
|
||||
public $surface;
|
||||
public $surface_units;
|
||||
public $volume;
|
||||
|
||||
@ -840,7 +840,7 @@ if ($action == 'create')
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Weight");
|
||||
print '</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST('weight', 'int').'"> ';
|
||||
$text=$formproduct->selectMeasuringUnits("weight_units", "weight", GETPOST('weight_units', 'int'));
|
||||
$text=$formproduct->selectMeasuringUnits("weight_units", "weight", GETPOST('weight_units', 'int'), 0, 2);
|
||||
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
|
||||
print $form->textwithpicto($text, $htmltext);
|
||||
print '</td></tr>';
|
||||
@ -851,7 +851,7 @@ if ($action == 'create')
|
||||
print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH', 'int').'">';
|
||||
print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS', 'int').'">';
|
||||
print ' ';
|
||||
$text=$formproduct->selectMeasuringUnits("size_units", "size");
|
||||
$text=$formproduct->selectMeasuringUnits("size_units", "size", GETPOST('size_units', 'int'), 0, 2);
|
||||
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
|
||||
print $form->textwithpicto($text, $htmltext);
|
||||
print '</td></tr>';
|
||||
@ -1447,7 +1447,7 @@ elseif ($id || $ref)
|
||||
print '<input name="id" value="'.$object->id.'" type="hidden">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.'" type="text">';
|
||||
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units);
|
||||
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
|
||||
print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">';
|
||||
print ' <input class="button" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">';
|
||||
print '</form>';
|
||||
@ -1475,14 +1475,14 @@ elseif ($id || $ref)
|
||||
|
||||
// Height
|
||||
print '<tr><td>'.$form->editfieldkey("Height", 'trueHeight', $object->trueHeight, $object, $user->rights->reception->creer).'</td><td colspan="3">';
|
||||
if($action=='edittrueHeight')
|
||||
if ($action=='edittrueHeight')
|
||||
{
|
||||
print '<form name="settrueHeight" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input name="action" value="settrueHeight" type="hidden">';
|
||||
print '<input name="id" value="'.$object->id.'" type="hidden">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.'" type="text">';
|
||||
print $formproduct->selectMeasuringUnits("size_units", "size", $object->size_units);
|
||||
print $formproduct->selectMeasuringUnits("size_units", "size", $object->size_units, 0, 2);
|
||||
print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">';
|
||||
print ' <input class="button" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">';
|
||||
print '</form>';
|
||||
@ -1789,8 +1789,6 @@ elseif ($id || $ref)
|
||||
|
||||
print '<td>';
|
||||
|
||||
|
||||
|
||||
$text=$lines[$i]->product->getNomUrl(1);
|
||||
$text.= ' - '.$label;
|
||||
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->product->description));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user