forked from Wavyzz/dolibarr
FIX Better compatible fix for the trouble of weight / size units
Conflicts: htdocs/core/class/html.form.class.php htdocs/product/card.php
This commit is contained in:
@@ -643,11 +643,11 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_tracking_number'=>$object->tracking_number,
|
$array_key.'_tracking_number'=>$object->tracking_number,
|
||||||
$array_key.'_tracking_url'=>$object->tracking_url,
|
$array_key.'_tracking_url'=>$object->tracking_url,
|
||||||
$array_key.'_shipping_method'=>$object->listmeths[0]['libelle'],
|
$array_key.'_shipping_method'=>$object->listmeths[0]['libelle'],
|
||||||
$array_key.'_weight'=>$object->trueWeight.' '.measuring_units_string($object->weight_units, 'weight'),
|
$array_key.'_weight'=>$object->trueWeight.' '.measuringUnitString(0, 'weight', $object->weight_units),
|
||||||
$array_key.'_width'=>$object->trueWidth.' '.measuring_units_string($object->width_units, 'size'),
|
$array_key.'_width'=>$object->trueWidth.' '.measuringUnitString(0, 'size', $object->width_units),
|
||||||
$array_key.'_height'=>$object->trueHeight.' '.measuring_units_string($object->height_units, 'size'),
|
$array_key.'_height'=>$object->trueHeight.' '.measuringUnitString(0, 'size', $object->height_units),
|
||||||
$array_key.'_depth'=>$object->trueDepth.' '.measuring_units_string($object->depth_units, 'size'),
|
$array_key.'_depth'=>$object->trueDepth.' '.measuringUnitString(0, 'size', $object->depth_units),
|
||||||
$array_key.'_size'=>$calculatedVolume.' '.measuring_units_string(0, 'volume'),
|
$array_key.'_size'=>$calculatedVolume.' '.measuringUnitString(0, 'volume'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add vat by rates
|
// Add vat by rates
|
||||||
@@ -701,10 +701,10 @@ abstract class CommonDocGenerator
|
|||||||
'line_price_ht'=>price($line->total_ht),
|
'line_price_ht'=>price($line->total_ht),
|
||||||
'line_price_ttc'=>price($line->total_ttc),
|
'line_price_ttc'=>price($line->total_ttc),
|
||||||
'line_price_vat'=>price($line->total_tva),
|
'line_price_vat'=>price($line->total_tva),
|
||||||
'line_weight'=>empty($line->weight) ? '' : $line->weight*$line->qty_shipped.' '.measuring_units_string($line->weight_units, 'weight'),
|
'line_weight'=>empty($line->weight) ? '' : $line->weight*$line->qty_shipped.' '.measuringUnitString(0, 'weight', $line->weight_units),
|
||||||
'line_length'=>empty($line->length) ? '' : $line->length*$line->qty_shipped.' '.measuring_units_string($line->length_units, 'size'),
|
'line_length'=>empty($line->length) ? '' : $line->length*$line->qty_shipped.' '.measuringUnitString(0, 'size', $line->length_units),
|
||||||
'line_surface'=>empty($line->surface) ? '' : $line->surface*$line->qty_shipped.' '.measuring_units_string($line->surface_units, 'surface'),
|
'line_surface'=>empty($line->surface) ? '' : $line->surface*$line->qty_shipped.' '.measuringUnitString(0, 'surface', $line->surface_units),
|
||||||
'line_volume'=>empty($line->volume) ? '' : $line->volume*$line->qty_shipped.' '.measuring_units_string($line->volume_units, 'volume'),
|
'line_volume'=>empty($line->volume) ? '' : $line->volume*$line->qty_shipped.' '.measuringUnitString(0, 'volume', $line->volume_units),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
|
|||||||
@@ -3708,9 +3708,10 @@ abstract class CommonObject
|
|||||||
$trueWeightUnit = 0.0283495;
|
$trueWeightUnit = 0.0283495;
|
||||||
$totalWeight += $weight * $qty * $trueWeightUnit;
|
$totalWeight += $weight * $qty * $trueWeightUnit;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
$totalWeight += $weight * $qty; // This may be wrong if we mix different units
|
$totalWeight += $weight * $qty; // This may be wrong if we mix different units
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch)
|
if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch)
|
||||||
{
|
{
|
||||||
//print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit;
|
//print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit;
|
||||||
|
|||||||
@@ -244,8 +244,8 @@ class CUnits // extends CommonObject
|
|||||||
$sqlwhere = array();
|
$sqlwhere = array();
|
||||||
if (count($filter) > 0) {
|
if (count($filter) > 0) {
|
||||||
foreach ($filter as $key => $value) {
|
foreach ($filter as $key => $value) {
|
||||||
if ($key=='t.rowid' || $key=='t.active') {
|
if ($key=='t.rowid' || $key=='t.active' || $key=='t.scale') {
|
||||||
$sqlwhere[] = $key . '='. $value;
|
$sqlwhere[] = $key . '='. (int) $value;
|
||||||
}
|
}
|
||||||
elseif (strpos($key, 'date') !== false) {
|
elseif (strpos($key, 'date') !== false) {
|
||||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
||||||
|
|||||||
@@ -4569,7 +4569,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round
|
|||||||
$unit = $forceunitoutput;
|
$unit = $forceunitoutput;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string(0, $type, $unit);
|
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuringUnitString(0, $type, $unit);
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -480,6 +480,22 @@ function show_stats_for_company($product, $socid)
|
|||||||
return $nblines++;
|
return $nblines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return translation label of a unit key.
|
||||||
|
* Function kept for backward compatibility.
|
||||||
|
*
|
||||||
|
* @param string $scale Scale of unit: '0', '-3', '6', ...
|
||||||
|
* @param string $measuring_style Style of unit: weight, volume,...
|
||||||
|
* @param int $unit ID of unit (rowid in llx_c_units table)
|
||||||
|
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
|
||||||
|
* @return string Unit string
|
||||||
|
* @see measuringUnitString() formproduct->selectMeasuringUnits()
|
||||||
|
*/
|
||||||
|
function measuring_units_string($scale = '', $measuring_style = '', $unit = 0, $use_short_label = 0)
|
||||||
|
{
|
||||||
|
return measuringUnitString($unit, $measuring_style, $scale, $use_short_label);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return translation label of a unit key
|
* Return translation label of a unit key
|
||||||
*
|
*
|
||||||
@@ -488,9 +504,9 @@ function show_stats_for_company($product, $socid)
|
|||||||
* @param string $scale Scale of unit: '0', '-3', '6', ...
|
* @param string $scale Scale of unit: '0', '-3', '6', ...
|
||||||
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
|
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
|
||||||
* @return string Unit string
|
* @return string Unit string
|
||||||
* @see formproduct->selectMeasuringUnits
|
* @see formproduct->selectMeasuringUnits()
|
||||||
*/
|
*/
|
||||||
function measuring_units_string($unit, $measuring_style = '', $scale = '', $use_short_label = 0)
|
function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_short_label = 0)
|
||||||
{
|
{
|
||||||
global $langs, $db;
|
global $langs, $db;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
||||||
|
|||||||
@@ -509,12 +509,12 @@ class pdf_espadon extends ModelePdfExpedition
|
|||||||
$weighttxt='';
|
$weighttxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
|
||||||
{
|
{
|
||||||
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units, "weight");
|
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units);
|
||||||
}
|
}
|
||||||
$voltxt='';
|
$voltxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
|
||||||
{
|
{
|
||||||
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0, "volume");
|
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -525,12 +525,12 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
$weighttxt='';
|
$weighttxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
|
||||||
{
|
{
|
||||||
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units, "weight");
|
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units);
|
||||||
}
|
}
|
||||||
$voltxt='';
|
$voltxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
|
||||||
{
|
{
|
||||||
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0, "volume");
|
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME))
|
if (empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME))
|
||||||
|
|||||||
@@ -451,12 +451,12 @@ class pdf_squille extends ModelePdfReception
|
|||||||
$weighttxt='';
|
$weighttxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->weight)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->weight)
|
||||||
{
|
{
|
||||||
$weighttxt=round($object->lines[$i]->product->weight * $object->lines[$i]->qty, 5).' '.measuring_units_string($object->lines[$i]->product->weight_units, "weight");
|
$weighttxt=round($object->lines[$i]->product->weight * $object->lines[$i]->qty, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->product->weight_units);
|
||||||
}
|
}
|
||||||
$voltxt='';
|
$voltxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->volume)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->volume)
|
||||||
{
|
{
|
||||||
$voltxt=round($object->lines[$i]->product->volume * $object->lines[$i]->qty, 5).' '.measuring_units_string($object->lines[$i]->product->volume_units?$object->lines[$i]->product->volume_units:0, "volume");
|
$voltxt=round($object->lines[$i]->product->volume * $object->lines[$i]->qty, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->product->volume_units?$object->lines[$i]->product->volume_units:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C');
|
$pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C');
|
||||||
|
|||||||
@@ -1706,7 +1706,6 @@ elseif ($id || $ref)
|
|||||||
// Print form confirm
|
// Print form confirm
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
|
|
||||||
|
|
||||||
// Calculate totalWeight and totalVolume for all products
|
// Calculate totalWeight and totalVolume for all products
|
||||||
// by adding weight and volume of each product line.
|
// by adding weight and volume of each product line.
|
||||||
$tmparray=$object->getTotalWeightVolume();
|
$tmparray=$object->getTotalWeightVolume();
|
||||||
@@ -1849,16 +1848,14 @@ elseif ($id || $ref)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $object->trueWeight;
|
print $object->trueWeight;
|
||||||
print ($object->trueWeight && $object->weight_units!='')?' '.measuring_units_string(0, "weight", $object->weight_units):'';
|
print ($object->trueWeight && $object->weight_units!='')?' '.measuringUnitString(0, "weight", $object->weight_units):'';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculated
|
// Calculated
|
||||||
if ($totalWeight > 0)
|
if ($totalWeight > 0)
|
||||||
{
|
{
|
||||||
if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': ';
|
if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': ';
|
||||||
//print $totalWeight.' '.measuring_units_string(0, "weight");
|
|
||||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
||||||
//if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')';
|
|
||||||
if (!empty($object->trueWeight)) print ')';
|
if (!empty($object->trueWeight)) print ')';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -1866,7 +1863,7 @@ elseif ($id || $ref)
|
|||||||
// Width
|
// Width
|
||||||
print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
|
print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer);
|
print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer);
|
||||||
print ($object->trueWidth && $object->width_units!='')?' '.measuring_units_string(0, "size", $object->width_units):'';
|
print ($object->trueWidth && $object->width_units!='')?' '.measuringUnitString(0, "size", $object->width_units):'';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Height
|
// Height
|
||||||
@@ -1886,7 +1883,7 @@ elseif ($id || $ref)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $object->trueHeight;
|
print $object->trueHeight;
|
||||||
print ($object->trueHeight && $object->height_units!='')?' '.measuring_units_string(0, "size", $object->height_units):'';
|
print ($object->trueHeight && $object->height_units!='')?' '.measuringUnitString(0, "size", $object->height_units):'';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -1894,7 +1891,7 @@ elseif ($id || $ref)
|
|||||||
// Depth
|
// Depth
|
||||||
print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
|
print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer);
|
print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer);
|
||||||
print ($object->trueDepth && $object->depth_units!='')?' '.measuring_units_string(0, "size", $object->depth_units):'';
|
print ($object->trueDepth && $object->depth_units!='')?' '.measuringUnitString(0, "size", $object->depth_units):'';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
@@ -1914,15 +1911,13 @@ elseif ($id || $ref)
|
|||||||
{
|
{
|
||||||
if ($volumeUnit < 50)
|
if ($volumeUnit < 50)
|
||||||
{
|
{
|
||||||
//print $calculatedVolume.' '.measuring_units_string($volumeUnit, "volume");
|
|
||||||
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||||
}
|
}
|
||||||
else print $calculatedVolume.' '.measuring_units_string($volumeUnit, "volume");
|
else print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit);
|
||||||
}
|
}
|
||||||
if ($totalVolume > 0)
|
if ($totalVolume > 0)
|
||||||
{
|
{
|
||||||
if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': ';
|
if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': ';
|
||||||
//print $totalVolume.' '.measuring_units_string(0, "volume");
|
|
||||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||||
//if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')';
|
//if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')';
|
||||||
if ($calculatedVolume) print ')';
|
if ($calculatedVolume) print ')';
|
||||||
@@ -2405,18 +2400,18 @@ elseif ($id || $ref)
|
|||||||
|
|
||||||
// Weight
|
// Weight
|
||||||
print '<td class="center linecolweight">';
|
print '<td class="center linecolweight">';
|
||||||
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string(0, "weight", $lines[$i]->weight_units);
|
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "weight", $lines[$i]->weight_units);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
print '<td class="center linecolvolume">';
|
print '<td class="center linecolvolume">';
|
||||||
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string(0, "volume", $lines[$i]->volume_units);
|
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
//print '<td class="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units, "volume").'</td>';
|
//print '<td class="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units).'</td>';
|
||||||
|
|
||||||
if ($action == 'editline' && $lines[$i]->id == $line_id)
|
if ($action == 'editline' && $lines[$i]->id == $line_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -211,25 +211,25 @@ class ActionsCardProduct
|
|||||||
// Weight
|
// Weight
|
||||||
if ($this->object->weight != '')
|
if ($this->object->weight != '')
|
||||||
{
|
{
|
||||||
$this->tpl['weight'] = $this->object->weight." ".measuring_units_string($this->object->weight_units, "weight");
|
$this->tpl['weight'] = $this->object->weight." ".measuringUnitString(0, "weight", $this->object->weight_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Length
|
// Length
|
||||||
if ($this->object->length != '')
|
if ($this->object->length != '')
|
||||||
{
|
{
|
||||||
$this->tpl['length'] = $this->object->length." ".measuring_units_string($this->object->length_units, "size");
|
$this->tpl['length'] = $this->object->length." ".measuringUnitString(0, "size", $this->object->length_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Surface
|
// Surface
|
||||||
if ($this->object->surface != '')
|
if ($this->object->surface != '')
|
||||||
{
|
{
|
||||||
$this->tpl['surface'] = $this->object->surface." ".measuring_units_string($this->object->surface_units, "surface");
|
$this->tpl['surface'] = $this->object->surface." ".measuringUnitString(0, "surface", $this->object->surface_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
if ($this->object->volume != '')
|
if ($this->object->volume != '')
|
||||||
{
|
{
|
||||||
$this->tpl['volume'] = $this->object->volume." ".measuring_units_string($this->object->volume_units, "volume");
|
$this->tpl['volume'] = $this->object->volume." ".measuringUnitString(0, "volume", $this->object->volume_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tpl['fiche_end']=dol_get_fiche_end();
|
$this->tpl['fiche_end']=dol_get_fiche_end();
|
||||||
|
|||||||
@@ -1825,7 +1825,7 @@ else
|
|||||||
print '<tr><td class="titlefield">'.$langs->trans("Weight").'</td><td colspan="2">';
|
print '<tr><td class="titlefield">'.$langs->trans("Weight").'</td><td colspan="2">';
|
||||||
if ($object->weight != '')
|
if ($object->weight != '')
|
||||||
{
|
{
|
||||||
print $object->weight." ".measuring_units_string(0, "weight", $object->weight_units);
|
print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1841,7 +1841,7 @@ else
|
|||||||
print $object->length;
|
print $object->length;
|
||||||
if ($object->width) print " x ".$object->width;
|
if ($object->width) print " x ".$object->width;
|
||||||
if ($object->height) print " x ".$object->height;
|
if ($object->height) print " x ".$object->height;
|
||||||
print ' '.measuring_units_string(0, "size", $object->length_units);
|
print ' '.measuringUnitString(0, "size", $object->length_units);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1855,7 +1855,7 @@ else
|
|||||||
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="2">';
|
||||||
if ($object->surface != '')
|
if ($object->surface != '')
|
||||||
{
|
{
|
||||||
print $object->surface." ".measuring_units_string(0, "surface", $object->surface_units);
|
print $object->surface." ".measuringUnitString(0, "surface", $object->surface_units);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1869,7 +1869,7 @@ else
|
|||||||
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="2">';
|
||||||
if ($object->volume != '')
|
if ($object->volume != '')
|
||||||
{
|
{
|
||||||
print $object->volume." ".measuring_units_string(0, "volume", $object->volume_units);
|
print $object->volume." ".measuringUnitString(0, "volume", $object->volume_units);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ class FormProduct
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a combo box with list of units
|
* Return a combo box with list of units
|
||||||
* For the moment, units labels are defined in measuring_units_string
|
* Units labels are defined in llx_c_units
|
||||||
*
|
*
|
||||||
* @param string $name Name of HTML field
|
* @param string $name Name of HTML field
|
||||||
* @param string $measuring_style Unit to show: weight, size, surface, volume, time
|
* @param string $measuring_style Unit to show: weight, size, surface, volume, time
|
||||||
|
|||||||
@@ -3985,22 +3985,22 @@ class Product extends CommonObject
|
|||||||
if ($this->type == Product::TYPE_PRODUCT)
|
if ($this->type == Product::TYPE_PRODUCT)
|
||||||
{
|
{
|
||||||
if ($this->weight) {
|
if ($this->weight) {
|
||||||
$label.="<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuring_units_string($this->weight_units, "weight");
|
$label.="<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units);
|
||||||
}
|
}
|
||||||
if ($this->length) {
|
if ($this->length) {
|
||||||
$label.="<br><b>".$langs->trans("Length").'</b>: '.$this->length.' '.measuring_units_string($this->length_units, 'size');
|
$label.="<br><b>".$langs->trans("Length").'</b>: '.$this->length.' '.measuringUnitString(0, 'size', $this->length_units);
|
||||||
}
|
}
|
||||||
if ($this->width) {
|
if ($this->width) {
|
||||||
$label.="<br><b>".$langs->trans("Width").'</b>: '.$this->width.' '.measuring_units_string($this->width_units, 'size');
|
$label.="<br><b>".$langs->trans("Width").'</b>: '.$this->width.' '.measuringUnitString(0, 'size', $this->width_units);
|
||||||
}
|
}
|
||||||
if ($this->height) {
|
if ($this->height) {
|
||||||
$label.="<br><b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuring_units_string($this->height_units, 'size');
|
$label.="<br><b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units);
|
||||||
}
|
}
|
||||||
if ($this->surface) {
|
if ($this->surface) {
|
||||||
$label.="<br><b>".$langs->trans("Surface").'</b>: '.$this->surface.' '.measuring_units_string($this->surface_units, 'surface');
|
$label.="<br><b>".$langs->trans("Surface").'</b>: '.$this->surface.' '.measuringUnitString(0, 'surface', $this->surface_units);
|
||||||
}
|
}
|
||||||
if ($this->volume) {
|
if ($this->volume) {
|
||||||
$label.="<br><b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuring_units_string($this->volume_units, 'volume');
|
$label.="<br><b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1455,16 +1455,14 @@ elseif ($id || $ref)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $object->trueWeight;
|
print $object->trueWeight;
|
||||||
print ($object->trueWeight && $object->weight_units!='')?' '.measuring_units_string($object->weight_units, "weight"):'';
|
print ($object->trueWeight && $object->weight_units!='')?' '.measuringUnitString(0, "weight", $object->weight_units):'';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculated
|
// Calculated
|
||||||
if ($totalWeight > 0)
|
if ($totalWeight > 0)
|
||||||
{
|
{
|
||||||
if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': ';
|
if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': ';
|
||||||
//print $totalWeight.' '.measuring_units_string(0,"weight");
|
|
||||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
||||||
//if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')';
|
|
||||||
if (!empty($object->trueWeight)) print ')';
|
if (!empty($object->trueWeight)) print ')';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -1472,7 +1470,7 @@ elseif ($id || $ref)
|
|||||||
// Width
|
// Width
|
||||||
print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer).'</td><td colspan="3">';
|
print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer);
|
print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer);
|
||||||
print ($object->trueWidth && $object->width_units!='')?' '.measuring_units_string($object->width_units, "size"):'';
|
print ($object->trueWidth && $object->width_units!='')?' '.measuringUnitString(0, "size", $object->width_units):'';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Height
|
// Height
|
||||||
@@ -1492,7 +1490,7 @@ elseif ($id || $ref)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $object->trueHeight;
|
print $object->trueHeight;
|
||||||
print ($object->trueHeight && $object->height_units!='')?' '.measuring_units_string($object->height_units, "size"):'';
|
print ($object->trueHeight && $object->height_units!='')?' '.measuringUnitString(0, "size", $object->height_units):'';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -1500,7 +1498,7 @@ elseif ($id || $ref)
|
|||||||
// Depth
|
// Depth
|
||||||
print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer).'</td><td colspan="3">';
|
print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer);
|
print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer);
|
||||||
print ($object->trueDepth && $object->depth_units!='')?' '.measuring_units_string($object->depth_units, "size"):'';
|
print ($object->trueDepth && $object->depth_units!='')?' '.measuringUnitString(0, "size", $object->depth_units):'';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
@@ -1520,15 +1518,13 @@ elseif ($id || $ref)
|
|||||||
{
|
{
|
||||||
if ($volumeUnit < 50)
|
if ($volumeUnit < 50)
|
||||||
{
|
{
|
||||||
//print $calculatedVolume.' '.measuring_units_string($volumeUnit,"volume");
|
|
||||||
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||||
}
|
}
|
||||||
else print $calculatedVolume.' '.measuring_units_string($volumeUnit, "volume");
|
else print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit);
|
||||||
}
|
}
|
||||||
if ($totalVolume > 0)
|
if ($totalVolume > 0)
|
||||||
{
|
{
|
||||||
if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': ';
|
if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': ';
|
||||||
//print $totalVolume.' '.measuring_units_string(0,"volume");
|
|
||||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||||
//if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')';
|
//if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')';
|
||||||
if ($calculatedVolume) print ')';
|
if ($calculatedVolume) print ')';
|
||||||
@@ -1960,13 +1956,13 @@ elseif ($id || $ref)
|
|||||||
|
|
||||||
// Weight
|
// Weight
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->product->weight*$lines[$i]->qty.' '.measuring_units_string($lines[$i]->product->weight_units, "weight");
|
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->product->weight*$lines[$i]->qty.' '.measuringUnitString(0, "weight", $lines[$i]->product->weight_units);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->product->volume*$lines[$i]->qty.' '.measuring_units_string($lines[$i]->product->volume_units, "volume");
|
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->product->volume*$lines[$i]->qty.' '.measuringUnitString(0, "volume", $lines[$i]->product->volume_units);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ if (! empty($id) || ! empty($ref))
|
|||||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||||
if ($object->weight != '')
|
if ($object->weight != '')
|
||||||
{
|
{
|
||||||
print $object->weight." ".measuring_units_string($object->weight_units, "weight");
|
print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -788,7 +788,7 @@ if (! empty($id) || ! empty($ref))
|
|||||||
} ?>
|
} ?>
|
||||||
</td>
|
</td>
|
||||||
<td class="right"><?php echo ($currcomb->variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?></td>
|
<td class="right"><?php echo ($currcomb->variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?></td>
|
||||||
<?php if ($object->isProduct()) print '<td class="right">'.($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight').'</td>'; ?>
|
<?php if ($object->isProduct()) print '<td class="right">'.($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuringUnitString(0, 'weight', $prodstatic->weight_units).'</td>'; ?>
|
||||||
<td class="center"><?php echo $prodstatic->getLibStatut(2, 0) ?></td>
|
<td class="center"><?php echo $prodstatic->getLibStatut(2, 0) ?></td>
|
||||||
<td class="center"><?php echo $prodstatic->getLibStatut(2, 1) ?></td>
|
<td class="center"><?php echo $prodstatic->getLibStatut(2, 1) ?></td>
|
||||||
<td class="right">
|
<td class="right">
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ if (! empty($id) || ! empty($ref)) {
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
dictionary_attr = <?php echo json_encode($dictionary_attr) ?>;
|
dictionary_attr = <?php echo json_encode($dictionary_attr) ?>;
|
||||||
weight_units = '<?php echo measuring_units_string($object->weight_units, 'weight') ?>';
|
weight_units = '<?php echo measuringUnitString(0, 'weight', $object->weight_units) ?>';
|
||||||
attr_selected = {};
|
attr_selected = {};
|
||||||
percentage_variation = jQuery('input#price_var_percent').prop('checked');
|
percentage_variation = jQuery('input#price_var_percent').prop('checked');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user