fix MR from prod

This commit is contained in:
root 2017-07-19 14:34:05 +02:00
parent 246121bc14
commit 1a975aea61
7 changed files with 188 additions and 76 deletions

View File

@ -54,7 +54,7 @@ function phone_format($phone, $id_country = 8){
// if (($i+1)%2==0) // if (($i+1)%2==0)
// $_phone .= ' '; // $_phone .= ' ';
// } // }
$phone = $_phone; // $phone = $_phone;
// set format // set format
$phone = $prefix . substr($phone, 1); $phone = $prefix . substr($phone, 1);
@ -112,8 +112,8 @@ $sql = '
ON d.`id_order` = o.`id_order` ON d.`id_order` = o.`id_order`
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 -- p.`date_add` > "'.pSQL($last_sync).'" WHERE p.`date_add` > "'.pSQL($last_sync).'"
d.`id_order_detail` IS NOT NULL AND d.`id_order_detail` IS NOT NULL
AND o.`id_order` IS NOT NULL AND o.`id_order` IS NOT NULL
GROUP BY p.`shipping_number` GROUP BY p.`shipping_number`
'; ';
@ -560,28 +560,28 @@ $mr_ftp_conf = Configuration::getMultiple(array(
'MONDIALRELAYWS_FTP_PASSWORD' 'MONDIALRELAYWS_FTP_PASSWORD'
)); ));
// $id_ftp = ftp_connect($mr_ftp_conf['MONDIALRELAYWS_FTP_HOST']); $id_ftp = ftp_connect($mr_ftp_conf['MONDIALRELAYWS_FTP_HOST']);
// if (!ftp_login($id_ftp, $mr_ftp_conf['MONDIALRELAYWS_FTP_LOGIN'], $mr_ftp_conf['MONDIALRELAYWS_FTP_PASSWORD'])) if (!ftp_login($id_ftp, $mr_ftp_conf['MONDIALRELAYWS_FTP_LOGIN'], $mr_ftp_conf['MONDIALRELAYWS_FTP_PASSWORD']))
// die('erreur lors de l\'identification FTP'.chr(10).chr(10)); die('erreur lors de l\'identification FTP'.chr(10).chr(10));
// //activation du mode passif // //activation du mode passif
// // if (!ftp_pasv($id_ftp, true)) // // if (!ftp_pasv($id_ftp, true))
// // die('erreur lors de l\'activation du mode passif'.chr(10).chr(10)); // // die('erreur lors de l\'activation du mode passif'.chr(10).chr(10));
// $repo_dpc = dirname(__FILE__) . '/dpc/'; $repo_dpc = dirname(__FILE__) . '/dpc/';
// $mr_repo_in = 'versmrelay/'; $mr_repo_in = 'versmrelay/';
// //envoie du fichier //envoie du fichier
// $list = scandir($repo_dpc); $list = scandir($repo_dpc);
// foreach($list as $file) foreach($list as $file)
// { {
// if (!preg_match('/^dpc\..+\.txt$/', $file)) if (!preg_match('/^dpc\..+\.txt$/', $file))
// continue; continue;
// if ($file == '.' || $file == '..') if ($file == '.' || $file == '..')
// continue; continue;
// if (!ftp_put ($id_ftp, $mr_repo_in . $file, $repo_dpc . $file, FTP_BINARY)) if (!ftp_put ($id_ftp, $mr_repo_in . $file, $repo_dpc . $file, FTP_BINARY))
// print('erreur lors de l\'ouverture du fichier : ' . $file . chr(10)); print('erreur lors de l\'ouverture du fichier : ' . $file . chr(10));
// else else
// unlink($repo_dpc . $file); unlink($repo_dpc . $file);
// } }
// ftp_close($id_ftp); ftp_close($id_ftp);

View File

@ -85,7 +85,7 @@ foreach ($iterator as $fileinfo) {
LEFT JOIN `' . _DB_PREFIX_ . 'order_state_current` osc LEFT JOIN `' . _DB_PREFIX_ . 'order_state_current` osc
ON osc.`id_order` = d.`id_order` ON osc.`id_order` = d.`id_order`
WHERE s.`expedition_number` IN (' . implode(', ', $expeditions) . ') WHERE s.`expedition_number` IN (' . implode(', ', $expeditions) . ')
AND osc.`id_order_state` IN (2, 3, 12, 13, 17, 25) AND osc.`id_order_state` IN (2, 3, 12, 13, 17)
') as $row) { ') as $row) {
$expedition_shipping[$row['expedition_number']] = $row['shipping_number']; $expedition_shipping[$row['expedition_number']] = $row['shipping_number'];
$expedition_orders[$row['expedition_number']] = (int) $row['id_order']; $expedition_orders[$row['expedition_number']] = (int) $row['id_order'];
@ -173,6 +173,23 @@ foreach ($iterator as $fileinfo) {
} }
} }
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'philea_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
$remaining = array(); $remaining = array();
foreach($order_details as $d) { foreach($order_details as $d) {
if(!in_array($d, $products_sent)) { if(!in_array($d, $products_sent)) {
@ -243,8 +260,14 @@ foreach ($iterator as $fileinfo) {
$content_txt = 'Contenu du colis :'; $content_txt = 'Contenu du colis :';
} }
if((int) $order->id_lang == 3) {
$url = 'http://www.puntopack.es/seguir-mi-envio/?numeroExpedition='.$shipping_number;
} else {
$url = 'http://www.mondialrelay.fr/suivi-de-colis/?numeroExpedition='.$shipping_number;
}
$templateVars = array( $templateVars = array(
'{followup}' => str_replace('@', $shipping_number, $carrier->url), '{followup}' => $url,
'{firstname}' => $customer->firstname, '{firstname}' => $customer->firstname,
'{lastname}' => $customer->lastname, '{lastname}' => $customer->lastname,
'{id_order}' => (int) $order->id, '{id_order}' => (int) $order->id,

View File

@ -811,6 +811,7 @@ var PS_MRObject = (function($, undefined) {
// present everytime in the page. Body is the only one sure. // present everytime in the page. Body is the only one sure.
// It's an hidden block which will be put in the right block when user select his // It's an hidden block which will be put in the right block when user select his
// own carrier // own carrier
return;
$('body').prepend('\ $('body').prepend('\
<tr id="PS_MRGmapDefaultPosition_' + id_carrier + '" class="PS_MRGmapDefaultPosition">\ <tr id="PS_MRGmapDefaultPosition_' + id_carrier + '" class="PS_MRGmapDefaultPosition">\
<td colspan="4"> \ <td colspan="4"> \
@ -1102,10 +1103,10 @@ var PS_MRObject = (function($, undefined) {
MR_carrier = isMRCarrier(MR_idcarrier); MR_carrier = isMRCarrier(MR_idcarrier);
if($('#'+new_element).length > 0) { if($('#'+new_element).length > 0) {
$('#'+new_element).remove(); $('#'+new_element).parent().parent().parent().remove();
if( isMRCarrier(MR_idcarrier)!=false && typeof(MR_carrier) != "undefined" && (MR_carrier.dlv_mode!='LD1' && MR_carrier.dlv_mode!='LDS' && MR_carrier.dlv_mode!='HOM')) { if( isMRCarrier(MR_idcarrier)!=false && typeof(MR_carrier) != "undefined" && (MR_carrier.dlv_mode!='LD1' && MR_carrier.dlv_mode!='LDS' && MR_carrier.dlv_mode!='HOM')) {
$(parent_element).after( $(parent_element).after(
'<tr><td colspan="10" style="border:0;"><div><table width="98%" id="'+new_element+'" class="trMRSelected" style="display:none;"><tr>' '<tr><td colspan="10" style="border:0;height: auto;"><div><table width="98%" id="'+new_element+'" class="trMRSelected" style="display:none;"><tr>'
+ '<td style="border:0;"></td>' + '<td style="border:0;"></td>'
+'</tr></table></div>' +'</tr></table></div>'
+'</td></tr>' +'</td></tr>'
@ -1117,7 +1118,7 @@ var PS_MRObject = (function($, undefined) {
if(typeof(MR_carrier) != "undefined" && (MR_carrier.dlv_mode!='LD1' && MR_carrier.dlv_mode!='LDS' && MR_carrier.dlv_mode!='HOM')) if(typeof(MR_carrier) != "undefined" && (MR_carrier.dlv_mode!='LD1' && MR_carrier.dlv_mode!='LDS' && MR_carrier.dlv_mode!='HOM'))
{ {
$(parent_element).after( $(parent_element).after(
'<tr><td colspan="10" style="border:0;"><div><table width="98%" id="'+new_element+'" class="trMRSelected" style="display:none;"><tr>' '<tr><td colspan="10" style="border:0;height: auto;"><div><table width="98%" id="'+new_element+'" class="trMRSelected" style="display:none;"><tr>'
+ '<td style="border:0;"></td>' + '<td style="border:0;"></td>'
+'</tr></table></div>' +'</tr></table></div>'
+'</td></tr>' +'</td></tr>'

View File

@ -658,7 +658,7 @@ class MondialRelay extends Module
)); ));
return $this->fetchTemplate('/views/templates/front/', 'header_widget'); //return $this->fetchTemplate('/views/templates/front/', 'header_widget');
if (Configuration::get('MONDIAL_RELAY_MODE') == 'widget' && !_PS_MOBILE_) if (Configuration::get('MONDIAL_RELAY_MODE') == 'widget' && !_PS_MOBILE_)
return $this->fetchTemplate('/views/templates/front/', 'header_widget'); return $this->fetchTemplate('/views/templates/front/', 'header_widget');

View File

@ -24,6 +24,94 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<style>
#carrierTable table.trMRSelected td {
background: #f1f1f1;
}
#carrierTable table.trMRSelected tr:first-child td, #carrierTable table.trMRSelected tr:first-child {
display: none !important;
}
#carrierTable table.trMRSelected .PS_MRRelayPointInfo {
margin-top: 10px;
background: #ffffff;
padding: 10px;
}
#carrierTable table.trMRSelected .PS_MRRelayPointInfo img {
max-width: 10%;
margin-right: 10%;
display: block;
float: left;
padding:0px;
height: auto;
}
#carrierTable table.trMRSelected .PS_MRRelayPointInfo p {
width: 80%;
float: left;
}
#carrierTable table.trMRSelected .PS_MRRelayPointInfo div:before {
display: table;
clear: both;
content: " ";
}
#carrierTable table.trMRSelected .PS_MRRelayPointInfo div {
text-align: center;
}
#carrierTable table.trMRSelected .PS_MRRelayPointInfo div a,
#carrierTable table.trMRSelected .PS_MRRelayPointInfo div a.PS_MRSelectRelayPointButton {
display: inline-block;
color: #ffffff;
background: #42b82f;
font-size: 14px;
padding: 10px 20px;
text-decoration: none;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
font-weight: bold;
float: none;
height: auto;
width:auto;
line-height: initial;
margin-top:0;
}
.PS_MRRelayPointInfo .PS_MRFloatRelayPointSelected{
background: none!important;
}
</style>
<script type="text/javascript">
// Global JS Value
var _PS_MR_MODULE_DIR_ = "{$new_base_dir|escape:'htmlall':'UTF-8'}";
var mrtoken = "{$MRToken|escape:'htmlall':'UTF-8'}";
var PS_MRMODE = "{$MR_MONDIAL_RELAY_MODE|escape:'htmlall':'UTF-8'}";
var PS_MROPC = {$one_page_checkout|escape:'htmlall':'UTF-8'};
var PS_MRTranslationList = [];
var PS_MRCarrierMethodList = [];
var PS_MRSelectedRelayPoint = {literal}{{/literal}'carrier_id': 0, 'relayPointNum': 0{literal}}{/literal};
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>
{if isset($addJsInTemplate)}
<!--On charge Google Map API-->
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
{/if}
<!--On charge le widget mondial relay depuis leurs serveurs-->
{if isset($page_name) && $page_name != 'module-mondialrelay-selection'}
<script type="text/javascript" src="{$new_base_dir|escape:'htmlall':'UTF-8'}js/mondialrelay.js"></script>
{/if}
<script type="text/javascript" src="{$new_base_dir|escape:'htmlall':'UTF-8'}js/gmap.js"></script>
<script type="text/javascript"> <script type="text/javascript">
// Global JS Value // Global JS Value
var PS_MRData = {$MR_Data}; var PS_MRData = {$MR_Data};

View File

@ -323,7 +323,7 @@ class AdminPrivateSalesLogistique extends AdminTab {
WHERE l.`id_lang` = '.(int) $cookie->id_lang.' WHERE l.`id_lang` = '.(int) $cookie->id_lang.'
AND c.`id_parent` = 1 AND c.`id_parent` = 1
ORDER BY c.id_category DESC ORDER BY c.id_category DESC
LIMIT 500 LIMIT 3000
'); ');
$ids = array(); $ids = array();
foreach ($categories as $key => $category) { foreach ($categories as $key => $category) {