diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index a23ffe3c5a7..b96ffd86cf2 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -89,12 +89,12 @@ class Expedition extends CommonObject $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (ref, date_creation, fk_user_author, date_expedition"; - $sql.= ", fk_soc, fk_expedition_methode, tracking_number"; - $sql.= ")"; - $sql.= " VALUES ('(PROV)', ".$this->db->idate(mktime()).", $user->id, ".$this->db->idate($this->date_expedition); - $sql.= ", ".$this->socid.",'". $this->expedition_method_id."','". $this->tracking_number."'"; - $sql.= ")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (ref, date_creation, fk_user_author, date_expedition,"; + $sql.= " fk_soc, fk_expedition_methode, tracking_number, weight, size, width, height, weight_units, size_units"; + $sql.= ")"; + $sql.= " VALUES ('(PROV)', now(), $user->id, ".$this->db->idate($this->date_expedition); + $sql.= ", ".$this->socid.",'". $this->expedition_method_id."','". $this->tracking_number."',".$this->weight.",".$this->sizeS.",".$this->sizeW.",".$this->sizeH.",".$this->weight_units.",".$this->size_units; + $sql.= ")"; $resql=$this->db->query($sql); if ($resql) @@ -205,6 +205,7 @@ class Expedition extends CommonObject global $conf; $sql = "SELECT e.rowid, e.fk_soc as socid, e.date_creation, e.ref, e.fk_user_author, e.fk_statut"; + $sql.= ", weight, weight_units, size, size_units, width, height"; $sql.= ", ".$this->db->pdate("e.date_expedition")." as date_expedition, e.model_pdf, e.fk_adresse_livraison"; $sql.= ", e.fk_expedition_methode, e.tracking_number"; if ($conf->commande->enabled) @@ -250,7 +251,11 @@ class Expedition extends CommonObject $this->modelpdf = $obj->model_pdf; $this->expedition_method_id = $obj->fk_expedition_methode; $this->tracking_number = $obj->tracking_number; - + $this->trueWeight = $obj->weight; + $this->weight_units = $obj->weight_units; + $this->trueSize = $obj->size."x".$obj->width."x".$obj->height; + $this->size_units = $obj->size_units; + if ($conf->commande->enabled) { $this->origin = "commande"; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 9f1d5956a55..0989dafb234 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -71,9 +71,15 @@ if ($_POST["action"] == 'add') $expedition->note = $_POST["note"]; $expedition->origin = $origin; $expedition->origin_id = $origin_id; - - // On boucle sur chaque ligne du document d'origine pour compl�ter objet expedition - // avec qt� � livrer + $expedition->weight = $_POST["weight"]==""?"NULL":$_POST["weight"]; + $expedition->sizeH = $_POST["sizeH"]==""?"NULL":$_POST["sizeH"]; + $expedition->sizeW = $_POST["sizeW"]==""?"NULL":$_POST["sizeW"]; + $expedition->sizeS = $_POST["sizeS"]==""?"NULL":$_POST["sizeS"]; + $expedition->size_units = $_POST["size_units"]; + $expedition->weight_units = $_POST["weight_units"]; + + // On boucle sur chaque ligne du document d'origine pour completer objet expedition + // avec qte a livrer $class = ucfirst($expedition->origin); $object = new $class($db); $object->fetch($expedition->origin_id); @@ -284,8 +290,28 @@ if ($_GET["action"] == 'create') { print ''.$langs->trans("NotePrivate").': '.nl2br($object->note).""; } + print ""; + + print ''; + print ''; + print '
'; + print $langs->trans("Weight"); + print ''; + print $html->select_measuring_units("weight_units","weight"); + print '
'; + print $langs->trans("width"); + print '  
'; + print $langs->trans("height"); + print ''; + print $html->select_measuring_units("size_units","size"); + print '
'; + print $langs->trans("depth"); + print ' 
'; - // Delivery method + + print ''; + + // Delivery method print ""; print '\n"; + print "
".$langs->trans("DeliveryMethod")."'; $expe->fetch_delivery_methods(); @@ -297,8 +323,9 @@ if ($_GET["action"] == 'create') print ''; print ''; print "
"; - + /* * Lignes de commandes * @@ -547,18 +574,22 @@ else print '
'; } - // calcul du poids total et du volume total des produits - //TODO: ajouter conversion pour le poids et le volume et selection de l'unit� de mesure la plus utilis�e + // Calcul du poids total et du volume total des produits $totalWeight = ''; $totalVolume = ''; - for ($i = 0 ; $i < $num_prod ; $i++) + for ($i = 0 ; $i < $num_prod ; $i++) { - $totalWeight += $lignes[$i]->weight*$lignes[$i]->qty_shipped; - $weightUnit = $lignes[$i]->weight_units; - $totalVolume += $lignes[$i]->volume*$lignes[$i]->qty_shipped; - $volumeUnit = $lignes[$i]->volume_units; + $weightUnit=0; + $volumeUnit=0; + if (! empty($lignes[$i]->weight_units)) $weightUnit = $lignes[$i]->weight_units; + $trueWeightUnit=pow(10,$weightUnit); + $totalWeight += $lignes[$i]->weight*$lignes[$i]->qty_shipped*$trueWeightUnit; + if (! empty($lignes[$i]->volume_units)) $volumeUnit = $lignes[$i]->volume_units; + $trueVolumeUnit=pow(10,$volumeUnit); + $totalVolume += $lignes[$i]->volume*$lignes[$i]->qty_shipped*$trueVolumeUnit; } - + $totalVolume=$totalVolume; + print ''; // Ref @@ -592,7 +623,7 @@ else } print ''; - // Ref client + // Ref customer print ''; print '\n"; print ''; @@ -602,16 +633,53 @@ else print '\n"; print ''; - // Poids Total - print ''; - print '\n"; - print ''; + // Weight + print ''; + print ''; // Volume Total print ''; - print '\n"; + print '\n"; print ''; + // Taille + print ''; + print '\n"; + print ''; + // Status print ''; print '\n"; diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index b5965660e65..00001e72400 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -76,10 +76,10 @@ WeightUnitg=g WeightUnitmg=mg Volume=Volume TotalVolume=Total volume -VolumeUnitm3=m3 -VolumeUnitdm3=dm3 -VolumeUnitcm3=cm3 -VolumeUnitmm3=mm3 +VolumeUnitm3=m3 +VolumeUnitdm3=dm3 +VolumeUnitcm3=cm3 +VolumeUnitmm3=mm3 BugTracker=Bug tracker SendNewPasswordDesc=This form allows you to request a new passord. It will be send to your email address.
Change will be effective only after clicking on confirmation link inside this email.
Check your email reader software. BackToLoginPage=Back to login page diff --git a/htdocs/langs/es_ES/other.lang b/htdocs/langs/es_ES/other.lang index b1eb6339071..37815a86581 100644 --- a/htdocs/langs/es_ES/other.lang +++ b/htdocs/langs/es_ES/other.lang @@ -77,10 +77,10 @@ WeightUnitg=g WeightUnitmg=mg Volume=Volumen TotalVolume=Volumen total -VolumeUnitm3=m3 -VolumeUnitdm3=dm3 -VolumeUnitcm3=cm3 -VolumeUnitmm3=mm3 +VolumeUnitm3=m3 +VolumeUnitdm3=dm3 +VolumeUnitcm3=cm3 +VolumeUnitmm3=mm3 BugTracker=Bug tracker SendNewPasswordDesc=Este formulario permite enviar una nueva contraseña. Se enviará al e-mail del usuario
La modificación de la contraseña no será efectiva hasta que el usario haga click en el link de confirmación incluido en este e-mail.
Supervise su correo. BackToLoginPage=Volver a la página de conexión diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index e0d570c2ef5..9978bb7440e 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -78,10 +78,18 @@ WeightUnitg=g WeightUnitmg=mg Volume=Volume TotalVolume=Volume total -VolumeUnitm3=m3 -VolumeUnitdm3=dm3 -VolumeUnitcm3=cm3 -VolumeUnitmm3=mm3 +VolumeUnitm3=m3 +VolumeUnitdm3=dm3 +VolumeUnitcm3=cm3 +VolumeUnitmm3=mm3 +height=hauteur +width=largeur +depth=profondeur +size=taille +SizeUnitm=m +SizeUnitdm=dm +SizeUnitcm=cm +SizeUnitmm=mm BugTracker=Bug tracker SendNewPasswordDesc=Ce formulaire permet d'envoyer un nouveau mot de passe. Il sera envoyé à l'adresse email de votre user.
La modification du mot de passe ne sera effective qu'après clic par le destinataire du lien de confirmation inclut dans ce mail.
Surveillez votre messagerie. BackToLoginPage=Retour page de connexion diff --git a/htdocs/langs/it_IT/other.lang b/htdocs/langs/it_IT/other.lang index 1b7064accb7..ba115eba6c5 100644 --- a/htdocs/langs/it_IT/other.lang +++ b/htdocs/langs/it_IT/other.lang @@ -75,10 +75,10 @@ WeightUnitg =g WeightUnitmg =mg Volume =Volume TotalVolume =Volume totale -VolumeUnitm3 =m3 -VolumeUnitdm3 =dm3 -VolumeUnitcm3 =cm 3 -VolumeUnitmm3 =mm 3 +VolumeUnitm3 =m3 +VolumeUnitdm3 =dm3 +VolumeUnitcm3 =cm3 +VolumeUnitmm3 =mm3 BugTracker =Bug tracker SendNewPasswordDesc =Questo modulo consente di richiedere una nuova passord. Sarà inviare al tuo indirizzo email.
Cambiamento sarà effettivo solo dopo aver fatto clic sul link di conferma all'interno di questa e-mail.
Controlla la tua email lettore software. BackToLoginPage =Torna alla pagina di accesso diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 559ff384585..f8271d42428 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -2554,6 +2554,13 @@ function measuring_units_string($unit,$measuring_style='') $measuring_units[-6] = $langs->trans("VolumeUnitcm3"); $measuring_units[-9] = $langs->trans("VolumeUnitmm3"); } + else if ($measuring_style == 'size') + { + $measuring_units[0] = $langs->trans("SizeUnitm"); + $measuring_units[-1] = $langs->trans("SizeUnitdm"); + $measuring_units[-2] = $langs->trans("SizeUnitcm"); + $measuring_units[-3] = $langs->trans("SizeUnitmm"); + } return $measuring_units[$unit]; } diff --git a/mysql/migration/2.4.0-2.5.0.sql b/mysql/migration/2.4.0-2.5.0.sql index 9d6c3f2747b..ac242889753 100644 --- a/mysql/migration/2.4.0-2.5.0.sql +++ b/mysql/migration/2.4.0-2.5.0.sql @@ -53,3 +53,9 @@ update llx_c_prospectlevel set code='PL_NONE', label='None' where code='PL_UNKOW update llx_societe set fk_prospectlevel=null where fk_prospectlevel='PL_UNKOWN'; +alter table llx_expedition add height integer; +alter table llx_expedition add width integer; +alter table llx_expedition add size_units integer; +alter table llx_expedition add size integer; +alter table llx_expedition add weight_units integer; +alter table llx_expedition add weight integer; diff --git a/mysql/tables/llx_expedition.sql b/mysql/tables/llx_expedition.sql index 09deab7c05d..a397b65441d 100644 --- a/mysql/tables/llx_expedition.sql +++ b/mysql/tables/llx_expedition.sql @@ -34,6 +34,12 @@ create table llx_expedition fk_expedition_methode integer, tracking_number varchar(50), fk_statut smallint DEFAULT 0, + height integer, + width integer, + size_units integer, + size integer, + weight_units integer, + weight integer, note text, model_pdf varchar(50) )type=innodb;
'.$langs->trans("RefCustomer").''.$object->ref_client."
'.dolibarr_print_date($expedition->date,"daytext")."
'.$langs->trans("TotalWeight").''.$totalWeight.' '.measuring_units_string($weightUnit,"weight")."
'.$langs->trans("TotalWeight").''; + if ($expedition->trueWeight) + { + // If sending weigth defined + print $expedition->trueWeight.' '.measuring_units_string($expedition->weight_units,"weight"); + } + else + { + // If sending Weight not defined we use sum of products + // TODO Show in best unit + if ($totalWeight > 0) print $totalWeight.' '.measuring_units_string(0,"weight"); + else print ' '; + } + print '
'.$langs->trans("TotalVolume").''.$totalVolume.' '.measuring_units_string($volumeUnit,"volume")."'; + if ($expedition->trueVolume) + { + // If sending volume defined + print $expedition->trueVolume.' '.measuring_units_string($expedition->volumeUnit,"volume"); + } + else + { + // If sending volume not defined we use sum of products + // TODO Show in best unit + if ($totalVolume > 0) print $totalVolume.' '.measuring_units_string(0,"volume"); + else print ' '; + } + print "
'.$langs->trans("Size").''; + if ($expedition->trueSize != 'xx' || measuring_units_string($expedition->size_units,"size")) + { + // If sending size defined + print $expedition->trueSize.' '.measuring_units_string($expedition->size_units,"size"); + } + else print ' '; + print "
'.$langs->trans("Status").''.$expedition->getLibStatut(4)."