Compare commits

..

1 Commits

Author SHA1 Message Date
Michael RICOIS
ff5ac6e829 Fix menu 2018-03-20 16:02:05 +01:00
4 changed files with 43 additions and 127 deletions

View File

@ -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();
}
@ -1314,51 +1293,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()
{
if (!Tools::isSubmit('submitImportFile'))
@ -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');
}

View File

@ -175,6 +175,7 @@ class PackCore extends Product
/**
* Add an item to the pack
*
* @param integer $id_product
* @param integer $id_item
* @param integer $qty
@ -186,19 +187,6 @@ class PackCore extends Product
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)
{
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'pack (id_product_pack, id_product_item, quantity)

View File

@ -3,12 +3,11 @@ 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',
@ -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,13 +161,11 @@ 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')) {
@ -332,10 +326,10 @@ 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) {
@ -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());
}

View File

@ -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;