mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 02:58:23 +01:00
Add weight and size in sendings
This commit is contained in:
@@ -89,12 +89,12 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (ref, date_creation, fk_user_author, date_expedition";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (ref, date_creation, fk_user_author, date_expedition,";
|
||||||
$sql.= ", fk_soc, fk_expedition_methode, tracking_number";
|
$sql.= " fk_soc, fk_expedition_methode, tracking_number, weight, size, width, height, weight_units, size_units";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
$sql.= " VALUES ('(PROV)', ".$this->db->idate(mktime()).", $user->id, ".$this->db->idate($this->date_expedition);
|
$sql.= " VALUES ('(PROV)', now(), $user->id, ".$this->db->idate($this->date_expedition);
|
||||||
$sql.= ", ".$this->socid.",'". $this->expedition_method_id."','". $this->tracking_number."'";
|
$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.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@@ -205,6 +205,7 @@ class Expedition extends CommonObject
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT e.rowid, e.fk_soc as socid, e.date_creation, e.ref, e.fk_user_author, e.fk_statut";
|
$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.= ", ".$this->db->pdate("e.date_expedition")." as date_expedition, e.model_pdf, e.fk_adresse_livraison";
|
||||||
$sql.= ", e.fk_expedition_methode, e.tracking_number";
|
$sql.= ", e.fk_expedition_methode, e.tracking_number";
|
||||||
if ($conf->commande->enabled)
|
if ($conf->commande->enabled)
|
||||||
@@ -250,7 +251,11 @@ class Expedition extends CommonObject
|
|||||||
$this->modelpdf = $obj->model_pdf;
|
$this->modelpdf = $obj->model_pdf;
|
||||||
$this->expedition_method_id = $obj->fk_expedition_methode;
|
$this->expedition_method_id = $obj->fk_expedition_methode;
|
||||||
$this->tracking_number = $obj->tracking_number;
|
$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)
|
if ($conf->commande->enabled)
|
||||||
{
|
{
|
||||||
$this->origin = "commande";
|
$this->origin = "commande";
|
||||||
|
|||||||
@@ -71,9 +71,15 @@ if ($_POST["action"] == 'add')
|
|||||||
$expedition->note = $_POST["note"];
|
$expedition->note = $_POST["note"];
|
||||||
$expedition->origin = $origin;
|
$expedition->origin = $origin;
|
||||||
$expedition->origin_id = $origin_id;
|
$expedition->origin_id = $origin_id;
|
||||||
|
$expedition->weight = $_POST["weight"]==""?"NULL":$_POST["weight"];
|
||||||
// On boucle sur chaque ligne du document d'origine pour compl<70>ter objet expedition
|
$expedition->sizeH = $_POST["sizeH"]==""?"NULL":$_POST["sizeH"];
|
||||||
// avec qt<71> <20> livrer
|
$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);
|
$class = ucfirst($expedition->origin);
|
||||||
$object = new $class($db);
|
$object = new $class($db);
|
||||||
$object->fetch($expedition->origin_id);
|
$object->fetch($expedition->origin_id);
|
||||||
@@ -284,8 +290,28 @@ if ($_GET["action"] == 'create')
|
|||||||
{
|
{
|
||||||
print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>";
|
print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>";
|
||||||
}
|
}
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '<table><tr><td>';
|
||||||
|
print $langs->trans("Weight");
|
||||||
|
print '</td><td><input name="weight" size="4" value=""></td><td>';
|
||||||
|
print $html->select_measuring_units("weight_units","weight");
|
||||||
|
print '</td></tr><tr><td>';
|
||||||
|
print $langs->trans("width");
|
||||||
|
print ' </td><td><input name="sizeW" size="4" value=""></td>';
|
||||||
|
print '<td> </td></tr><tr><td>';
|
||||||
|
print $langs->trans("height");
|
||||||
|
print '</td><td><input name="sizeH" size="4" value=""></td><td>';
|
||||||
|
print $html->select_measuring_units("size_units","size");
|
||||||
|
print '</td></tr><tr><td>';
|
||||||
|
print $langs->trans("depth");
|
||||||
|
print '</td><td><input name="sizeS" size="4" value=""></td>';
|
||||||
|
print '<td> </td></tr></table>';
|
||||||
|
|
||||||
// Delivery method
|
|
||||||
|
print '<table>';
|
||||||
|
|
||||||
|
// Delivery method
|
||||||
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
|
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
$expe->fetch_delivery_methods();
|
$expe->fetch_delivery_methods();
|
||||||
@@ -297,8 +323,9 @@ if ($_GET["action"] == 'create')
|
|||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print '<input name="tracking_number" size="20">';
|
print '<input name="tracking_number" size="20">';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lignes de commandes
|
* Lignes de commandes
|
||||||
*
|
*
|
||||||
@@ -547,18 +574,22 @@ else
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// calcul du poids total et du volume total des produits
|
// Calcul du poids total et du volume total des produits
|
||||||
//TODO: ajouter conversion pour le poids et le volume et selection de l'unit<69> de mesure la plus utilis<69>e
|
|
||||||
$totalWeight = '';
|
$totalWeight = '';
|
||||||
$totalVolume = '';
|
$totalVolume = '';
|
||||||
for ($i = 0 ; $i < $num_prod ; $i++)
|
for ($i = 0 ; $i < $num_prod ; $i++)
|
||||||
{
|
{
|
||||||
$totalWeight += $lignes[$i]->weight*$lignes[$i]->qty_shipped;
|
$weightUnit=0;
|
||||||
$weightUnit = $lignes[$i]->weight_units;
|
$volumeUnit=0;
|
||||||
$totalVolume += $lignes[$i]->volume*$lignes[$i]->qty_shipped;
|
if (! empty($lignes[$i]->weight_units)) $weightUnit = $lignes[$i]->weight_units;
|
||||||
$volumeUnit = $lignes[$i]->volume_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 '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@@ -592,7 +623,7 @@ else
|
|||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Ref client
|
// Ref customer
|
||||||
print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
|
print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
|
||||||
print '<td colspan="3">'.$object->ref_client."</a></td>\n";
|
print '<td colspan="3">'.$object->ref_client."</a></td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@@ -602,16 +633,53 @@ else
|
|||||||
print '<td colspan="3">'.dolibarr_print_date($expedition->date,"daytext")."</td>\n";
|
print '<td colspan="3">'.dolibarr_print_date($expedition->date,"daytext")."</td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Poids Total
|
// Weight
|
||||||
print '<tr><td>'.$langs->trans("TotalWeight").'</td>';
|
print '<tr><td>'.$langs->trans("TotalWeight").'</td>';
|
||||||
print '<td colspan="3">'.$totalWeight.' '.measuring_units_string($weightUnit,"weight")."</td>\n";
|
print '<td colspan="3">';
|
||||||
print '</tr>';
|
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 '</td></tr>';
|
||||||
|
|
||||||
// Volume Total
|
// Volume Total
|
||||||
print '<tr><td>'.$langs->trans("TotalVolume").'</td>';
|
print '<tr><td>'.$langs->trans("TotalVolume").'</td>';
|
||||||
print '<td colspan="3">'.$totalVolume.' '.measuring_units_string($volumeUnit,"volume")."</td>\n";
|
print '<td colspan="3">';
|
||||||
|
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 "</td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Taille
|
||||||
|
print '<tr><td>'.$langs->trans("Size").'</td>';
|
||||||
|
print '<td colspan="3">';
|
||||||
|
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 "</td>\n";
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||||
print '<td colspan="3">'.$expedition->getLibStatut(4)."</td>\n";
|
print '<td colspan="3">'.$expedition->getLibStatut(4)."</td>\n";
|
||||||
|
|||||||
@@ -76,10 +76,10 @@ WeightUnitg=g
|
|||||||
WeightUnitmg=mg
|
WeightUnitmg=mg
|
||||||
Volume=Volume
|
Volume=Volume
|
||||||
TotalVolume=Total volume
|
TotalVolume=Total volume
|
||||||
VolumeUnitm3=m<SUP>3</SUP>
|
VolumeUnitm3=m3
|
||||||
VolumeUnitdm3=dm<SUP>3</SUP>
|
VolumeUnitdm3=dm3
|
||||||
VolumeUnitcm3=cm<SUP>3</SUP>
|
VolumeUnitcm3=cm3
|
||||||
VolumeUnitmm3=mm<SUP>3</SUP>
|
VolumeUnitmm3=mm3
|
||||||
BugTracker=Bug tracker
|
BugTracker=Bug tracker
|
||||||
SendNewPasswordDesc=This form allows you to request a new passord. It will be send to your email address.<br>Change will be effective only after clicking on confirmation link inside this email.<br>Check your email reader software.
|
SendNewPasswordDesc=This form allows you to request a new passord. It will be send to your email address.<br>Change will be effective only after clicking on confirmation link inside this email.<br>Check your email reader software.
|
||||||
BackToLoginPage=Back to login page
|
BackToLoginPage=Back to login page
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ WeightUnitg=g
|
|||||||
WeightUnitmg=mg
|
WeightUnitmg=mg
|
||||||
Volume=Volumen
|
Volume=Volumen
|
||||||
TotalVolume=Volumen total
|
TotalVolume=Volumen total
|
||||||
VolumeUnitm3=m<SUP>3</SUP>
|
VolumeUnitm3=m3
|
||||||
VolumeUnitdm3=dm<SUP>3</SUP>
|
VolumeUnitdm3=dm3
|
||||||
VolumeUnitcm3=cm<SUP>3</SUP>
|
VolumeUnitcm3=cm3
|
||||||
VolumeUnitmm3=mm<SUP>3</SUP>
|
VolumeUnitmm3=mm3
|
||||||
BugTracker=Bug tracker
|
BugTracker=Bug tracker
|
||||||
SendNewPasswordDesc=Este formulario permite enviar una nueva contrase<73>a. Se enviar<61> al e-mail del usuario<br>La modificaci<63>n de la contrase<73>a no ser<65> efectiva hasta que el usario haga click en el link de confirmaci<63>n incluido en este e-mail.<br>Supervise su correo.
|
SendNewPasswordDesc=Este formulario permite enviar una nueva contrase<73>a. Se enviar<61> al e-mail del usuario<br>La modificaci<63>n de la contrase<73>a no ser<65> efectiva hasta que el usario haga click en el link de confirmaci<63>n incluido en este e-mail.<br>Supervise su correo.
|
||||||
BackToLoginPage=Volver a la p<>gina de conexi<78>n
|
BackToLoginPage=Volver a la p<>gina de conexi<78>n
|
||||||
|
|||||||
@@ -78,10 +78,18 @@ WeightUnitg=g
|
|||||||
WeightUnitmg=mg
|
WeightUnitmg=mg
|
||||||
Volume=Volume
|
Volume=Volume
|
||||||
TotalVolume=Volume total
|
TotalVolume=Volume total
|
||||||
VolumeUnitm3=m<SUP>3</SUP>
|
VolumeUnitm3=m3
|
||||||
VolumeUnitdm3=dm<SUP>3</SUP>
|
VolumeUnitdm3=dm3
|
||||||
VolumeUnitcm3=cm<SUP>3</SUP>
|
VolumeUnitcm3=cm3
|
||||||
VolumeUnitmm3=mm<SUP>3</SUP>
|
VolumeUnitmm3=mm3
|
||||||
|
height=hauteur
|
||||||
|
width=largeur
|
||||||
|
depth=profondeur
|
||||||
|
size=taille
|
||||||
|
SizeUnitm=m
|
||||||
|
SizeUnitdm=dm
|
||||||
|
SizeUnitcm=cm
|
||||||
|
SizeUnitmm=mm
|
||||||
BugTracker=Bug tracker
|
BugTracker=Bug tracker
|
||||||
SendNewPasswordDesc=Ce formulaire permet d'envoyer un nouveau mot de passe. Il sera envoy<6F> <20> l'adresse email de votre user.<br>La modification du mot de passe ne sera effective qu'apr<70>s clic par le destinataire du lien de confirmation inclut dans ce mail.<br>Surveillez votre messagerie.
|
SendNewPasswordDesc=Ce formulaire permet d'envoyer un nouveau mot de passe. Il sera envoy<6F> <20> l'adresse email de votre user.<br>La modification du mot de passe ne sera effective qu'apr<70>s clic par le destinataire du lien de confirmation inclut dans ce mail.<br>Surveillez votre messagerie.
|
||||||
BackToLoginPage=Retour page de connexion
|
BackToLoginPage=Retour page de connexion
|
||||||
|
|||||||
@@ -75,10 +75,10 @@ WeightUnitg =g
|
|||||||
WeightUnitmg =mg
|
WeightUnitmg =mg
|
||||||
Volume =Volume
|
Volume =Volume
|
||||||
TotalVolume =Volume totale
|
TotalVolume =Volume totale
|
||||||
VolumeUnitm3 =m<sup>3</ SUP>
|
VolumeUnitm3 =m3
|
||||||
VolumeUnitdm3 =dm<sup>3</ SUP>
|
VolumeUnitdm3 =dm3
|
||||||
VolumeUnitcm3 =cm <sup>3</ SUP>
|
VolumeUnitcm3 =cm3
|
||||||
VolumeUnitmm3 =mm <sup>3</ SUP>
|
VolumeUnitmm3 =mm3
|
||||||
BugTracker =Bug tracker
|
BugTracker =Bug tracker
|
||||||
SendNewPasswordDesc =Questo modulo consente di richiedere una nuova passord. Sar<61> inviare al tuo indirizzo email. <br> Cambiamento sar<61> effettivo solo dopo aver fatto clic sul link di conferma all'interno di questa e-mail. <br> Controlla la tua email lettore software.
|
SendNewPasswordDesc =Questo modulo consente di richiedere una nuova passord. Sar<61> inviare al tuo indirizzo email. <br> Cambiamento sar<61> effettivo solo dopo aver fatto clic sul link di conferma all'interno di questa e-mail. <br> Controlla la tua email lettore software.
|
||||||
BackToLoginPage =Torna alla pagina di accesso
|
BackToLoginPage =Torna alla pagina di accesso
|
||||||
|
|||||||
@@ -2554,6 +2554,13 @@ function measuring_units_string($unit,$measuring_style='')
|
|||||||
$measuring_units[-6] = $langs->trans("VolumeUnitcm3");
|
$measuring_units[-6] = $langs->trans("VolumeUnitcm3");
|
||||||
$measuring_units[-9] = $langs->trans("VolumeUnitmm3");
|
$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];
|
return $measuring_units[$unit];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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';
|
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;
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ create table llx_expedition
|
|||||||
fk_expedition_methode integer,
|
fk_expedition_methode integer,
|
||||||
tracking_number varchar(50),
|
tracking_number varchar(50),
|
||||||
fk_statut smallint DEFAULT 0,
|
fk_statut smallint DEFAULT 0,
|
||||||
|
height integer,
|
||||||
|
width integer,
|
||||||
|
size_units integer,
|
||||||
|
size integer,
|
||||||
|
weight_units integer,
|
||||||
|
weight integer,
|
||||||
note text,
|
note text,
|
||||||
model_pdf varchar(50)
|
model_pdf varchar(50)
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
Reference in New Issue
Block a user