diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 1aeede8b5ba..0b36281c825 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -709,12 +709,12 @@ class Expedition extends CommonObject $sql.= " fk_expedition_methode=".((isset($this->expedition_method_id) && $this->expedition_method_id > 0)?$this->expedition_method_id:"null").","; $sql.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").","; $sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").","; - $sql.= " height=".(isset($this->trueHeight)?$this->trueHeight:"null").","; - $sql.= " width=".(isset($this->trueWidth)?$this->trueWidth:"null").","; + $sql.= " height=".(($this->trueHeight != '')?$this->trueHeight:"null").","; + $sql.= " width=".(($this->trueWidth != '')?$this->trueWidth:"null").","; $sql.= " size_units=".(isset($this->size_units)?$this->size_units:"null").","; - $sql.= " size=".(isset($this->trueDepth)?$this->trueDepth:"null").","; + $sql.= " size=".(($this->trueDepth != '')?$this->trueDepth:"null").","; $sql.= " weight_units=".(isset($this->weight_units)?$this->weight_units:"null").","; - $sql.= " weight=".(isset($this->trueWeight)?$this->trueWeight:"null").","; + $sql.= " weight=".(($this->trueWeight != '')?$this->trueWeight:"null").","; $sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").","; $sql.= " model_pdf=".(isset($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null").","; $sql.= " entity=".$conf->entity; @@ -858,7 +858,8 @@ class Expedition extends CommonObject $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice"; $sql.= ", ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; - $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type, p.weight, p.weight_units, p.volume, p.volume_units"; + $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; + $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units"; $sql.= " FROM (".MAIN_DB_PREFIX."expeditiondet as ed,"; $sql.= " ".MAIN_DB_PREFIX."commandedet as cd)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; @@ -900,6 +901,10 @@ class Expedition extends CommonObject $line->qty_shipped = $obj->qty_shipped; $line->weight = $obj->weight; $line->weight_units = $obj->weight_units; + $line->length = $obj->length; + $line->length_units = $obj->length_units; + $line->surface = $obj->surface; + $line->surface_units = $obj->surface_units; $line->volume = $obj->volume; $line->volume_units = $obj->volume_units; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 363ec801e3a..f26ed0e8efe 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -285,10 +285,9 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl' header("Location: fiche.php?id=".$shipping->id); exit; } - $mesg=$shipping->error; + setEventMessage($shipping->error,'errors'); } - $mesg='
'.$mesg.'
'; $action=""; } @@ -537,7 +536,7 @@ else if ($action == 'classifybilled') /* * View -*/ + */ llxHeader('',$langs->trans('Sending'),'Expedition'); @@ -904,7 +903,7 @@ else /* * Confirmation de la suppression - */ + */ if ($action == 'delete') { $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); @@ -913,7 +912,7 @@ else /* * Confirmation de la validation - */ + */ if ($action == 'valid') { $objectref = substr($object->ref, 1, 4); @@ -930,15 +929,15 @@ else } /* * Confirmation de l'annulation - */ + */ if ($action == 'annuler') { $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); if ($ret == 'html') print '
'; } - // Calculate ture totalVeight and totalVolume for all products - // by adding weight and volume of each line. + // Calculate true totalWeight and totalVolume for all products + // by adding weight and volume of each product line. $totalWeight = ''; $totalVolume = ''; $weightUnit=0; @@ -949,6 +948,7 @@ else $volumeUnit=0; if (! empty($lines[$i]->weight_units)) $weightUnit = $lines[$i]->weight_units; if (! empty($lines[$i]->volume_units)) $volumeUnit = $lines[$i]->volume_units; + // TODO Use a function addvalueunits(val1,unit1,val2,unit2)=>(val,unit) if ($lines[$i]->weight_units < 50) { @@ -973,8 +973,6 @@ else $totalVolume += $lines[$i]->volume*$lines[$i]->qty_shipped; } } - $totalVolume=$totalVolume; - //print "totalVolume=".$totalVolume." volumeUnit=".$volumeUnit; print ''; @@ -1053,49 +1051,50 @@ else // Weight print ''; - // Volume Total - print ''; - print '\n"; - print ''; - // Width print ''; // Height print ''; // Depth print ''; + // Volume + print ''; + print '\n"; + print ''; + // Status print ''; print '\n";
'.$form->editfieldkey("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer).''; print $form->editfieldval("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer); - print $object->weight_units?measuring_units_string($object->weight_units,"weight"):''; + print ($object->weight_units!='')?' '.measuring_units_string($object->weight_units,"weight"):''; print '
'.$langs->trans("Volume").''; - if (! empty($object->trueVolume)) // FIXME trueVolume not exist - { - // If sending volume defined - print $object->trueVolume.' '.measuring_units_string($object->volumeUnit,"volume"); - } - else - { - // If sending volume not defined we use sum of products - if ($totalVolume > 0) - { - print $totalVolume.' '; - if ($volumeUnit < 50) print measuring_units_string(0,"volume"); - else print measuring_units_string($volumeUnit,"volume"); - } - else print ' '; - } - print "
'.$form->editfieldkey("Width",'trueWidth',$object->trueWidth,$object,$user->rights->expedition->creer).''; print $form->editfieldval("Width",'trueWidth',$object->trueWidth,$object,$user->rights->expedition->creer); - print $object->trueWidth?measuring_units_string($object->width_units,"size"):''; + print ($object->trueWidth!='')?' '.measuring_units_string($object->width_units,"size"):''; print '
'.$form->editfieldkey("Height",'trueHeight',$object->trueHeight,$object,$user->rights->expedition->creer).''; print $form->editfieldval("Height",'trueHeight',$object->trueHeight,$object,$user->rights->expedition->creer); - print $object->trueHeight?measuring_units_string($object->height_units,"size"):''; + print ($object->trueHeight!='')?' '.measuring_units_string($object->height_units,"size"):''; print '
'.$form->editfieldkey("Depth",'trueDepth',$object->trueDepth,$object,$user->rights->expedition->creer).''; print $form->editfieldval("Depth",'trueDepth',$object->trueDepth,$object,$user->rights->expedition->creer); - print $object->trueDepth?measuring_units_string($object->depth_units,"size"):''; + print ($object->trueDepth!='')?' '.measuring_units_string($object->depth_units,"size"):''; print '
'; + print $langs->trans("Volume"); + print ''; + $calculatedVolume=0; + if ($object->trueWidth && $object->trueHeight && $object->trueDepth) $calculatedVolume=($object->trueWidth * $object->trueHeight * $object->trueDepth); + // If sending volume not defined we use sum of products + if ($calculatedVolume > 0) + { + print $calculatedVolume.' '; + if ($volumeUnit < 50) print measuring_units_string(0,"volume"); + else print measuring_units_string($volumeUnit,"volume"); + } + if ($totalVolume > 0) + { + if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': '; + print $totalVolume; + if ($calculatedVolume) print ')'; + } + print "
'.$langs->trans("Status").''.$object->getLibStatut(4)."