This commit is contained in:
Michael RICOIS 2018-03-21 10:27:58 +01:00
parent 6b863fe940
commit 76b26ac6b4

View File

@ -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',
@ -34,7 +36,7 @@ class Logistics extends Module {
$t->module = 'logistics';
$t->class_name = 'AdminLogistics';
foreach(Language::getLanguages() as $lang) {
if(isset($tabs_i18n[$lang['iso_code']])) {
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())));
@ -822,7 +828,7 @@ class Logistics extends Module {
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));
}