WIP : Admin for carriers
This commit is contained in:
parent
751488e291
commit
67c06225a5
@ -105,11 +105,12 @@ print_titre($langs->trans("CarrierList"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Code").'</td>';
|
||||
print '<td width="200">'.$langs->trans("Name").'</td>';
|
||||
print '<td width="80">'.$langs->trans("Code").'</td>';
|
||||
print '<td width="150">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("TracingUrl").'</td>';
|
||||
print '<td>'.$langs->trans("TrackingUrl").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="30">'.$langs->trans("Edit").'</td>';
|
||||
print "</tr>\n";
|
||||
for ($i=0; $i<sizeof($object->listmeths); $i++)
|
||||
{
|
||||
@ -118,8 +119,8 @@ for ($i=0; $i<sizeof($object->listmeths); $i++)
|
||||
print '<td>'.$object->listmeths[$i][code].'</td>';
|
||||
print '<td>'.$object->listmeths[$i][libelle].'</td>';
|
||||
print '<td>'.$object->listmeths[$i][description].'</td>';
|
||||
print '<td>'.$object->listmeths[$i][tracing].'</td>';
|
||||
print '<td>';
|
||||
print '<td>'.$object->listmeths[$i][tracking].'</td>';
|
||||
print '<td align="center">';
|
||||
if($object->listmeths[$i][active] == 0)
|
||||
{
|
||||
print '<a href="carrier.php?action=activate_carrier&carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
@ -128,8 +129,17 @@ for ($i=0; $i<sizeof($object->listmeths); $i++)
|
||||
{
|
||||
print '<a href="carrier.php?action=disable_carrier&carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||
}
|
||||
print '</td><td align="center">';
|
||||
if($object->listmeths[$i][editable] == 1)
|
||||
{
|
||||
print '<a href="carrier.php?action=edit_carrier&carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Edit"),'edit').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
@ -1176,12 +1176,11 @@ class Expedition extends CommonObject
|
||||
function all_delivery_methods()
|
||||
{
|
||||
global $langs;
|
||||
$meths = array();
|
||||
$listmeths = array();
|
||||
$i=0;
|
||||
|
||||
$sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.active";
|
||||
$sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.tracking, em.active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||
//$sql.= " ORDER BY em.libelle ASC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1193,6 +1192,25 @@ class Expedition extends CommonObject
|
||||
$label=$langs->trans('SendingMethod'.$obj->code);
|
||||
$this->listmeths[$i][libelle] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
|
||||
$this->listmeths[$i][description] = $obj->description;
|
||||
if ($obj->tracking)
|
||||
{
|
||||
$this->listmeths[$i][tracking] = $obj->tracking;
|
||||
$this->listmeths[$i][editable] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($obj->code)
|
||||
{
|
||||
$classname = "methode_expedition_".strtolower($obj->code);
|
||||
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).".modules.php") )
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).'.modules.php';
|
||||
$shipmethod = new $classname();
|
||||
$this->listmeths[$i][tracking] = $shipmethod->provider_url_status('{TRACKID}');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->listmeths[$i][active] = $obj->active;
|
||||
$i++;
|
||||
}
|
||||
@ -1239,7 +1257,7 @@ class Expedition extends CommonObject
|
||||
|
||||
if (! empty($this->expedition_method_id))
|
||||
{
|
||||
$sql = "SELECT em.code";
|
||||
$sql = "SELECT em.code, em.tracking";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||
$sql.= " WHERE em.rowid = ".$this->expedition_method_id;
|
||||
|
||||
@ -1249,36 +1267,45 @@ class Expedition extends CommonObject
|
||||
if ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$code = $obj->code;
|
||||
$tracking = $obj->tracking;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($code)
|
||||
{
|
||||
$classname = "methode_expedition_".strtolower($code);
|
||||
if ($tracking)
|
||||
{
|
||||
$url = str_replace('{TRACKID}', $value, $tracking);
|
||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($code)
|
||||
{
|
||||
$classname = "methode_expedition_".strtolower($code);
|
||||
|
||||
$url='';
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($code).".modules.php") && ! empty($this->tracking_number))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($code).'.modules.php';
|
||||
$shipmethod = new $classname();
|
||||
$url = $shipmethod->provider_url_status($this->tracking_number);
|
||||
}
|
||||
$url='';
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($code).".modules.php") && ! empty($this->tracking_number))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($code).'.modules.php';
|
||||
$shipmethod = new $classname();
|
||||
$url = $shipmethod->provider_url_status($this->tracking_number);
|
||||
}
|
||||
|
||||
if ($url)
|
||||
{
|
||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
if ($url)
|
||||
{
|
||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Classify the shipping as invoiced
|
||||
|
||||
@ -29,11 +29,12 @@
|
||||
--
|
||||
-- Sending method
|
||||
--
|
||||
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);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (5,'UPS','UPS','United Parcel Service',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (6,'KIALA','KIALA','Relais Kiala',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (7,'GLS','GLS','General Logistics Systems',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (8,'CHRONO','Chronopost','Chronopost',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (1,'CATCH','Catch','Catch by client','',1);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (2,'TRANS','Transporter','Generic transporter','',1);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi','',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (4,'LETTREMAX','Lettre Max','Courrier Suivi et Lettre Max','',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (5,'UPS','UPS','United Parcel Service','',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (6,'KIALA','KIALA','Relais Kiala','',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (7,'GLS','GLS','General Logistics Systems','',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (8,'CHRONO','Chronopost','Chronopost','',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (9,'EDIT','EDITABLE','Transporteur Modifiable','http://www.website.com/dir/{TRACKID}',0);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
alter table llx_contratdet add column fk_product_fournisseur_price integer after info_bits;
|
||||
--
|
||||
-- Be carefull to requests order.
|
||||
-- This file must be loaded by calling /install/index.php page
|
||||
@ -50,3 +51,6 @@ INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (6,'KIALA','KIALA','Relais Kiala',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (7,'GLS','GLS','General Logistics Systems',0);
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (8,'CHRONO','Chronopost','Chronopost',0);
|
||||
|
||||
ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL AFTER description;
|
||||
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (9,'EDIT','EDITABLE','Transporteur Modifiable','http://www.website.com/dir/{TRACKID}',0);
|
||||
|
||||
@ -23,6 +23,7 @@ create table llx_c_shipment_mode
|
||||
code varchar(30) NOT NULL,
|
||||
libelle varchar(50) NOT NULL,
|
||||
description text,
|
||||
tracking varchar(256) NOT NULL,
|
||||
active tinyint DEFAULT 0,
|
||||
module varchar(32) NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user