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 '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="100">'.$langs->trans("Code").'</td>';
|
print '<td width="80">'.$langs->trans("Code").'</td>';
|
||||||
print '<td width="200">'.$langs->trans("Name").'</td>';
|
print '<td width="150">'.$langs->trans("Name").'</td>';
|
||||||
print '<td>'.$langs->trans("Description").'</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="60">'.$langs->trans("Status").'</td>';
|
||||||
|
print '<td align="center" width="30">'.$langs->trans("Edit").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
for ($i=0; $i<sizeof($object->listmeths); $i++)
|
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][code].'</td>';
|
||||||
print '<td>'.$object->listmeths[$i][libelle].'</td>';
|
print '<td>'.$object->listmeths[$i][libelle].'</td>';
|
||||||
print '<td>'.$object->listmeths[$i][description].'</td>';
|
print '<td>'.$object->listmeths[$i][description].'</td>';
|
||||||
print '<td>'.$object->listmeths[$i][tracing].'</td>';
|
print '<td>'.$object->listmeths[$i][tracking].'</td>';
|
||||||
print '<td>';
|
print '<td align="center">';
|
||||||
if($object->listmeths[$i][active] == 0)
|
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>';
|
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 '<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 "</tr>\n";
|
||||||
|
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
|
|||||||
@ -1176,12 +1176,11 @@ class Expedition extends CommonObject
|
|||||||
function all_delivery_methods()
|
function all_delivery_methods()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$meths = array();
|
$listmeths = array();
|
||||||
$i=0;
|
$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.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||||
//$sql.= " ORDER BY em.libelle ASC";
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -1193,6 +1192,25 @@ class Expedition extends CommonObject
|
|||||||
$label=$langs->trans('SendingMethod'.$obj->code);
|
$label=$langs->trans('SendingMethod'.$obj->code);
|
||||||
$this->listmeths[$i][libelle] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
|
$this->listmeths[$i][libelle] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
|
||||||
$this->listmeths[$i][description] = $obj->description;
|
$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;
|
$this->listmeths[$i][active] = $obj->active;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -1239,7 +1257,7 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if (! empty($this->expedition_method_id))
|
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.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||||
$sql.= " WHERE em.rowid = ".$this->expedition_method_id;
|
$sql.= " WHERE em.rowid = ".$this->expedition_method_id;
|
||||||
|
|
||||||
@ -1249,10 +1267,18 @@ class Expedition extends CommonObject
|
|||||||
if ($obj = $this->db->fetch_object($resql))
|
if ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$code = $obj->code;
|
$code = $obj->code;
|
||||||
|
$tracking = $obj->tracking;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
if ($code)
|
||||||
{
|
{
|
||||||
$classname = "methode_expedition_".strtolower($code);
|
$classname = "methode_expedition_".strtolower($code);
|
||||||
@ -1279,6 +1305,7 @@ class Expedition extends CommonObject
|
|||||||
$this->tracking_url = $value;
|
$this->tracking_url = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classify the shipping as invoiced
|
* Classify the shipping as invoiced
|
||||||
|
|||||||
@ -29,11 +29,12 @@
|
|||||||
--
|
--
|
||||||
-- Sending method
|
-- 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,tracking,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,tracking,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,tracking,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,tracking,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,tracking,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,tracking,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,tracking,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 (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.
|
-- Be carefull to requests order.
|
||||||
-- This file must be loaded by calling /install/index.php page
|
-- 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 (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 (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,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,
|
code varchar(30) NOT NULL,
|
||||||
libelle varchar(50) NOT NULL,
|
libelle varchar(50) NOT NULL,
|
||||||
description text,
|
description text,
|
||||||
|
tracking varchar(256) NOT NULL,
|
||||||
active tinyint DEFAULT 0,
|
active tinyint DEFAULT 0,
|
||||||
module varchar(32) NULL
|
module varchar(32) NULL
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user