Merge pull request #850 from atm-maxime/develop
Carrier conf modification
This commit is contained in:
commit
12caa20e38
@ -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;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/carrier.php";
|
||||
$head[$h][1] = $langs->trans("Carriers");
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||
|
||||
@ -147,7 +147,7 @@ $tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.org
|
||||
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||
$tabsql[16]= "SELECT code, label as libelle, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$tabsql[17]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_fees";
|
||||
$tabsql[18]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_shipment_mode";
|
||||
$tabsql[18]= "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode";
|
||||
$tabsql[19]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif";
|
||||
$tabsql[20]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method";
|
||||
$tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c";
|
||||
@ -203,7 +203,7 @@ $tabfield[14]= "code,libelle,price,organization,country_id,country";
|
||||
$tabfield[15]= "code,libelle,width,height,unit";
|
||||
$tabfield[16]= "code,libelle";
|
||||
$tabfield[17]= "code,libelle";
|
||||
$tabfield[18]= "code,libelle";
|
||||
$tabfield[18]= "code,libelle,tracking";
|
||||
$tabfield[19]= "code,libelle";
|
||||
$tabfield[20]= "code,libelle";
|
||||
$tabfield[21]= "code,label";
|
||||
@ -231,7 +231,7 @@ $tabfieldvalue[14]= "code,libelle,price,organization,country";
|
||||
$tabfieldvalue[15]= "code,libelle,width,height,unit";
|
||||
$tabfieldvalue[16]= "code,libelle";
|
||||
$tabfieldvalue[17]= "code,libelle";
|
||||
$tabfieldvalue[18]= "code,libelle";
|
||||
$tabfieldvalue[18]= "code,libelle,tracking";
|
||||
$tabfieldvalue[19]= "code,libelle";
|
||||
$tabfieldvalue[20]= "code,libelle";
|
||||
$tabfieldvalue[21]= "code,label";
|
||||
@ -259,7 +259,7 @@ $tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
|
||||
$tabfieldinsert[15]= "code,label,width,height,unit";
|
||||
$tabfieldinsert[16]= "code,label";
|
||||
$tabfieldinsert[17]= "code,libelle";
|
||||
$tabfieldinsert[18]= "code,libelle";
|
||||
$tabfieldinsert[18]= "code,libelle,tracking";
|
||||
$tabfieldinsert[19]= "code,libelle";
|
||||
$tabfieldinsert[20]= "code,libelle";
|
||||
$tabfieldinsert[21]= "code,label";
|
||||
@ -1307,6 +1307,7 @@ function fieldList($fieldlist,$obj='',$tabname='')
|
||||
print '<td>';
|
||||
$size='';
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='tracking') $size='size="92" ';
|
||||
if ($fieldlist[$field]=='accountancy_code') $size='size="15" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_sell') $size='size="15" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_buy') $size='size="15" ';
|
||||
|
||||
@ -201,10 +201,6 @@ $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");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||
$head[$h][1] = $langs->trans("Sending");
|
||||
$hselected=$h;
|
||||
|
||||
@ -189,10 +189,6 @@ $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");
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
|
||||
{
|
||||
$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 '';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1199,7 +1199,7 @@ class Expedition extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$listmeths = array();
|
||||
$this->listmeths = array();
|
||||
$i=0;
|
||||
|
||||
$sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.tracking, em.active";
|
||||
@ -1216,29 +1216,11 @@ 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;
|
||||
}
|
||||
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]['tracking'] = $obj->tracking;
|
||||
$this->listmeths[$i]['active'] = $obj->active;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($this->db,'');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1309,8 +1291,6 @@ class Expedition extends CommonObject
|
||||
*/
|
||||
function GetUrlTrackingStatus($value='')
|
||||
{
|
||||
$code='';
|
||||
|
||||
if (! empty($this->shipping_method_id))
|
||||
{
|
||||
$sql = "SELECT em.code, em.tracking";
|
||||
@ -1322,46 +1302,21 @@ class Expedition extends CommonObject
|
||||
{
|
||||
if ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$code = $obj->code;
|
||||
$tracking = $obj->tracking;
|
||||
$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)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($tracking) && !empty($value))
|
||||
{
|
||||
$url = str_replace('{TRACKID}', $value, $tracking);
|
||||
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value?$value:'url').'</a>',$url,$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tracking_url = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Classify the shipping as invoiced
|
||||
|
||||
@ -141,6 +141,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= ", fk_soc";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", datef";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", fk_user_author";
|
||||
@ -154,6 +155,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= ", ".$this->socid;
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||
$sql.= ", ".$this->fk_project;
|
||||
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
||||
$sql.= ", ".$user->id.",";
|
||||
|
||||
@ -41,6 +41,8 @@ if (!empty($conf->produit->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (!empty($conf->projet->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
|
||||
|
||||
$langs->load('bills');
|
||||
@ -271,6 +273,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
||||
// Creation facture
|
||||
$object->ref = $_POST['ref'];
|
||||
$object->ref_supplier = $_POST['ref_supplier'];
|
||||
$object->fk_project = GETPOST('projectid');
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->libelle = $_POST['libelle'];
|
||||
$object->date = $datefacture;
|
||||
@ -1153,6 +1156,15 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$langs->trans('DateMaxPayment').'</td><td>';
|
||||
$form->select_date($datedue,'ech','','','',"add",1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
select_projects(-1, $projectid, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
|
||||
@ -295,14 +295,13 @@ if ($sql_select)
|
||||
// Define output language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||
{
|
||||
$this->fetch_thirdparty();
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($objp->fk_product);
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if (empty($newlang)) $newlang=$this->client->default_lang;
|
||||
if (empty($newlang)) $newlang=$object->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user