Compare commits
1 Commits
master
...
ticket/r16
Author | SHA1 | Date | |
---|---|---|---|
|
ff5ac6e829 |
@ -79,16 +79,7 @@ class AdminImport extends AdminTab
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->entities = array_flip(array(
|
||||
$this->l('Categories'),
|
||||
$this->l('Products'),
|
||||
$this->l('Combinations'),
|
||||
$this->l('Customers'),
|
||||
$this->l('Addresses'),
|
||||
$this->l('Manufacturers'),
|
||||
$this->l('Suppliers'),
|
||||
$this->l('Pack'),
|
||||
));
|
||||
$this->entities = array_flip(array($this->l('Categories'), $this->l('Products'), $this->l('Combinations'), $this->l('Customers'), $this->l('Addresses'), $this->l('Manufacturers'), $this->l('Suppliers')));
|
||||
|
||||
switch ((int)(Tools::getValue('entity')))
|
||||
{
|
||||
@ -289,19 +280,7 @@ class AdminImport extends AdminTab
|
||||
'meta_keywords' => array('label' => $this->l('Meta-keywords')),
|
||||
'meta_description' => array('label' => $this->l('Meta-description')));
|
||||
break;
|
||||
|
||||
case $this->entities[$this->l('Pack')]:
|
||||
|
||||
self::$required_fields = array('id_product_item', 'qty', 'id');
|
||||
|
||||
$this->available_fields = array(
|
||||
'id_product_item' => array('label' => $this->l('ID Item')),
|
||||
'qty' => array('label' => $this->l('Quantity Item')),
|
||||
'id' => array('label' => $this->l('ID Pack')),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
@ -1313,51 +1292,6 @@ class AdminImport extends AdminTab
|
||||
}
|
||||
$this->closeCsvFile($handle);
|
||||
}
|
||||
|
||||
public function packImport()
|
||||
{
|
||||
$this->receiveTab();
|
||||
$handle = $this->openCsvFile();
|
||||
self::setLocale();
|
||||
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, Tools::getValue('separator')); $current_line++)
|
||||
{
|
||||
if (Tools::getValue('convert')) {
|
||||
$line = $this->utf8_encode_array($line);
|
||||
}
|
||||
$info = self::getMaskedRow($line);
|
||||
|
||||
self::setDefaultValues($info);
|
||||
|
||||
// Is product a pack
|
||||
if (array_key_exists('id', $info) && (int)($info['id']) && Pack::isPack((int)($info['id']))) {
|
||||
$pack = new Pack((int)($info['id']));
|
||||
}
|
||||
else {
|
||||
$pack = new Pack();
|
||||
}
|
||||
|
||||
self::array_walk($info, array('AdminImport', 'fillInfo'), $pack);
|
||||
if (($fieldError = $pack->validateFields(UNFRIENDLY_ERROR, true)) === true && is_numeric($info['qty']))
|
||||
{
|
||||
$res = false;
|
||||
// Is product item in pack
|
||||
if ($pack->isPacked($info['id_product_item'])) {
|
||||
$res = $pack->updateItem($info['id'], $info['id_product_item'], $info['qty']);
|
||||
}
|
||||
// Insert
|
||||
if (!$res) {
|
||||
$res = $pack->addItem($info['id'], $info['id_product_item'], $info['qty']);
|
||||
}
|
||||
if (!$res) {
|
||||
$this->_errors[] = mysql_error().' '.$info['id_product_item'].(isset($info['id']) ? ' (ID '.$info['id'].')' : '').' '.Tools::displayError('Cannot be saved');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->_errors[] = ($fieldError !== true ? $fieldError : '').($langFieldError !== true ? $langFieldError : '');
|
||||
}
|
||||
}
|
||||
$this->closeCsvFile($handle);
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
@ -1890,9 +1824,6 @@ class AdminImport extends AdminTab
|
||||
case $this->entities[$this->l('Suppliers')]:
|
||||
$this->supplierImport();
|
||||
break;
|
||||
case $this->entities[$this->l('Pack')]:
|
||||
$this->packImport();
|
||||
break;
|
||||
default:
|
||||
$this->_errors[] = $this->l('no entity selected');
|
||||
}
|
||||
|
@ -174,30 +174,18 @@ class PackCore extends Product
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to the pack
|
||||
* @param integer $id_product
|
||||
* @param integer $id_item
|
||||
* @param integer $qty
|
||||
* @return boolean true if everything was fine
|
||||
*/
|
||||
* Add an item to the pack
|
||||
*
|
||||
* @param integer $id_product
|
||||
* @param integer $id_item
|
||||
* @param integer $qty
|
||||
* @return boolean true if everything was fine
|
||||
*/
|
||||
public static function addItem($id_product, $id_item, $qty)
|
||||
{
|
||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 1 WHERE id_product = '.(int)($id_product).' LIMIT 1');
|
||||
return Db::getInstance()->AutoExecute(_DB_PREFIX_.'pack', array('id_product_pack' => (int)($id_product), 'id_product_item' => (int)($id_item), 'quantity' => (int)($qty)), 'INSERT');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update item and his pack association
|
||||
* @param integer $id_product
|
||||
* @param integer $id_item
|
||||
* @param integer $qty
|
||||
* @return boolean true if everything was fine
|
||||
*/
|
||||
public static function updateItem($id_product, $id_item, $qty)
|
||||
{
|
||||
return Db::getInstance()->AutoExecute(_DB_PREFIX_.'pack', array('quantity' => (int)($qty)),
|
||||
'UPDATE', 'id_product_pack='.(int)($id_product).' AND id_product_item='.(int)($id_item));
|
||||
}
|
||||
|
||||
public static function duplicate($id_product_old, $id_product_new)
|
||||
{
|
||||
|
@ -1,14 +1,13 @@
|
||||
<?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';
|
||||
@ -21,8 +20,7 @@ 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',
|
||||
@ -35,8 +33,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'];
|
||||
@ -49,8 +47,7 @@ class Logistics extends Module
|
||||
&& $this->registerHook('updateCarrier');
|
||||
}
|
||||
|
||||
private function installCarriers()
|
||||
{
|
||||
private function installCarriers() {
|
||||
return
|
||||
// La Poste
|
||||
Db::getInstance()->Execute('
|
||||
@ -153,8 +150,7 @@ 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`');
|
||||
@ -165,16 +161,14 @@ 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())));
|
||||
|
||||
@ -332,13 +326,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'));
|
||||
|
||||
// Set print queue - employe : name
|
||||
foreach (Tools::getValue('employee', array()) as $id_employee => $queue) {
|
||||
Configuration::updateValue('LOGISTICS_QUEUE_'.(int)$id_employee, $queue);
|
||||
}
|
||||
|
||||
// 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)));
|
||||
@ -465,7 +459,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>';
|
||||
}
|
||||
|
||||
@ -563,7 +557,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) {
|
||||
@ -609,7 +603,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>';
|
||||
}
|
||||
|
||||
@ -701,7 +695,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) {
|
||||
@ -749,7 +743,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>';
|
||||
}
|
||||
|
||||
@ -810,7 +804,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) {
|
||||
@ -826,9 +820,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']);
|
||||
// }
|
||||
|
||||
@ -840,7 +834,7 @@ class Logistics extends Module
|
||||
}
|
||||
|
||||
$lock = Configuration::get('LOGISTICS_LOCK');
|
||||
if ($lock === false || empty($lock)) {
|
||||
if($lock === FALSE || empty($lock)) {
|
||||
$lock = serialize(array());
|
||||
}
|
||||
|
||||
@ -868,21 +862,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));
|
||||
}
|
||||
|
@ -1810,6 +1810,7 @@ body#page-404 .footer_links {
|
||||
list-style: outside none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
height: 550px;
|
||||
}
|
||||
#sales_menu > ul {
|
||||
background: #565388;
|
||||
@ -1958,10 +1959,12 @@ li.active .container_submenu .content_submenu {
|
||||
padding: 15px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 710px;
|
||||
width: 705px;
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
min-height: 380px;
|
||||
overflow-y: scroll;
|
||||
min-height: 420px;
|
||||
height: 380px;
|
||||
}
|
||||
.submenu > ul > li > .sales_submenu ul {
|
||||
animation-duration: 0.3s;
|
||||
@ -1973,7 +1976,7 @@ li.active .container_submenu .content_submenu {
|
||||
background: #f5f5f5;
|
||||
float: left;
|
||||
margin: 10px 20px;
|
||||
width: 310px;
|
||||
width: 305px;
|
||||
}
|
||||
.submenu .sales_submenu li img {
|
||||
float: left;
|
||||
|
Loading…
Reference in New Issue
Block a user