[-] MO : Mondialrelay, merge 1.4 => 1.5

This commit is contained in:
vSchoener committed 2011-12-05 10:46:33 +00:00
1 parent 62e51a9b44
commit 8e8fcd3dfd
5 files changed
+161 -101

No files matched your search

@@ -286,8 +286,7 @@ class MRCreateTickets implements IMondialRelayWSMethod
$this->_fields['list']['Expe_Pays']['value'] = Country::getIsoById(Configuration::get('PS_SHOP_COUNTRY_ID')); $this->_fields['list']['Expe_Pays']['value'] = Country::getIsoById(Configuration::get('PS_SHOP_COUNTRY_ID'));
else else
$this->_fields['list']['Expe_Pays']['value'] = substr(Configuration::get('PS_SHOP_COUNTRY'), 0, 2); $this->_fields['list']['Expe_Pays']['value'] = substr(Configuration::get('PS_SHOP_COUNTRY'), 0, 2);
$this->_fields['list']['Expe_Tel1']['value'] = str_replace(array('.', ' ', '-', '_'), '', Configuration::get('PS_SHOP_PHONE'));
$this->_fields['list']['Expe_Tel1']['value'] = str_replace(array('.', ' ', '-'), '', Configuration::get('PS_SHOP_PHONE'));
$this->_fields['list']['Expe_Mail']['value'] = Configuration::get('PS_SHOP_EMAIL'); $this->_fields['list']['Expe_Mail']['value'] = Configuration::get('PS_SHOP_EMAIL');
$this->_fields['list']['NbColis']['value'] = 1; $this->_fields['list']['NbColis']['value'] = 1;
$this->_fields['list']['CRT_Valeur']['value'] = 0; $this->_fields['list']['CRT_Valeur']['value'] = 0;
@@ -331,15 +330,15 @@ class MRCreateTickets implements IMondialRelayWSMethod
$tmp['NDossier']['value'] = $orderDetail['id_order']; $tmp['NDossier']['value'] = $orderDetail['id_order'];
$tmp['NClient']['value'] = $orderDetail['id_customer']; $tmp['NClient']['value'] = $orderDetail['id_customer'];
$tmp['Dest_Langage']['value'] = 'FR'; //Language::getIsoById($orderDetail['id_lang']); $tmp['Dest_Langage']['value'] = 'FR'; //Language::getIsoById($orderDetail['id_lang']);
$tmp['Dest_Ad1']['value'] = $deliveriesAddress->firstname.' '.$deliveriesAddress->lastname; $tmp['Dest_Ad1']['value'] = substr($deliveriesAddress->firstname.' '.$deliveriesAddress->lastname, 0, 32);;
$tmp['Dest_Ad2']['value'] = $deliveriesAddress->address2; $tmp['Dest_Ad2']['value'] = substr($deliveriesAddress->address2, 0, 32);
$tmp['Dest_Ad3']['value'] = $deliveriesAddress->address1; $tmp['Dest_Ad3']['value'] = substr($deliveriesAddress->address1, 0, 32);
$tmp['Dest_Ville']['value'] = $deliveriesAddress->city; $tmp['Dest_Ville']['value'] = $deliveriesAddress->city;
$tmp['Dest_CP']['value'] = $deliveriesAddress->postcode; $tmp['Dest_CP']['value'] = $deliveriesAddress->postcode;
$tmp['Dest_CP']['params']['id_country'] = $deliveriesAddress->id_country; $tmp['Dest_CP']['params']['id_country'] = $deliveriesAddress->id_country;
$tmp['Dest_Pays']['value'] = $destIsoCode; $tmp['Dest_Pays']['value'] = $destIsoCode;
$tmp['Dest_Tel1']['value'] = $deliveriesAddress->phone; $tmp['Dest_Tel1']['value'] = str_replace(array('.', ' ', '-', '_'), '', $deliveriesAddress->phone);
$tmp['Dest_Tel2']['value'] = $deliveriesAddress->phone_mobile; $tmp['Dest_Tel2']['value'] = str_replace(array('.', ' ', '-', '_'), '', $deliveriesAddress->phone_mobile);
$tmp['Dest_Mail']['value'] = $customer->email; $tmp['Dest_Mail']['value'] = $customer->email;
$tmp['Assurance']['value'] = $orderDetail['mr_ModeAss']; $tmp['Assurance']['value'] = $orderDetail['mr_ModeAss'];
if ($orderDetail['MR_Selected_Num'] != 'LD1' && $orderDetail['MR_Selected_Num'] != 'LDS') if ($orderDetail['MR_Selected_Num'] != 'LD1' && $orderDetail['MR_Selected_Num'] != 'LDS')
+113 -42
View File
@@ -1,7 +1,7 @@
/* /*
* GMAP3 Plugin for JQuery * GMAP3 Plugin for JQuery
* Version : 4.0 * Version : 4.1
* Date : 2011-08-23 * Date : 2011-11-18
* Licence : GPL v3 : http://www.gnu.org/licenses/gpl.html * Licence : GPL v3 : http://www.gnu.org/licenses/gpl.html
* Author : DEMONTE Jean-Baptiste * Author : DEMONTE Jean-Baptiste
* Contact : jbdemonte@gmail.com * Contact : jbdemonte@gmail.com
@@ -386,7 +386,7 @@
return markers[i]; return markers[i];
} }
this.clusters = function(map, radius, force){ this.clusters = function(map, radius, maxZoom, force){
var proj = map.getProjection(), var proj = map.getProjection(),
nwP = proj.fromLatLngToPoint( nwP = proj.fromLatLngToPoint(
new google.maps.LatLng( new google.maps.LatLng(
@@ -403,12 +403,14 @@
cluster, cluster,
chk, chk,
lat, lng, keys, cnt, lat, lng, keys, cnt,
bounds = map.getBounds(); bounds = map.getBounds(),
noClusters = maxZoom && (maxZoom <= map.getZoom()),
chkContain = map.getZoom() > 2;
cnt = 0; cnt = 0;
keys = {}; keys = {};
for(i = 0; i < markers.length; i++){ for(i = 0; i < markers.length; i++){
if (!bounds.contains(markers[i].latLng)){ if (chkContain && !bounds.contains(markers[i].latLng)){
continue; continue;
} }
p = proj.fromLatLngToPoint(markers[i].latLng); p = proj.fromLatLngToPoint(markers[i].latLng);
@@ -420,7 +422,7 @@
cnt++; cnt++;
} }
// check if visible markers have changed // check if visible markers have changed
if (!force){ if (!force && !noClusters){
for(k = 0; k < latest.length; k++){ for(k = 0; k < latest.length; k++){
if( k in keys ){ if( k in keys ){
cnt--; cnt--;
@@ -466,6 +468,10 @@
lng = pos[i][1]; lng = pos[i][1];
saved = null; saved = null;
if (noClusters){
saved = {lat:lat, lng:lng, idx:[i]};
} else {
do{ do{
cluster = {lat:0, lng:0, idx:[]}; cluster = {lat:0, lng:0, idx:[]};
for(k2 = k; k2<keys.length; k2++){ for(k2 = k; k2<keys.length; k2++){
@@ -498,6 +504,7 @@
lng = Math.floor((p.y - nwP.y) * Math.pow(2, z)); lng = Math.floor((p.y - nwP.y) * Math.pow(2, z));
} }
} while(chk); } while(chk);
}
for(k2 = 0; k2 < saved.idx.length; k2++){ for(k2 = 0; k2 < saved.idx.length; k2++){
if (saved.idx[k2] in unik){ if (saved.idx[k2] in unik){
@@ -946,14 +953,14 @@
} }
} }
/** /**
* returns the geographical coordinates from an address and call internal method * returns the geographical coordinates from an address and call internal or given method
**/ **/
this._resolveLatLng = function(todo, method, all, attempt){ this._resolveLatLng = function(todo, method, all, attempt){
var address = ival(todo, 'address'), var address = ival(todo, 'address'),
params, params,
that = this; that = this,
fnc = typeof(method) === 'function' ? method : that[method];
if ( address ){ if ( address ){
if (!attempt){ // convert undefined to int if (!attempt){ // convert undefined to int
attempt = 0; attempt = 0;
@@ -967,7 +974,7 @@
params, params,
function(results, status) { function(results, status) {
if (status === google.maps.GeocoderStatus.OK){ if (status === google.maps.GeocoderStatus.OK){
that[method](todo, all ? results : results[0].geometry.location); fnc.apply(that, [todo, all ? results : results[0].geometry.location]);
} else if ( (status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT) && (attempt < _default.queryLimit.attempt) ){ } else if ( (status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT) && (attempt < _default.queryLimit.attempt) ){
setTimeout(function(){ setTimeout(function(){
that._resolveLatLng(todo, method, all, attempt+1); that._resolveLatLng(todo, method, all, attempt+1);
@@ -978,14 +985,41 @@
if (_default.verbose){ if (_default.verbose){
alert('Geocode error : ' + status); alert('Geocode error : ' + status);
} }
that[method](todo, false); fnc.apply(that, [todo, false]);;
} }
} }
); );
} else { } else {
that[method](todo, toLatLng(todo, false, true)); fnc.apply(that, [todo, toLatLng(todo, false, true)]);
}
}
/**
* returns the geographical coordinates from an array of object using "address" and call internal method
**/
this._resolveAllLatLng = function(todo, property, method){
var that = this,
i = -1,
solveNext = function(){
do{
i++;
}while( (i < todo[property].length) && !('address' in todo[property][i]) );
if (i < todo[property].length){
(function(todo){
that._resolveLatLng(
todo,
function(todo, latLng){
todo.latLng = latLng;
solveNext.apply(that, []); // solve next or execute exit method
}
);
})(todo[property][i]);
} else {
that[method](todo);
}
};
solveNext();
} }
},
/** /**
* call a function of framework or google map object of the instance * call a function of framework or google map object of the instance
@@ -1129,7 +1163,7 @@
if (map){ if (map){
delete map; delete map;
} }
this._callback($this, null, todo); this._callback(null, todo);
this._end(); this._end();
} }
@@ -1137,7 +1171,7 @@
* Initialize google.maps.Map object * Initialize google.maps.Map object
**/ **/
this.init = function(todo, internal){ this.init = function(todo, internal){
var o, k; var o, k, opts;
if (map) { // already initialized if (map) { // already initialized
return this._end(); return this._end();
} }
@@ -1177,28 +1211,46 @@
/** /**
* returns address from latlng * returns address from latlng
**/ **/
this.getaddress = function(todo){ this.getaddress = function(todo, attempt){
var latLng = toLatLng(todo, false, true), var latLng = toLatLng(todo, false, true),
address = ival(todo, 'address'), address = ival(todo, 'address'),
params = latLng ? {latLng:latLng} : ( address ? (typeof(address) === 'string' ? {address:address} : address) : null), params = latLng ? {latLng:latLng} : ( address ? (typeof(address) === 'string' ? {address:address} : address) : null),
callback = ival(todo, 'callback'); callback = ival(todo, 'callback'),
that = this;
if (!attempt){ // convert undefined to int
attempt = 0;
}
if (params && typeof(callback) === 'function') { if (params && typeof(callback) === 'function') {
getGeocoder().geocode( getGeocoder().geocode(
params, params,
function(results, status) { function(results, status) {
if ( (status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT) && (attempt < _default.queryLimit.attempt) ){
setTimeout(function(){
that.getaddress(todo, attempt+1);
},
_default.queryLimit.delay + Math.floor(Math.random() * _default.queryLimit.random)
);
} else {
var out = status === google.maps.GeocoderStatus.OK ? results : false; var out = status === google.maps.GeocoderStatus.OK ? results : false;
callback.apply($this, [out, status]); callback.apply($this, [out, status]);
if (!out && _default.verbose){
alert('Geocode error : ' + status);
}
that._end();
}
} }
); );
} } else {
this._end(); this._end();
} }
}
/** /**
* return a route * return a route
**/ **/
this.getroute = function(todo){ this.getroute = function(todo){
var callback = ival(todo, 'callback'); var callback = ival(todo, 'callback'),
that = this;
if ( (typeof(callback) === 'function') && todo.options ) { if ( (typeof(callback) === 'function') && todo.options ) {
todo.options.origin = toLatLng(todo.options.origin, true); todo.options.origin = toLatLng(todo.options.origin, true);
todo.options.destination = toLatLng(todo.options.destination, true); todo.options.destination = toLatLng(todo.options.destination, true);
@@ -1207,25 +1259,29 @@
function(results, status) { function(results, status) {
var out = status == google.maps.DirectionsStatus.OK ? results : false; var out = status == google.maps.DirectionsStatus.OK ? results : false;
callback.apply($this, [out, status]); callback.apply($this, [out, status]);
that._end();
} }
); );
} } else {
this._end(); this._end();
} }
}
/** /**
* return the elevation of a location * return the elevation of a location
**/ **/
this.getelevation = function(todo){ this.getelevation = function(todo){
var fnc, latLng, path, samples, i, var fnc, path, samples, i,
locations = [], locations = [],
callback = ival(todo, 'callback'), callback = ival(todo, 'callback'),
latLng = ival(todo, 'latlng'); latLng = ival(todo, 'latlng'),
that = this;
if (typeof(callback) === 'function'){ if (typeof(callback) === 'function'){
fnc = function(results, status){ fnc = function(results, status){
var out = status === google.maps.ElevationStatus.OK ? results : false; var out = status === google.maps.ElevationStatus.OK ? results : false;
callback.apply($this, [out, status]); callback.apply($this, [out, status]);
that._end();
}; };
if (latLng){ if (latLng){
locations.push(toLatLng(latLng)); locations.push(toLatLng(latLng));
@@ -1252,16 +1308,19 @@
} }
} }
} }
} } else {
this._end(); this._end();
} }
}
/** /**
* return the distance between an origin and a destination * return the distance between an origin and a destination
* *
**/ **/
this.getdistance = function(todo){ this.getdistance = function(todo){
var i, callback = ival(todo, 'callback'); var i,
callback = ival(todo, 'callback'),
that = this;
if ( (typeof(callback) === 'function') && todo.options && todo.options.origins && todo.options.destinations ) { if ( (typeof(callback) === 'function') && todo.options && todo.options.origins && todo.options.destinations ) {
// origins and destinations are array containing one or more address strings and/or google.maps.LatLng objects // origins and destinations are array containing one or more address strings and/or google.maps.LatLng objects
todo.options.origins = array(todo.options.origins); todo.options.origins = array(todo.options.origins);
@@ -1277,8 +1336,11 @@
function(results, status) { function(results, status) {
var out = status == google.maps.DistanceMatrixStatus.OK ? results : false; var out = status == google.maps.DistanceMatrixStatus.OK ? results : false;
callback.apply($this, [out, status]); callback.apply($this, [out, status]);
that._end();
} }
); );
} else {
this._end();
} }
} }
@@ -1336,22 +1398,14 @@
return result; return result;
} }
/**
* Resize map
**/
this.resize = function()
{
google.maps.event.trigger(this.getMap(), 'resize');
}
/** /**
* add markers (without address resolution) * add markers (without address resolution)
**/ **/
this.addmarkers = function(todo){ this.addmarkers = function(todo){
if (ival(todo, 'clusters')){ if (ival(todo, 'clusters')){
this._addclusteredmarkers(todo); this._resolveAllLatLng(todo, 'markers', '_addclusteredmarkers');
} else { } else {
this._addmarkers(todo); this._resolveAllLatLng(todo, 'markers', '_addmarkers');
} }
} }
@@ -1410,6 +1464,7 @@
var clusterer, i, latLng, storeId, var clusterer, i, latLng, storeId,
that = this, that = this,
radius = ival(todo, 'radius'), radius = ival(todo, 'radius'),
maxZoom = ival(todo, 'maxZoom'),
markers = ival(todo, 'markers'), markers = ival(todo, 'markers'),
styles = ival(todo, 'clusters'); styles = ival(todo, 'clusters');
@@ -1431,7 +1486,7 @@
latLng = toLatLng(markers[i]); latLng = toLatLng(markers[i]);
clusterer.add(latLng, markers[i]); clusterer.add(latLng, markers[i]);
} }
storeId = this._initClusters(todo, clusterer, radius, styles); storeId = this._initClusters(todo, clusterer, radius, maxZoom, styles);
} }
this._callback(storeId, todo); this._callback(storeId, todo);
@@ -1439,11 +1494,11 @@
} }
this._initClusters = function(todo, clusterer, radius, styles){ this._initClusters = function(todo, clusterer, radius, maxZoom, styles){
var that = this; var that = this;
clusterer.setRedraw(function(force){ clusterer.setRedraw(function(force){
var same, clusters = clusterer.clusters(map, radius, force); var same, clusters = clusterer.clusters(map, radius, maxZoom, force);
if (clusters){ if (clusters){
same = clusterer.freeDiff(clusters); same = clusterer.freeDiff(clusters);
that._displayClusters(todo, clusterer, clusters, same, styles); that._displayClusters(todo, clusterer, clusters, same, styles);
@@ -1803,7 +1858,6 @@
**/ **/
this.adddirectionsrenderer = function(todo, internal){ this.adddirectionsrenderer = function(todo, internal){
var dr, o = getObject('directionrenderer', todo, 'panelId'); var dr, o = getObject('directionrenderer', todo, 'panelId');
store.rm('directionrenderer');
o.options.map = map; o.options.map = map;
dr = new google.maps.DirectionsRenderer(o.options); dr = new google.maps.DirectionsRenderer(o.options);
if (o.panelId) { if (o.panelId) {
@@ -2029,18 +2083,21 @@
} }
this._getMaxZoom = function(todo, latLng){ this._getMaxZoom = function(todo, latLng){
var callback = ival(todo, 'callback'); var callback = ival(todo, 'callback'),
that = this;
if (callback && typeof(callback) === 'function') { if (callback && typeof(callback) === 'function') {
getMaxZoomService().getMaxZoomAtLatLng( getMaxZoomService().getMaxZoomAtLatLng(
latLng, latLng,
function(result) { function(result) {
var zoom = result.status === google.maps.MaxZoomStatus.OK ? result.zoom : false; var zoom = result.status === google.maps.MaxZoomStatus.OK ? result.zoom : false;
callback.apply($this, [zoom, result.status]); callback.apply($this, [zoom, result.status]);
that._end();
} }
); );
} } else {
this._end(); this._end();
} }
}
/** /**
* modify default values * modify default values
@@ -2056,7 +2113,8 @@
this.autofit = function(todo, internal){ this.autofit = function(todo, internal){
var names, list, obj, i, j, var names, list, obj, i, j,
empty = true, empty = true,
bounds = new google.maps.LatLngBounds(); bounds = new google.maps.LatLngBounds(),
maxZoom = ival(todo, 'maxZoom', null);
names = store.names(); names = store.names();
for(i=0; i<names.length; i++){ for(i=0; i<names.length; i++){
@@ -2088,7 +2146,20 @@
} }
} }
} }
if (!empty){
if (!empty && (!map.getBounds() || !map.getBounds().equals(bounds))){
if (maxZoom !== null){
// fitBouds Callback event => detect zoom level and check maxZoom
google.maps.event.addListenerOnce(
map,
'bounds_changed',
function() {
if (this.getZoom() > maxZoom){
this.setZoom(maxZoom);
}
}
);
}
map.fitBounds(bounds); map.fitBounds(bounds);
} }
if (!internal){ if (!internal){
+16 -16
View File
@@ -512,7 +512,7 @@ function PS_MRDisplayRelayPoint(json, blockContent, carrier_id)
numberDisplayed = 0; numberDisplayed = 0;
// Disable Gmap for IE user // Disable Gmap for IE user
if (!$.browser.msie) // if (!$.browser.msie)
PS_MRCreateGmap(carrier_id); PS_MRCreateGmap(carrier_id);
blockContent.fadeOut('fast', function() blockContent.fadeOut('fast', function()
{ {
@@ -530,26 +530,26 @@ function PS_MRDisplayRelayPoint(json, blockContent, carrier_id)
var classSelection = (PS_MRPreSelectedRelay == json.success[relayPoint].Num) ? var classSelection = (PS_MRPreSelectedRelay == json.success[relayPoint].Num) ?
'PS_MRFloatRelayPointSelected' : 'PS_MRFloatRelayPointSelecteIt'; 'PS_MRFloatRelayPointSelected' : 'PS_MRFloatRelayPointSelecteIt';
$('<div class="PS_MRRelayPointInfo clearfix" id="' + contentBlockid + '"> \ $('<div class="PS_MRRelayPointInfo clearfix" id="' + contentBlockid + '">'
<img src="' + _PS_MR_MODULE_DIR_ + 'logo_hd.png" /> \ + '<img src="' + _PS_MR_MODULE_DIR_ + 'logo_hd.png" />'
<p><b>' + json.success[relayPoint].LgAdr1 + '</b><br /> ' + json.success[relayPoint].LgAdr3 + '<p><b>' + json.success[relayPoint].LgAdr1 + '</b><br /> ' + json.success[relayPoint].LgAdr3
+ ' - ' + json.success[relayPoint].CP + ' - ' + json.success[relayPoint].Ville + ' - ' + json.success[relayPoint].CP + ' - ' + json.success[relayPoint].Ville
+ ' ' + json.success[relayPoint].Pays + '</p> \ + ' ' + json.success[relayPoint].Pays + '</p>'
<div class="' + classSelection + '"> \ + '<div class="' + classSelection + '">'
<a class="PS_MRSelectRelayPointButton">' + BtTranslation + '</a> \ + '<a class="PS_MRSelectRelayPointButton">' + BtTranslation + '</a>'
</div> \ + '</div> \
</div>').appendTo($(this).children('td')); </div>').appendTo($(this).children('td'));
// Store all the object content to prevent an ajax request // Store all the object content to prevent an ajax request
relayPointDataContainers[json.success[relayPoint].Num] = json.success[relayPoint]; relayPointDataContainers[json.success[relayPoint].Num] = json.success[relayPoint];
++numberDisplayed; ++numberDisplayed;
// Display popup for IE user // Display popup for IE user
if (!$.browser.msie) //if (!$.browser.msie)
PS_MRAddGMapMarker(carrier_id, json.success[relayPoint].Num, contentBlockid); PS_MRAddGMapMarker(carrier_id, json.success[relayPoint].Num, contentBlockid);
else /* else
$('#' + contentBlockid).children('p').click(function() { $('#' + contentBlockid).children('p').click(function() {
PS_MROpenPopupDetail(json.success[relayPoint].permaLinkDetail); PS_MROpenPopupDetail(json.success[relayPoint].permaLinkDetail);
}); });*/
} }
} }
PS_MRHandleSelectedRelayPoint(); PS_MRHandleSelectedRelayPoint();
@@ -693,8 +693,8 @@ function PS_MRGmapPlaceViewOnMarker($map, marker, relayNum)
{ {
PS_MRDisplayClickedGmapWindow(marker, relayNum, $map); PS_MRDisplayClickedGmapWindow(marker, relayNum, $map);
// Make dancing markers in Firefox will use the CPU to 100 % // Make dancing markers in Firefox / IE will use the CPU to 50 to 100 % about
if (!$.browser.mozilla) if (!$.browser.msie && !$.browser.mozilla)
(function(m) (function(m)
{ {
setTimeout(function() setTimeout(function()
@@ -723,9 +723,9 @@ function PS_MRStopDancingMarkers(currentMarkerList)
*/ */
function PS_MRDisplayGmap(contentBlockid, $map) function PS_MRDisplayGmap(contentBlockid, $map)
{ {
tab = contentBlockid.split('_'); var tab = contentBlockid.split('_');
relayPointNumber = tab[1]; var relayPointNumber = tab[1];
id_carrier = tab[2]; var id_carrier = tab[2];
// Stop the dancing marker of the current carrier // Stop the dancing marker of the current carrier
PS_MRStopDancingMarkers(markerList[id_carrier]); PS_MRStopDancingMarkers(markerList[id_carrier]);
+26 -19
View File
@@ -194,7 +194,7 @@ class MondialRelay extends Module
!$this->registerHook('updateCarrier') || !$this->registerHook('updateCarrier') ||
!$this->registerHook('newOrder') || !$this->registerHook('newOrder') ||
!$this->registerHook('BackOfficeHeader') || !$this->registerHook('BackOfficeHeader') ||
!$this->registerHook('paymentTop'))) !$this->registerHook('header')))
return false; return false;
if (_PS_VERSION_ >= '1.4' && if (_PS_VERSION_ >= '1.4' &&
@@ -438,7 +438,6 @@ class MondialRelay extends Module
var mrtoken = "'.self::$MRBackToken.'"; var mrtoken = "'.self::$MRBackToken.'";
</script>'; </script>';
return $ret; return $ret;
return $ret;
} }
private function _postValidation() private function _postValidation()
@@ -543,13 +542,6 @@ class MondialRelay extends Module
return $this->display(__FILE__, 'orderDetail.tpl'); return $this->display(__FILE__, 'orderDetail.tpl');
} }
/*
** No need anymore
*/
public function hookProcessCarrier($params)
{
}
/* /*
** Update the carrier id to use the new one if changed ** Update the carrier id to use the new one if changed
*/ */
@@ -600,6 +592,23 @@ class MondialRelay extends Module
return $carriers; return $carriers;
} }
/*
** Added to be used properly with OPC
*/
public function hookHeader($params)
{
if (in_array(basename($_SERVER['SCRIPT_NAME']), array('order-opc.php', 'order.php')))
{
$$this->context->smarty->assign(array(
'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0),
'new_base_dir' => self::$moduleURL,
'MRToken' => self::$MRFrontToken,
'jQueryOverload' => self::getJqueryCompatibility(false)));
return $this->display(__FILE__, 'header.tpl');
}
return '';
}
public function hookextraCarrier($params) public function hookextraCarrier($params)
{ {
global $nbcarriers; global $nbcarriers;
@@ -634,14 +643,9 @@ class MondialRelay extends Module
} }
$preSelectedRelay = $this->getRelayPointSelected($params['cart']->id); $preSelectedRelay = $this->getRelayPointSelected($params['cart']->id);
$this->context->smarty->assign(array( $smarty->assign(array(
'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0),
'new_base_dir' => self::$moduleURL,
'MRToken' => self::$MRFrontToken,
'carriersextra' => $carriersList, 'carriersextra' => $carriersList,
'preSelectedRelay' => isset($preSelectedRelay['MR_selected_num']) ? $preSelectedRelay['MR_selected_num'] : '', 'preSelectedRelay' => isset($preSelectedRelay['MR_selected_num']) ? $preSelectedRelay['MR_selected_num'] : ''));
'jQueryOverload' => self::getJqueryCompatibility(false)
));
return $this->display(__FILE__, 'mondialrelay.tpl'); return $this->display(__FILE__, 'mondialrelay.tpl');
} }
@@ -1133,7 +1137,8 @@ class MondialRelay extends Module
WHERE id_mr_selected=\''.(int)($shipping_number).'\';'; WHERE id_mr_selected=\''.(int)($shipping_number).'\';';
$settings = Db::getInstance()->executeS($query); $settings = Db::getInstance()->executeS($query);
if(!isset($settings[0]['url_suivi']))
return null;
return $settings[0]['url_suivi']; return $settings[0]['url_suivi'];
} }
@@ -1183,7 +1188,8 @@ class MondialRelay extends Module
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)
@@ -1214,7 +1220,8 @@ class MondialRelay extends Module
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)
-17
View File
@@ -26,28 +26,11 @@
{$jQueryOverload} {$jQueryOverload}
<link href="{$new_base_dir}/style.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript"> <script type="text/javascript">
// Global JS Value // Global JS Value
var _PS_MR_MODULE_DIR_ = "{$new_base_dir}";
var mrtoken = "{$MRToken}";
var PS_MROPC = {$one_page_checkout};
var PS_MRTranslationList = new Array();
var PS_MRCarrierMethodList = new Array();
var PS_MRSelectedRelayPoint = {literal}{{/literal}'carrier_id': 0, 'relayPointNum': 0{literal}}{/literal};
var PS_MRPreSelectedRelay = '{$preSelectedRelay}'; var PS_MRPreSelectedRelay = '{$preSelectedRelay}';
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>
<script type="text/javascript" src="{$new_base_dir}mondialrelay.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="{$new_base_dir}js/gmap.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() $(document).ready(function()