Debug option PRODUCT_ADD_NET_MEASURE

This commit is contained in:
Laurent Destailleur 2019-10-23 02:58:39 +02:00
parent ee39cb9651
commit f0355b3057
6 changed files with 28 additions and 21 deletions

View File

@ -379,7 +379,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');
@ -994,7 +994,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>';
@ -1005,7 +1005,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>';
@ -2199,6 +2199,10 @@ elseif ($id || $ref)
$product_static->weight_units=$lines[$i]->weight_units;
$product_static->length=$lines[$i]->length;
$product_static->length_units=$lines[$i]->length_units;
$product_static->width=$lines[$i]->width;
$product_static->width_units=$lines[$i]->width_units;
$product_static->height=$lines[$i]->height;
$product_static->height_units=$lines[$i]->height_units;
$product_static->surface=$lines[$i]->surface;
$product_static->surface_units=$lines[$i]->surface_units;
$product_static->volume=$lines[$i]->volume;

View File

@ -324,8 +324,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");

View File

@ -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')

View File

@ -1120,7 +1120,7 @@ else
// Net Measure
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
print '<input name="net_measure" size="4" value="'.GETPOST('net_measure').'">';
print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units')?GETPOST('net_measure_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), '');
print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units')?GETPOST('net_measure_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0);
print '</td></tr>';
}
}
@ -1503,7 +1503,7 @@ else
// Net Measure
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
print '<input name="net_measure" size="5" value="'.$object->net_measure.'"> ';
print $formproduct->selectMeasuringUnits($object->net_measure_units, '');
print $formproduct->selectMeasuringUnits($object->net_measure_units, '', 0, 0, 0);
print '</td></tr>';
}
}

View File

@ -256,18 +256,23 @@ class Product extends CommonObject
*/
public $url;
//! Unites de mesure
public $net_measure;
public $net_measure_units;
//! 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;
public $volume_units;
public $net_measure;
public $net_measure_units;
public $accountancy_code_sell;
public $accountancy_code_sell_intra;
public $accountancy_code_sell_export;

View File

@ -833,7 +833,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>';
@ -844,7 +844,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>';
@ -1444,7 +1444,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>';
@ -1472,14 +1472,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>';
@ -1786,8 +1786,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));