// Merge 1.4 => 1.5
This commit is contained in:
@@ -59,7 +59,7 @@ class MondialRelay extends Module
|
|||||||
{
|
{
|
||||||
$this->name = 'mondialrelay';
|
$this->name = 'mondialrelay';
|
||||||
$this->tab = 'shipping_logistics';
|
$this->tab = 'shipping_logistics';
|
||||||
$this->version = '1.7.6';
|
$this->version = '1.7.8';
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
@@ -112,19 +112,22 @@ class MondialRelay extends Module
|
|||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
|
// AdminOrders id_tab
|
||||||
|
$id_parent = 3;
|
||||||
|
|
||||||
/*tab install */
|
/*tab install */
|
||||||
$result = Db::getInstance()->getRow('
|
$result = Db::getInstance()->getRow('
|
||||||
SELECT position
|
SELECT position
|
||||||
FROM `' . _DB_PREFIX_ . 'tab`
|
FROM `' . _DB_PREFIX_ . 'tab`
|
||||||
WHERE `id_parent` = 3
|
WHERE `id_parent` = '.(int)$id_parent.'
|
||||||
ORDER BY `'. _DB_PREFIX_ .'tab`.`position` DESC');
|
ORDER BY `'. _DB_PREFIX_ .'tab`.`position` DESC');
|
||||||
|
|
||||||
$pos = (isset($result['position'])) ? $result['position'] + 1 : 0;
|
$pos = (isset($result['position'])) ? $result['position'] + 1 : 0;
|
||||||
|
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('
|
||||||
INSERT INTO ' . _DB_PREFIX_ . 'tab
|
INSERT INTO ' . _DB_PREFIX_ . 'tab
|
||||||
(id_parent, class_name, position, module)
|
(id_parent, class_name, position, module)
|
||||||
VALUES(3, "AdminMondialRelay", "'.(int)($pos).'", "mondialrelay")');
|
VALUES('.(int)$id_parent.', "AdminMondialRelay", "'.(int)($pos).'", "mondialrelay")');
|
||||||
|
|
||||||
$id_tab = Db::getInstance()->Insert_ID();
|
$id_tab = Db::getInstance()->Insert_ID();
|
||||||
|
|
||||||
@@ -149,15 +152,14 @@ class MondialRelay extends Module
|
|||||||
if (!Configuration::get('MONDIAL_RELAY'))
|
if (!Configuration::get('MONDIAL_RELAY'))
|
||||||
{
|
{
|
||||||
Configuration::updateValue('MONDIAL_RELAY', $this->version);
|
Configuration::updateValue('MONDIAL_RELAY', $this->version);
|
||||||
Configuration::updateValue('MONDIAL_RELAY_ORDER_STATE', 3);
|
Configuration::updateValue('MONDIAL_RELAY_ORDER_STATE', 3);
|
||||||
Configuration::updateValue('MONDIAL_RELAY_SECURE_KEY', md5(time().rand(0,10)));
|
Configuration::updateValue('MONDIAL_RELAY_SECURE_KEY', md5(time().rand(0,10)));
|
||||||
Configuration::updateValue('MR_GOOGLE_MAP', '1');
|
Configuration::updateValue('MR_GOOGLE_MAP', '1');
|
||||||
Configuration::updateValue('MR_ENSEIGNE_WEBSERVICE', '');
|
Configuration::updateValue('MR_ENSEIGNE_WEBSERVICE', '');
|
||||||
Configuration::updateValue('MR_CODE_MARQUE', '');
|
Configuration::updateValue('MR_CODE_MARQUE', '');
|
||||||
Configuration::updateValue('MR_KEY_WEBSERVICE', '');
|
Configuration::updateValue('MR_KEY_WEBSERVICE', '');
|
||||||
Configuration::updateValue('MR_LANGUAGE', '');
|
Configuration::updateValue('MR_LANGUAGE', '');
|
||||||
Configuration::updateValue('MR_WEIGHT_COEF', '');
|
Configuration::updateValue('MR_WEIGHT_COEF', '');
|
||||||
Configuration::updateValue('PS_MR_SHOP_NAME', Configuration::get('PS_SHOP_NAME'));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -265,8 +267,7 @@ class MondialRelay extends Module
|
|||||||
!Configuration::deleteByName('MR_ENSEIGNE_WEBSERVICE') ||
|
!Configuration::deleteByName('MR_ENSEIGNE_WEBSERVICE') ||
|
||||||
!Configuration::deleteByName('MR_CODE_MARQUE') ||
|
!Configuration::deleteByName('MR_CODE_MARQUE') ||
|
||||||
!Configuration::deleteByName('MR_KEY_WEBSERVICE') ||
|
!Configuration::deleteByName('MR_KEY_WEBSERVICE') ||
|
||||||
!Configuration::deleteByName('MR_WEIGHT_COEF') ||
|
!Configuration::deleteByName('MR_WEIGHT_COEF'))
|
||||||
!Configuration::deleteByName('PS_MR_SHOP_NAME'))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Drop databases
|
// Drop databases
|
||||||
@@ -313,16 +314,16 @@ class MondialRelay extends Module
|
|||||||
*/
|
*/
|
||||||
private function _update_v1_4()
|
private function _update_v1_4()
|
||||||
{
|
{
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'carrier`
|
UPDATE `'._DB_PREFIX_.'carrier`
|
||||||
SET
|
SET
|
||||||
`shipping_external` = 0,
|
`shipping_external` = 0,
|
||||||
`need_range` = 1,
|
`need_range` = 1,
|
||||||
`external_module_name` =
|
`external_module_name` =
|
||||||
"mondialrelay",
|
"mondialrelay",
|
||||||
`shipping_method` = 1
|
`shipping_method` = 1
|
||||||
WHERE `id_carrier`
|
WHERE `id_carrier`
|
||||||
IN (SELECT `id_mr_method`
|
IN (SELECT `id_carrier`
|
||||||
FROM `'._DB_PREFIX_.'mr_method`)');
|
FROM `'._DB_PREFIX_.'mr_method`)');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,15 +397,16 @@ class MondialRelay extends Module
|
|||||||
*/
|
*/
|
||||||
public static function getJqueryCompatibility($overloadCurrent = false)
|
public static function getJqueryCompatibility($overloadCurrent = false)
|
||||||
{
|
{
|
||||||
|
// Store the last inclusion into a variable and include the new one
|
||||||
if ($overloadCurrent)
|
if ($overloadCurrent)
|
||||||
return '
|
return '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
current = jQuery.noConflict(true);
|
currentJquery = jQuery.noConflict(true);
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="'.self::$moduleURL.'/jquery-1.4.4.min.js"></script>';
|
<script type="text/javascript" src="'.self::$moduleURL.'/js/jquery-1.6.4.min.js"></script>';
|
||||||
|
|
||||||
return '
|
return '
|
||||||
<script type="text/javascript" src="'.self::$moduleURL.'/jquery-1.4.4.min.js"></script>
|
<script type="text/javascript" src="'.self::$moduleURL.'/js/jquery-1.6.4.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
MRjQuery = jQuery.noConflict(true);
|
MRjQuery = jQuery.noConflict(true);
|
||||||
</script>';
|
</script>';
|
||||||
@@ -412,7 +414,7 @@ class MondialRelay extends Module
|
|||||||
|
|
||||||
public function hookNewOrder($params)
|
public function hookNewOrder($params)
|
||||||
{
|
{
|
||||||
DB::getInstance()->Execute('
|
DB::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'mr_selected`
|
UPDATE `'._DB_PREFIX_.'mr_selected`
|
||||||
SET `id_order` = '.$params['order']->id.'
|
SET `id_order` = '.$params['order']->id.'
|
||||||
WHERE `id_cart` = '.$params['cart']->id);
|
WHERE `id_cart` = '.$params['cart']->id);
|
||||||
@@ -423,14 +425,17 @@ class MondialRelay extends Module
|
|||||||
$cssFilePath = $this->_path.'style.css';
|
$cssFilePath = $this->_path.'style.css';
|
||||||
$jsFilePath= $this->_path.'mondialrelay.js';
|
$jsFilePath= $this->_path.'mondialrelay.js';
|
||||||
|
|
||||||
return '
|
$ret = '';
|
||||||
<link type="text/css" rel="stylesheet" href="'.$cssFilePath.'" />
|
if (Tools::getValue('tab') == 'AdminMondialRelay')
|
||||||
<script type="text/javascript">
|
$ret = '
|
||||||
var _PS_MR_MODULE_DIR_ = "'.self::$moduleURL.'";
|
<link type="text/css" rel="stylesheet" href="'.$cssFilePath.'" />
|
||||||
var mrtoken = "'.self::$MRBackToken.'";
|
<script type="text/javascript">
|
||||||
</script>
|
var _PS_MR_MODULE_DIR_ = "'.self::$moduleURL.'";
|
||||||
<script type="text/javascript" src="'.$jsFilePath.'"></script>'.
|
var mrtoken = "'.self::$MRBackToken.'";
|
||||||
self::getJqueryCompatibility(true);
|
</script>
|
||||||
|
<script type="text/javascript" src="'.$jsFilePath.'"></script>'.
|
||||||
|
self::getJqueryCompatibility(true);
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _postValidation()
|
private function _postValidation()
|
||||||
@@ -493,9 +498,9 @@ class MondialRelay extends Module
|
|||||||
self::mrUpdate('settings', $setArray, $keyArray);
|
self::mrUpdate('settings', $setArray, $keyArray);
|
||||||
else if (isset($_POST['submitShipping']) AND $_POST['submitShipping'])
|
else if (isset($_POST['submitShipping']) AND $_POST['submitShipping'])
|
||||||
self::mrUpdate('shipping', $_POST, array());
|
self::mrUpdate('shipping', $_POST, array());
|
||||||
else if (Tools::getValue('PS_MRSubmitFieldPersonalization'))
|
/*elseif (Tools::getValue('PS_MRSubmitFieldPersonalization'))
|
||||||
$this->updateFieldsPersonalization();
|
$this->updateFieldsPersonalization();*/
|
||||||
else if (isset($_POST['submitMethod']) AND $_POST['submitMethod'])
|
elseif (isset($_POST['submitMethod']) AND $_POST['submitMethod'])
|
||||||
self::mrUpdate('addShipping', $setArray, $keyArray);
|
self::mrUpdate('addShipping', $setArray, $keyArray);
|
||||||
else if (isset($_POST['submit_order_state']) AND $_POST['submit_order_state'])
|
else if (isset($_POST['submit_order_state']) AND $_POST['submit_order_state'])
|
||||||
{
|
{
|
||||||
@@ -661,8 +666,8 @@ class MondialRelay extends Module
|
|||||||
self::mrDelete((int)($_GET['delete_mr']));
|
self::mrDelete((int)($_GET['delete_mr']));
|
||||||
|
|
||||||
$this->_html .= '<h2>'.$this->l('Configure Mondial Relay Rate Module').'</h2>
|
$this->_html .= '<h2>'.$this->l('Configure Mondial Relay Rate Module').'</h2>
|
||||||
|
|
||||||
<div class="warn">'.
|
<div class="MR_warn">'.
|
||||||
$this->l('Try to turn off the cache and put the force compilation to on if you have any problems with the module after an update').'
|
$this->l('Try to turn off the cache and put the force compilation to on if you have any problems with the module after an update').'
|
||||||
</div>
|
</div>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@@ -1163,11 +1168,10 @@ class MondialRelay extends Module
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'customer` c
|
LEFT JOIN `'._DB_PREFIX_.'customer` c
|
||||||
ON (c.`id_customer` = o.`id_customer`)
|
ON (c.`id_customer` = o.`id_customer`)
|
||||||
WHERE (
|
WHERE (
|
||||||
SELECT moh.`id_order_state`
|
SELECT moh.`id_order_state`
|
||||||
FROM `'._DB_PREFIX_.'order_history` moh
|
FROM `'._DB_PREFIX_.'order_history` moh
|
||||||
WHERE moh.`id_order` = o.`id_order`
|
WHERE moh.`id_order` = o.`id_order`
|
||||||
ORDER BY moh.`date_add` DESC LIMIT 1) = '.(int)($id_order_state).'
|
ORDER BY moh.`date_add` DESC LIMIT 1) = '.(int)($id_order_state);
|
||||||
AND ca.`external_module_name` = "mondialrelay"';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function ordersSQLQuery1_3($id_order_state)
|
public static function ordersSQLQuery1_3($id_order_state)
|
||||||
@@ -1185,21 +1189,20 @@ class MondialRelay extends Module
|
|||||||
mrs.`MR_Selected_Pays` as MR_Selected_Pays, mrs.`exp_number` as exp_number,
|
mrs.`MR_Selected_Pays` as MR_Selected_Pays, mrs.`exp_number` as exp_number,
|
||||||
mr.`mr_ModeCol` as mr_ModeCol, mr.`mr_ModeLiv` as mr_ModeLiv, mr.`mr_ModeAss` as mr_ModeAss
|
mr.`mr_ModeCol` as mr_ModeCol, mr.`mr_ModeLiv` as mr_ModeLiv, mr.`mr_ModeAss` as mr_ModeAss
|
||||||
FROM `'._DB_PREFIX_.'orders` o
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
LEFT JOIN `'._DB_PREFIX_.'carrier` ca
|
LEFT JOIN `'._DB_PREFIX_.'carrier` ca
|
||||||
ON (ca.`id_carrier` = o.`id_carrier`)
|
ON (ca.`id_carrier` = o.`id_carrier`
|
||||||
AND ca.`name` = "mondialrelay"
|
AND ca.`name` = "mondialrelay")
|
||||||
LEFT JOIN `'._DB_PREFIX_.'mr_selected` mrs
|
LEFT JOIN `'._DB_PREFIX_.'mr_selected` mrs
|
||||||
ON (mrs.`id_cart` = o.`id_cart`)
|
ON (mrs.`id_cart` = o.`id_cart`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'mr_method` mr
|
LEFT JOIN `'._DB_PREFIX_.'mr_method` mr
|
||||||
ON (mr.`id_carrier` = ca.`id_carrier`)
|
ON (mr.`id_carrier` = ca.`id_carrier`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer` c
|
LEFT JOIN `'._DB_PREFIX_.'customer` c
|
||||||
ON (c.`id_customer` = o.`id_customer`)
|
ON (c.`id_customer` = o.`id_customer`)
|
||||||
WHERE (
|
WHERE (
|
||||||
SELECT moh.`id_order_state`
|
SELECT moh.`id_order_state`
|
||||||
FROM `'._DB_PREFIX_.'order_history` moh
|
FROM `'._DB_PREFIX_.'order_history` moh
|
||||||
WHERE moh.`id_order` = o.`id_order`
|
WHERE moh.`id_order` = o.`id_order`
|
||||||
ORDER BY moh.`date_add` DESC LIMIT 1) = '.(int)($id_order_state).'
|
ORDER BY moh.`date_add` DESC LIMIT 1) = '.(int)($id_order_state);
|
||||||
AND ca.`name` = "mondialrelay"';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getBaseOrdersSQLQuery($id_order_state)
|
public static function getBaseOrdersSQLQuery($id_order_state)
|
||||||
|
|||||||
Reference in New Issue
Block a user