Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

php 7.0 support #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions AdminMondialRelay.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ private function displayOrdersTable()
$this->mondialrelay
);
if (is_array($orders) && count($orders))
foreach ($orders as &$order)
foreach ($orders as $keyOrder => $order)
{
$order['display_total_price'] = Tools::displayPrice($order['total'], new Currency($order['id_currency']));
$order['display_shipping_price'] = Tools::displayPrice($order['shipping'], new Currency($order['id_currency']));
$orders[$keyOrder]['display_total_price'] = Tools::displayPrice($order['total'], new Currency($order['id_currency']));
$orders[$keyOrder]['display_shipping_price'] = Tools::displayPrice($order['shipping'], new Currency($order['id_currency']));
if (version_compare(_PS_VERSION_, '1.5.5', '<'))
$order['display_date'] = Tools::displayDate($order['date'], $this->context->language->id);
$orders[$keyOrder]['display_date'] = Tools::displayDate($order['date'], $this->context->language->id);
else
$order['display_date'] = Tools::displayDate($order['date']);
$order['weight'] = (!empty($order['mr_weight']) && $order['mr_weight'] > 0) ? $order['mr_weight'] : $order['order_weight'];
$orders[$keyOrder]['display_date'] = Tools::displayDate($order['date']);
$orders[$keyOrder]['weight'] = (!empty($order['mr_weight']) && $order['mr_weight'] > 0) ? $order['mr_weight'] : $order['order_weight'];
}

$controller = (_PS_VERSION_ < '1.5') ? 'AdminContact' : 'AdminStores';
Expand All @@ -99,8 +99,8 @@ public function displayhistoriqueForm()
$query = 'SELECT * FROM `'._DB_PREFIX_.'mr_history` ORDER BY `id` DESC ;';
$history = Db::getInstance()->executeS($query);

foreach ($history as &$item)
$item['url_10x15'] = str_replace('format=A4', 'format=10x15', $item['url_a4']);
foreach ($history as $historyKey => $item)
$history[$historyKey]['url_10x15'] = str_replace('format=A4', 'format=10x15', $item['url_a4']);

$this->context->smarty->assign(array(
'MR_histories' => $history)
Expand Down
4 changes: 3 additions & 1 deletion classes/MRCreateTickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,10 @@ private function _generateMD5SecurityKey()
$cleanedString = MRTools::removeAccents($valueDetailed['value']);
$valueDetailed['value'] = !empty($cleanedString) ? Tools::strtoupper($cleanedString) : Tools::strtoupper($valueDetailed['value']);

$call = !empty($valueDetailed['methodValidation']) ? call_user_func('MRTools::' . $valueDetailed['methodValidation'], array($valueDetailed['value'], $valueDetailed['params'])) : false;

// Call a pointer function if exist to do different test
if (isset($valueDetailed['methodValidation']) && method_exists('MRTools', $valueDetailed['methodValidation']) && isset($valueDetailed['params']) && MRTools::$valueDetailed['methodValidation']($valueDetailed['value'], $valueDetailed['params']))
if (isset($valueDetailed['methodValidation']) && method_exists('MRTools', $valueDetailed['methodValidation']) && isset($valueDetailed['params']) && $call)
$concatenationValue .= $valueDetailed['value'];
// Use simple Regex test given by MondialRelay
else if (isset($valueDetailed['regexValidation']) && preg_match($valueDetailed['regexValidation'], $valueDetailed['value'], $matches))
Expand Down
16 changes: 9 additions & 7 deletions classes/MRGetRelayPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ private function _generateMD5SecurityKey()
$valueDetailed['value'] = !empty($cleanedString) ? Tools::strtoupper($cleanedString) : Tools::strtoupper($valueDetailed['value']);

$valueDetailed['value'] = Tools::strtoupper($valueDetailed['value']);
$call = !empty($valueDetailed['methodValidation']) ? call_user_func('MRTools::' . $valueDetailed['methodValidation'], array($valueDetailed['value'], $valueDetailed['params'])) : false;

// Call a pointer function if exist to do different test
if (isset($valueDetailed['methodValidation']) && method_exists('MRTools', $valueDetailed['methodValidation']) && isset($valueDetailed['params']) && MRTools::$valueDetailed['methodValidation']($valueDetailed['value'], $valueDetailed['params']))
if (isset($valueDetailed['methodValidation']) && method_exists('MRTools', $valueDetailed['methodValidation']) && isset($valueDetailed['params']) && $call)
$concatenationValue .= $valueDetailed['value'];
// Use simple Regex test given by MondialRelay
else if (isset($valueDetailed['regexValidation']) && preg_match($valueDetailed['regexValidation'], $valueDetailed['value'], $matches))
Expand Down Expand Up @@ -188,11 +190,11 @@ private function _addLinkHoursDetail(&$relayPointList)
foreach ($relayPointList as $relayPoint)
$relayPointNumList[] = $relayPoint->Num;
$permaList = MRRelayDetail::getPermaLink($relayPointNumList, $this->_id_address_delivery);
foreach ($relayPointList as &$relayPoint)
foreach ($relayPointList as $keyRelay => $relayPoint)
{
$relayPoint->permaLinkDetail = '';
$relayPointList->$keyRelay->permaLinkDetail = '';
if (array_key_exists($relayPoint->Num, $permaList))
$relayPoint->permaLinkDetail = $permaList[$relayPoint->Num];
$relayPointList->$keyRelay->permaLinkDetail = $permaList[$relayPoint->Num];
}
return $relayPointList;
}
Expand Down Expand Up @@ -220,10 +222,10 @@ private function _parseResult($client, $result, $params)
foreach ($result as $num => $relayPoint)
{
$totalEmptyFields = 0;
foreach ($relayPoint as &$value)
foreach ($relayPoint as $keyRelay => $value)
{
$value = trim($value);
if (empty($value))
$relayPoint->$keyRelay = trim($relayPoint->$keyRelay);
if (empty($relayPoint->$keyRelay))
++$totalEmptyFields;
}
if ($totalEmptyFields == count($relayPoint))
Expand Down
5 changes: 3 additions & 2 deletions classes/MRRelayDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ private function _generateMD5SecurityKey()
// TODO : test on windows and linux server
$cleanedString = MRTools::removeAccents($valueDetailed['value']);
$valueDetailed['value'] = !empty($cleanedString) ? Tools::strtoupper($cleanedString) : Tools::strtoupper($valueDetailed['value']);

$call = !empty($valueDetailed['methodValidation']) ? call_user_func('MRTools::' . $valueDetailed['methodValidation'], array($valueDetailed['value'], $valueDetailed['params'])) : false;

// Call a pointer function if exist to do different test
if (isset($valueDetailed['methodValidation']) && method_exists('MRTools', $valueDetailed['methodValidation']) && isset($valueDetailed['params']) && MRTools::$valueDetailed['methodValidation']($valueDetailed['value'], $valueDetailed['params']))
if (isset($valueDetailed['methodValidation']) && method_exists('MRTools', $valueDetailed['methodValidation']) && isset($valueDetailed['params']) && $call)
$concatenationValue .= $valueDetailed['value'];
// Use simple Regex test given by MondialRelay
else if (isset($valueDetailed['regexValidation']) && preg_match($valueDetailed['regexValidation'], $valueDetailed['value'], $matches))
Expand Down
8 changes: 3 additions & 5 deletions js/mondialrelay.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,13 +593,12 @@ var PS_MRObject = (function($, undefined) {
*/
function PS_MRCheckSelectedRelayPoint()
{
var input;
var input = $('input.delivery_option_radio:checked').val().replace(",", "");
var compareTo = PS_MRData['carrier_list'][0]['id_carrier'];

// Check if the input is linked to the module and look into
// a temporary variable if a relay point has been selected
if ((input = $('input[name=id_carrier]:checked')).length &&
PS_MRCarrierMethodList[input.val()] != undefined &&
PS_MRSelectedRelayPoint['relayPointNum'] == 0)
if (input == compareTo && PS_MRSelectedRelayPoint['relayPointNum'] < 1)
{
//$('#PS_MRSelectCarrierError').fadeIn('fast');
alert(PS_MRTranslationList['errorSelection']);
Expand Down Expand Up @@ -1176,7 +1175,6 @@ var PS_MRObject = (function($, undefined) {
// Hide MR input if one of them is not selected
if($(e).val() == carrier_selected)
{
console.log(carrier_selected);
if(MR_carrier != false) {
PS_MRCarrierMethodList[MR_idcarrier] = MR_carrier.id_mr_method;
PS_MRSelectedRelayPoint['carrier_id'] = MR_idcarrier;
Expand Down
35 changes: 35 additions & 0 deletions lib/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

header("Location: ../");
exit;
Loading