From fb75358c101b580a7a80829518229b980e5123ac Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 18 Mar 2013 17:34:29 +0100 Subject: [PATCH] fix: deprecated for expedition_methode_id --- .../doc/pdf_expedition_merou.modules.php | 4 ++-- .../doc/pdf_expedition_rouget.modules.php | 4 ++-- htdocs/expedition/class/expedition.class.php | 12 +++++----- htdocs/expedition/fiche.php | 22 +++++++++---------- .../install/mysql/migration/3.3.0-3.4.0.sql | 1 + 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php index 56e0d90fdb3..39c70faab79 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php @@ -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 diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php index 172966b89cf..368527612f1 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php @@ -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")."
"; $label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :"; $pdf->SetFont('','B', $default_font_size - 2); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index cac81eda070..393a316df15 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -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) diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 21289f60864..bcb55bb3ef8 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -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 "".$langs->trans("DeliveryMethod").""; print ''; $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 "\n"; @@ -1105,26 +1105,26 @@ else print $langs->trans('SendingMethod'); print ''; - if ($action != 'editexpedition_method_id') print 'id.'">'.img_edit($langs->trans('SetSendingMethod'),1).''; + if ($action != 'editshipping_method_id') print 'id.'">'.img_edit($langs->trans('SetSendingMethod'),1).''; print ''; print ''; - if ($action == 'editexpedition_method_id') + if ($action == 'editshipping_method_id') { - print '
'; + print ''; print ''; - print ''; + print ''; $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 ''; print '
'; } 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)); } } diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index a8a57e7750d..a01458780a6 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -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;