|
|
|
@ -1,13 +1,14 @@
|
|
|
|
|
<?php
|
|
|
|
|
if(!defined('_PS_VERSION_')) {
|
|
|
|
|
if (!defined('_PS_VERSION_')) {
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Logistics extends Module {
|
|
|
|
|
class Logistics extends Module
|
|
|
|
|
{
|
|
|
|
|
public $_html = '';
|
|
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this->name = 'logistics';
|
|
|
|
|
$this->tab = 'shipping_logistics';
|
|
|
|
|
$this->version = '2.0';
|
|
|
|
@ -20,7 +21,8 @@ class Logistics extends Module {
|
|
|
|
|
$this->description = $this->l('Allows to manage parcels');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function install() {
|
|
|
|
|
public function install()
|
|
|
|
|
{
|
|
|
|
|
# Add admin tabs
|
|
|
|
|
$tabs_i18n = array(
|
|
|
|
|
'fr' => 'Gestion des envois',
|
|
|
|
@ -33,8 +35,8 @@ class Logistics extends Module {
|
|
|
|
|
$t->active = TRUE;
|
|
|
|
|
$t->module = 'logistics';
|
|
|
|
|
$t->class_name = 'AdminLogistics';
|
|
|
|
|
foreach(Language::getLanguages() as $lang) {
|
|
|
|
|
if(isset($tabs_i18n[$lang['iso_code']])) {
|
|
|
|
|
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'];
|
|
|
|
@ -47,7 +49,8 @@ class Logistics extends Module {
|
|
|
|
|
&& $this->registerHook('updateCarrier');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function installCarriers() {
|
|
|
|
|
private function installCarriers()
|
|
|
|
|
{
|
|
|
|
|
return
|
|
|
|
|
// La Poste
|
|
|
|
|
Db::getInstance()->Execute('
|
|
|
|
@ -150,7 +153,8 @@ class Logistics extends Module {
|
|
|
|
|
');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function uninstallCarriers() {
|
|
|
|
|
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`');
|
|
|
|
@ -161,14 +165,16 @@ class Logistics extends Module {
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function uninstall() {
|
|
|
|
|
public function uninstall()
|
|
|
|
|
{
|
|
|
|
|
return $this->uninstallCarriers() && parent::uninstall();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getContent() {
|
|
|
|
|
public function getContent()
|
|
|
|
|
{
|
|
|
|
|
global $cookie;
|
|
|
|
|
|
|
|
|
|
if(Tools::isSubmit('submitUpdate')) {
|
|
|
|
|
if (Tools::isSubmit('submitUpdate')) {
|
|
|
|
|
/* La Poste */
|
|
|
|
|
Configuration::updateValue('LAPOSTEWS_CARRIERS', serialize(Tools::getValue('laposte_carriers', array())));
|
|
|
|
|
|
|
|
|
@ -326,13 +332,13 @@ class Logistics extends Module {
|
|
|
|
|
Configuration::updateValue('MONDIALRELAYWS_FTP_LOGIN', Tools::getValue('mondialrelay_ftp_login'));
|
|
|
|
|
Configuration::updateValue('MONDIALRELAYWS_FTP_PASSWORD', Tools::getValue('mondialrelay_ftp_password'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// foreach(Tools::getValue('employee', array()) as $id_employee => $queue) {
|
|
|
|
|
// Configuration::updateValue('LOGISTICS_QUEUE_'.(int) $id_employee, $queue);
|
|
|
|
|
// }
|
|
|
|
|
// Set print queue - employe : name
|
|
|
|
|
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) {
|
|
|
|
|
foreach (explode(', ', Tools::getValue('lock_products')) as $item) {
|
|
|
|
|
$lock[] = (int) $item;
|
|
|
|
|
}
|
|
|
|
|
Configuration::updateValue('LOGISTICS_LOCK', serialize(implode(',', $lock)));
|
|
|
|
@ -459,7 +465,7 @@ class Logistics extends Module {
|
|
|
|
|
<label for="laposte_exp_country">'.$this->l('Country:').'</label>
|
|
|
|
|
<select name="laposte_exp_country">';
|
|
|
|
|
|
|
|
|
|
foreach(Country::getCountries((int) $cookie->id_lang) as $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>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -557,7 +563,7 @@ class Logistics extends Module {
|
|
|
|
|
';
|
|
|
|
|
|
|
|
|
|
$laposte_carriers = unserialize(Configuration::get('LAPOSTEWS_CARRIERS', serialize(array())));
|
|
|
|
|
foreach(Db::getInstance()->ExecuteS('
|
|
|
|
|
foreach (Db::getInstance()->ExecuteS('
|
|
|
|
|
SELECT c.*
|
|
|
|
|
FROM `'._DB_PREFIX_.'carrier` c
|
|
|
|
|
') as $carrier) {
|
|
|
|
@ -603,7 +609,7 @@ class Logistics extends Module {
|
|
|
|
|
<label for="exapaq_exp_country">'.$this->l('Country:').'</label>
|
|
|
|
|
<select name="exapaq_exp_country">';
|
|
|
|
|
|
|
|
|
|
foreach(Country::getCountries((int) $cookie->id_lang) as $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>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -695,7 +701,7 @@ class Logistics extends Module {
|
|
|
|
|
';
|
|
|
|
|
|
|
|
|
|
$exapaq_carriers = unserialize(Configuration::get('EXAPAQWS_CARRIERS', serialize(array())));
|
|
|
|
|
foreach(Db::getInstance()->ExecuteS('
|
|
|
|
|
foreach (Db::getInstance()->ExecuteS('
|
|
|
|
|
SELECT c.*
|
|
|
|
|
FROM `'._DB_PREFIX_.'carrier` c
|
|
|
|
|
') as $carrier) {
|
|
|
|
@ -743,7 +749,7 @@ class Logistics extends Module {
|
|
|
|
|
<label for="mondialrelay_exp_country">'.$this->l('Country:').'</label>
|
|
|
|
|
<select name="mondialrelay_exp_country">';
|
|
|
|
|
|
|
|
|
|
foreach(Country::getCountries((int) $cookie->id_lang) as $country) {
|
|
|
|
|
foreach (Country::getCountries((int) $cookie->id_lang) as $country) {
|
|
|
|
|
$this->_html .= '<option value="'.$country['id_country'].'"'.(Configuration::get('MONDIALRELAY_EXP_COUNTRY') == $country['id_country']? ' selected="selected"': '').'>'.$country['name'].'</option>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -804,7 +810,7 @@ class Logistics extends Module {
|
|
|
|
|
';
|
|
|
|
|
|
|
|
|
|
$mondialrelay_carriers = unserialize(Configuration::get('MONDIALRELAYWS_CARRIERS', serialize(array())));
|
|
|
|
|
foreach(Db::getInstance()->ExecuteS('
|
|
|
|
|
foreach (Db::getInstance()->ExecuteS('
|
|
|
|
|
SELECT c.*
|
|
|
|
|
FROM `'._DB_PREFIX_.'carrier` c
|
|
|
|
|
') as $carrier) {
|
|
|
|
@ -820,9 +826,9 @@ class Logistics extends Module {
|
|
|
|
|
<fieldset id="tab-4" style="line-height: 1.5em; display: none;">
|
|
|
|
|
';
|
|
|
|
|
|
|
|
|
|
foreach(Employee::getEmployees() as $employee) {
|
|
|
|
|
foreach (Employee::getEmployees() as $employee) {
|
|
|
|
|
$value = Configuration::get('LOGISTICS_QUEUE_'.(int) $employee['id_employee']);
|
|
|
|
|
// if($value === FALSE) {
|
|
|
|
|
// if ($value === FALSE) {
|
|
|
|
|
// $value = Configuration::get('LAPOSTEWS_EMPL_'.(int) $employee['id_employee']);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
@ -834,7 +840,7 @@ class Logistics extends Module {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$lock = Configuration::get('LOGISTICS_LOCK');
|
|
|
|
|
if($lock === FALSE || empty($lock)) {
|
|
|
|
|
if ($lock === false || empty($lock)) {
|
|
|
|
|
$lock = serialize(array());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -862,21 +868,21 @@ class Logistics extends Module {
|
|
|
|
|
|
|
|
|
|
$carriers = Configuration::get('LAPOSTEWS_CARRIERS');
|
|
|
|
|
|
|
|
|
|
if(in_array((int) $params['id_carrier'], $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)) {
|
|
|
|
|
if (in_array((int) $params['id_carrier'], $carriers)) {
|
|
|
|
|
$carriers[] = (int) $new_carrier_id;
|
|
|
|
|
Configuration::updateValue('EXAPAQWS_CARRIERS', serialize($carriers));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$carriers = Configuration::get('MONDIALRELAYWS_CARRIERS');
|
|
|
|
|
|
|
|
|
|
if(in_array((int) $params['id_carrier'], $carriers)) {
|
|
|
|
|
if (in_array((int) $params['id_carrier'], $carriers)) {
|
|
|
|
|
$carriers[] = (int) $new_carrier_id;
|
|
|
|
|
Configuration::updateValue('MONDIALRELAYWS_CARRIERS', serialize($carriers));
|
|
|
|
|
}
|
|
|
|
|