fix: deprecated for expedition_methode_id

This commit is contained in:
Grand Philippe 2013-03-18 17:34:29 +01:00
parent c6b4259735
commit fb75358c10
5 changed files with 21 additions and 22 deletions

View File

@ -546,10 +546,10 @@ class pdf_expedition_merou extends ModelePdfExpedition
$object->GetUrlTrackingStatus($object->tracking_number);
if (! empty($object->tracking_url))
{
if ($object->expedition_method_id > 0)
if ($object->shipping_method_id > 0)
{
// Get code using getLabelFromKey
$code=$outputlangs->getLabelFromKey($this->db,$object->expedition_method_id,'c_shipment_mode','rowid','code');
$code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
$label=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
}
else

View File

@ -189,10 +189,10 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$object->GetUrlTrackingStatus($object->tracking_number);
if (! empty($object->tracking_url))
{
if ($object->expedition_method_id > 0)
if ($object->shipping_method_id > 0)
{
// Get code using getLabelFromKey
$code=$outputlangs->getLabelFromKey($this->db,$object->expedition_method_id,'c_shipment_mode','rowid','code');
$code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
$label=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
$label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
$pdf->SetFont('','B', $default_font_size - 2);

View File

@ -51,7 +51,6 @@ class Expedition extends CommonObject
var $origin;
var $origin_id;
var $lines=array();
var $expedition_method_id; // deprecated
var $shipping_method_id;
var $tracking_number;
var $tracking_url;
@ -203,7 +202,7 @@ class Expedition extends CommonObject
$sql.= ", ".($this->date_delivery>0?"'".$this->db->idate($this->date_delivery)."'":"null");
$sql.= ", ".$this->socid;
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null");
$sql.= ", ".($this->expedition_method_id>0?$this->expedition_method_id:"null");
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null");
$sql.= ", '".$this->db->escape($this->tracking_number)."'";
$sql.= ", ".$this->weight;
$sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth
@ -373,7 +372,6 @@ class Expedition extends CommonObject
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
$this->fk_delivery_address = $obj->fk_address;
$this->modelpdf = $obj->model_pdf;
$this->expedition_method_id = $obj->fk_expedition_methode; // TODO deprecated
$this->shipping_method_id = $obj->fk_expedition_methode;
$this->tracking_number = $obj->tracking_number;
$this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
@ -683,7 +681,7 @@ class Expedition extends CommonObject
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid);
if (isset($this->fk_delivery_address)) $this->fk_delivery_address=trim($this->fk_delivery_address);
if (isset($this->expedition_method_id)) $this->expedition_method_id=trim($this->expedition_method_id);
if (isset($this->shipping_method_id)) $this->shipping_method_id=trim($this->shipping_method_id);
if (isset($this->tracking_number)) $this->tracking_number=trim($this->tracking_number);
if (isset($this->statut)) $this->statut=trim($this->statut);
if (isset($this->trueDepth)) $this->trueDepth=trim($this->trueDepth);
@ -714,7 +712,7 @@ class Expedition extends CommonObject
$sql.= " date_expedition=".(dol_strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').",";
$sql.= " date_delivery=".(dol_strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').",";
$sql.= " fk_address=".(isset($this->fk_delivery_address)?$this->fk_delivery_address:"null").",";
$sql.= " fk_expedition_methode=".((isset($this->expedition_method_id) && $this->expedition_method_id > 0)?$this->expedition_method_id:"null").",";
$sql.= " fk_shipping_method=".((isset($this->shipping_method_id) && $this->shipping_method_id > 0)?$this->shipping_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=".(($this->trueHeight != '')?$this->trueHeight:"null").",";
@ -1291,11 +1289,11 @@ class Expedition extends CommonObject
{
$code='';
if (! empty($this->expedition_method_id))
if (! empty($this->shipping_method_id))
{
$sql = "SELECT em.code, em.tracking";
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
$sql.= " WHERE em.rowid = ".$this->expedition_method_id;
$sql.= " WHERE em.rowid = ".$this->shipping_method_id;
$resql = $this->db->query($sql);
if ($resql)

View File

@ -104,7 +104,7 @@ if ($action == 'add')
$object->ref_customer = $objectsrc->ref_client;
$object->date_delivery = $date_delivery; // Date delivery planed
$object->fk_delivery_address = $objectsrc->fk_delivery_address;
$object->expedition_method_id = GETPOST('expedition_method_id','int');
$object->shipping_method_id = GETPOST('shipping_method_id','int');
$object->tracking_number = GETPOST('tracking_number','alpha');
$object->ref_int = GETPOST('ref_int','alpha');
@ -260,7 +260,7 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|| $action == 'settrueWidth'
|| $action == 'settrueHeight'
|| $action == 'settrueDepth'
|| $action == 'setexpedition_method_id')
|| $action == 'setshipping_method_id')
{
$error=0;
@ -274,7 +274,7 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
if ($action == 'settrueWidth') $shipping->trueWidth = trim(GETPOST('trueWidth','int'));
if ($action == 'settrueHeight') $shipping->trueHeight = trim(GETPOST('trueHeight','int'));
if ($action == 'settrueDepth') $shipping->trueDepth = trim(GETPOST('trueDepth','int'));
if ($action == 'setexpedition_method_id') $shipping->expedition_method_id = trim(GETPOST('expedition_method_id','int'));
if ($action == 'setshipping_method_id') $shipping->shipping_method_id = trim(GETPOST('shipping_method_id','int'));
if (! $error)
{
@ -658,7 +658,7 @@ if ($action == 'create')
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
print '<td colspan="3">';
$expe->fetch_delivery_methods();
print $form->selectarray("expedition_method_id",$expe->meths,GETPOST('expedition_method_id','int'),1,0,0,"",1);
print $form->selectarray("shipping_method_id",$expe->meths,GETPOST('shipping_method_id','int'),1,0,0,"",1);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print "</td></tr>\n";
@ -1105,26 +1105,26 @@ else
print $langs->trans('SendingMethod');
print '</td>';
if ($action != 'editexpedition_method_id') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editexpedition_method_id&amp;id='.$object->id.'">'.img_edit($langs->trans('SetSendingMethod'),1).'</a></td>';
if ($action != 'editshipping_method_id') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping_method_id&amp;id='.$object->id.'">'.img_edit($langs->trans('SetSendingMethod'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($action == 'editexpedition_method_id')
if ($action == 'editshipping_method_id')
{
print '<form name="setexpedition_method_id" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<form name="setshipping_method_id" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setexpedition_method_id">';
print '<input type="hidden" name="action" value="setshipping_method_id">';
$object->fetch_delivery_methods();
print $form->selectarray("expedition_method_id",$object->meths,$object->expedition_method_id,1,0,0,"",1);
print $form->selectarray("shipping_method_id",$object->meths,$object->shipping_method_id,1,0,0,"",1);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
else
{
if ($object->expedition_method_id > 0)
if ($object->shipping_method_id > 0)
{
// Get code using getLabelFromKey
$code=$langs->getLabelFromKey($db,$object->expedition_method_id,'c_shipment_mode','rowid','code');
$code=$langs->getLabelFromKey($db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
print $langs->trans("SendingMethod".strtoupper($code));
}
}

View File

@ -81,6 +81,7 @@ alter table llx_socpeople CHANGE COLUMN cp zip varchar(10);
alter table llx_societe_rib CHANGE COLUMN adresse_proprio owner_address text;
alter table llx_societe_address CHANGE COLUMN ville town text;
alter table llx_societe_address CHANGE COLUMN cp zip varchar(10);
alter table llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer;
ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description;