// Merge -> revision 9221
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/classes/MondialRelayClass.php');
|
||||
require_once(dirname(__FILE__).'/classes/MRCreateTickets.php');
|
||||
require_once(dirname(__FILE__).'/mondialrelay.php');
|
||||
|
||||
class AdminMondialRelay extends AdminTab
|
||||
@@ -35,10 +36,10 @@ class AdminMondialRelay extends AdminTab
|
||||
public function __construct()
|
||||
{
|
||||
MondialRelay::initModuleAccess();
|
||||
|
||||
|
||||
$this->table = 'mr_selected';
|
||||
$this->className = 'MondialRelayClass';
|
||||
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
@@ -47,14 +48,31 @@ class AdminMondialRelay extends AdminTab
|
||||
$mondialrelay = new MondialRelay();
|
||||
$order_state = new OrderState((int)(Configuration::get('MONDIAL_RELAY_ORDER_STATE')), $this->context->language->id);
|
||||
$mr_weight_coef = (int)(Configuration::get('MR_WEIGHT_COEF'));
|
||||
|
||||
|
||||
$html = '';
|
||||
|
||||
$html .= $this->l('To generate labels, you must register a correct address for your store on').
|
||||
|
||||
// Simulate a ticket generation
|
||||
$MRCreateTicket = new MRCreateTickets(array(
|
||||
'orderIdList' => NULL,
|
||||
'totalOrder' => NULL,
|
||||
'weightList' => NULL));
|
||||
|
||||
$errorListTicket = $MRCreateTicket->checkPreValidation();
|
||||
|
||||
if (count($errorListTicket))
|
||||
{
|
||||
$html .= '<div class="error">'.
|
||||
$this->l('Thanks to kindly correct the following errors on ').
|
||||
' <a href="index.php?tab=AdminContact&token='.Tools::getAdminToken('AdminContact'.
|
||||
(int)(Tab::getIdFromClassName('AdminContact')).(int)$this->context->employee->id).'" class="green">'.
|
||||
$this->l('The contact page').'</a>';
|
||||
$html .= '<p>'.$this->l('All orders which have the state').' "<b>'.$order_state->name.'</b>"';
|
||||
(int)(Tab::getIdFromClassName('AdminContact')).(int)$this->context->id_employee).'" style="color:#f00;">'.
|
||||
$this->l('the contact page').'</a>:<ul>';
|
||||
foreach($errorListTicket as $type => $error)
|
||||
$html .= '<li>'.$type.': '.$error.'</li>';
|
||||
$html .= '</ul></div>';
|
||||
}
|
||||
|
||||
$html .= '<p>'.$this->l('All orders which have the state').' "<b>'.$order_state->name.'</b>" '.
|
||||
$this->l('will be available for sticker creation');
|
||||
$html .= '. <a href="index.php?tab=AdminModules&configure=mondialrelay&token='.
|
||||
Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).
|
||||
(int)$this->context->employee->id).'" class="green">' . $this->l('Change configuration') . '</a></p>
|
||||
@@ -63,7 +81,7 @@ class AdminMondialRelay extends AdminTab
|
||||
<span></span>
|
||||
</div>';
|
||||
|
||||
$orders = MondialRelay::getOrders(array(), MondialRelay::WITHOUT_HOME_DELIVERY);
|
||||
$orders = MondialRelay::getOrders(array());
|
||||
if (empty($orders))
|
||||
$html.= '<h3 style="color:red;">' . $this->l('No orders with this state.') . '</h3>';
|
||||
else
|
||||
@@ -71,22 +89,22 @@ class AdminMondialRelay extends AdminTab
|
||||
$html.= '<form method="post" action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'">';
|
||||
$html.= "\n<table class=\"table\" id='orders'>";
|
||||
$html.= '<tr>';
|
||||
$html.= '<th><input type="checkbox" id="toggleStatusOrderList" /></th>';
|
||||
$html.= '<th>'.$this->l('Order ID').'</th>';
|
||||
$html.= '<th>'.$this->l('Customer').'</th>';
|
||||
$html.= '<th>'.$this->l('Total price').'</th>';
|
||||
$html.= '<th>'.$this->l('Total shipping').'</th>';
|
||||
$html.= '<th>'.$this->l('Date').'</th>';
|
||||
$html.= '<th>'.$this->l('Put a Weight (grams)').'</th>';
|
||||
$html.= '<th class="fixed"><a href="javascript:void(0);" id="toggleStatusOrderList">'.$this->l('Toggle selection').'</a><br /></th>';
|
||||
$html.= '<th>'.$this->l('MR Number').'</th>';
|
||||
$html.= '<th>'.$this->l('MR Country').'</th>';
|
||||
$html.= '<th>'.$this->l('Exp Number').'</th>';
|
||||
$html.= '<th>'.$this->l('Detail').'</th>';
|
||||
$html.= '</tr>';
|
||||
|
||||
|
||||
foreach ($orders as $order)
|
||||
{
|
||||
if ($order['weight'] == 0)
|
||||
if ($order['weight'] == 0)
|
||||
{
|
||||
$result_weight = Db::getInstance()->getRow('
|
||||
SELECT SUM(product_weight * product_quantity) as weight
|
||||
@@ -96,13 +114,13 @@ class AdminMondialRelay extends AdminTab
|
||||
}
|
||||
|
||||
$html .= '<tr id="PS_MRLineOrderInformation-'.$order['id_order'].'">';
|
||||
$html .= '<td><input type="checkbox" class="order_id_list" name="order_id_list[]" id="order_id_list" value="'.$order['id_order'].'" /></td>';
|
||||
$html .= '<td>'.$order['id_order'].'</td>';
|
||||
$html .= '<td>'.$order['customer'].'</td>';
|
||||
$html .= '<td>'.Tools::displayPrice($order['total'], new Currency($order['id_currency'])) . '</td>';
|
||||
$html .= '<td>'.Tools::displayPrice($order['shipping'], new Currency($order['id_currency'])) . '</td>';
|
||||
$html .= '<td>'.Tools::displayDate($order['date'], $order['id_lang']).'</td>';
|
||||
$html .= '<td><input type="text" name="weight_'.$order['id_order'].'" id="weight_' . $order['id_order'] . '" size="7" value="'.$order['weight'].'" /></td>';
|
||||
$html .= '<td><input type="checkbox" class="order_id_list" name="order_id_list[]" id="order_id_list" value="'.$order['id_order'].'" /></td>';
|
||||
$html .= '<td>'.$order['MR_Selected_Num'].'</td>';
|
||||
$html .= '<td>'.$order['MR_Selected_Pays'].'</td>';
|
||||
$html .= '<td>'.$order['exp_number'].'</td>';
|
||||
@@ -147,7 +165,7 @@ class AdminMondialRelay extends AdminTab
|
||||
$_html = '';
|
||||
$query = "SELECT * FROM `" . _DB_PREFIX_ ."mr_historique` ORDER BY `id` DESC ;";
|
||||
$query = Db::getInstance()->executeS($query);
|
||||
|
||||
|
||||
$_html.= '
|
||||
<fieldset>
|
||||
<legend>' . $this->l('History of labels creation') . '</legend>
|
||||
@@ -156,13 +174,13 @@ class AdminMondialRelay extends AdminTab
|
||||
<table class="table" id="PS_MRHistoriqueTableList">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><a href="javascript:void(0);" id="toggleStatusHistoryList">' . $this->l('Toggle selection') . '</a></th>
|
||||
<th><input type="checkbox" id="toggleStatusHistoryList" /></th>
|
||||
<th>' . $this->l('Order ID') . '</th>
|
||||
<th>' . $this->l('Exp num') . '</th>
|
||||
<th>' . $this->l('Print stick A4') . '</th>
|
||||
<th>' . $this->l('Print stick A5') . '</th>
|
||||
</tr>';
|
||||
foreach ($query AS $k => $row)
|
||||
foreach ($query AS $k => $row)
|
||||
{
|
||||
$_html.= '
|
||||
<tr id="detailHistory_'.$row['order'].'">
|
||||
@@ -194,9 +212,9 @@ class AdminMondialRelay extends AdminTab
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
{
|
||||
$html = '';
|
||||
|
||||
|
||||
// Allow to override the older jquery to use a new one :)
|
||||
// Added for the 1.3 compatibility to keep using the recent code
|
||||
if (_PS_VERSION_ < '1.4')
|
||||
@@ -206,7 +224,7 @@ class AdminMondialRelay extends AdminTab
|
||||
<script type="text/javascript" language="javascript">
|
||||
var _PS_MR_MODULE_DIR_ = "'.MondialRelay::$moduleURL.'";
|
||||
</script>';
|
||||
|
||||
|
||||
$html .= $this->displayOrdersTable();
|
||||
$html .= '<br/><br/>';
|
||||
$html .= $this->displayhistoriqueForm();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -31,13 +31,14 @@
|
||||
* Each Name method allow to instanciate an object containing
|
||||
* methods to manage correctly the data and name fields
|
||||
*/
|
||||
|
||||
|
||||
require_once(realpath(dirname(__FILE__).'/../../config/config.inc.php'));
|
||||
require_once(realpath(dirname(__FILE__).'/../../init.php'));
|
||||
require(dirname(__FILE__).'/mondialrelay.php');
|
||||
require(dirname(__FILE__).'/classes/MRCreateTickets.php');
|
||||
require(dirname(__FILE__).'/classes/MRGetTickets.php');
|
||||
require(dirname(__FILE__).'/classes/MRGetRelayPoint.php');
|
||||
require(dirname(__FILE__).'/classes/MRRelayDetail.php');
|
||||
require(dirname(__FILE__).'/classes/MRManagement.php');
|
||||
|
||||
MondialRelay::initModuleAccess();
|
||||
@@ -64,7 +65,7 @@ $result = array();
|
||||
if (!isset($accessPageList[$token]) || !in_array($method, $accessPageList[$token]))
|
||||
exit();
|
||||
|
||||
// Method name allow to instanciate his object to properly call the
|
||||
// Method name allow to instanciate his object to properly call the
|
||||
// implemented interface method and do his job
|
||||
switch($method)
|
||||
{
|
||||
@@ -98,12 +99,12 @@ switch($method)
|
||||
}
|
||||
|
||||
// Try to instanciate the method object name and call the necessaries method
|
||||
try
|
||||
try
|
||||
{
|
||||
if (class_exists($method, false))
|
||||
{
|
||||
$obj = new $method($params);
|
||||
|
||||
|
||||
// Verify that the class implement correctly the interface
|
||||
// Else use a Management class to do some ajax stuff
|
||||
if (($obj instanceof IMondialRelayWSMethod))
|
||||
@@ -117,7 +118,7 @@ try
|
||||
else if (($management = new MRManagement($params)) &&
|
||||
method_exists($management, $method))
|
||||
$result = $management->{$method}();
|
||||
else
|
||||
else
|
||||
throw new Exception('Method Class : '.$method.' can\'t be found');
|
||||
unset($management);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
'ModeLiv' => array(
|
||||
'required' => true,
|
||||
'value' => '',
|
||||
'regexValidation' => '#^(LCC|LDR|LDS|24R|ESP|DRI)$#'),
|
||||
'regexValidation' => '#^(LCC|LD1|LDS|24R|ESP|DRI)$#'),
|
||||
'NDossier' => array(
|
||||
'required' => false,
|
||||
'value' => '',
|
||||
@@ -272,7 +272,6 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
*/
|
||||
private function _setRequestDefaultValue()
|
||||
{
|
||||
|
||||
$this->_fields['list']['Enseigne']['value'] = Configuration::get('MR_ENSEIGNE_WEBSERVICE');
|
||||
$this->_fields['list']['Expe_Langage']['value'] = Configuration::get('MR_LANGUAGE');
|
||||
$this->_fields['list']['Expe_Ad1']['value'] = Configuration::get('PS_MR_SHOP_NAME');
|
||||
@@ -422,7 +421,7 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
$order = new Order($params['NDossier']);
|
||||
|
||||
// Update the database for order and orderHistory
|
||||
$order->shipping_number = $id_mr_selected;
|
||||
$order->shipping_number = $expeditionNum;
|
||||
$order->update();
|
||||
|
||||
$templateVars = array('{followup}' => $trackingURL);
|
||||
@@ -507,6 +506,60 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
throw new Exception($this->_mondialRelay->l('The Mondial Relay webservice isn\'t currently reliable'));
|
||||
}
|
||||
|
||||
/*
|
||||
** Check if the shop parameter are currently well configured
|
||||
*/
|
||||
public function checkPreValidation()
|
||||
{
|
||||
$errorList = array();
|
||||
|
||||
if (!$this->_mondialRelay)
|
||||
$this->_mondialRelay = new MondialRelay();
|
||||
|
||||
$list = array(
|
||||
'Expe_Langage' => array(
|
||||
'value' => Configuration::get('MR_LANGUAGE'),
|
||||
'error' => $this->_mondialRelay->l('Please check your language configuration')),
|
||||
'Expe_Ad1' => array(
|
||||
'value' => Configuration::get('PS_MR_SHOP_NAME'),
|
||||
'error' => $this->_mondialRelay->l('Please check your shop name configuration')),
|
||||
'Expe_Ad3' => array(
|
||||
'value' => Configuration::get('PS_SHOP_ADDR1'),
|
||||
'error' => $this->_mondialRelay->l('Please check your address 1 configuration')),
|
||||
'Expe_Ville' => array(
|
||||
'value' => Configuration::get('PS_SHOP_CITY'),
|
||||
'error' => $this->_mondialRelay->l('Please check your city configuration')),
|
||||
'Expe_CP' => array(
|
||||
'value' => Configuration::get('PS_SHOP_CODE'),
|
||||
'error' => $this->_mondialRelay->l('Please check your zipcode configuration')),
|
||||
'Expe_Pays' => array(
|
||||
'value' => ((_PS_VERSION_ >= '1.4') ?
|
||||
Country::getIsoById(Configuration::get('PS_SHOP_COUNTRY_ID')) :
|
||||
substr(Configuration::get('PS_SHOP_COUNTRY'), 0, 2)),
|
||||
'error' => $this->_mondialRelay->l('Please check your country configuration')),
|
||||
'Expe_Tel1' => array(
|
||||
'value' => str_replace(array('.', ' ', '-'), '', Configuration::get('PS_SHOP_PHONE')),
|
||||
'error' => $this->_mondialRelay->l('Please check your Phone configuration')),
|
||||
'Expe_Mail' => array(
|
||||
'value' => Configuration::get('PS_SHOP_EMAIL'),
|
||||
'error' => $this->_mondialRelay->l('Please check your mail configuration')));
|
||||
|
||||
foreach($list as $name => $tab)
|
||||
{
|
||||
$tab['value'] = strtoupper($tab['value']);
|
||||
if ($name == 'Expe_CP')
|
||||
{
|
||||
if (!MRTools::checkZipcodeByCountry($tab['value'], array(
|
||||
'id_country' => Configuration::get('PS_COUNTRY_DEFAULT'))))
|
||||
$errorList[$name] = $tab['error'];
|
||||
}
|
||||
else if (isset($this->_fields['list'][$name]['regexValidation']) &&
|
||||
(!preg_match($this->_fields['list'][$name]['regexValidation'], $tab['value'], $matches)))
|
||||
$errorList[$name] = $tab['error'];
|
||||
}
|
||||
return $errorList;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the values with associated fields name
|
||||
* @fields : array containing multiple values information
|
||||
|
||||
@@ -167,6 +167,41 @@ class MRGetRelayPoint implements IMondialRelayWSMethod
|
||||
return $params;
|
||||
}
|
||||
|
||||
/*
|
||||
** Get detail information for each relay
|
||||
*/
|
||||
private function _getRelayPointDetails($relayPointList)
|
||||
{
|
||||
$relayPointNumList = array();
|
||||
foreach($relayPointList as $num => $relayPoint)
|
||||
$relayPointNumList[] = $relayPoint['Num'];
|
||||
|
||||
$MRRelayDetail = new MRRelayDetail(array(
|
||||
'relayPointNumList' => $relayPointNumList,
|
||||
'id_address_delivery' => $this->_id_address_delivery));
|
||||
$MRRelayDetail->init();
|
||||
$MRRelayDetail->send();
|
||||
return $MRRelayDetail->getResult();
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate a perman link to view relay detail on their website
|
||||
*/
|
||||
private function _addLinkHoursDetail(&$relayPointList)
|
||||
{
|
||||
$relayPointNumList = array();
|
||||
foreach($relayPointList as $num => $relayPoint)
|
||||
$relayPointNumList[] = $relayPoint['Num'];
|
||||
$permaList = MRRelayDetail::getPermaLink($relayPointNumList, $this->_id_address_delivery);
|
||||
foreach($relayPointList as $num => &$relayPoint)
|
||||
{
|
||||
$relayPoint['permaLinkDetail'] = '';
|
||||
if (array_key_exists($relayPoint['Num'], $permaList))
|
||||
$relayPoint['permaLinkDetail'] = $permaList[$relayPoint['Num']];
|
||||
}
|
||||
return $relayPointList;
|
||||
}
|
||||
|
||||
/*
|
||||
* Manage the return value of the webservice, handle the errors or build the
|
||||
* succeed message
|
||||
@@ -206,6 +241,14 @@ class MRGetRelayPoint implements IMondialRelayWSMethod
|
||||
}
|
||||
if (!count($result))
|
||||
$errors[] = $this->_mondialRelay->l('MondialRelay can\'t find any relay point near your address. Maybe your address isn\'t properly filled ?');
|
||||
else
|
||||
{
|
||||
$this->_addLinkHoursDetail($result);
|
||||
|
||||
// Fetch detail info using webservice (not used anymore)
|
||||
// $this->_generateLinkHoursDetail($result);
|
||||
// $result = (count($relayDetail['success'])) ? $relayDetail['success'] : $result;
|
||||
}
|
||||
$success = $result;
|
||||
}
|
||||
$this->_resultList['error'] = $errors;
|
||||
@@ -251,4 +294,4 @@ class MRGetRelayPoint implements IMondialRelayWSMethod
|
||||
{
|
||||
return $this->_resultList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,9 @@ class MRManagement extends MondialRelay
|
||||
FROM `' . _DB_PREFIX_ . 'mr_selected`
|
||||
WHERE `id_cart` = '.(int)$this->_params['id_cart'];
|
||||
|
||||
// Not exist and needed for database
|
||||
unset($this->_params['relayPointInfo']['permaLinkDetail']);
|
||||
|
||||
// Update if Exist else add a new entry
|
||||
if (Db::getInstance()->getRow($query))
|
||||
{
|
||||
|
||||
+274
@@ -0,0 +1,274 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 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/afl-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-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 8783 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Interface
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/IMondialRelayWSMethod.php');
|
||||
|
||||
/*
|
||||
* Allow to retrieve relay point details - 'WSI2_DetailPointRelais'
|
||||
*/
|
||||
class MRRelayDetail implements IMondialRelayWSMethod
|
||||
{
|
||||
private $_fields = array(
|
||||
'list' => array(
|
||||
'Enseigne' => array(
|
||||
'required' => true,
|
||||
'value' => '',
|
||||
'regexValidation' => '#^[0-9A-Z]{2}[0-9A-Z ]{6}$#'),
|
||||
'Num' => array(
|
||||
'required' => true,
|
||||
'value' => '',
|
||||
'regexValidation' => '#^[0-9]{6}$#'),
|
||||
'Pays' => array(
|
||||
'required' => true,
|
||||
'value' => '',
|
||||
'regexValidation' => '#^[A-Z]{2}$#'),
|
||||
'Security' => array(
|
||||
'required' => true,
|
||||
'value' => '',
|
||||
'regexValidation' => '#^[0-9A-Z]{32}$#')));
|
||||
|
||||
private $_relayPointNumList = array();
|
||||
private $_id_address_delivery = 0;
|
||||
private $_webServiceKey = '';
|
||||
private $_mondialRelay = NULL;
|
||||
private $_markCode = '';
|
||||
|
||||
private $_resultList = array(
|
||||
'error' => array(),
|
||||
'success' => array());
|
||||
|
||||
private $_webserviceURL = 'http://www.mondialrelay.fr/webservice/Web_Services.asmx?WSDL';
|
||||
|
||||
public function __construct($params)
|
||||
{
|
||||
$this->_relayPointNumList = $params['relayPointNumList'];
|
||||
$this->_id_address_delivery = (int)($params['id_address_delivery']);
|
||||
$this->_webServiceKey = Configuration::get('MR_KEY_WEBSERVICE');
|
||||
$this->_markCode = Configuration::get('MR_CODE_MARQUE');
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->_mondialRelay);
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->_mondialRelay = new MondialRelay();
|
||||
$address = new Address($this->_id_address_delivery);
|
||||
|
||||
if (!$address)
|
||||
throw new Exception($this->_mondialrelay->l('Customer address can\'t be found'));
|
||||
|
||||
$this->_fields['list']['Enseigne']['value'] = Configuration::get('MR_ENSEIGNE_WEBSERVICE');
|
||||
$this->_fields['list']['Pays']['value'] = Country::getIsoById($address->id_country);
|
||||
|
||||
foreach ($this->_relayPointNumList as $num)
|
||||
{
|
||||
// Storage temporary
|
||||
$base = $this->_fields;
|
||||
$tmp = &$base['list'];
|
||||
|
||||
$tmp['Num']['value'] = $num;
|
||||
$this->_fieldsList[] = $base;
|
||||
}
|
||||
$this->_generateMD5SecurityKey();
|
||||
unset($address);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate the MD5 key for each param list
|
||||
*/
|
||||
private function _generateMD5SecurityKey()
|
||||
{
|
||||
// RootCase is the array case where the main information are stored
|
||||
// it's an array containing id_mr_selected and an array with the necessary fields
|
||||
foreach($this->_fieldsList as &$rootCase)
|
||||
{
|
||||
$concatenationValue = '';
|
||||
foreach($rootCase['list'] as $paramName => &$valueDetailed)
|
||||
if ($paramName != 'Texte' && $paramName != 'Security')
|
||||
{
|
||||
// Mac server make an empty string instead of a cleaned string
|
||||
// TODO : test on windows and linux server
|
||||
$cleanedString = MRTools::replaceAccentedCharacters($valueDetailed['value']);
|
||||
$valueDetailed['value'] = !empty($cleanedString) ? strtoupper($cleanedString) : strtoupper($valueDetailed['value']);
|
||||
|
||||
// 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']))
|
||||
$concatenationValue .= $valueDetailed['value'];
|
||||
// Use simple Regex test given by MondialRelay
|
||||
else if (isset($valueDetailed['regexValidation']) &&
|
||||
preg_match($valueDetailed['regexValidation'], $valueDetailed['value'], $matches))
|
||||
$concatenationValue .= $valueDetailed['value'];
|
||||
// If the key is required, we set an error, else it's skipped
|
||||
else if ((!strlen($valueDetailed['value']) && $valueDetailed['required']) || strlen($valueDetailed['value']))
|
||||
{
|
||||
if (empty($valueDetailed['value']))
|
||||
$error = $this->_mondialRelay->l('This key').' ['.$paramName.'] '.$this->_mondialRelay->l('is empty and need to be filled');
|
||||
else
|
||||
$error = 'This key ['.$paramName.'] hasn\'t a valid value format : '.$valueDetailed['value'];
|
||||
$this->_resultList['error'][$rootCase['list']['Num']['value']] = $error;
|
||||
}
|
||||
}
|
||||
$concatenationValue .= $this->_webServiceKey;
|
||||
$rootCase['list']['Security']['value' ] = strtoupper(md5($concatenationValue));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the values with associated fields name
|
||||
* @fields : array containing multiple values information
|
||||
*/
|
||||
private function _getSimpleParamArray($fields)
|
||||
{
|
||||
$params = array();
|
||||
|
||||
foreach($fields as $keyName => $valueDetailed)
|
||||
$params[$keyName] = $valueDetailed['value'];
|
||||
return $params;
|
||||
}
|
||||
|
||||
/*
|
||||
* Manage the return value of the webservice, handle the errors or build the
|
||||
* succeed message
|
||||
*/
|
||||
private function _parseResult($client, $result, $params)
|
||||
{
|
||||
$errors = array();
|
||||
|
||||
if ($client->fault)
|
||||
$errors[$errorTotal++] = $this->_mondialRelay->l('It seems the request isn\'t valid:').
|
||||
$result;
|
||||
$result = $result['WSI2_DetailPointRelaisResult'];
|
||||
if (($errorNumber = $result['STAT']) != 0)
|
||||
{
|
||||
$errors[] = $this->_mondialRelay->l('There is an error number : ').$errorNumber;
|
||||
$errors[] = $this->_mondialRelay->l('Details : ').
|
||||
$this->_mondialRelay->getErrorCodeDetail($errorNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
$HDayList = array(
|
||||
'Horaires_Lundi' => $this->_mondialRelay->l('Monday'),
|
||||
'Horaires_Mardi' => $this->_mondialRelay->l('Tuesday'),
|
||||
'Horaires_Mercredi' => $this->_mondialRelay->l('Wednesday'),
|
||||
'Horaires_Jeudi' => $this->_mondialRelay->l('Thursday'),
|
||||
'Horaires_Vendredi' => $this->_mondialRelay->l('Friday'),
|
||||
'Horaires_Samedi' => $this->_mondialRelay->l('Saturday'),
|
||||
'Horaires_Dimanche' => $this->_mondialRelay->l('Sunday'));
|
||||
|
||||
$orderedDate = array();
|
||||
// Format hour properly
|
||||
$priority = 0;
|
||||
foreach($HDayList as $day => $tradDayName)
|
||||
{
|
||||
foreach($result[$day]['string'] as $num => &$value)
|
||||
if ($value == '0000')
|
||||
$value = '';
|
||||
else
|
||||
$value = implode('h', str_split($value, 2));
|
||||
$orderedDate[$priority++] = array('name' => $tradDayName, 'list' => $result[$day]);
|
||||
unset($result[$day]);
|
||||
}
|
||||
$result['orderedDate'] = $orderedDate;
|
||||
$this->_resultList['success'][$result['Num']] = $result;
|
||||
}
|
||||
$this->_resultList['error'][] = $errors;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send one or multiple request to the webservice
|
||||
*/
|
||||
public function send()
|
||||
{
|
||||
if ($client = new nusoap_client($this->_webserviceURL, true))
|
||||
{
|
||||
$client->soap_defencoding = 'UTF-8';
|
||||
$client->decode_utf8 = false;
|
||||
|
||||
foreach($this->_fieldsList as $rootCase)
|
||||
{
|
||||
$params = $this->_getSimpleParamArray($rootCase['list']);
|
||||
$result = $client->call(
|
||||
'WSI2_DetailPointRelais',
|
||||
$params,
|
||||
'http://www.mondialrelay.fr/webservice/',
|
||||
'http://www.mondialrelay.fr/webservice/WSI2_GetEtiquettes');
|
||||
|
||||
$this->_parseResult($client, $result, $params);
|
||||
}
|
||||
unset($client);
|
||||
}
|
||||
else
|
||||
throw new Exception($this->_mondialRelay->l('The Mondial Relay webservice isn\'t currently reliable'));
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate a list of perma link
|
||||
*/
|
||||
static public function getPermaLink($relayList, $id_address_delivery)
|
||||
{
|
||||
if (!($address = new Address($id_address_delivery)))
|
||||
return array();
|
||||
|
||||
$permaList = array();
|
||||
$iso = strtoupper(Country::getIsoById($address->id_country));
|
||||
$ens = strtoupper(Configuration::get('MR_ENSEIGNE_WEBSERVICE').Configuration::get('MR_CODE_MARQUE'));
|
||||
$url = 'http://www.mondialrelay.com/public/permanent/details_relais.aspx?ens='.
|
||||
Configuration::get('MR_ENSEIGNE_WEBSERVICE').Configuration::get('MR_CODE_MARQUE');
|
||||
foreach($relayList as $num => $relayNum)
|
||||
{
|
||||
$crc = strtoupper(MD5('<'.$ens.'>'.$relayNum.$iso.'<'.Configuration::get('MR_KEY_WEBSERVICE').'>'));
|
||||
$permaList[$relayNum] = $url.'&num='.$relayNum.'&pays='.$iso.'&crc='.$crc;
|
||||
}
|
||||
unset($address);
|
||||
return $permaList;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the values with associated fields name
|
||||
*/
|
||||
public function getFieldsList()
|
||||
{
|
||||
return $this->_fieldsList['list'];
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the result of one or multiple send request
|
||||
*/
|
||||
public function getResult()
|
||||
{
|
||||
return $this->_resultList;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>mondialrelay</name>
|
||||
<displayName><![CDATA[Mondial Relay]]></displayName>
|
||||
<version><![CDATA[1.7.5]]></version>
|
||||
<version><![CDATA[1.7.6]]></version>
|
||||
<description><![CDATA[Deliver in Relay points]]></description>
|
||||
<author><![CDATA[]]></author>
|
||||
<tab><![CDATA[shipping_logistics]]></tab>
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_a25569b97604bddcfba04d7eb9950eeb'] = 'Pour générer des étiquettes, vous devez inscrire une adresse correcte pour votre boutique sur ';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_3d2da0d2e731d59465a92f13216cf82d'] = 'La page de contact';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_de21dc13e1ea638777fbfad49f88b332'] = 'Toutes les commandes qui auront un status';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_d1908b9b04e81c4b6112e38b608c49af'] = 'Merci de bien vouloir corriger les erreurs suivantes dans';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_ccce63109db30895153094de05c60fa5'] = 'la page de contact';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_de21dc13e1ea638777fbfad49f88b332'] = 'Toutes les commandes qui auront un statut';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_a0bf3c9ac2d785f053d883b8746e91ba'] = 'seront disponibles pour la création d\'ètiquette';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_2345e28c9b93f368968be4781ed70f5c'] = 'Changer la configuration';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_37c85a61df6352af7285c307022c4413'] = 'Aucune commande n\'existe avec ce status';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_37c85a61df6352af7285c307022c4413'] = 'Aucune commande n\'existe avec ce statut';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_d79cf3f429596f77db95c65074663a54'] = 'Identifiant de la commande';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_ce26601dac0dea138b7295f02b7620a7'] = 'Client';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_0eede552438475bdfe820c13f24c9399'] = 'Prix total';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_f4e8b53a114e5a17d051ab84d326cae5'] = 'Total frais d\'expédition';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_44749712dbec183e983dcd78a7736c41'] = 'Date';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_3715c824cbc0f966c61a72254f248a2e'] = 'Mettez un poids (grammes)';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_5635c2608fff4c95a564aea8c6118b8c'] = 'Inverser la sélection';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_6ccc0fdff9995e1a0fce00c99e5b6085'] = 'Numéro MR';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_f9c50cba4de9032d7a6797a2458f8ed9'] = 'Pays MR';
|
||||
$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_428c091372d840900cf8536519fa0056'] = 'Numéro d\'expedition';
|
||||
@@ -48,7 +48,7 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_cb5e100e5a9a3e7f6d1fd9751221528
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_350c1cc4343826a89f08a33bb49c6d98'] = 'Configuration du Module Mondial Relay';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_d21a9f93917604d5490ad529a7cf1ff9'] = 'Pour créer un transporteur Mondial Relay';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_c6a2e6af5fff47adb3afd780b97d9b4b'] = 'Remplissez et sauvegarder vos paramètres Mondial Relay';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_94fbe32464fcfa902feed9f256439833'] = 'Créer un transporteur utilisant le formulaire \"ajouter un transporteur\" ci-dessous';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_94fbe32464fcfa902feed9f256439833'] = 'Créez un transporteur via le formulaire ‘’ajouter un transporteur’’ ci-dessous';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_b962d8fb95f5a439f50502152f3bad71'] = 'Definissez un prix pour votre transporteur sur';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_faf1247ae6846a9955a466d4f301bbe4'] = 'La page Transporteurs';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_10d78806b84b97ebc774e9f6277af6ac'] = 'Pour générer vos étiquettes, vous devez avoir enregistré une adresse valide de votre boutique sur votre';
|
||||
@@ -77,9 +77,9 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_0309a6c666a7a803fdb9db95de71cf0
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_6c1674d14bf5f95742f572cddb0641a7'] = 'Belgique';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_06630c890abadde9228ea818ce52b621'] = 'Luxembourg';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_907eba32d950bfab68227fd7ea22999b'] = 'Espagne';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_0c24ec05a02c710cedd400e3680d8b81'] = 'Liste des tranporteurs';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_0c24ec05a02c710cedd400e3680d8b81'] = 'Liste des transporteurs';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_14039af96b01e718a9c9d9c1259b6472'] = 'Aucun transporteur créé';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_8596361cec00f8d2438d264827eee737'] = 'Modification de la configuration';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_8596361cec00f8d2438d264827eee737'] = 'Modifier les paramètres de ce transporteur';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_9ffc3ccc968a96d902af963c6d7b4e97'] = 'Paramètres avancés';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_1d1d57f5840e1da871622295ba206b30'] = 'Cliquez pour afficher / cacher les options';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_fcf5b2122da1d5a5f5c7253b96a3f9d9'] = 'URL de la tache CRON à lancer pour la mise à jour des statuts de commandes';
|
||||
@@ -110,10 +110,12 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_bba366864d25056c941b72f18ef79e7
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_e0626222614bdee31951d84c64e5e9ff'] = 'Choisir';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_91b442d385b54e1418d81adc34871053'] = 'Sélectionné';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_ef2a1f426c2c289ed5986c7636a5d696'] = 'Merci de choisir un point relay';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_80a0c205cd57b22fca7f174253870300'] = 'Heures d\'ouvertures';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_2b56b60f878922093facd42284848a0c'] = 'Plus de détails';
|
||||
$_MODULE['<{mondialrelay}prestashop>orderdetail_81b7b4587a2a3ea7a0d6bb1df3fbba54'] = 'Livraison à';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_a1c3470a944b9625cfb924fd15c8bdbf'] = 'Veuillez choisir au moins une commande';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_dc41aac14af17f1d19fca5e3b9439e74'] = 'Cette clé';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_306b346c19017609403424203ea3d720'] = 'est vide et doit être rensignée';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_306b346c19017609403424203ea3d720'] = 'est vide et doit être renseignée';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_e6940b76f045c8bc0aaaa5b2476cdaf7'] = 'Il semble que la requête ne soit pas valide';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_c9b4de92f371ae545ad6f051c07d58ca'] = 'Erreur numéro :';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_ea5f761be4e4888eabf4e1501d7817d1'] = 'Détails :';
|
||||
@@ -121,6 +123,14 @@ $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_eabb11bf9623f08409a0a4c9d035
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_b92c3d3319314513c547675924ceecd1'] = 'URL du Ticket :';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_66b793b6b4125e300717e8cf7449f533'] = 'Url de Tracking :';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_2653c23b8c0daac59571e4be5e8fa7d0'] = 'Le webservice Mondial Relay est actuellement innaccessible.';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_26b6b6eaec970108c5e84286159fbf48'] = 'Merci de vérifier la configuration de votre langue';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_557595c2e17c9948a9448eb763ac1a88'] = 'Merci de vérifier la configuration de votre nom de boutique';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_017ca6b770ad53669a4eec82894dfcd3'] = 'Merci de vérifier la configuration de votre adresse 1';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_3f79e1fc66b4f9cca7bd68cab176020d'] = 'Merci de vérifier la configuration de votre ville';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_404665d9b65239985d59b30b3dcb26b5'] = 'Merci de vérifier la configuration de votre code postal';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_0b8a30478b9572b86718989d483fd88d'] = 'Merci de vérifier la configuration de votre pays';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_7ddf2d94bf037b7d1088c0600ea589c3'] = 'Merci de vérifier la configuration de votre téléphone';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_9c7ce7be9a2c593b24d448edb4f804e0'] = 'Merci de vérifier la configuration de votre email';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrgetrelaypoint_14288d48d107056c1acf8aaae1bf282b'] = 'L\'adresse du client ne peut etre trouvé';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrgetrelaypoint_dc41aac14af17f1d19fca5e3b9439e74'] = 'Cette clé';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrgetrelaypoint_135a7b9a62531e066a95093d8951b344'] = 'n\'a pas un format valide';
|
||||
@@ -142,3 +152,17 @@ $_MODULE['<{mondialrelay}prestashop>mrmanagement_0b7f47fce1d82d53244771c64b1535c
|
||||
$_MODULE['<{mondialrelay}prestashop>mrmanagement_ea4788705e6873b424c65e91c2846b19'] = 'Annuler';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrmanagement_a42bb0eaa485682166770a54469385f6'] = 'Certaines étiquettes ne peuvent pas être supprimées : veuillez réessayer un peu plus tard.';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrmanagement_11744bfebb33e52be37a66a530b7045d'] = 'Veuillez choisir au moins un élèment de l\'historique';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_14288d48d107056c1acf8aaae1bf282b'] = 'L\'adresse du client ne peut être trouvé';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_dc41aac14af17f1d19fca5e3b9439e74'] = 'Cette clé';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_306b346c19017609403424203ea3d720'] = 'est vide et doit être renseignée';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_e6940b76f045c8bc0aaaa5b2476cdaf7'] = 'Il semble que la requête ne soit pas valide';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_c9b4de92f371ae545ad6f051c07d58ca'] = 'Erreur numéro :';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_ea5f761be4e4888eabf4e1501d7817d1'] = 'Détails :';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_6f8522e0610541f1ef215a22ffa66ff6'] = 'Lundi';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_5792315f09a5d54fb7e3d066672b507f'] = 'Mardi';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_796c163589f295373e171842f37265d5'] = 'Mercredi';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_78ae6f0cd191d25147e252dc54768238'] = 'Jeudi';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_c33b138a163847cdb6caeeb7c9a126b4'] = 'Vendredi';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_8b7051187b9191cdcdae6ed5a10e5adc'] = 'Samedi';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_9d1a0949c39e66a0cd65240bc0ac9177'] = 'Dimanche';
|
||||
$_MODULE['<{mondialrelay}prestashop>mrrelaydetail_2653c23b8c0daac59571e4be5e8fa7d0'] = 'Le webservice Mondial Relay est actuellement innaccessible.';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var toggle_status_order_list = false;
|
||||
var toggle_history_order_list = false;
|
||||
var relay_point_max = 10;
|
||||
var last_gmap_info_clicked = '';
|
||||
|
||||
// /!\ All the following list data could be store into the same variable
|
||||
// But for a better reading of the code, there are separated
|
||||
@@ -665,7 +666,7 @@ function PS_MRGmapResizeEvent($map)
|
||||
** Move the view of the gmap to a marker
|
||||
** liable to the relay point
|
||||
*/
|
||||
function PS_MRGmapPlaceViewOnMarker($map, marker)
|
||||
function PS_MRGmapPlaceViewOnMarker($map, marker, relayNum)
|
||||
{
|
||||
$map.gmap3(
|
||||
{
|
||||
@@ -673,6 +674,7 @@ function PS_MRGmapPlaceViewOnMarker($map, marker)
|
||||
args:[marker.position],
|
||||
callback: function()
|
||||
{
|
||||
PS_MRDisplayClickedGmapWindow(marker, relayNum, $map);
|
||||
(function(m)
|
||||
{
|
||||
setTimeout(function()
|
||||
@@ -713,7 +715,7 @@ function PS_MRDisplayGmap(contentBlockid, $map)
|
||||
$('#PS_MRGmap_' + id_carrier).slideDown('fast', function()
|
||||
{
|
||||
PS_MRGmapResizeEvent($map);
|
||||
PS_MRGmapPlaceViewOnMarker($map, markerList[id_carrier][relayPointNumber]);
|
||||
PS_MRGmapPlaceViewOnMarker($map, markerList[id_carrier][relayPointNumber], relayPointNumber);
|
||||
});
|
||||
}
|
||||
else
|
||||
@@ -727,13 +729,60 @@ function PS_MRDisplayGmap(contentBlockid, $map)
|
||||
$('#' + contentBlockid).after($(this));
|
||||
$('#PS_MRGmap_' + id_carrier).slideDown('fast', function()
|
||||
{
|
||||
PS_MRGmapPlaceViewOnMarker($map, markerList[id_carrier][relayPointNumber]);
|
||||
PS_MRGmapPlaceViewOnMarker($map, markerList[id_carrier][relayPointNumber], relayPointNumber);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate an html block to display the opening hours details
|
||||
*/
|
||||
function PS_MRGetTimeRelayDetail(relayInfo)
|
||||
{
|
||||
onClick = 'onClick="PS_MROpenPopupDetail(\'' + relayInfo.permaLinkDetail + '\')"';
|
||||
|
||||
var html = ' \
|
||||
<div class="PS_MRGmapBulbe"> \
|
||||
<img src="' + _PS_MR_MODULE_DIR_ + 'logo_hd.png" width="10%" style="float:left;" /> \
|
||||
<p><b>' + relayInfo.LgAdr1 + '</b><br /> ' + relayInfo.LgAdr3
|
||||
+ ' - ' + relayInfo.CP + ' - ' + relayInfo.Ville
|
||||
+ ' ' + relayInfo.Pays + '</p> \
|
||||
<a href="javascript:void(0)" ' + onClick + '>' + PS_MRTranslationList['moreDetails'] + '</a> \
|
||||
</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
/*
|
||||
** Call a MondialRelay page into a popup
|
||||
*/
|
||||
function PS_MROpenPopupDetail(url)
|
||||
{
|
||||
window.open(url, 'MondialRelay',
|
||||
'height=200, width=400, top=100, left=100, toolbar=no, menubar=yes, \
|
||||
location=no, resizable=yes, scrollbars=no, status=no');
|
||||
}
|
||||
|
||||
/*
|
||||
** Display the gmap windows selected by the user
|
||||
*/
|
||||
function PS_MRDisplayClickedGmapWindow(marker, relayNum, mapObject)
|
||||
{
|
||||
if (last_gmap_info_clicked.length)
|
||||
{
|
||||
// Close the last opening window in gmap
|
||||
if ((lastWin = mapObject.gmap3({action:'get', name:'infowindow', tag:last_gmap_info_clicked})))
|
||||
lastWin.close();
|
||||
}
|
||||
|
||||
// Open the selected detail window
|
||||
map = mapObject.gmap3('get');
|
||||
if ((currentWindow = mapObject.gmap3({action:'get', name:'infowindow', tag:relayNum})))
|
||||
currentWindow.open(map, marker);
|
||||
last_gmap_info_clicked = relayNum;
|
||||
}
|
||||
|
||||
/*
|
||||
** Add a new Marker to a Gmap for a carrier using the
|
||||
** relay point information
|
||||
@@ -743,20 +792,30 @@ function PS_MRAddGMapMarker(id_carrier, relayPointNumber, contentBlockid)
|
||||
// Check if the gmap has been properly created
|
||||
if (GmapList[id_carrier] == undefined)
|
||||
return ;
|
||||
relayInfo = relayPointDataContainers[relayPointNumber];
|
||||
var relayInfo = relayPointDataContainers[relayPointNumber];
|
||||
var detailContentHtml = PS_MRGetTimeRelayDetail(relayInfo);
|
||||
|
||||
// Add Marker to the map
|
||||
fullFormatedAddress = relayInfo.LgAdr1 + ' ' + relayInfo.LgAdr3 + ' ' +
|
||||
var fullFormatedAddress = relayInfo.LgAdr1 + ' ' + relayInfo.LgAdr3 + ' ' +
|
||||
relayInfo.CP + ' ' + relayInfo.Ville + ' ' + relayInfo.Pays;
|
||||
GmapList[id_carrier].gmap3(
|
||||
{
|
||||
action: 'addMarker',
|
||||
address: fullFormatedAddress,
|
||||
tag:relayInfo.Num,
|
||||
map:
|
||||
{
|
||||
center: true,
|
||||
zoom: 14
|
||||
},
|
||||
marker: {
|
||||
events:
|
||||
{
|
||||
click:function(marker, event, data)
|
||||
{
|
||||
PS_MRDisplayClickedGmapWindow(marker, relayInfo.Num, $(this));
|
||||
}
|
||||
},
|
||||
callback: function(marker)
|
||||
{
|
||||
if (marker)
|
||||
@@ -776,6 +835,18 @@ function PS_MRAddGMapMarker(id_carrier, relayPointNumber, contentBlockid)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
infowindow:
|
||||
{
|
||||
options: {content:detailContentHtml},
|
||||
tag:relayInfo.Num,
|
||||
callback: function() {
|
||||
// To avoid any bug, foreach anytime the elements and try to close them
|
||||
var windowList = $(this).gmap3({action:'get', name:'infowindow', all:true});
|
||||
for (var x in windowList)
|
||||
windowList[x].close();
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,8 @@
|
||||
PS_MRTranslationList['Select'] = "{l s='Select' mod='mondialrelay'}";
|
||||
PS_MRTranslationList['Selected'] = "{l s='Selected' mod='mondialrelay'}";
|
||||
PS_MRTranslationList['errorSelection'] = "{l s='Please choose a relay point' mod='mondialrelay'}";
|
||||
PS_MRTranslationList['openingRelay'] = "{l s='Opening hours' mod='mondialrelay'}";
|
||||
PS_MRTranslationList['moreDetails'] = "{l s='More details' mod='mondialrelay'}";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="{$new_base_dir}mondialrelay.js"></script>
|
||||
|
||||
@@ -96,8 +96,7 @@ div#PS_MRUnRemovedItem
|
||||
}
|
||||
|
||||
.shippingList {
|
||||
width: 400px;
|
||||
float: right;
|
||||
|
||||
}
|
||||
.shippingList li {
|
||||
margin: 5px;
|
||||
@@ -326,3 +325,18 @@ div#PS_MRPersonalizedFields
|
||||
}
|
||||
.clearfix:after {clear: both}
|
||||
.clearfix {zoom: 1}
|
||||
|
||||
.PS_MRGmapBulbe
|
||||
{
|
||||
width:405px;
|
||||
height:66px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.MR_date {width:450px;position:relative;float:right; line-height: 9px;}
|
||||
.MR_date span.titre {margin-left:50px;font-weight:bold;}
|
||||
.MR_date span.vacances {margin-left:5px;color:Red; }
|
||||
.MR_date table {border-spacing:3px;font-size:11pt; border: solid 1px #eee;}
|
||||
.MR_date tr.p {background-color:#e9e9e9; height:9px;}
|
||||
.MR_date td.g {font-weight:bold;}
|
||||
.MR_date td.d {}
|
||||
|
||||
Reference in New Issue
Block a user