743 lines
33 KiB
PHP
743 lines
33 KiB
PHP
<?php
|
|
if(!defined('_PS_VERSION_')) {
|
|
exit;
|
|
}
|
|
|
|
|
|
class Logistics extends Module {
|
|
public $_html = '';
|
|
|
|
public function __construct() {
|
|
$this->name = 'logistics';
|
|
$this->tab = 'shipping_logistics';
|
|
$this->version = '2.0';
|
|
$this->author = 'Antadis';
|
|
$this->need_instance = 0;
|
|
|
|
parent::__construct();
|
|
|
|
$this->displayName = $this->l('Logistics');
|
|
$this->description = $this->l('Allows to manage parcels');
|
|
}
|
|
|
|
public function install() {
|
|
# Add admin tabs
|
|
$tabs_i18n = array(
|
|
'fr' => 'Gestion des envois',
|
|
'en' => 'Parcel management',
|
|
);
|
|
|
|
$t = new Tab();
|
|
$t->id_parent = (int) Tab::getIdFromClassName('AdminOrders');
|
|
$st->position = (int) Tab::getNewLastPosition($st->id_parent);
|
|
$t->active = TRUE;
|
|
$t->module = 'logistics';
|
|
$t->class_name = 'AdminLogistics';
|
|
foreach(Language::getLanguages() as $lang) {
|
|
if(isset($tabs_i18n[$lang['iso_code']])) {
|
|
$t->name[$lang['id_lang']] = $tabs_i18n[$lang['iso_code']];
|
|
} else {
|
|
$t->name[$lang['id_lang']] = $tabs_i18n['en'];
|
|
}
|
|
}
|
|
$t->save();
|
|
|
|
return $this->installCarriers()
|
|
&& parent::install()
|
|
&& $this->registerHook('updateCarrier');
|
|
}
|
|
|
|
private function installCarriers() {
|
|
return
|
|
// La Poste
|
|
Db::getInstance()->Execute('
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'lapostews` (
|
|
`id_order_detail` INTEGER UNSIGNED NOT NULL,
|
|
`id_employee` INTEGER UNSIGNED NOT NULL,
|
|
`quantity` INTEGER UNSIGNED NOT NULL,
|
|
`shipping_number` VARCHAR(64) NOT NULL,
|
|
`date_add` DATETIME NOT NULL,
|
|
PRIMARY KEY(`id_order_detail`, `date_add`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci
|
|
') && Db::getInstance()->Execute('
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'lapostews_pr` (
|
|
`id_pr` VARCHAR(6) NOT NULL,
|
|
`name` VARCHAR(255) NOT NULL,
|
|
`address1` VARCHAR(255) NOT NULL,
|
|
`address2` VARCHAR(255) NOT NULL,
|
|
`address3` VARCHAR(255) NOT NULL,
|
|
`address4` VARCHAR(255) NOT NULL,
|
|
`postcode` VARCHAR(6) NOT NULL,
|
|
`city` VARCHAR(255) NOT NULL,
|
|
`xcoords` VARCHAR(24) NOT NULL,
|
|
`ycoords` VARCHAR(24) NOT NULL,
|
|
`type` VARCHAR(6) NOT NULL,
|
|
`code1` VARCHAR(8) NOT NULL,
|
|
`code2` VARCHAR(8) NOT NULL,
|
|
PRIMARY KEY(`id_pr`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci
|
|
')
|
|
// Exapaq
|
|
&& Db::getInstance()->Execute('
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'exapaqws` (
|
|
`id_order_detail` INTEGER UNSIGNED NOT NULL,
|
|
`id_employee` INTEGER UNSIGNED NOT NULL,
|
|
`quantity` INTEGER UNSIGNED NOT NULL,
|
|
`shipping_number` VARCHAR(64) NOT NULL,
|
|
`date_add` DATETIME NOT NULL,
|
|
PRIMARY KEY(`id_order_detail`, `date_add`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci
|
|
') && Db::getInstance()->Execute('
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'exapaqws_shippingnumber` (
|
|
`shipping_number` INTEGER NOT NULL AUTO_INCREMENT,
|
|
`id_order` INTEGER NOT NULL,
|
|
PRIMARY KEY (`shipping_number`),
|
|
INDEX (`id_order`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci
|
|
') && Db::getInstance()->Execute('
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'exapaqws_route` (
|
|
`iso_code` VARCHAR(2) NOT NULL,
|
|
`lpfx` VARCHAR(3) NOT NULL,
|
|
`postcode_start` VARCHAR(10) NOT NULL,
|
|
`postcode_end` VARCHAR(10) NOT NULL,
|
|
`tri1` VARCHAR(1) NOT NULL,
|
|
`ligne1` VARCHAR(2) NOT NULL,
|
|
`tri2` VARCHAR(1) NOT NULL,
|
|
`ligne2` VARCHAR(2) NOT NULL,
|
|
`ac` VARCHAR(3) NOT NULL,
|
|
`acprint` VARCHAR(3) NOT NULL,
|
|
`tour` VARCHAR(3) NOT NULL,
|
|
`tourprint` VARCHAR(3) NOT NULL,
|
|
`pretri` VARCHAR(3) NOT NULL,
|
|
`cbtri` VARCHAR(4) NOT NULL,
|
|
`msg` VARCHAR(1) NOT NULL,
|
|
INDEX (`iso_code`),
|
|
INDEX (`postcode_start`),
|
|
INDEX (`postcode_end`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci
|
|
') && Db::getInstance()->Execute('
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'exapaqws_parcel_route` (
|
|
`shipping_number` VARCHAR(64) NOT NULL,
|
|
`id_order` INTEGER NOT NULL,
|
|
`weight` DECIMAL(20,6) NOT NULL,
|
|
`iso_code` VARCHAR(2) NOT NULL,
|
|
`lpfx` VARCHAR(3) NOT NULL,
|
|
`tri1` VARCHAR(1) NOT NULL,
|
|
`ligne1` VARCHAR(2) NOT NULL,
|
|
`tri2` VARCHAR(1) NOT NULL,
|
|
`ligne2` VARCHAR(2) NOT NULL,
|
|
`ac` VARCHAR(3) NOT NULL,
|
|
`acprint` VARCHAR(3) NOT NULL,
|
|
`tour` VARCHAR(3) NOT NULL,
|
|
`tourprint` VARCHAR(3) NOT NULL,
|
|
`pretri` VARCHAR(3) NOT NULL,
|
|
`cbtri` VARCHAR(4) NOT NULL,
|
|
`msg` VARCHAR(255) NOT NULL,
|
|
`date_add` DATETIME NOT NULL,
|
|
INDEX (`id_order`),
|
|
INDEX (`shipping_number`),
|
|
INDEX (`iso_code`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci
|
|
')
|
|
// Global
|
|
&& Db::getInstance()->Execute('
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'logistics_shipping` (
|
|
`carrier` VARCHAR(32) NOT NULL,
|
|
`delivery_mode` VARCHAR(16) NOT NULL,
|
|
`value` varchar(64) NOT NULL,
|
|
PRIMARY KEY (`carrier`, `delivery_mode`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
');
|
|
}
|
|
|
|
private function uninstallCarriers() {
|
|
/*Db::getInstance()->ExecuteS('DROP TABLE IF EXISTS `'._DB_PREFIX_.'lapostews`');
|
|
Db::getInstance()->ExecuteS('DROP TABLE IF EXISTS `'._DB_PREFIX_.'lapostews_pr`');
|
|
Db::getInstance()->ExecuteS('DROP TABLE IF EXISTS `'._DB_PREFIX_.'exapaqws`');
|
|
Db::getInstance()->ExecuteS('DROP TABLE IF EXISTS `'._DB_PREFIX_.'exapaqws_route`');
|
|
Db::getInstance()->ExecuteS('DROP TABLE IF EXISTS `'._DB_PREFIX_.'exapaqws_shippingnumber`');
|
|
Db::getInstance()->ExecuteS('DROP TABLE IF EXISTS `'._DB_PREFIX_.'exapaqws_parcel_route`');
|
|
Db::getInstance()->ExecuteS('DROP TABLE IF EXISTS `'._DB_PREFIX_.'logistics_shipping`');*/
|
|
return TRUE;
|
|
}
|
|
|
|
public function uninstall() {
|
|
return $this->uninstallCarriers() && parent::uninstall();
|
|
}
|
|
|
|
public function getContent() {
|
|
global $cookie;
|
|
|
|
if(Tools::isSubmit('submitUpdate')) {
|
|
/* La Poste */
|
|
Configuration::updateValue('LAPOSTEWS_CARRIERS', serialize(Tools::getValue('laposte_carriers', array())));
|
|
|
|
Configuration::updateValue('LAPOSTEWS_CONTRACT', Tools::getValue('laposte_contract'));
|
|
Configuration::updateValue('LAPOSTEWS_API_PASSWORD', Tools::getValue('laposte_apipassword'));
|
|
Configuration::updateValue('LAPOSTEWS_API_CONTRACT', Tools::getValue('laposte_apicontract'));
|
|
Configuration::updateValue('LAPOSTEWS_API_PASSWORD2', Tools::getValue('laposte_apipassword2'));
|
|
Configuration::updateValue('LAPOSTEWS_API_CONTRACT2', Tools::getValue('laposte_apicontract2'));
|
|
Configuration::updateValue('LAPOSTEWS_MODE', Tools::getValue('laposte_mode'));
|
|
Configuration::updateValue('LAPOSTEWS_COMMERCIALNAME', Tools::getValue('laposte_commercialname'));
|
|
Configuration::updateValue('LAPOSTEWS_SHIPPING_SITE', Tools::getValue('laposte_shippingsite'));
|
|
Configuration::updateValue('LAPOSTEWS_SHIPPING_SITE_CODE', Tools::getValue('laposte_shippingsite_code'));
|
|
Configuration::updateValue('LAPOSTEWS_SUMMARIES_COUNT', Tools::getValue('laposte_summaries_count'));
|
|
|
|
Configuration::updateValue('LAPOSTEWS_EXP_ADDR1', Tools::getValue('laposte_exp_addr1'));
|
|
Configuration::updateValue('LAPOSTEWS_EXP_ADDR2', Tools::getValue('laposte_exp_addr2'));
|
|
Configuration::updateValue('LAPOSTEWS_EXP_CITY', Tools::getValue('laposte_exp_city'));
|
|
Configuration::updateValue('LAPOSTEWS_EXP_COMPANY', Tools::getValue('laposte_exp_company'));
|
|
Configuration::updateValue('LAPOSTEWS_EXP_COUNTRY', Tools::getValue('laposte_exp_country'));
|
|
Configuration::updateValue('LAPOSTEWS_EXP_EMAIL', Tools::getValue('laposte_exp_email'));
|
|
Configuration::updateValue('LAPOSTEWS_EXP_FIRSTNAME', Tools::getValue('laposte_exp_firstname'));
|
|
Configuration::updateValue('LAPOSTEWS_EXP_LASTNAME', Tools::getValue('laposte_exp_lastname'));
|
|
Configuration::updateValue('LAPOSTEWS_EXP_PHONE', Tools::getValue('laposte_exp_phone'));
|
|
Configuration::updateValue('LAPOSTEWS_EXP_POSTALCODE', Tools::getValue('laposte_exp_postalcode'));
|
|
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_0_P', Tools::getValue('laposte_range_0_p'));
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_1_P', Tools::getValue('laposte_range_1_p'));
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_2_P', Tools::getValue('laposte_range_2_p'));
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_3_P', Tools::getValue('laposte_range_3_p'));
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_4_P', Tools::getValue('laposte_range_4_p'));
|
|
|
|
Db::getInstance()->ExecuteS('
|
|
INSERT INTO `'._DB_PREFIX_.'logistics_shipping`
|
|
VALUES (
|
|
"laposte",
|
|
"0",
|
|
'.(int) Tools::getValue('laposte_range_0_s').'
|
|
)
|
|
ON DUPLICATE KEY UPDATE
|
|
`value` = '.(int) Tools::getValue('laposte_range_0_s').'
|
|
');
|
|
Db::getInstance()->ExecuteS('
|
|
INSERT INTO `'._DB_PREFIX_.'logistics_shipping`
|
|
VALUES (
|
|
"laposte",
|
|
"1",
|
|
'.(int) Tools::getValue('laposte_range_1_s').'
|
|
)
|
|
ON DUPLICATE KEY UPDATE
|
|
`value` = '.(int) Tools::getValue('laposte_range_1_s').'
|
|
');
|
|
Db::getInstance()->ExecuteS('
|
|
INSERT INTO `'._DB_PREFIX_.'logistics_shipping`
|
|
VALUES (
|
|
"laposte",
|
|
"2",
|
|
'.(int) Tools::getValue('laposte_range_2_s').'
|
|
)
|
|
ON DUPLICATE KEY UPDATE
|
|
`value` = '.(int) Tools::getValue('laposte_range_2_s').'
|
|
');
|
|
Db::getInstance()->ExecuteS('
|
|
INSERT INTO `'._DB_PREFIX_.'logistics_shipping`
|
|
VALUES (
|
|
"laposte",
|
|
"3",
|
|
'.(int) Tools::getValue('laposte_range_3_s').'
|
|
)
|
|
ON DUPLICATE KEY UPDATE
|
|
`value` = '.(int) Tools::getValue('laposte_range_3_s').'
|
|
');
|
|
Db::getInstance()->ExecuteS('
|
|
INSERT INTO `'._DB_PREFIX_.'logistics_shipping`
|
|
VALUES (
|
|
"laposte",
|
|
"4",
|
|
'.(int) Tools::getValue('laposte_range_4_s').'
|
|
)
|
|
ON DUPLICATE KEY UPDATE
|
|
`value` = '.(int) Tools::getValue('laposte_range_4_s').'
|
|
');
|
|
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_0_E', sprintf('%08d', (int) Tools::getValue('laposte_range_0_e')));
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_1_E', sprintf('%08d', (int) Tools::getValue('laposte_range_1_e')));
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_2_E', sprintf('%08d', (int) Tools::getValue('laposte_range_2_e')));
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_3_E', sprintf('%08d', (int) Tools::getValue('laposte_range_3_e')));
|
|
Configuration::updateValue('LAPOSTEWS_RANGE_4_E', sprintf('%08d', (int) Tools::getValue('laposte_range_4_e')));
|
|
|
|
|
|
/* Exapaq */
|
|
Configuration::updateValue('EXAPAQWS_CARRIERS', serialize(Tools::getValue('exapaq_carriers', array())));
|
|
|
|
Configuration::updateValue('EXAPAQWS_EXP_ADDR1', Tools::getValue('exapaq_exp_addr1'));
|
|
Configuration::updateValue('EXAPAQWS_EXP_ADDR2', Tools::getValue('exapaq_exp_addr2'));
|
|
Configuration::updateValue('EXAPAQWS_EXP_CITY', Tools::getValue('exapaq_exp_city'));
|
|
Configuration::updateValue('EXAPAQWS_EXP_COMPANY', Tools::getValue('exapaq_exp_company'));
|
|
Configuration::updateValue('EXAPAQWS_EXP_COUNTRY', Tools::getValue('exapaq_exp_country'));
|
|
Configuration::updateValue('EXAPAQWS_EXP_EMAIL', Tools::getValue('exapaq_exp_email'));
|
|
Configuration::updateValue('EXAPAQWS_EXP_FIRSTNAME', Tools::getValue('exapaq_exp_firstname'));
|
|
Configuration::updateValue('EXAPAQWS_EXP_LASTNAME', Tools::getValue('exapaq_exp_lastname'));
|
|
Configuration::updateValue('EXAPAQWS_EXP_PHONE', Tools::getValue('exapaq_exp_phone'));
|
|
Configuration::updateValue('EXAPAQWS_EXP_POSTALCODE', Tools::getValue('exapaq_exp_postalcode'));
|
|
|
|
Db::getInstance()->ExecuteS('
|
|
INSERT INTO `'._DB_PREFIX_.'logistics_shipping`
|
|
VALUES (
|
|
"exapaq",
|
|
"b2b",
|
|
'.(int) Tools::getValue('exapaq_b2b_shippinglow').'
|
|
)
|
|
ON DUPLICATE KEY UPDATE
|
|
`value` = '.(int) Tools::getValue('exapaq_b2b_shippinglow').'
|
|
');
|
|
Configuration::updateValue('EXAPAQWS_B2B_SHIPPINGHIGH', Tools::getValue('exapaq_b2b_shippinghigh'));
|
|
Configuration::updateValue('EXAPAQWS_B2B_AGENCYCODE', Tools::getValue('exapaq_b2b_agency'));
|
|
Configuration::updateValue('EXAPAQWS_B2B_CHARGING_ACCOUNT', Tools::getValue('exapaq_b2b_charging'));
|
|
Configuration::updateValue('EXAPAQWS_B2B_COUNTRY_RETURN', Tools::getValue('exapaq_b2b_creturn'));
|
|
Configuration::updateValue('EXAPAQWS_B2B_COUNTRY_AGENCY', Tools::getValue('exapaq_b2b_cagency'));
|
|
|
|
Db::getInstance()->ExecuteS('
|
|
INSERT INTO `'._DB_PREFIX_.'logistics_shipping`
|
|
VALUES (
|
|
"exapaq",
|
|
"b2c",
|
|
'.(int) Tools::getValue('exapaq_b2c_shippinglow').'
|
|
)
|
|
ON DUPLICATE KEY UPDATE
|
|
`value` = '.(int) Tools::getValue('exapaq_b2c_shippinglow').'
|
|
');
|
|
Configuration::updateValue('EXAPAQWS_B2C_SHIPPINGHIGH', Tools::getValue('exapaq_b2c_shippinghigh'));
|
|
Configuration::updateValue('EXAPAQWS_B2C_AGENCYCODE', Tools::getValue('exapaq_b2c_agency'));
|
|
Configuration::updateValue('EXAPAQWS_B2C_CHARGING_ACCOUNT', Tools::getValue('exapaq_b2c_charging'));
|
|
Configuration::updateValue('EXAPAQWS_B2C_COUNTRY_RETURN', Tools::getValue('exapaq_b2c_creturn'));
|
|
Configuration::updateValue('EXAPAQWS_B2C_COUNTRY_AGENCY', Tools::getValue('exapaq_b2c_cagency'));
|
|
|
|
|
|
foreach(Tools::getValue('employee', array()) as $id_employee => $queue) {
|
|
Configuration::updateValue('LOGISTICS_QUEUE_'.(int) $id_employee, $queue);
|
|
}
|
|
|
|
$lock = array();
|
|
foreach(explode(', ', Tools::getValue('lock_products')) as $item) {
|
|
$lock[] = (int) $item;
|
|
}
|
|
Configuration::updateValue('LOGISTICS_LOCK', serialize(implode(',', $lock)));
|
|
|
|
$this->_html = '<p class="conf">'.$this->l('Configuration updated successfully').'</p><br />';
|
|
}
|
|
|
|
$this->_html .= '
|
|
<style type="text/css">
|
|
#editSettings > ul {
|
|
display: block;
|
|
margin: 0px 0px -1px;
|
|
padding: 0px;
|
|
list-style: outside none;
|
|
}
|
|
|
|
#editSettings > ul li {
|
|
display: inline-block;
|
|
margin: 0px;
|
|
padding: 5px 8px;
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
}
|
|
|
|
#editSettings > ul .active {
|
|
border: 1px solid #DFD5C3;
|
|
border-bottom: 0px;
|
|
background: #fffff0;
|
|
}
|
|
|
|
p.text {
|
|
clear: both;
|
|
}
|
|
|
|
#editSettings label {
|
|
width: 250px;
|
|
}
|
|
</style>
|
|
|
|
<h1>'.$this->l('Logistics').'</h1>
|
|
|
|
<form method="POST" action="" id="editSettings">
|
|
<ul>
|
|
<li class="active" onclick="$(\'#tab-2, #tab-3, #tab-4\').hide();$(\'#tab-1\').show();$(\'#editSettings > ul .active\').removeClass(\'active\');$(this).addClass(\'active\');">'.$this->l('La Poste configuration').'</li>
|
|
<li onclick="$(\'#tab-1, #tab-3, #tab-4\').hide();$(\'#tab-2\').show();$(\'#editSettings > ul .active\').removeClass(\'active\');$(this).addClass(\'active\');">'.$this->l('Exapaq configuration').'</li>
|
|
<li onclick="$(\'#tab-1, #tab-2, #tab-4\').hide();$(\'#tab-3\').show();$(\'#editSettings > ul .active\').removeClass(\'active\');$(this).addClass(\'active\');">'.$this->l('Printing queues').'</li>
|
|
<li onclick="$(\'#tab-1, #tab-2, #tab-3\').hide();$(\'#tab-4\').show();$(\'#editSettings > ul .active\').removeClass(\'active\');$(this).addClass(\'active\');">'.$this->l('Lock products').'</li>
|
|
</ul>
|
|
<fieldset id="tab-1" style="line-height: 1.5em;">
|
|
<h2>'.$this->l('Account settings').'</h2>
|
|
<p class="text">
|
|
<label for="laposte_commercialname">'.$this->l('Commercial name:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_COMMERCIALNAME').'" id="laposte_commercialname" name="laposte_commercialname" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_contract">'.$this->l('Contract number:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_CONTRACT').'" id="laposte_contract" name="laposte_contract" />
|
|
</p>
|
|
|
|
<br /><br />
|
|
|
|
<h2>'.$this->l('API settings').'</h2>
|
|
|
|
<h3>'.$this->l('getLetterColissimo method').'</h3>
|
|
|
|
<p class="text">
|
|
<label for="laposte_apicontract">'.$this->l('Contract number:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_API_CONTRACT').'" id="laposte_apicontract" name="laposte_apicontract" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_apipassword">'.$this->l('Password:').'</label>
|
|
<input type="password" value="'.Configuration::get('LAPOSTEWS_API_PASSWORD').'" id="laposte_apipassword" name="laposte_apipassword" />
|
|
</p>
|
|
|
|
<br />
|
|
|
|
<h3>'.$this->l('genererEtiquetteBIC3 method (required for international shipping)').'</h3>
|
|
|
|
<p class="text">
|
|
<label for="laposte_apicontract2">'.$this->l('Contract number:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_API_CONTRACT2').'" id="laposte_apicontract2" name="laposte_apicontract2" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_apipassword2">'.$this->l('Password:').'</label>
|
|
<input type="password" value="'.Configuration::get('LAPOSTEWS_API_PASSWORD2').'" id="laposte_apipassword2" name="laposte_apipassword2" />
|
|
</p>
|
|
|
|
<input type="hidden" name="mode" value="1" />
|
|
|
|
<br /><br />
|
|
|
|
<h2>'.$this->l('Parcel sender details').'</h2>
|
|
|
|
<p class="text">
|
|
<label for="laposte_exp_company">'.$this->l('Company:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_EXP_COMPANY').'" id="laposte_exp_company" name="laposte_exp_company" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_exp_firstname">'.$this->l('First name:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_EXP_FIRSTNAME').'" id="laposte_exp_firstname" name="laposte_exp_firstname" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_exp_lastname">'.$this->l('Last name:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_EXP_LASTNAME').'" id="laposte_exp_lastname" name="laposte_exp_lastname" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_exp_addr1">'.$this->l('Address 1:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_EXP_ADDR1').'" id="laposte_exp_addr1" name="laposte_exp_addr1" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_exp_addr2">'.$this->l('Address 2:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_EXP_ADDR2').'" id="laposte_exp_addr2" name="laposte_exp_addr2" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_exp_postalcode">'.$this->l('Postal code:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_EXP_POSTALCODE').'" id="laposte_exp_postalcode" name="laposte_exp_postalcode" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_exp_city">'.$this->l('City:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_EXP_CITY').'" id="laposte_exp_city" name="laposte_exp_city" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_exp_country">'.$this->l('Country:').'</label>
|
|
<select name="laposte_exp_country">';
|
|
|
|
foreach(Country::getCountries((int) $cookie->id_lang) as $country) {
|
|
$this->_html .= '<option value="'.$country['id_country'].'"'.(Configuration::get('LAPOSTEWS_EXP_COUNTRY') == $country['id_country']? ' selected="selected"': '').'>'.$country['name'].'</option>';
|
|
}
|
|
|
|
$this->_html .= '</select>
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_exp_phone">'.$this->l('Phone:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_EXP_PHONE').'" id="laposte_exp_phone" name="laposte_exp_phone" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_exp_email">'.$this->l('Email:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_EXP_EMAIL').'" id="laposte_exp_email" name="laposte_exp_email" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_shippingsite">'.$this->l('Shipping site:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_SHIPPING_SITE').'" id="laposte_shippingsite" name="laposte_shippingsite" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_shippingsite_code">'.$this->l('Shipping site code:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_SHIPPING_SITE_CODE').'" id="laposte_shippingsite_code" name="laposte_shippingsite_code" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="laposte_summaries_count">'.$this->l('Summaries counter:').'</label>
|
|
<input type="text" value="'.Configuration::get('LAPOSTEWS_SUMMARIES_COUNT').'" id="laposte_summaries_count" name="laposte_summaries_count" />
|
|
</p>
|
|
|
|
<br /><br />
|
|
|
|
<h2>'.$this->l('Shipping number ranges').'</h2>
|
|
|
|
<p class="text">
|
|
<label>SO Colissimo INT Commerçant</label>
|
|
<input style="width: 30px;" type="text" name="laposte_range_0_p" id="laposte_range_0_p" value="'.Configuration::get('LAPOSTEWS_RANGE_0_P').'" />
|
|
<input type="text" name="laposte_range_0_s" id="laposte_range_0_s" value="'.sprintf('%08d', (int) Db::getInstance()->getValue('
|
|
SELECT `value`
|
|
FROM `'._DB_PREFIX_.'logistics_shipping`
|
|
WHERE `carrier` = "laposte"
|
|
AND `delivery_mode` = "0"
|
|
')).'" />
|
|
> <input type="text" name="laposte_range_0_e" id="laposte_range_0_e" value="'.sprintf('%08d', Configuration::get('LAPOSTEWS_RANGE_0_E')).'" />
|
|
</p>
|
|
|
|
<p class="text">
|
|
<label>SO Colissimo INT Bureau de poste</label>
|
|
<input style="width: 30px;" type="text" name="laposte_range_1_p" id="laposte_range_1_p" value="'.Configuration::get('LAPOSTEWS_RANGE_1_P').'" />
|
|
<input type="text" name="laposte_range_1_s" id="laposte_range_1_s" value="'.sprintf('%08d', (int) Db::getInstance()->getValue('
|
|
SELECT `value`
|
|
FROM `'._DB_PREFIX_.'logistics_shipping`
|
|
WHERE `carrier` = "laposte"
|
|
AND `delivery_mode` = "1"
|
|
')).'" />
|
|
> <input type="text" name="laposte_range_1_e" id="laposte_range_1_e" value="'.sprintf('%08d', Configuration::get('LAPOSTEWS_RANGE_1_E')).'" />
|
|
</p>
|
|
|
|
<p class="text">
|
|
<label>SO Colissimo INT Domicile contre signature</label>
|
|
<input style="width: 30px;" type="text" name="laposte_range_2_p" id="laposte_range_2_p" value="'.Configuration::get('LAPOSTEWS_RANGE_2_P').'" />
|
|
<input type="text" name="laposte_range_2_s" id="laposte_range_2_s" value="'.sprintf('%08d', (int) Db::getInstance()->getValue('
|
|
SELECT `value`
|
|
FROM `'._DB_PREFIX_.'logistics_shipping`
|
|
WHERE `carrier` = "laposte"
|
|
AND `delivery_mode` = "2"
|
|
')).'" />
|
|
> <input type="text" name="laposte_range_2_e" id="laposte_range_2_e" value="'.sprintf('%08d', Configuration::get('LAPOSTEWS_RANGE_2_E')).'" />
|
|
</p>
|
|
|
|
<p class="text">
|
|
<label>SO Colissimo INT Domicile sans signature</label>
|
|
<input style="width: 30px;" type="text" name="laposte_range_3_p" id="laposte_range_3_p" value="'.Configuration::get('LAPOSTEWS_RANGE_3_P').'" />
|
|
<input type="text" name="laposte_range_3_s" id="laposte_range_3_s" value="'.sprintf('%08d', (int) Db::getInstance()->getValue('
|
|
SELECT `value`
|
|
FROM `'._DB_PREFIX_.'logistics_shipping`
|
|
WHERE `carrier` = "laposte"
|
|
AND `delivery_mode` = "3"
|
|
')).'" />
|
|
> <input type="text" name="laposte_range_3_e" id="laposte_range_3_e" value="'.sprintf('%08d', Configuration::get('LAPOSTEWS_RANGE_3_E')).'" />
|
|
</p>
|
|
|
|
<p class="text">
|
|
<label>SO Colissimo EXPERT INT</label>
|
|
<input style="width: 30px;" type="text" name="laposte_range_4_p" id="laposte_range_4_p" value="'.Configuration::get('LAPOSTEWS_RANGE_4_P').'" />
|
|
<input type="text" name="laposte_range_4_s" id="laposte_range_4_s" value="'.sprintf('%08d', (int) Db::getInstance()->getValue('
|
|
SELECT `value`
|
|
FROM `'._DB_PREFIX_.'logistics_shipping`
|
|
WHERE `carrier` = "laposte"
|
|
AND `delivery_mode` = "4"
|
|
')).'" />
|
|
> <input type="text" name="laposte_range_4_e" id="laposte_range_4_e" value="'.sprintf('%08d', Configuration::get('LAPOSTEWS_RANGE_4_E')).'" />
|
|
</p>
|
|
|
|
<br /><br />
|
|
|
|
<h2>'.$this->l('Carrier selection').'</h2>
|
|
<p>
|
|
';
|
|
|
|
$laposte_carriers = unserialize(Configuration::get('LAPOSTEWS_CARRIERS', serialize(array())));
|
|
foreach(Db::getInstance()->ExecuteS('
|
|
SELECT c.*
|
|
FROM `'._DB_PREFIX_.'carrier` c
|
|
') as $carrier) {
|
|
$this->_html .= '<input style="vertical-align: middle;" type="checkbox" name="laposte_carriers[]" value="'.$carrier['id_carrier'].'" id="laposte_carriers_'.$carrier['id_carrier'].'"'.(in_array($carrier['id_carrier'], $laposte_carriers)? ' checked="checked"': '').' /> <label style="'.($carrier['active'] && !$carrier['deleted']? 'font-weight: bold;': 'font-weight: normal;').'float: none; display: inline; width: auto;" for="laposte_carriers_'.$carrier['id_carrier'].'">'.$carrier['name'].'</label><br />';
|
|
}
|
|
|
|
$this->_html .= '</p>
|
|
|
|
</fieldset>
|
|
|
|
<fieldset id="tab-2" style="line-height: 1.5em; display: none;">
|
|
<h2>'.$this->l('Parcel sender details').'</h2>
|
|
|
|
<p class="text">
|
|
<label for="exapaq_exp_company">'.$this->l('Company:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_EXP_COMPANY').'" id="exapaq_exp_company" name="exapaq_exp_company" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_firstname">'.$this->l('First name:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_EXP_FIRSTNAME').'" id="exapaq_exp_firstname" name="exapaq_exp_firstname" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_lastname">'.$this->l('Last name:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_EXP_LASTNAME').'" id="exapaq_exp_lastname" name="exapaq_exp_lastname" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_addr1">'.$this->l('Address 1:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_EXP_ADDR1').'" id="exapaq_exp_addr1" name="exapaq_exp_addr1" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_addr2">'.$this->l('Address 2:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_EXP_ADDR2').'" id="exapaq_exp_addr2" name="exapaq_exp_addr2" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_postalcode">'.$this->l('Postal code:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_EXP_POSTALCODE').'" id="exapaq_exp_postalcode" name="exapaq_exp_postalcode" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_city">'.$this->l('City:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_EXP_CITY').'" id="exapaq_exp_city" name="exapaq_exp_city" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_country">'.$this->l('Country:').'</label>
|
|
<select name="exapaq_exp_country">';
|
|
|
|
foreach(Country::getCountries((int) $cookie->id_lang) as $country) {
|
|
$this->_html .= '<option value="'.$country['id_country'].'"'.(Configuration::get('EXAPAQWS_EXP_COUNTRY') == $country['id_country']? ' selected="selected"': '').'>'.$country['name'].'</option>';
|
|
}
|
|
|
|
$this->_html .= '</select>
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_phone">'.$this->l('Phone:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_EXP_PHONE').'" id="exapaq_exp_phone" name="exapaq_exp_phone" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_email">'.$this->l('Email:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_EXP_EMAIL').'" id="exapaq_exp_email" name="exapaq_exp_email" />
|
|
</p>
|
|
|
|
<br /><br />
|
|
|
|
<h2>'.$this->l('B2B Account informations').'</h2>
|
|
|
|
<p class="text">
|
|
<label for="exapaq_exp_phone">'.$this->l('Agency code:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2B_AGENCYCODE').'" id="exapaq_b2b_agency" name="exapaq_b2b_agency" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_phone">'.$this->l('Charging account:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2B_CHARGING_ACCOUNT').'" id="exapaq_b2b_charging" name="exapaq_b2b_charging" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_phone">'.$this->l('Country and agency:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2B_COUNTRY_AGENCY').'" id="exapaq_b2b_cagency" name="exapaq_b2b_cagency" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_phone">'.$this->l('Country and return code:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2B_COUNTRY_RETURN').'" id="exapaq_b2b_creturn" name="exapaq_b2b_creturn" />
|
|
</p>
|
|
|
|
<p class="text">
|
|
<label for="exapaq_shippinglow">'.$this->l('Parcel number lower limit:').'</label>
|
|
<input type="text" value="'.(int) Db::getInstance()->getValue('
|
|
SELECT `value`
|
|
FROM `'._DB_PREFIX_.'logistics_shipping`
|
|
WHERE `carrier` = "exapaq"
|
|
AND `delivery_mode` = "b2b"
|
|
').'" id="exapaq_b2b_shippinglow" name="exapaq_b2b_shippinglow" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_shippinghigh">'.$this->l('Parcel number upper limit:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2B_SHIPPINGHIGH').'" id="exapaq_b2b_shippinghigh" name="exapaq_b2b_shippinghigh" />
|
|
</p>
|
|
|
|
<br /><br />
|
|
|
|
<h2>'.$this->l('B2C Account informations').'</h2>
|
|
|
|
<p class="text">
|
|
<label for="exapaq_exp_phone">'.$this->l('Agency code:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2C_AGENCYCODE').'" id="exapaq_b2c_agency" name="exapaq_b2c_agency" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_phone">'.$this->l('Charging account:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2C_CHARGING_ACCOUNT').'" id="exapaq_b2c_charging" name="exapaq_b2c_charging" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_phone">'.$this->l('Country and agency:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2C_COUNTRY_AGENCY').'" id="exapaq_b2c_cagency" name="exapaq_b2c_cagency" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_exp_phone">'.$this->l('Country and return code:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2C_COUNTRY_RETURN').'" id="exapaq_b2c_creturn" name="exapaq_b2c_creturn" />
|
|
</p>
|
|
|
|
<p class="text">
|
|
<label for="exapaq_shippinglow">'.$this->l('Parcel number lower limit:').'</label>
|
|
<input type="text" value="'.(int) Db::getInstance()->getValue('
|
|
SELECT `value`
|
|
FROM `'._DB_PREFIX_.'logistics_shipping`
|
|
WHERE `carrier` = "exapaq"
|
|
AND `delivery_mode` = "b2c"
|
|
').'" id="exapaq_b2c_shippinglow" name="exapaq_b2c_shippinglow" />
|
|
</p>
|
|
<p class="text">
|
|
<label for="exapaq_shippinghigh">'.$this->l('Parcel number upper limit:').'</label>
|
|
<input type="text" value="'.Configuration::get('EXAPAQWS_B2C_SHIPPINGHIGH').'" id="exapaq_b2c_shippinghigh" name="exapaq_b2c_shippinghigh" />
|
|
</p>
|
|
|
|
<br /><br />
|
|
|
|
<h2>'.$this->l('Carrier selection').'</h2>
|
|
<p>
|
|
';
|
|
|
|
$exapaq_carriers = unserialize(Configuration::get('EXAPAQWS_CARRIERS', serialize(array())));
|
|
foreach(Db::getInstance()->ExecuteS('
|
|
SELECT c.*
|
|
FROM `'._DB_PREFIX_.'carrier` c
|
|
') as $carrier) {
|
|
$this->_html .= '<input style="vertical-align: middle;" type="checkbox" name="exapaq_carriers[]" value="'.$carrier['id_carrier'].'" id="exapaq_carriers_'.$carrier['id_carrier'].'"'.(in_array($carrier['id_carrier'], $exapaq_carriers)? ' checked="checked"': '').' /> <label style="'.($carrier['active'] && !$carrier['deleted']? 'font-weight: bold;': 'font-weight: normal;').'float: none; display: inline; width: auto;" for="exapaq_carriers_'.$carrier['id_carrier'].'">'.$carrier['name'].'</label><br />';
|
|
}
|
|
|
|
$this->_html .= '</p>
|
|
</fieldset>
|
|
|
|
<fieldset id="tab-3" style="line-height: 1.5em; display: none;">
|
|
';
|
|
|
|
foreach(Employee::getEmployees() as $employee) {
|
|
$value = Configuration::get('LOGISTICS_QUEUE_'.(int) $employee['id_employee']);
|
|
if($value === FALSE) {
|
|
$value = Configuration::get('LAPOSTEWS_EMPL_'.(int) $employee['id_employee']);
|
|
}
|
|
|
|
$this->_html .= '
|
|
<p class="text">
|
|
<label for="employee_'.(int) $employee['id_employee'].'">'.$employee['name'].'</label>
|
|
<input type="text" value="'.$value.'" id="employee_'.(int) $employee['id_employee'].'" name="employee['.(int) $employee['id_employee'].']" />
|
|
</p>';
|
|
}
|
|
|
|
$lock = Configuration::get('LOGISTICS_LOCK');
|
|
if($lock === FALSE || empty($lock)) {
|
|
$lock = serialize(array());
|
|
}
|
|
|
|
$this->_html .= '</fieldset>
|
|
|
|
<fieldset id="tab-4" style="line-height: 1.5em; display: none;">
|
|
<p class="text">
|
|
<label for="lock_products">'.$this->l('Enter here sale IDs separated by commas to prevent shipping of their products:').'</label>
|
|
<textarea id="lock_products" name="lock_products" style="width: 300px; height: 200px;">'.implode(', ', unserialize($lock)).'</textarea>
|
|
</fieldset
|
|
|
|
<br /><br />
|
|
|
|
<p class="submit" style="margin-top: 10px;"><input type="submit" name="submitUpdate" class="button" value="'.$this->l('Submit').'" /></p>
|
|
</form>
|
|
';
|
|
|
|
return $this->_html;
|
|
}
|
|
|
|
public function hookUpdateCarrier($params) {
|
|
$new_carrier_id = (int) Db::getInstance()->getValue('
|
|
SELECT MAX(`id_carrier`) FROM `'._DB_PREFIX_.'carrier`
|
|
');
|
|
|
|
$carriers = Configuration::get('LAPOSTEWS_CARRIERS');
|
|
|
|
if(in_array((int) $params['id_carrier'], $carriers)) {
|
|
$carriers[] = (int) $new_carrier_id;
|
|
Configuration::updateValue('LAPOSTEWS_CARRIERS', serialize($carriers));
|
|
}
|
|
|
|
$carriers = Configuration::get('EXAPAQWS_CARRIERS');
|
|
|
|
if(in_array((int) $params['id_carrier'], $carriers)) {
|
|
$carriers[] = (int) $new_carrier_id;
|
|
Configuration::updateValue('EXAPAQWS_CARRIERS', serialize($carriers));
|
|
}
|
|
}
|
|
}
|