Change carrier config into dict instead of dedicated conf page
This commit is contained in:
parent
26aba2b609
commit
bfb05c78cd
@ -1,222 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
*
|
|
||||||
* 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 3 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/admin/carrier.php
|
|
||||||
* \ingroup expedition
|
|
||||||
* \brief Page to setup carriers. TODO Delete this page. We mut use dictionnary instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
require '../main.inc.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
|
||||||
|
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("sendings");
|
|
||||||
$langs->load("deliveries");
|
|
||||||
$langs->load('other');
|
|
||||||
|
|
||||||
if (! $user->admin)
|
|
||||||
accessforbidden();
|
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
|
||||||
$carrier=GETPOST('carrier','int');
|
|
||||||
|
|
||||||
$object = new Expedition($db);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
//if ($action==setvalue AND $carrier)
|
|
||||||
if ($action=='setvalue')
|
|
||||||
{
|
|
||||||
// need to add check on values
|
|
||||||
$object->update['code']=GETPOST('code','alpha');
|
|
||||||
$object->update['libelle']=GETPOST('libelle','alpha');
|
|
||||||
$object->update['description']=GETPOST('description','alpha');
|
|
||||||
$object->update['tracking']=GETPOST('tracking','alpha');
|
|
||||||
$object->update_delivery_method($carrier);
|
|
||||||
header("Location: carrier.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action=='activate_carrier' && $carrier!='')
|
|
||||||
{
|
|
||||||
$object->activ_delivery_method($carrier);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action=='disable_carrier' && $carrier!='')
|
|
||||||
{
|
|
||||||
$object->disable_delivery_method($carrier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$form=new Form($db);
|
|
||||||
|
|
||||||
llxHeader("","");
|
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
|
||||||
print_fiche_titre($langs->trans("SendingsSetup"),$linkback,'setup');
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
|
|
||||||
//if ($mesg) print $mesg.'<br>';
|
|
||||||
|
|
||||||
|
|
||||||
$h = 0;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
|
|
||||||
$head[$h][1] = $langs->trans("Setup");
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/carrier.php";
|
|
||||||
$head[$h][1] = $langs->trans("Carriers");
|
|
||||||
$hselected=$h;
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
|
||||||
$head[$h][1] = $langs->trans("Sending");
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_SUBMODULE_LIVRAISON))
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/livraison.php";
|
|
||||||
$head[$h][1] = $langs->trans("Receivings");
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Carrier List
|
|
||||||
*/
|
|
||||||
if ($action=='edit_carrier' || $action=='setvalue')
|
|
||||||
{
|
|
||||||
// Carrier Edit
|
|
||||||
if ($carrier!='') $object->list_delivery_methods($carrier);
|
|
||||||
print_titre($langs->trans("CarrierEdit"));
|
|
||||||
|
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?carrier='.$carrier.'">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="action" value="setvalue">';
|
|
||||||
|
|
||||||
|
|
||||||
print '<table class="nobordernopadding" width="100%">';
|
|
||||||
|
|
||||||
$var=true;
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td width="150">'.$langs->trans("CarrierParameter").'</td>';
|
|
||||||
print '<td>'.$langs->trans("Value").'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
|
||||||
print $langs->trans("Code").'</td><td>';
|
|
||||||
print '<input size="32" type="text" name="code" value="'.$object->listmeths[0]['code'].'">';
|
|
||||||
print ' '.$langs->trans("Example").': CODE';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
|
||||||
print $langs->trans("Name").'</td><td>';
|
|
||||||
print '<input size="32" type="text" name="libelle" value="'.$object->listmeths[0]['libelle'].'">';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
|
||||||
print $langs->trans("Description").'</td><td>';
|
|
||||||
print '<input size="64" type="text" name="description" value="'.$object->listmeths[0]['description'].'">';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
|
||||||
print $langs->trans("Tracking").'</td><td>';
|
|
||||||
print '<input size="80" type="text" name="tracking" value="'.$object->listmeths[0]['tracking'].'">';
|
|
||||||
print ' '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
if ($carrier)
|
|
||||||
{
|
|
||||||
print '<tr><td colspan="2" align="center"><br><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<tr><td colspan="2" align="center"><br><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Display List
|
|
||||||
$object->list_delivery_methods();
|
|
||||||
$var=true;
|
|
||||||
print_titre($langs->trans("CarrierList"));
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
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("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";
|
|
||||||
$numlistmeths=count($object->listmeths);
|
|
||||||
for ($i=0; $i<$numlistmeths; $i++)
|
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
print "<tr ".$bc[$var].">";
|
|
||||||
print '<td>'.$object->listmeths[$i]['code'].'</td>';
|
|
||||||
print '<td>'.$object->listmeths[$i]['libelle'].'</td>';
|
|
||||||
print '<td>'.$object->listmeths[$i]['description'].'</td>';
|
|
||||||
print '<td>'.dol_trunc($object->listmeths[$i]['tracking'],92,'middle').'</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>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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">';
|
|
||||||
print '<a href="carrier.php?action=edit_carrier&carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Edit"),'edit').'</a>';
|
|
||||||
print '</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
print '<tr><td align="center"><a href="carrier.php?action=edit_carrier"><br>'.$langs->trans("Add").'</a></td><tr>';
|
|
||||||
|
|
||||||
print '</table><br>';
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
?>
|
|
||||||
@ -84,10 +84,6 @@ $head[$h][1] = $langs->trans("Setup");
|
|||||||
$hselected=$h;
|
$hselected=$h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/carrier.php";
|
|
||||||
$head[$h][1] = $langs->trans("Carriers");
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||||
|
|||||||
@ -201,10 +201,6 @@ $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
|
|||||||
$head[$h][1] = $langs->trans("Setup");
|
$head[$h][1] = $langs->trans("Setup");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/carrier.php";
|
|
||||||
$head[$h][1] = $langs->trans("Carriers");
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||||
$head[$h][1] = $langs->trans("Sending");
|
$head[$h][1] = $langs->trans("Sending");
|
||||||
$hselected=$h;
|
$hselected=$h;
|
||||||
|
|||||||
@ -189,10 +189,6 @@ $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
|
|||||||
$head[$h][1] = $langs->trans("Setup");
|
$head[$h][1] = $langs->trans("Setup");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/carrier.php";
|
|
||||||
$head[$h][1] = $langs->trans("Carriers");
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||||
|
|||||||
@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
*
|
|
||||||
* 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 3 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/>.
|
|
||||||
* or see http://www.gnu.org/
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/core/modules/expedition/methode_expedition.modules.php
|
|
||||||
* \ingroup expedition
|
|
||||||
* \brief Fichier contenant la classe mere de generation de bon de livraison en PDF
|
|
||||||
* et la classe mere de numerotation des bons de livraisons
|
|
||||||
*/
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parent class for shipping method classes
|
|
||||||
*/
|
|
||||||
class ModeleShippingMethod
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructo
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db = $db;
|
|
||||||
$this->name = "NOT DEFINED";
|
|
||||||
$this->description = "ERROR IN MODULE DESCRIPTION";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return list of active generation modules
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
* @param string $maxfilenamelength Max length of value to show
|
|
||||||
* @return array List of templates
|
|
||||||
*/
|
|
||||||
static function liste_modeles($db,$maxfilenamelength=0)
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$type='???';
|
|
||||||
$liste=array();
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
||||||
$liste=getListOfModels($db,$type,$maxfilenamelength);
|
|
||||||
|
|
||||||
return $liste;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2008 Bearstech - http://bearstech.com/
|
|
||||||
*
|
|
||||||
* 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 3 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/core/modules/expedition/methode_expedition_colsui.modules.php
|
|
||||||
* \ingroup expedition
|
|
||||||
*/
|
|
||||||
include_once 'methode_expedition.modules.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class to manage shipment Colsui
|
|
||||||
*/
|
|
||||||
class methode_expedition_colsui extends ModeleShippingMethod
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db=0)
|
|
||||||
{
|
|
||||||
$this->db = $db;
|
|
||||||
$this->id = 3; // Do not change this value
|
|
||||||
$this->code = "COLSUI"; // Do not change this value
|
|
||||||
$this->name = "Colissimo Suivi";
|
|
||||||
$this->description = "Colissimo Suivi";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return URL of provider
|
|
||||||
*
|
|
||||||
* @param string $tracking_number Tracking number
|
|
||||||
* @return string URL for tracking
|
|
||||||
*/
|
|
||||||
function provider_url_status($tracking_number)
|
|
||||||
{
|
|
||||||
return sprintf("http://www.coliposte.net/particulier/suivi_particulier.jsp?colispart=%s",$tracking_number);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
*
|
|
||||||
* 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 3 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/core/modules/expedition/methode_expedition_enl.modules.php
|
|
||||||
* \ingroup expedition
|
|
||||||
*/
|
|
||||||
include_once 'methode_expedition.modules.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class to manage shipment Enl
|
|
||||||
*/
|
|
||||||
class methode_expedition_enl extends ModeleShippingMethod
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db=0)
|
|
||||||
{
|
|
||||||
global $langs;
|
|
||||||
$this->db = $db;
|
|
||||||
$this->id = 1; // Do not change this value
|
|
||||||
$this->name = "Enlevement";
|
|
||||||
$this->code = "ENL";
|
|
||||||
$this->description = $langs->trans("Enlevement");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return URL of provider
|
|
||||||
*
|
|
||||||
* @param string $tracking_number Tracking number
|
|
||||||
* @return string URL for tracking
|
|
||||||
*/
|
|
||||||
function provider_url_status($tracking_number)
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
|
||||||
*
|
|
||||||
* 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 3 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/core/modules/expedition/methode_expedition_lettremax.modules.php
|
|
||||||
* \ingroup expedition
|
|
||||||
*/
|
|
||||||
|
|
||||||
include_once 'methode_expedition.modules.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class to manage shipment lettremax
|
|
||||||
*/
|
|
||||||
class methode_expedition_lettremax extends ModeleShippingMethod
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($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";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return URL of provider
|
|
||||||
*
|
|
||||||
* @param string $tracking_number Tracking number
|
|
||||||
* @return string URL for tracking
|
|
||||||
*/
|
|
||||||
function provider_url_status($tracking_number)
|
|
||||||
{
|
|
||||||
return sprintf("http://www.csuivi.courrier.laposte.fr/default.asp?EZ_ACTION=rechercheRapide&numObjet=%s",$tracking_number);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
*
|
|
||||||
* 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 3 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/core/modules/expedition/methode_expedition_trans.modules.php
|
|
||||||
* \ingroup expedition
|
|
||||||
*/
|
|
||||||
include_once 'methode_expedition.modules.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class to manage shipment Trans
|
|
||||||
*/
|
|
||||||
class methode_expedition_trans extends ModeleShippingMethod
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db=0)
|
|
||||||
{
|
|
||||||
global $langs;
|
|
||||||
|
|
||||||
$this->db = $db;
|
|
||||||
$this->id = 2; // Ne pas changer cette valeur
|
|
||||||
$this->code = "TRANS";
|
|
||||||
$this->name = "Transporteur";
|
|
||||||
$this->description = $langs->trans("GenericTransport");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return URL of provider
|
|
||||||
*
|
|
||||||
* @param string $tracking_number Tracking number
|
|
||||||
* @return string URL for tracking
|
|
||||||
*/
|
|
||||||
function provider_url_status($tracking_number)
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1309,8 +1309,6 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function GetUrlTrackingStatus($value='')
|
function GetUrlTrackingStatus($value='')
|
||||||
{
|
{
|
||||||
$code='';
|
|
||||||
|
|
||||||
if (! empty($this->shipping_method_id))
|
if (! empty($this->shipping_method_id))
|
||||||
{
|
{
|
||||||
$sql = "SELECT em.code, em.tracking";
|
$sql = "SELECT em.code, em.tracking";
|
||||||
@ -1322,46 +1320,21 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
if ($obj = $this->db->fetch_object($resql))
|
if ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$code = $obj->code;
|
$tracking = $obj->tracking;
|
||||||
$tracking = $obj->tracking;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tracking)
|
if (!empty($tracking))
|
||||||
{
|
{
|
||||||
$url = str_replace('{TRACKID}', $value, $tracking);
|
$url = str_replace('{TRACKID}', $value, $tracking);
|
||||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($code)
|
$this->tracking_url = $value;
|
||||||
{
|
}
|
||||||
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
* Classify the shipping as invoiced
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user