New: add shipment method "Lettre Max" for France
This commit is contained in:
parent
3ebd00e059
commit
38a097b2fb
@ -96,10 +96,11 @@ class Form
|
||||
* @param paramkey Key of parameter (unique if there is several parameter to show)
|
||||
* @param perm Permission to allow button to edit parameter
|
||||
* @param typeofdata Type of data ('string' by default, 'email', 'text', ...)
|
||||
* @param editvalue Use this value instead $preselected
|
||||
* @return string HTML edit field
|
||||
* TODO no GET or POST in class file, use a param
|
||||
*/
|
||||
function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string')
|
||||
function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string',$editvalue='')
|
||||
{
|
||||
global $langs;
|
||||
$ret='';
|
||||
@ -114,11 +115,11 @@ class Form
|
||||
$ret.='<tr><td>';
|
||||
if (in_array($typeofdata,array('string','email')))
|
||||
{
|
||||
$ret.='<input type="text" name="'.$htmlname.'" value="'.$preselected.'">';
|
||||
$ret.='<input type="text" name="'.$htmlname.'" value="'.($editvalue?$editvalue:$preselected).'">';
|
||||
}
|
||||
else if ($typeofdata == 'text')
|
||||
{
|
||||
$ret.='<textarea name="'.$htmlname.'">'.$preselected.'</textarea>';
|
||||
$ret.='<textarea name="'.$htmlname.'">'.($editvalue?$editvalue:$preselected).'</textarea>';
|
||||
}
|
||||
$ret.='</td>';
|
||||
$ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
|
||||
@ -1054,18 +1054,23 @@ class Expedition extends CommonObject
|
||||
/**
|
||||
* Get tracking url status
|
||||
*/
|
||||
function GetUrlTrackingStatus()
|
||||
function GetUrlTrackingStatus($value='')
|
||||
{
|
||||
$sql = "SELECT em.code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||
$sql.= " WHERE em.rowid = ".$this->expedition_method_id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
$code='';
|
||||
|
||||
if (! empty($this->expedition_method_id))
|
||||
{
|
||||
if ($obj = $this->db->fetch_object($resql))
|
||||
$sql = "SELECT em.code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||
$sql.= " WHERE em.rowid = ".$this->expedition_method_id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$code = $obj->code;
|
||||
if ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$code = $obj->code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1083,16 +1088,16 @@ class Expedition extends CommonObject
|
||||
|
||||
if ($url)
|
||||
{
|
||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">url</a>',$url,$url);
|
||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = '';
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = '';
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -672,11 +672,6 @@ else
|
||||
$expedition->fetch_origin();
|
||||
}
|
||||
|
||||
if (dol_strlen($expedition->tracking_number))
|
||||
{
|
||||
$expedition->GetUrlTrackingStatus();
|
||||
}
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($expedition->socid);
|
||||
|
||||
@ -930,17 +925,11 @@ else
|
||||
print '</tr>';
|
||||
|
||||
// Tracking Number
|
||||
$expedition->GetUrlTrackingStatus($expedition->tracking_number);
|
||||
print '<tr><td>'.$html->editfieldkey("TrackingNumber",'trackingnumber',$expedition->tracking_number,'id',$expedition->id,$user->rights->expedition->creer).'</td><td colspan="3">';
|
||||
print $html->editfieldval("TrackingNumber",'trackingnumber',$expedition->tracking_number,'id',$expedition->id,$user->rights->expedition->creer);
|
||||
print $html->editfieldval("TrackingNumber",'trackingnumber',$expedition->tracking_url,'id',$expedition->id,$user->rights->expedition->creer,'string',$expedition->tracking_number);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($expedition->tracking_url)
|
||||
{
|
||||
print '<tr><td>'.$html->editfieldkey("TrackingUrl",'trackingurl',$expedition->tracking_url,'id',$expedition->id,$user->rights->expedition->creer).'</td><td colspan="3">';
|
||||
print $html->editfieldval("TrackingUrl",'trackingurl',$expedition->tracking_url,'id',$expedition->id,$user->rights->expedition->creer);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
/*
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/includes/modules/expedition/methode_expedition_lettremax.modules.php
|
||||
* \ingroup expedition
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
include_once "methode_expedition.modules.php";
|
||||
|
||||
|
||||
class methode_expedition_lettremax extends ModeleShippingMethod
|
||||
{
|
||||
|
||||
function methode_expedition_lettremax($db=0)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->id = 4; // Do not change this value
|
||||
$this->code = "LETTREMAX"; // Do not change this value
|
||||
$this->name = "Lettre max";
|
||||
$this->description = "Courrier suivi et lettre max";
|
||||
}
|
||||
|
||||
function provider_url_status($tracking_number)
|
||||
{
|
||||
return sprintf("http://www.csuivi.courrier.laposte.fr/default.asp?EZ_ACTION=rechercheRapide&numObjet=%s",$tracking_number);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -3,7 +3,7 @@
|
||||
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
|
||||
-- Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
-- Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
@ -34,3 +34,4 @@
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (1,'CATCH','Catch','Catch by client',1);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (2,'TRANS','Transporter','Generic transporter',1);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (4,'LETTREMAX','Lettre Max','Courrier Suivi et Lettre Max',0);
|
||||
|
||||
@ -122,6 +122,8 @@ ALTER TABLE llx_expedition ADD COLUMN ref_int varchar(30) AFTER ref_ext;
|
||||
ALTER TABLE llx_livraison ADD COLUMN ref_ext varchar(30) AFTER fk_soc;
|
||||
ALTER TABLE llx_livraison ADD COLUMN ref_int varchar(30) AFTER ref_ext;
|
||||
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (4,'LETTREMAX','Lettre Max','Courrier Suivi et Lettre Max',0);
|
||||
|
||||
--Add Chile data (id pays=67)
|
||||
-- Regions Chile
|
||||
INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6701, 6701, 67, NULL, NULL, 'Tarapacá', 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user