fix conflict
This commit is contained in:
commit
541a0ed663
@ -33,6 +33,7 @@ if (isset($_GET['getSales'])){
|
||||
|
||||
echo "<thead><tr>
|
||||
<th>ID</th>
|
||||
<th>Categorie</th>
|
||||
<th>Titre</th>
|
||||
<th>Début</th>
|
||||
<th>Fin</th>
|
||||
@ -50,6 +51,7 @@ if (isset($_GET['getSales'])){
|
||||
foreach($sales as $key => $sale) {
|
||||
echo '<tr id="item_'.$sale->id. '">
|
||||
<td>'.$sale->id.'</td>
|
||||
<td>'.$sale->id_category.'</td>
|
||||
<td><strong>'.$sale->title[intval($cookie->id_lang)].'</strong><br/><span style="color:#666; font-style:italic">'.$extrafields[$sale->id][1].'</span></td>
|
||||
<td>'.$sale->date_start.'</td>
|
||||
<td>'.$sale->date_end.'</td>
|
||||
|
@ -108,8 +108,14 @@ $postfields = array(
|
||||
'DATEQ' => date('dmYHis')
|
||||
);
|
||||
|
||||
$authorized_ip = array(
|
||||
'88.163.22.99',
|
||||
'90.63.178.63',
|
||||
);
|
||||
$trame = http_build_query($postfields, '', '&');
|
||||
mail('marion@antadis.com', '[BBB] Envoi trame paiement direct', $trame);
|
||||
if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
|
||||
mail('marion@antadis.com', '[BBB] Envoi paybox direct', $trame);
|
||||
}
|
||||
|
||||
curl_setopt($curl, CURLOPT_POST, true);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
|
||||
@ -125,7 +131,11 @@ $autorisation = explode('AUTORISATION=', $data[5]);
|
||||
$code_reponse = explode('CODEREPONSE=', $data[6]);
|
||||
$commentaire = explode('COMMENTAIRE=', $data[7]);
|
||||
|
||||
mail('marion@antadis.com', '[BBB] Paiement direct reponse globale', $response);
|
||||
$data[7] = utf8_encode($data[7]);
|
||||
|
||||
if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
|
||||
mail('marion@antadis.com', '[BBB] Reponse paybox direct', $response);
|
||||
}
|
||||
|
||||
$error = '';
|
||||
$paybox = new Paybox();
|
||||
@ -147,6 +157,9 @@ $values = array(
|
||||
|
||||
if ((!isset($autorisation[1]) || empty($autorisation[1])))
|
||||
{
|
||||
if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
|
||||
mail('marion@antadis.com', '[BBB] ERREUR Reponse paybox direct', http_build_query($data, '', '&'));
|
||||
}
|
||||
Logger::addLog('No autorisation number', 4);
|
||||
die('No autorisation number');
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
<input type="hidden" name="id_paybox_card" value="{$account.id_paybox_card}"/>
|
||||
</form>
|
||||
</div>
|
||||
<input data-module-name="paybox" type="radio" value="{$base_dir_ssl}modules/paybox/direct_paiement.php?id_paybox_card={$account.id_paybox_card}" name="paiement-method" id="paybox_{$account.id_paybox_card}">
|
||||
<input data-module-name="paybox-direct" type="radio" value="{$base_dir_ssl}modules/paybox/direct_paiement.php?id_paybox_card={$account.id_paybox_card}" name="paiement-method" id="paybox_{$account.id_paybox_card}">
|
||||
<label for="paybox_{$account.id_paybox_card}">{$account.payment_type} {$account.value} - {$account.date_validity}</label>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
@ -86,12 +86,18 @@ if( Configuration::get('PBX_DEMO_MODE') == 0 ) {
|
||||
$params .= " PBX_PAYBOX=https://tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi PBX_BACKUP1=https://tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi";
|
||||
}
|
||||
}
|
||||
mail('marion@antadis.com', '[BBB] Envoi param paiement', $params);
|
||||
|
||||
$authorized_ip = array(
|
||||
'88.163.22.99',
|
||||
'90.63.178.63',
|
||||
);
|
||||
if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
|
||||
mail('marion@antadis.com', '[BBB] Envoi paybox', $params);
|
||||
}
|
||||
$info_useless = array('Content-type: text/html', 'Cache-Control: no-cache, no-store' , 'Pragma: no-cache');
|
||||
if( Configuration::get('PBX_DEMO_MODE') == 0 ) {
|
||||
echo str_replace($info_useless,'', shell_exec('/srv/http/bbb_git/cgi-bin/modulev2.cgi '. $params));
|
||||
} else {
|
||||
//echo str_replace($info_useless,'', shell_exec('/srv/http/bbb_git/cgi-bin/modulev2.cgi '. $params));
|
||||
echo str_replace($info_useless,'', shell_exec('/home/www/bebeboutik.com/cgi/www/modulev2.cgi '. $params));
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,8 @@ class Paybox extends PaymentModule
|
||||
WHERE cg.`id_customer` = '.(int)$cart->id_customer.'
|
||||
AND cg.`id_group` = 2
|
||||
');
|
||||
if ($isInGroupTest == 0 || $orders_with_delivery_address == 0){
|
||||
//if ($isInGroupTest == 0 || $orders_with_delivery_address == 0){
|
||||
if ($isInGroupTest == 0){
|
||||
$paybox_cards = array();
|
||||
} else {
|
||||
$paybox_cards = Db::getInstance()->executeS('
|
||||
@ -283,7 +284,7 @@ class Paybox extends PaymentModule
|
||||
'pbx_text' => $this->l('Pay by credit card with Paybox'),
|
||||
'paybox_cards' => $paybox_cards,
|
||||
'pbx_link_plus' => $pbx_link_plus,
|
||||
'isInGroupTest' => (int)$isInGroupTest,
|
||||
'isInGroupTest' => (int)$isInGroupTest
|
||||
));
|
||||
|
||||
return ($this->display(__FILE__, 'hookpayment.tpl'));
|
||||
@ -296,7 +297,13 @@ class Paybox extends PaymentModule
|
||||
**/
|
||||
public function saveInformationPaiement($values,$direct_plus=false) {
|
||||
|
||||
mail('marion@antadis.com', 'Transaction value', http_build_query($values,'',', ')); // dev
|
||||
$authorized_ip = array(
|
||||
'88.163.22.99',
|
||||
'90.63.178.63',
|
||||
);
|
||||
if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
|
||||
mail('marion@antadis.com', '[BBB] Reponse paybox - Transaction value', http_build_query($values,'',', ')); // dev
|
||||
}
|
||||
|
||||
if(isset($values['u'])
|
||||
|| !empty($values['u'])
|
||||
@ -330,6 +337,7 @@ class Paybox extends PaymentModule
|
||||
|
||||
if(!$save) {
|
||||
mail('thibault@antadis.com', 'Erreur save commande', serialize($values));
|
||||
mail('marion@antadis.com', '[BBB] Erreur save commande', serialize($values));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -339,18 +347,25 @@ class Paybox extends PaymentModule
|
||||
* @param array $values Tableau de retour Paybox
|
||||
**/
|
||||
public function saveInformationCB($values,$id_customer) {
|
||||
|
||||
mail('marion@antadis.com', 'Transaction value + Save CB', http_build_query($values,'',', ')); // dev
|
||||
$authorized_ip = array(
|
||||
'88.163.22.99',
|
||||
'90.63.178.63',
|
||||
);
|
||||
if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
|
||||
mail('marion@antadis.com', '[BBB] Reponse paybox - Transaction value + Save CB', http_build_query($values,'',', ')); // dev
|
||||
}
|
||||
$handle = explode(' ',$values['u']);
|
||||
$date = substr($values["d"], -2).substr($values["d"], 0, 2);
|
||||
$payment = str_replace("_", " ",$values["c"]);
|
||||
$customer = new Customer((int)$id_customer);
|
||||
$refabonne = $customer->email;
|
||||
|
||||
$exists = Db::getInstance()->getValue('
|
||||
SELECT `id_paybox_card`
|
||||
FROM `ps_paybox_customer_agreement`
|
||||
WHERE `handle` = "'.pSQL($handle[0]).'"
|
||||
AND `date`="'.pSQL($date).'"
|
||||
AND `refabonne`='.(int)$values['b'].'
|
||||
AND `refabonne`='.pSQL($refabonne).'
|
||||
AND `id_customer`='.(int)$id_customer.'
|
||||
');
|
||||
|
||||
@ -361,7 +376,7 @@ class Paybox extends PaymentModule
|
||||
(`id_customer`,`refabonne`,`handle`,`value`,`date`,`payment_type`)
|
||||
VALUES (
|
||||
'. (int)$id_customer .',
|
||||
'. (int)$values["b"] .',
|
||||
"'. pSQL($refabonne) .'",
|
||||
"'. pSQL($handle[0]) .'",
|
||||
"'. pSQL($num_value) .'",
|
||||
"'.pSQL($date).'",
|
||||
|
@ -274,10 +274,31 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
.button:focus{
|
||||
background-color: rgba(86,84,133,0.6);
|
||||
}
|
||||
|
||||
.div_report_overlay{
|
||||
background: rgb(181,189,200); /* Old browsers */
|
||||
background: -moz-linear-gradient(top, rgba(181,189,200,0.4) 0%, rgba(130,140,149,0.4) 36%, rgba(40,52,59,0.4) 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(181,189,200,0.4)), color-stop(36%,rgba(130,140,149,0.4)), color-stop(100%,rgba(40,52,59,0.4))); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, rgba(181,189,200,0.4) 0%,rgba(130,140,149,0.4) 36%,rgba(40,52,59,0.4) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, rgba(181,189,200,0.4) 0%,rgba(130,140,149,0.4) 36%,rgba(40,52,59,0.4) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, rgba(181,189,200,0.4) 0%,rgba(130,140,149,0.4) 36%,rgba(40,52,59,0.4) 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, rgba(181,189,200,0.4) 0%,rgba(130,140,149,0.4) 36%,rgba(40,52,59,0.4) 100%); /* W3C */
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 998;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
}
|
||||
.div_report {
|
||||
position: absolute;
|
||||
display:none;
|
||||
position: fixed;
|
||||
z-index: 999;
|
||||
left: 50%;
|
||||
margin-left: -287.5px;
|
||||
position: fixed;
|
||||
top: 15%;
|
||||
padding: 15px;
|
||||
padding-top: 20px;
|
||||
background: #fff;
|
||||
@ -285,6 +306,7 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
line-height: 20px;
|
||||
text-align: left;
|
||||
max-height: 300px;
|
||||
width: 575px;
|
||||
overflow: auto;
|
||||
color:#000;
|
||||
}
|
||||
@ -359,9 +381,9 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
<th colspan="2">' . $this->l('ID sale') . '</th>
|
||||
<th width="325">' . $this->l('Name') . '</th>
|
||||
<th>' . $this->l('Date envoi (ART)') . '</th>
|
||||
<th>' . $this->l('Télécharger le CRR') . '</th>
|
||||
<th>' . $this->l('Envoyer la commande') . '</th>
|
||||
<th>' . $this->l('Date envoi (CMD)') . '</th>
|
||||
<th>' . $this->l('Préparation (CRP)') . '</th>
|
||||
<th>' . $this->l('Envoi auto') . '</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -401,24 +423,25 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
<p>'.(!empty($CRR['sync_date'])?date('d-m-Y H:i',strtotime($CRR['sync_date'])):'--').'</p>
|
||||
'.((isset($CRR['sync_date']) && !empty($CRR['sync_date']))?'<p><a class="button see_report" data-id="'. (int) $CRR['id_sale'] .'" data-type="ART" href="#" title="'.$this->l('See ATR report').'">'.$this->l('Rapport').'</a></p>':'').'
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<p>'.($CRR['recep_date']!= "--"?date('d-m-Y H:i',strtotime($CRR['recep_date'])):'--').'</p>
|
||||
' . $dl_link . '
|
||||
</td>
|
||||
<td style="text-align: center;"><a title="'.$this->l('Envoi du fichier CDC').'" class="button upload_link" data-id="' . (int) $CRR['id_sale'] . '" href="'.$submit_link.'" title="'.$this->l('Upload CDC file').'"><img src="../img/admin/export.gif"/>'.$this->l('Envoyer à Philea').'</a></td>
|
||||
<td style="text-align: center;" id="CDC_'. (int) $CRR['id_sale'] .'">
|
||||
<p>'.(!empty($CRR['sent_date'])?date('d-m-Y H:i',strtotime($CRR['sent_date'])):'--').'</p>
|
||||
'.((isset($CRR['sent_date']) && !empty($CRR['sent_date']))?'<p><a class="button see_report" data-id="'. (int) $CRR['id_sale'] .'" data-type="CDC" href="#" title="'.$this->l('See CDC report').'">'.$this->l('Rapport').'</a></p>':'').'
|
||||
</td>
|
||||
<td style="text-align: center;" id="CRP_'. (int) $CRR['id_sale'] .'">
|
||||
'.((isset($CRR['sent_date']) && !empty($CRR['sent_date']))?'<p><a class="button see_report" data-id="'. (int) $CRR['id_sale'] .'" data-type="CRP" href="#" title="'.$this->l('See CRP report').'">'.$this->l('Rapport').'</a></p>':'').'
|
||||
</td>
|
||||
<td style="text-align: center;">'.$auto_sync_btn.'</td>
|
||||
</tr>';
|
||||
}
|
||||
$form .= '
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="report_error div_report"></div>
|
||||
<p><input type="submit" class="btn button" name="philea_archive_submit" value="' . $this->l('Archiver la sélection') . '"/></p>
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="div_report_overlay"></div>
|
||||
<script type="text/javascript">
|
||||
$("document").ready(function(){
|
||||
$(".upload_link").click(function(e){
|
||||
@ -429,7 +452,8 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
|
||||
$(".see_report").click(function(e){
|
||||
e.preventDefault();
|
||||
$(".report_error").remove();
|
||||
$(".report_error").empty();
|
||||
$(".report_error").hide();
|
||||
id_sale = $(this).data("id");
|
||||
type = $(this).data("type");
|
||||
data = {
|
||||
@ -445,16 +469,18 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
success: function(response) {
|
||||
if (response.error == \'true\') {
|
||||
$("#"+type+"_"+id_sale).append("<p class=\'report_error\'>"+response.message+"</p>");
|
||||
$(".div_report").css("text-align","center");
|
||||
} else if (response.report.report_data != "" && response.report.report_data != "null") {
|
||||
$("#"+type+"_"+id_sale).append("<div class=\'report_error div_report\'><h3>Rapport "+type+" vente "+id_sale+"</h3>"+response.report.report_data+"</div>");
|
||||
$(".div_report").css(\'top\',$("#"+type+"_"+id_sale+" .see_report").position().top);
|
||||
$(".div_report").append("<h3>Rapport "+type+" vente "+id_sale+"</h3>"+response.report.report_data+"");
|
||||
|
||||
if (type == \'ART\') {
|
||||
$(".div_report").css(\'left\',$("#"+type+"_"+id_sale+" .see_report").position().left+50);
|
||||
} else if (type == \'CDC\') {
|
||||
pos = $(window).width() - ($("#"+type+"_"+id_sale+" .see_report").offset().left + $("#"+type+"_"+id_sale+" .see_report").outerWidth());
|
||||
$(".div_report").css(\'right\',pos+50);
|
||||
if(type == "ART") {
|
||||
$(".div_report").css("text-align","left");
|
||||
} else {
|
||||
$(".div_report").css("text-align","center");
|
||||
}
|
||||
|
||||
$(".div_report").show();
|
||||
$(".div_report_overlay").show();
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
@ -463,8 +489,10 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
});
|
||||
});
|
||||
|
||||
$(document).click(function(e){
|
||||
$(".div_report").remove();
|
||||
$(".div_report_overlay").click(function(e){
|
||||
$(".div_report").empty();
|
||||
$(".div_report").hide();
|
||||
$(".div_report_overlay").hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -16,6 +16,9 @@ switch (Tools::getValue('type')) {
|
||||
case 'CDC':
|
||||
die(getReport('CDC'));
|
||||
break;
|
||||
case 'CRP':
|
||||
die(getReport('CRP'));
|
||||
break;
|
||||
default:
|
||||
http_response_code(418);
|
||||
die(json_encode('I\'m a teapot'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
||||
include dirname(__FILE__).'/../../config/config.inc.php';
|
||||
|
||||
die('test');
|
||||
if(isset($_SERVER['REMOTE_ADDR'])) {
|
||||
exit;
|
||||
}
|
||||
@ -39,11 +39,11 @@ if($row = Db::getInstance()->getRow('
|
||||
ORDER BY `date_add` ASC
|
||||
')) {
|
||||
// SEND CDC02
|
||||
/*Db::getInstance()->ExecuteS('
|
||||
Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'philea_sync`
|
||||
SET `status` = 4
|
||||
WHERE `id_sync` = '.(int) $row['id_sync'].'
|
||||
LIMIT 1
|
||||
');
|
||||
system('cd '.dirname(__FILE__).'/script && php send_commande.php '.(int) $row['id_sale']);*/
|
||||
system('cd '.dirname(__FILE__).'/script && php send_commande.php '.(int) $row['id_sale']);
|
||||
}
|
@ -38,40 +38,42 @@ if(is_object($iterator) && count($iterator)) {
|
||||
$result = array();
|
||||
|
||||
foreach($xml->Listing->Message as $message) {
|
||||
$result[] = ((string) $message['bloquant'] == 'False'? '[W]': '[E]').' '.(string) $message['codeArticle'].' : '.(string) $message;
|
||||
$result[] = ((string) $message['bloquant'] == 'False'? '<span>[W]': '<span style="color:red;">[E]').' '.(string) $message['codeArticle'].' : </span>'.(string) $message;
|
||||
}
|
||||
|
||||
$result = nl2br(implode("\n", $result));
|
||||
|
||||
if($result != '') {
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'philea_syncreport`
|
||||
SET `report_date` = NOW(),
|
||||
`report_data` = "'.pSQL($result, TRUE).'"
|
||||
WHERE `filename` = "'.pSQL($file).'"
|
||||
LIMIT 1
|
||||
');
|
||||
$result = "RAS";
|
||||
}
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'philea_syncreport`
|
||||
SET `report_date` = NOW(),
|
||||
`report_data` = "'.pSQL($result, TRUE).'"
|
||||
WHERE `filename` = "'.pSQL($file).'"
|
||||
LIMIT 1
|
||||
');
|
||||
} elseif($xml->TypeMessage == 'CMDCLI') {
|
||||
$file = explode('.', str_replace((string) $xml->TypeMessage.'_', '', (string) $xml->NomFichier));
|
||||
$file = $file[0].'.DAT';
|
||||
$result = array();
|
||||
|
||||
foreach($xml->Listing->Message as $message) {
|
||||
$result[] = ((string) $message['bloquant'] == 'False'? '[W]': '[E]').' '.(string) $message['ordrePreparation'].' : '.(string) $message;
|
||||
$result[] = ((string) $message['bloquant'] == 'False'? '<span>[W]': '<span style="color:red;">[E]').' '.(string) $message['ordrePreparation'].' : </span>'.(string) $message;
|
||||
}
|
||||
|
||||
$result = nl2br(implode("\n", $result));
|
||||
|
||||
if($result != '') {
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'philea_syncreport`
|
||||
SET `report_date` = NOW(),
|
||||
`report_data` = "'.pSQL($result, TRUE).'"
|
||||
WHERE `filename` = "'.pSQL($file).'"
|
||||
LIMIT 1
|
||||
');
|
||||
$result = "RAS";
|
||||
}
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'philea_syncreport`
|
||||
SET `report_date` = NOW(),
|
||||
`report_data` = "'.pSQL($result, TRUE).'"
|
||||
WHERE `filename` = "'.pSQL($file).'"
|
||||
LIMIT 1
|
||||
');
|
||||
} elseif($xml->TypeMessage == 'ANAPRO') {
|
||||
$file = explode('.', str_replace((string) $xml->TypeMessage.'_', '', (string) $xml->NomFichier));
|
||||
$file = $file[0].'.DAT';
|
||||
|
@ -1,442 +1,464 @@
|
||||
<?php
|
||||
|
||||
include('../../../config/settings.inc.php');
|
||||
include('../../../config/config.inc.php');
|
||||
include('../../../config/settings.inc.php');
|
||||
include('../../../config/config.inc.php');
|
||||
|
||||
$_SERVER['SERVER_PORT'] = 80;
|
||||
$_SERVER['SERVER_PORT'] = 80;
|
||||
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
global $regex_file_in;
|
||||
$regex_file_in = '@^CRE(.*)\.(BAL|DAT)@';
|
||||
@ini_set('display_errors', 'on');
|
||||
$magistorModule = new philea_magistor();
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
global $regex_file_in;
|
||||
$regex_file_in = '@^CRE(.*)\.(BAL|DAT)@';
|
||||
@ini_set('display_errors', 'on');
|
||||
$magistorModule = new philea_magistor();
|
||||
|
||||
|
||||
//$id_shipping = 4; // PHILEA
|
||||
//$id_shipping = 4; // PHILEA
|
||||
|
||||
$CRE = array(
|
||||
'OP_CODE' => array(1,10),
|
||||
'CODE_SOC' => array(11,20),
|
||||
'NO_CLIENT' => array(31,8),
|
||||
'N_CDE' => array(39,50),
|
||||
'NO_COLIS' => array(89,50),
|
||||
'NO_TRACKING' => array(139,50),
|
||||
'NO_EXPEDITION' => array(189,50),
|
||||
'DATE_EXPED' => array(239,8),
|
||||
'TRANSPORTEUR' => array(247,50),
|
||||
);
|
||||
$CRE = array(
|
||||
'OP_CODE' => array(1,10),
|
||||
'CODE_SOC' => array(11,20),
|
||||
'NO_CLIENT' => array(31,8),
|
||||
'N_CDE' => array(39,50),
|
||||
'NO_COLIS' => array(89,50),
|
||||
'NO_TRACKING' => array(139,50),
|
||||
'NO_EXPEDITION' => array(189,50),
|
||||
'DATE_EXPED' => array(239,8),
|
||||
'TRANSPORTEUR' => array(247,50),
|
||||
'CODE_ART' => array(297, 50),
|
||||
'QTE' => array(347, 10),
|
||||
);
|
||||
|
||||
$tab_conversion_carrier = philea_magistor::getTabState();
|
||||
$tab_conversion_carrier = philea_magistor::getTabState();
|
||||
|
||||
$socol_to_magistor = array(
|
||||
'DOM' => 'SOCOLMDSS',
|
||||
'DOS' => 'SOCOLMDS',
|
||||
'RDV' => 'SOCOLMRDV',
|
||||
'CIT' => 'SOCOLCITY',
|
||||
'BPR' => 'SOCOLMBP',
|
||||
'CDI' => 'SOCOLMBP',
|
||||
'A2P' => 'SOCOLMC',
|
||||
'ACP' => 'SOCOLMBP',
|
||||
);
|
||||
$socol_to_magistor = array(
|
||||
'DOM' => 'SOCOLMDSS',
|
||||
'DOS' => 'SOCOLMDS',
|
||||
'RDV' => 'SOCOLMRDV',
|
||||
'CIT' => 'SOCOLCITY',
|
||||
'BPR' => 'SOCOLMBP',
|
||||
'CDI' => 'SOCOLMBP',
|
||||
'A2P' => 'SOCOLMC',
|
||||
'ACP' => 'SOCOLMBP',
|
||||
);
|
||||
|
||||
$mr_to_magistor = array(
|
||||
'24R' => 'MRMDSS', // Point relais
|
||||
'DRI' => 'MRMDS', // Colis drive
|
||||
'LD1' => 'MRMRDV', // Domicile RDC (1 pers)
|
||||
'LDS' => 'MRCITY', // Domicile spé (2 pers)
|
||||
'HOM' => 'MRMBP', // Domicile spé
|
||||
);
|
||||
$mr_to_magistor = array(
|
||||
'24R' => 'MRMDSS', // Point relais
|
||||
'DRI' => 'MRMDS', // Colis drive
|
||||
'LD1' => 'MRMRDV', // Domicile RDC (1 pers)
|
||||
'LDS' => 'MRCITY', // Domicile spé (2 pers)
|
||||
'HOM' => 'MRMBP', // Domicile spé
|
||||
);
|
||||
|
||||
$format = $CRE;
|
||||
if($magistorModule->active) {
|
||||
require_once('connection_ftp.php');
|
||||
@set_time_limit(0);
|
||||
$format = $CRE;
|
||||
if($magistorModule->active) {
|
||||
//require_once('connection_ftp.php');
|
||||
@set_time_limit(0);
|
||||
|
||||
// Checking for ".bal" files with a "CRE" prefix that has an equivalent ".dat" file and process them...
|
||||
$inFolder = dirname(__FILE__) . '/IN/';
|
||||
// Checking for ".bal" files with a "CRE" prefix that has an equivalent ".dat" file and process them...
|
||||
$inFolder = dirname(__FILE__) . '/IN/';
|
||||
|
||||
$iterator = new DirectoryIterator($inFolder);
|
||||
$id_order_state = Configuration::get('PHILEA_MAGISTOR_STATUS_CRE');
|
||||
$iterator = new DirectoryIterator($inFolder);
|
||||
$id_order_state = Configuration::get('PHILEA_MAGISTOR_STATUS_CRE');
|
||||
|
||||
foreach ($iterator as $fileinfo) {
|
||||
if ($fileinfo->isFile()) {
|
||||
if( preg_match('@^CRE(.*)\.BAL@', $fileinfo->getFilename())) {
|
||||
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
|
||||
foreach ($iterator as $fileinfo) {
|
||||
if ($fileinfo->isFile()) {
|
||||
if( preg_match('@^CRE(.*)\.BAL@', $fileinfo->getFilename())) {
|
||||
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
|
||||
|
||||
if(file_exists($datFile)) {
|
||||
$content = file_get_contents($datFile);
|
||||
$lines = preg_split('@\n@',$content);
|
||||
if(file_exists($datFile)) {
|
||||
$content = file_get_contents($datFile);
|
||||
$lines = preg_split('@\n@',$content);
|
||||
|
||||
if(!empty($lines)) {
|
||||
foreach( $lines as $line ) {
|
||||
$data = array();
|
||||
foreach($format as $field=>$value) {
|
||||
$data[] = substr($line, ($value[0]-1), $value[1]);
|
||||
}
|
||||
|
||||
if(!isset($data[2]) || (isset($data[2]) && !$data[2])){
|
||||
continue;
|
||||
}
|
||||
$id_order_details = array();
|
||||
$shipping_numbers = array();
|
||||
$parcel_carrier = array();
|
||||
if(!empty($lines)) {
|
||||
foreach( $lines as $line ) {
|
||||
|
||||
$id_sale = 0;
|
||||
$id_order = (string) $data[3];
|
||||
if(substr($id_order, 0, 2) == 'OP') {
|
||||
$id_order = explode('-', $id_order);
|
||||
if(count($id_order) < 2) {
|
||||
continue;
|
||||
}
|
||||
$id_sale = (int) str_replace('OP', '', $id_order[0]);
|
||||
$id_order = (int) $id_order[1];
|
||||
} else {
|
||||
$id_order = (int) $id_order;
|
||||
}
|
||||
$data = array();
|
||||
foreach($format as $field=>$value) {
|
||||
$data[] = substr($line, ($value[0]-1), $value[1]);
|
||||
}
|
||||
|
||||
if($detail = Db::getInstance()->getRow('
|
||||
SELECT `id_order_detail`, `product_quantity` - GREATEST(`product_quantity_return`, `product_quantity_refunded`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE `id_order` = '.(int) $id_order.'
|
||||
AND (
|
||||
`product_ean13` = "'.pSQL($data[9]).'"
|
||||
OR `product_supplier_reference` = "'.pSQL($data[9]).'"
|
||||
)
|
||||
')) {
|
||||
$sent = (int) Db::getInstance()->getValue('
|
||||
SELECT SUM(`quantity`)
|
||||
FROM `'._DB_PREFIX_.'philea_parcel`
|
||||
WHERE `id_order_detail` = '.(int) $detail['id_order_detail'].'
|
||||
');
|
||||
if(!isset($data[2]) || (isset($data[2]) && !$data[2])){
|
||||
continue;
|
||||
}
|
||||
|
||||
$to_send = (int) $detail['quantity'] - $sent;
|
||||
$id_sale = 0;
|
||||
$id_order = (string) $data[3];
|
||||
if(substr($id_order, 0, 2) == 'OP') {
|
||||
$id_order = explode('-', $id_order);
|
||||
if(count($id_order) < 2) {
|
||||
continue;
|
||||
}
|
||||
$id_sale = (int) str_replace('OP', '', $id_order[0]);
|
||||
$id_order = (int) $id_order[1];
|
||||
} else {
|
||||
$id_order = (int) $id_order;
|
||||
}
|
||||
|
||||
if((int) $data[10] <= $to_send) {
|
||||
if(trim($data[5]) != '') {
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_parcel`
|
||||
VALUES (
|
||||
'.(int) $detail['id_order_detail'].',
|
||||
'.(int) $data[10].',
|
||||
"'.pSQL(trim($data[5])).'",
|
||||
"'.pSQL(substr($data[7], 0, 4).'-'.substr($data[7], 4, 2).'-'.substr($data[7], 6, 2).' 18:00:00').'"
|
||||
)
|
||||
');
|
||||
$order = new Order((int) $id_order);
|
||||
|
||||
$id_order_details[] = (int) $detail['id_order_detail'];
|
||||
$shipping_numbers[] = '"'.pSQL(trim($data[5])).'"';
|
||||
$code_art = explode("_", trim($data[9]));
|
||||
if(count($code_art)>1) {
|
||||
list($id_product, $id_attribute) = $code_art;
|
||||
} else {
|
||||
$id_product = $code_art[0];
|
||||
$id_attribute = 0;
|
||||
}
|
||||
if($detail = Db::getInstance()->getRow('
|
||||
SELECT `id_order_detail`, `product_quantity` - GREATEST(`product_quantity_return`, `product_quantity_refunded`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE `id_order` = '.(int) $id_order.'
|
||||
AND `product_id` = '.(int) $id_product.'
|
||||
AND `product_attribute_id` = '.(int) $id_attribute.'
|
||||
')) {
|
||||
$sent = (int) Db::getInstance()->getValue('
|
||||
SELECT SUM(`quantity`)
|
||||
FROM `'._DB_PREFIX_.'philea_parcel`
|
||||
WHERE `id_order_detail` = '.(int) $detail['id_order_detail'].'
|
||||
');
|
||||
|
||||
if (isset($data[8]) && $data[8]){
|
||||
$carrier_name = trim($data[8]);
|
||||
$carriers = philea_magistor::getCarriersIdByRef($carrier_name);
|
||||
if ($carriers){
|
||||
foreach ($carriers as $carrier) {
|
||||
if ($carrier['name'] == 'GLS' && $carrier_name == 'DPD') {
|
||||
continue;
|
||||
}
|
||||
if ($carrier['active'] == 1 && $carrier['deleted'] == 0) {
|
||||
$id_active_carrier = (int) $carrier['id_carrier'];
|
||||
}
|
||||
if ($carrier['active'] == 0 && $carrier['deleted'] == 0) {
|
||||
$id_inactive_carrier = (int) $carrier['id_carrier'];
|
||||
}
|
||||
// if ((int) $order->id_carrier == (int) $carrier['id_carrier']){
|
||||
// $carrier_found = (int) $order->id_carrier;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
$to_send = (int) $detail['quantity'] - $sent;
|
||||
|
||||
if(isset($id_active_carrier) && $id_active_carrier) {
|
||||
$parcel_carrier[(int) $id_order.'|'.trim($data[5])] = $carriers[$data[8]];
|
||||
} else { // MISSING CARRIER
|
||||
$errors[] = array(
|
||||
$data[3],
|
||||
$data[8], // carrier name
|
||||
$data[9],
|
||||
$data[10], // quantity
|
||||
$data[5], // shipping number
|
||||
$data[7],
|
||||
'carrier_missing',
|
||||
);
|
||||
}
|
||||
} else { // SHIPPING NUMBER IS EMPTY
|
||||
$errors[] = array(
|
||||
$data[3],
|
||||
$data[8],
|
||||
$data[9],
|
||||
$data[10],
|
||||
$data[5],
|
||||
$data[7],
|
||||
'empty_shipping_number',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// TOO MUCH
|
||||
$errors[] = array(
|
||||
$data[3],
|
||||
$data[8],
|
||||
$data[9],
|
||||
$data[10],
|
||||
$data[5],
|
||||
$data[7],
|
||||
'wrong_quantities',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// NOT FOUND
|
||||
$errors[] = array(
|
||||
$data[3],
|
||||
$data[8],
|
||||
$data[9],
|
||||
$data[10],
|
||||
$data[5],
|
||||
$data[7],
|
||||
'product_not_found',
|
||||
);
|
||||
}
|
||||
}
|
||||
if((int) $data[10] <= $to_send) {
|
||||
if(trim($data[5]) != '') {
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_parcel`
|
||||
VALUES (
|
||||
'.(int) $detail['id_order_detail'].',
|
||||
'.(int) $data[10].',
|
||||
"'.pSQL(trim($data[5])).'",
|
||||
"'.pSQL(substr($data[7], 0, 4).'-'.substr($data[7], 4, 2).'-'.substr($data[7], 6, 2).' 18:00:00').'"
|
||||
)
|
||||
');
|
||||
|
||||
$id_order_details = array_unique($id_order_details);
|
||||
$shipping_numbers = array_unique($shipping_numbers);
|
||||
$id_order_details[] = (int) $detail['id_order_detail'];
|
||||
$shipping_numbers[] = '"'.pSQL(trim($data[5])).'"';
|
||||
|
||||
if(count($id_order_details) > 0) {
|
||||
$id_orders = array();
|
||||
$orders_infos = array();
|
||||
// GET CARRIER ID
|
||||
$carrier_found = false;
|
||||
$id_active_carrier = false;
|
||||
$id_inactive_carrier = false;
|
||||
if (isset($data[8]) && $data[8]){
|
||||
$carrier_name = trim($data[8]);
|
||||
$carriers = philea_magistor::getCarriersIdByRef($carrier_name);
|
||||
if ($carriers){
|
||||
foreach ($carriers as $carrier) {
|
||||
if ($carrier['name'] == 'GLS' && $carrier_name == 'DPD') {
|
||||
continue;
|
||||
}
|
||||
if ($carrier['active'] == 1 && $carrier['deleted'] == 0) {
|
||||
$id_active_carrier = (int) $carrier['id_carrier'];
|
||||
}
|
||||
if ($carrier['active'] == 0 && $carrier['deleted'] == 0) {
|
||||
$id_inactive_carrier = (int) $carrier['id_carrier'];
|
||||
}
|
||||
if ((int) $order->id_carrier == (int) $carrier['id_carrier']){
|
||||
$carrier_found = (int) $order->id_carrier;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(Db::getInstance()->ExecuteQ('
|
||||
SELECT d.`id_order`, p.`shipping_number`, p.`date_add`
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d
|
||||
ON p.`id_order_detail` = d.`id_order_detail`
|
||||
WHERE d.`id_order_detail` IN ('.implode(', ', $id_order_details).')
|
||||
AND p.`shipping_number` IN ('.implode(', ', $shipping_numbers).')
|
||||
GROUP BY d.`id_order`, p.`shipping_number`
|
||||
') as $row) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'shipping_history`
|
||||
VALUES (
|
||||
'.(int) $row['id_order'].',
|
||||
"'.pSQL($row['shipping_number']).'",
|
||||
"'.pSQL($row['date_add']).'",
|
||||
'.(int) $parcel_carrier[(int) $row['id_order'].'|'.$row['shipping_number']].',
|
||||
0
|
||||
)
|
||||
');
|
||||
if ($carrier_found)
|
||||
$id_carrier = (int) $carrier_found;
|
||||
elseif ($id_active_carrier)
|
||||
$id_carrier = (int) $id_active_carrier;
|
||||
elseif ($id_inactive_carrier)
|
||||
$id_carrier = (int) $id_inactive_carrier;
|
||||
else
|
||||
$id_carrier = (int) $order->id_carrier;
|
||||
|
||||
$id_orders[] = (int) $row['id_order'];
|
||||
if(!isset($orders_infos[(int) $row['id_order']])) {
|
||||
$orders_infos[(int) $row['id_order']] = array();
|
||||
}
|
||||
$orders_infos[(int) $row['id_order']][] = array($row['shipping_number'], $row['date_add'], (int) $parcel_carrier[(int) $row['id_order'].'|'.$row['shipping_number']]);
|
||||
}
|
||||
if(isset($id_carrier) && $id_carrier) {
|
||||
$parcel_carrier[(int) $id_order.'|'.trim($data[5])] = $id_carrier;
|
||||
} else { // MISSING CARRIER
|
||||
$errors[] = array(
|
||||
$data[3],
|
||||
$data[8], // carrier name
|
||||
$data[9], // code article productId_attributeId
|
||||
$data[10], // quantity
|
||||
$data[5], // shipping number
|
||||
$data[7],
|
||||
'carrier_missing',
|
||||
);
|
||||
}
|
||||
} else { // SHIPPING NUMBER IS EMPTY
|
||||
$errors[] = array(
|
||||
$data[3],
|
||||
$data[8],
|
||||
$data[9],
|
||||
$data[10],
|
||||
$data[5],
|
||||
$data[7],
|
||||
'empty_shipping_number',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// TOO MUCH
|
||||
$errors[] = array(
|
||||
$data[3],
|
||||
$data[8],
|
||||
$data[9],
|
||||
$data[10],
|
||||
$data[5],
|
||||
$data[7],
|
||||
'wrong_quantities',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// NOT FOUND
|
||||
$errors[] = array(
|
||||
$data[3],
|
||||
$data[8],
|
||||
$data[9],
|
||||
$data[10],
|
||||
$data[5],
|
||||
$data[7],
|
||||
'product_not_found',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$id_orders = array_unique($id_orders);
|
||||
$id_order_details = array_unique($id_order_details);
|
||||
$shipping_numbers = array_unique($shipping_numbers);
|
||||
|
||||
$products = Db::getInstance()->ExecuteQ('
|
||||
SELECT d.`id_order_detail`, d.`id_order`, c.`id_sale`, d.`product_quantity` - GREATEST(d.`product_quantity_refunded`, d.`product_quantity_return`) AS `quantity`
|
||||
FROM ps_order_detail d
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c
|
||||
ON d.`product_id` = c.`id_product`
|
||||
WHERE d.`id_order` IN ('.implode(', ', $id_orders).')
|
||||
');
|
||||
if(count($id_order_details) > 0) {
|
||||
$id_orders = array();
|
||||
$orders_infos = array();
|
||||
|
||||
$sent_sales = array();
|
||||
foreach(Db::getInstance()->ExecuteQ('
|
||||
SELECT `id_order`, `id_sale`
|
||||
FROM `'._DB_PREFIX_.'shipping_history`
|
||||
WHERE `id_order` IN ('.implode(', ', $id_orders).')
|
||||
AND `id_sale` != 0
|
||||
GROUP BY `id_order`, `id_sale`
|
||||
') as $row) {
|
||||
if(!isset($sent_sales[(int) $row['id_order']])) {
|
||||
$sent_sales[(int) $row['id_order']] = array();
|
||||
}
|
||||
$sent_sales[(int) $row['id_order']][] = (int) $row['id_sale'];
|
||||
}
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT d.`id_order`, p.`shipping_number`, p.`date_add`
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (p.`id_order_detail` = d.`id_order_detail`)
|
||||
WHERE d.`id_order_detail` IN ('.implode(', ', $id_order_details).')
|
||||
AND p.`shipping_number` IN ('.implode(', ', $shipping_numbers).')
|
||||
GROUP BY d.`id_order`, p.`shipping_number`
|
||||
') as $row) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'shipping_history`
|
||||
VALUES (
|
||||
'.(int) $row['id_order'].',
|
||||
"'.pSQL($row['shipping_number']).'",
|
||||
"'.pSQL($row['date_add']).'",
|
||||
'.(int) $parcel_carrier[(int) $row['id_order'].'|'.$row['shipping_number']].',
|
||||
0
|
||||
)
|
||||
');
|
||||
|
||||
$to_send = array();
|
||||
foreach($products as $product) {
|
||||
if((int) $product['quantity'] > 0
|
||||
&& (!isset($sent_sales[(int) $product['id_order']])
|
||||
|| !in_array((int) $product['id_sale'], $sent_sales[(int) $product['id_order']]))) {
|
||||
$to_send[] = $product;
|
||||
}
|
||||
}
|
||||
$id_orders[] = (int) $row['id_order'];
|
||||
if(!isset($orders_infos[(int) $row['id_order']])) {
|
||||
$orders_infos[(int) $row['id_order']] = array();
|
||||
}
|
||||
$orders_infos[(int) $row['id_order']][] = array($row['shipping_number'], $row['date_add'], (int) $parcel_carrier[(int) $row['id_order'].'|'.$row['shipping_number']]);
|
||||
}
|
||||
|
||||
unset($products);
|
||||
$id_orders = array_unique($id_orders);
|
||||
|
||||
$sent_products = array();
|
||||
foreach(Db::getInstance()->ExecuteQ('
|
||||
SELECT l.`id_order_detail`, SUM(l.`quantity`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'lapostews` l
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d
|
||||
ON l.`id_order_detail` = d.`id_order_detail`
|
||||
WHERE d.`id_order` IN ('.implode(', ', $id_orders).')
|
||||
GROUP BY l.`id_order_detail`
|
||||
') as $row) {
|
||||
$sent_products[(int) $row['id_order_detail']] = (int) $row['quantity'];
|
||||
}
|
||||
foreach(Db::getInstance()->ExecuteQ('
|
||||
SELECT l.`id_order_detail`, SUM(l.`quantity`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` l
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d
|
||||
ON l.`id_order_detail` = d.`id_order_detail`
|
||||
WHERE d.`id_order` IN ('.implode(', ', $id_orders).')
|
||||
GROUP BY l.`id_order_detail`
|
||||
') as $row) {
|
||||
$sent_products[(int) $row['id_order_detail']] = (int) $row['quantity'];
|
||||
}
|
||||
$products = Db::getInstance()->ExecuteS('
|
||||
SELECT d.`id_order_detail`, d.`id_order`, c.`id_sale`, d.`product_quantity` - GREATEST(d.`product_quantity_refunded`, d.`product_quantity_return`) AS `quantity`
|
||||
FROM ps_order_detail d
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON (d.`product_id` = c.`id_product`)
|
||||
WHERE d.`id_order` IN ('.implode(', ', $id_orders).')
|
||||
');
|
||||
|
||||
$orders_to_send = array();
|
||||
$orders_list = array();
|
||||
$sent_sales = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_order`, `id_sale`
|
||||
FROM `'._DB_PREFIX_.'shipping_history`
|
||||
WHERE `id_order` IN ('.implode(', ', $id_orders).')
|
||||
AND `id_sale` != 0
|
||||
GROUP BY `id_order`, `id_sale`
|
||||
') as $row) {
|
||||
if(!isset($sent_sales[(int) $row['id_order']])) {
|
||||
$sent_sales[(int) $row['id_order']] = array();
|
||||
}
|
||||
$sent_sales[(int) $row['id_order']][] = (int) $row['id_sale'];
|
||||
}
|
||||
|
||||
$total = count($to_send);
|
||||
$to_send = array();
|
||||
foreach($products as $product) {
|
||||
if ((int) $product['quantity'] > 0
|
||||
&& (!isset($sent_sales[(int) $product['id_order']])
|
||||
|| !in_array((int) $product['id_sale'], $sent_sales[(int) $product['id_order']]))) {
|
||||
$to_send[] = $product;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($to_send as $product) {
|
||||
if(!in_array((int) $product['id_order'], $orders_list)) {
|
||||
$orders_list[] = (int) $product['id_order'];
|
||||
}
|
||||
if(!in_array((int) $product['id_order'], $orders_to_send)) {
|
||||
if(!isset($sent_products[(int) $product['id_order_detail']])
|
||||
|| $product['quantity'] > $sent_products[(int) $product['id_order_detail']]) {
|
||||
$orders_to_send[] = (int) $product['id_order'];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($products);
|
||||
|
||||
unset($sent_products);
|
||||
unset($to_send);
|
||||
$sent_products = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT l.`id_order_detail`, SUM(l.`quantity`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'lapostews` l
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (l.`id_order_detail` = d.`id_order_detail`)
|
||||
WHERE d.`id_order` IN ('.implode(', ', $id_orders).')
|
||||
GROUP BY l.`id_order_detail`
|
||||
') as $row) {
|
||||
$sent_products[(int) $row['id_order_detail']] = (int) $row['quantity'];
|
||||
}
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT l.`id_order_detail`, SUM(l.`quantity`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` l
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (l.`id_order_detail` = d.`id_order_detail`)
|
||||
WHERE d.`id_order` IN ('.implode(', ', $id_orders).')
|
||||
GROUP BY l.`id_order_detail`
|
||||
') as $row) {
|
||||
$sent_products[(int) $row['id_order_detail']] = (int) $row['quantity'];
|
||||
}
|
||||
|
||||
$orders_sent = array();
|
||||
foreach($orders_list as $order) {
|
||||
if(!in_array($order, $orders_to_send)) {
|
||||
$orders_sent[] = $order;
|
||||
}
|
||||
}
|
||||
$orders_to_send = array();
|
||||
$orders_list = array();
|
||||
|
||||
unset($orders_list);
|
||||
$total = count($to_send);
|
||||
|
||||
$status_sent = array();
|
||||
$status_partially_sent = array();
|
||||
foreach($to_send as $product) {
|
||||
if(!in_array((int) $product['id_order'], $orders_list)) {
|
||||
$orders_list[] = (int) $product['id_order'];
|
||||
}
|
||||
if(!in_array((int) $product['id_order'], $orders_to_send)) {
|
||||
if(!isset($sent_products[(int) $product['id_order_detail']])
|
||||
|| $product['quantity'] > $sent_products[(int) $product['id_order_detail']]) {
|
||||
$orders_to_send[] = (int) $product['id_order'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($orders_sent as $order) {
|
||||
if((int) Db::getInstance()->getValue('
|
||||
SELECT `id_order_state`
|
||||
FROM `'._DB_PREFIX_.'order_history`
|
||||
WHERE `id_order` = '.(int) $order.'
|
||||
ORDER BY `date_add` DESC
|
||||
') != 4) {
|
||||
$status_sent[] = (int) $order;
|
||||
}
|
||||
}
|
||||
unset($sent_products);
|
||||
unset($to_send);
|
||||
|
||||
foreach($id_orders as $order) {
|
||||
if(!in_array($order, $status_sent)) {
|
||||
if(!in_array((int) Db::getInstance()->getValue('
|
||||
SELECT `id_order_state`
|
||||
FROM `'._DB_PREFIX_.'order_history`
|
||||
WHERE `id_order` = '.(int) $order.'
|
||||
ORDER BY `date_add` DESC
|
||||
'), array(4, 17, 9))) {
|
||||
$status_partially_sent[] = (int) $order;
|
||||
}
|
||||
}
|
||||
}
|
||||
$orders_sent = array();
|
||||
foreach($orders_list as $order) {
|
||||
if(!in_array($order, $orders_to_send)) {
|
||||
$orders_sent[] = $order;
|
||||
}
|
||||
}
|
||||
|
||||
unset($orders_sent);
|
||||
unset($orders_to_send);
|
||||
unset($orders_list);
|
||||
|
||||
foreach($orders_infos as $id_order => $parcels) {
|
||||
$order = new Order($id_order);
|
||||
$customer = new Customer((int) $order->id_customer);
|
||||
$status_sent = array();
|
||||
$status_partially_sent = array();
|
||||
|
||||
foreach($parcels as $parcel) {
|
||||
$products_sent = '';
|
||||
foreach($orders_sent as $order) {
|
||||
if((int) Db::getInstance()->getValue('
|
||||
SELECT `id_order_state`
|
||||
FROM `'._DB_PREFIX_.'order_history`
|
||||
WHERE `id_order` = '.(int) $order.'
|
||||
ORDER BY `date_add` DESC LIMIT 1
|
||||
') != 4) {
|
||||
$status_sent[] = (int) $order;
|
||||
}
|
||||
}
|
||||
|
||||
$products_names = array();
|
||||
foreach($id_orders as $order) {
|
||||
if(!in_array($order, $status_sent)) {
|
||||
if(!in_array((int) Db::getInstance()->getValue('
|
||||
SELECT `id_order_state`
|
||||
FROM `'._DB_PREFIX_.'order_history`
|
||||
WHERE `id_order` = '.(int) $order.'
|
||||
ORDER BY `date_add` DESC LIMIT 1
|
||||
'), array(4, 17, 9, 19))) {
|
||||
$status_partially_sent[] = (int) $order;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(Db::getInstance()->ExecuteQ('
|
||||
SELECT d.`id_order_detail`, d.`product_name`, SUM(p.`quantity`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d
|
||||
ON p.`id_order_detail` = d.`id_order_detail`
|
||||
WHERE d.`id_order` = '.(int) $id_order.'
|
||||
AND p.`shipping_number` = "'.pSQL($parcel[0]).'"
|
||||
AND p.`date_add` = "'.pSQL($parcel[1]).'"
|
||||
GROUP BY d.`id_order_detail`
|
||||
') as $p) {
|
||||
$products_sent .= '<br />'."\r\n".$p['quantity'].' x '.$p['product_name'];
|
||||
}
|
||||
unset($orders_sent);
|
||||
unset($orders_to_send);
|
||||
|
||||
$carrier = new Carrier($parcel[2], (int) $order->id_lang);
|
||||
foreach($orders_infos as $id_order => $parcels) {
|
||||
$order = new Order($id_order);
|
||||
$customer = new Customer((int) $order->id_customer);
|
||||
|
||||
if((int) $order->id_lang == 3) {
|
||||
if(in_array((int) $carrier->id, array(145, 152, 103))) {
|
||||
$carrier->url .= '&language=es_ES';
|
||||
}
|
||||
$content_html = '<strong>Contenido del paquete:</strong>';
|
||||
$content_txt = 'Contenido del paquete:';
|
||||
} else {
|
||||
$content_html = '<strong>Contenu du colis :</strong>';
|
||||
$content_txt = 'Contenu du colis :';
|
||||
}
|
||||
foreach($parcels as $parcel) {
|
||||
$products_sent = '';
|
||||
|
||||
$templateVars = array(
|
||||
'{followup}' => str_replace('@', $parcel[0], $carrier->url),
|
||||
'{firstname}' => $customer->firstname,
|
||||
'{lastname}' => $customer->lastname,
|
||||
'{id_order}' => (int) $order->id,
|
||||
'{product_list}' => !empty($products_sent)? $content_html.$products_sent: '',
|
||||
'{product_list_txt}' => !empty($products_sent)? $content_txt.strip_tags($products_sent): '',
|
||||
);
|
||||
$products_names = array();
|
||||
|
||||
if(in_array($order->id, $status_sent)) {
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int) $order->id;
|
||||
$history->changeIdOrderState(4, (int) $order->id);
|
||||
$history->addWithemail(TRUE, $templateVars);
|
||||
} elseif(in_array($order->id, $status_partially_sent)) {
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int) $order->id;
|
||||
$history->changeIdOrderState(17, (int) $order->id);
|
||||
$history->addWithemail(TRUE, $templateVars);
|
||||
}
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT d.`id_order_detail`, d.`product_name`, SUM(p.`quantity`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (p.`id_order_detail` = d.`id_order_detail`)
|
||||
WHERE d.`id_order` = '.(int) $id_order.'
|
||||
AND p.`shipping_number` = "'.pSQL($parcel[0]).'"
|
||||
AND p.`date_add` = "'.pSQL($parcel[1]).'"
|
||||
GROUP BY d.`id_order_detail`
|
||||
') as $p) {
|
||||
$products_sent .= '<br />'."\r\n".$p['quantity'].' x '.$p['product_name'];
|
||||
}
|
||||
|
||||
$subjects = array(
|
||||
1 => 'Package in transit',
|
||||
2 => 'Livraison en cours',
|
||||
3 => 'Pedido en tránsito',
|
||||
);
|
||||
$carrier = new Carrier($parcel[2], (int) $order->id_lang);
|
||||
|
||||
Mail::Send(
|
||||
intval($order->id_lang),
|
||||
'in_transit',
|
||||
$subjects[(int) $order->id_lang],
|
||||
$templateVars,
|
||||
$customer->email,
|
||||
$customer->firstname.' '.$customer->lastname
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if((int) $order->id_lang == 3) {
|
||||
if(preg_match('/colissimo/i', $carrier->name)) {
|
||||
$carrier->url .= '&language=es_ES';
|
||||
}
|
||||
$content_html = '<strong>Contenido del paquete:</strong>';
|
||||
$content_txt = 'Contenido del paquete:';
|
||||
} else {
|
||||
$content_html = '<strong>Contenu du colis :</strong>';
|
||||
$content_txt = 'Contenu du colis :';
|
||||
}
|
||||
|
||||
if(count($errors) > 0) {
|
||||
mail('marion@antadis.com', '[BBB] Erreurs integration envoi Philea', serialize($errors));
|
||||
}
|
||||
}
|
||||
$templateVars = array(
|
||||
'{followup}' => str_replace('@', $parcel[0], $carrier->url),
|
||||
'{firstname}' => $customer->firstname,
|
||||
'{lastname}' => $customer->lastname,
|
||||
'{id_order}' => (int) $order->id,
|
||||
'{product_list}' => !empty($products_sent)? $content_html.$products_sent: '',
|
||||
'{product_list_txt}' => !empty($products_sent)? $content_txt.strip_tags($products_sent): '',
|
||||
);
|
||||
|
||||
$repo_archive = './archives/IN/LIVRAISON/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
if(in_array($order->id, $status_sent)) {
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int) $order->id;
|
||||
$history->changeIdOrderState(4, (int) $order->id);
|
||||
$history->addWithemail(true, $templateVars);
|
||||
} elseif(in_array($order->id, $status_partially_sent)) {
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int) $order->id;
|
||||
$history->changeIdOrderState(17, (int) $order->id);
|
||||
$history->addWithemail(true, $templateVars);
|
||||
}
|
||||
|
||||
copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
|
||||
unlink($inFolder.$fileinfo->getFilename());
|
||||
unlink($datFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo 'fin';
|
||||
$subjects = array(
|
||||
1 => 'Package in transit',
|
||||
2 => 'Livraison en cours',
|
||||
3 => 'Pedido en tránsito',
|
||||
);
|
||||
|
||||
Mail::Send(
|
||||
intval($order->id_lang),
|
||||
'in_transit',
|
||||
$subjects[(int) $order->id_lang],
|
||||
$templateVars,
|
||||
$customer->email,
|
||||
$customer->firstname.' '.$customer->lastname
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(count($errors) > 0) {
|
||||
mail('marion@antadis.com', '[BBB] Erreurs integration envoi Philea', serialize($errors));
|
||||
}
|
||||
}
|
||||
|
||||
$repo_archive = './archives/IN/LIVRAISON/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
|
||||
unlink($inFolder.$fileinfo->getFilename());
|
||||
unlink($datFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo 'fin';
|
||||
|
@ -1,127 +1,148 @@
|
||||
<?php
|
||||
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['HTTP_HOST'] = 'www.bricoprive.com';
|
||||
include('../../../config/settings.inc.php');
|
||||
include('../../../config/config.inc.php');
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
||||
include('../../../config/settings.inc.php');
|
||||
include('../../../config/config.inc.php');
|
||||
|
||||
@ini_set('display_errors', 'on');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
global $regex_file_in;
|
||||
$regex_file_in = '@^CRP(.*)\.(BAL|DAT)@';
|
||||
@ini_set('display_errors', 'on');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
global $regex_file_in;
|
||||
$regex_file_in = '@^CRP(.*)\.(BAL|DAT)@';
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
$magistorModule = new philea_magistor();
|
||||
|
||||
$CRP = array(
|
||||
'OP_CODE' => array(1,10),
|
||||
'CODE_SOC' => array(11,20),
|
||||
'N_CDE' => array(31,50),
|
||||
'NO_CLIENT' => array(81,8), // NO_VENTE
|
||||
'DATE_PREP' => array(89,8),
|
||||
'NO_LIGNE' => array(97,4),
|
||||
'NO_COLIS' => array(101,50), // N_CDE
|
||||
'CODE_ART' => array(151,50),
|
||||
'QTE' => array(201,10)
|
||||
);
|
||||
$CRP = array(
|
||||
'OP_CODE' => array(1,10),
|
||||
'CODE_SOC' => array(11,20),
|
||||
'N_CDE' => array(31,50),
|
||||
'NO_CLIENT' => array(81,8), // NO_VENTE
|
||||
'DATE_PREP' => array(89,8),
|
||||
'NO_LIGNE' => array(97,4),
|
||||
'NO_COLIS' => array(101,50), // N_CDE
|
||||
'CODE_ART' => array(151,50),
|
||||
'QTE' => array(201,10)
|
||||
);
|
||||
|
||||
$format = $CRP;
|
||||
$format = $CRP;
|
||||
|
||||
if($magistorModule->active) {
|
||||
require_once('connection_ftp.php');
|
||||
@set_time_limit(0);
|
||||
if($magistorModule->active) {
|
||||
require_once('connection_ftp.php');
|
||||
@set_time_limit(0);
|
||||
|
||||
// Checking for ".bal" files with a "CRP" prefix that has an equivalent ".dat" file and process them...
|
||||
// Checking for ".bal" files with a "CRP" prefix that has an equivalent ".dat" file and process them...
|
||||
|
||||
$inFolder = dirname(__FILE__) . '/IN/';
|
||||
$inFolder = dirname(__FILE__) . '/IN/';
|
||||
$iterator = new DirectoryIterator($inFolder);
|
||||
|
||||
$iterator = new DirectoryIterator($inFolder);
|
||||
foreach ($iterator as $fileinfo) {
|
||||
|
||||
foreach ($iterator as $fileinfo) {
|
||||
if ($fileinfo->isFile()) {
|
||||
|
||||
if ($fileinfo->isFile()) {
|
||||
if( preg_match( '@^CRP(.*)\.BAL@', $fileinfo->getFilename() ) ) {
|
||||
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
|
||||
|
||||
if( preg_match( '@^CRP(.*)\.BAL@', $fileinfo->getFilename() ) ) {
|
||||
if( file_exists( $datFile ) ) {
|
||||
$content = file_get_contents( $datFile );
|
||||
$lines = preg_split( '@\n@', $content );
|
||||
|
||||
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
|
||||
// ANTADIS
|
||||
if( !empty($lines) ) {
|
||||
$order_details = array();
|
||||
foreach( $lines as $line ) {
|
||||
$data = array();
|
||||
foreach($format as $field => $value) {
|
||||
$data[] = substr($line, ($value[0]-1), $value[1]);
|
||||
}
|
||||
|
||||
if( file_exists( $datFile ) ) {
|
||||
if( !isset($data[2]) || (isset($data[2]) && !$data[2]) )
|
||||
continue;
|
||||
|
||||
$content = file_get_contents( $datFile );
|
||||
// GET ORDER
|
||||
$order = (string) trim($data[2]);
|
||||
if(substr($order, 0, 2) == 'OP') {
|
||||
$order = explode('-', $order);
|
||||
if(count($order) < 2)
|
||||
continue;
|
||||
$id_sale = (int) str_replace('OP', '', $order[0]);
|
||||
$id_order = (int) $order[1];
|
||||
} else {
|
||||
$id_order = (int) $order;
|
||||
}
|
||||
|
||||
$lines = preg_split( '@\n@', $content );
|
||||
// GET PRODUCT
|
||||
$product = trim($data[7]);
|
||||
$product = explode('_', $product);
|
||||
$id_product = (int) $product[0];
|
||||
$id_product_attribute = (isset($product[1]) ? (int) $product[1] : 0);
|
||||
|
||||
// ANTADIS
|
||||
if( !empty($lines) ) {
|
||||
if($detail = Db::getInstance()->getRow('
|
||||
SELECT `id_order_detail`, `product_quantity` - GREATEST(`product_quantity_return`, `product_quantity_refunded`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE `id_order` = '.(int) $id_order.'
|
||||
AND `product_id` = '.(int) $id_product.'
|
||||
AND `product_attribute_id` = '.(int) $id_product_attribute.'
|
||||
')) {
|
||||
if ($id_sale && !isset($order_details[$id_sale])) {
|
||||
$order_details[$id_sale] = array();
|
||||
}
|
||||
if ($id_sale && !isset($order_details[$id_sale][$id_order])) {
|
||||
$order_details[$id_sale][$id_order] = array();
|
||||
}
|
||||
|
||||
foreach( $lines as $line ) {
|
||||
// $data = array();
|
||||
// foreach($format as $field => $value) {
|
||||
// $data[] = substr($line, ($value[0]-1), $value[1]);
|
||||
// }
|
||||
// GET QTY
|
||||
$qty = (int) trim($data[8]);
|
||||
$order_details[$id_sale][$id_order][$id_product.'|'.$id_product_attribute] = (int) $detail['quantity'] - $qty;
|
||||
}
|
||||
}
|
||||
foreach ($order_details as $sale => $orders) {
|
||||
$comments = "";
|
||||
foreach ($orders as $order => $products) {
|
||||
$errors = "";
|
||||
$count = 0;
|
||||
foreach ($products as $key => $qty) {
|
||||
$count += $qty;
|
||||
$product = explode('|', $key);
|
||||
$id_product = (int) $product[0];
|
||||
$id_product_attribute = (isset($product[1]) ? (int) $product[1] : 0);
|
||||
if ($qty>0) {
|
||||
$errors .= "<li>".$qty." Produit #".$id_product.($id_product_attribute?" - attribute #".$id_product_attribute:"")." manquant</li>";
|
||||
}
|
||||
}
|
||||
$comments .= "<strong>Commande [".$order."] : ".($count>0? "<span style='color:red;'>Produits manquants</span>": "<span style='color:green;'>Commande préparée</span>")."</strong><br />";
|
||||
if(!empty($errors)) {
|
||||
$comments .= "<ul style='margin:0; padding:0 25px; list-style:none;'>".$errors."</ul>";
|
||||
}
|
||||
}
|
||||
if ($sale) {
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_syncreport`
|
||||
VALUE (
|
||||
'.(int) $sale.',
|
||||
"'.pSQL(preg_replace('@BAL$@', 'DAT', $fileinfo->getFilename())).'",
|
||||
NOW(),
|
||||
NOW(),
|
||||
"'.pSQL($comments, TRUE).'"
|
||||
)
|
||||
');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if( !isset($data[2]) || (isset($data[2]) && !$data[2]) )
|
||||
// continue;
|
||||
$repo_archive = './archives/IN/PREPARATION/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
// // UPDATE SUPPLIER_ORDER
|
||||
copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
|
||||
|
||||
// // GET ORDER
|
||||
// $order = (string) trim($data[2]);
|
||||
// if(substr($order, 0, 2) == 'OP') {
|
||||
// $order = explode('-', $order);
|
||||
// if(count($order) < 2)
|
||||
// continue;
|
||||
// $id_sale = (int) str_replace('OP', '', $order[0]);
|
||||
// $id_order = (int) $order[1];
|
||||
// } else {
|
||||
// $id_order = (int) $order;
|
||||
// }
|
||||
|
||||
// // GET PRODUCT
|
||||
// $product = trim($data[7]);
|
||||
// $product = explode('_', $product);
|
||||
// $id_product = (int) $product[0];
|
||||
// $id_product_attribute = (isset($product[1]) ? (int) $product[1] : 0);
|
||||
|
||||
// // GET QTY
|
||||
// if (!isset($data[8]) || !$data[8])
|
||||
// continue;
|
||||
// $qty = (int) trim($data[8]);
|
||||
// if (!$qty)
|
||||
// continue;
|
||||
|
||||
// $id_order_form = Db::getInstance()->getValue('
|
||||
// SELECT `id_order_form`
|
||||
// FROM `' . _DB_PREFIX_ . 'supplier_order`
|
||||
// WHERE `id_sale` = ' . (int) $id_sale);
|
||||
// if (!$id_order_form)
|
||||
// continue;
|
||||
|
||||
// $update_sql = '
|
||||
// UPDATE `' . _DB_PREFIX_ . 'supplier_order_detail`
|
||||
// SET `quantity_accepted` = `quantity_accepted` + ' . (int)$qty . '
|
||||
// WHERE `id_order_form` = ' . (int) $id_order_form . '
|
||||
// AND `id_product` = ' . (int) $id_product . '
|
||||
// AND `id_product_attribute` = ' . (int) $id_product_attribute . '
|
||||
// LIMIT 1';
|
||||
// Db::getInstance()->execute($update_sql);
|
||||
}
|
||||
}
|
||||
|
||||
$repo_archive = './archives/IN/PREPARATION/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
|
||||
copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
|
||||
|
||||
unlink($inFolder.$fileinfo->getFilename());
|
||||
unlink($datFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unlink($inFolder.$fileinfo->getFilename());
|
||||
unlink($datFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,23 @@ if($magistorModule->active) {
|
||||
$db = Db::getInstance();
|
||||
$id_order_state = 2;
|
||||
|
||||
// for dev
|
||||
// $include_orders = array();
|
||||
// foreach($db->ExecuteS('
|
||||
// SELECT DISTINCT d.`id_order`
|
||||
// FROM `'._DB_PREFIX_.'order_detail` d
|
||||
// LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON d.`product_id` = c.`id_product`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'philea_sent` pms ON (pms.`id_sale` = c.`id_sale` AND pms.`id_order` = d.`id_order`)
|
||||
// LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = d.`id_order`)
|
||||
// WHERE oh.`id_order_history` = (SELECT MAX(`id_order_history`) FROM `'._DB_PREFIX_.'order_history` moh WHERE moh.`id_order` = d.`id_order` GROUP BY moh.`id_order`)
|
||||
// AND oh.`id_order_state` IN (2, 3, 4, 13, 17, 9, 18, 19)
|
||||
// AND c.`id_sale` = '.(int) $id_sale.'
|
||||
// AND pms.`id_order` IS NULL
|
||||
// AND d.`product_quantity` - d.`product_quantity_refunded` > 0
|
||||
// ') as $row) {
|
||||
// $include_orders[] = (int) $row['id_order'];
|
||||
// }
|
||||
|
||||
$include_orders = array();
|
||||
foreach($db->ExecuteS('
|
||||
SELECT DISTINCT o.`id_order`
|
||||
|
@ -96,6 +96,8 @@ class Print_Ean extends Module {
|
||||
if(empty($combination['ean13'])) {
|
||||
$ean_generate = $this->_getEanNumber();
|
||||
$this->_updateAttributeEan((int)$product->id, $id_attribute, $ean_generate);
|
||||
} else {
|
||||
$ean_generate = $combination['ean13'];
|
||||
}
|
||||
$this->printEAN13($ean_generate,1,Configuration::get('LOGISTICS_QUEUE_'.(int) $cookie->id_employee));
|
||||
}
|
||||
@ -269,7 +271,7 @@ class Print_Ean extends Module {
|
||||
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Client.php';
|
||||
|
||||
$redis = new Predis\Client();
|
||||
|
||||
// .'1'.(strlen($ean13) == 12? 'B': 'F').'0000000150340'.$ean13."\n"
|
||||
$redis->publish(
|
||||
$queue,
|
||||
json_encode(array(
|
||||
@ -280,7 +282,7 @@ class Print_Ean extends Module {
|
||||
.'C0000'."\n"
|
||||
.'D11'."\n"
|
||||
.chr(2).'L'."\n"
|
||||
.'1'.(strlen($ean13) == 12? 'B': 'F').'0000000150340'.$ean13."\n"
|
||||
.'1'.(strlen($ean13) == 12? 'B': (strlen($ean13) == 13? 'F': 'E')).'0000000150340'.$ean13."\n"
|
||||
.'Q'.sprintf('%04d', $quantity)."\n"
|
||||
.'E'."\n"
|
||||
),
|
||||
|
@ -547,8 +547,8 @@ class AdminPrivateSalesSales extends AdminTab {
|
||||
//ANTADIS
|
||||
echo '<fieldset style="margin-top:15px">';
|
||||
echo '<legend>Tri des ventes</legend>';
|
||||
echo '<input type="submit" value="Ventes actuelles" name="not_ended" class="tri button active">';
|
||||
echo '<input type="submit" value="Ventes terminées" name="finished" class="tri button">';
|
||||
echo '<input type="submit" value="Ventes actuelles" name="not_ended" class="tri button active" style="margin-right:10px;">';
|
||||
echo '<input type="submit" value="Ventes terminées" name="finished" class="tri button" style="margin-right:10px;">';
|
||||
echo '<input type="submit" value="Toutes les ventes" name="all" class="tri button">';
|
||||
echo '</fieldset>';
|
||||
|
||||
@ -670,6 +670,7 @@ class AdminPrivateSalesSales extends AdminTab {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.$this->l('ID').'</th>
|
||||
<th>'.$this->l('Categorie').'</th>
|
||||
<th>'.$this->l('Title').'</th>
|
||||
<th>'.$this->l('Start').'</th>
|
||||
<th>'.$this->l('End').'</th>
|
||||
@ -696,6 +697,7 @@ class AdminPrivateSalesSales extends AdminTab {
|
||||
foreach($sales as $key => $sale) {
|
||||
echo '<tr id="item_'.$sale->id. '" class="sale_'.($key%2).'">
|
||||
<td>'.$sale->id.'</td>
|
||||
<td>'.$sale->id_category.'</td>
|
||||
<td><strong>'.$sale->title[intval($cookie->id_lang)].'</strong><br/><span style="color:#666; font-style:italic">'.$extrafields[$sale->id][1].'</span></td>
|
||||
<td>'.$sale->date_start.'</td>
|
||||
<td>'.$sale->date_end.'</td>
|
||||
|
@ -52,10 +52,10 @@ class SoFlexibiliteSaveInfoCommande extends SoFlexibilite
|
||||
$soDelivery->id_customer = (int)$this->context->customer->id;
|
||||
$soDelivery->loadDelivery();
|
||||
|
||||
$phone = trim(Tools::getValue('phone'));
|
||||
$info = trim(Tools::getValue('infoDelivery'));
|
||||
$email = trim(Tools::getValue('email'));
|
||||
$delivery_mode = Tools::strtoupper(trim(Tools::getValue('delivery_mode')));
|
||||
$phone = htmlentities(strip_tags(trim(Tools::getValue('phone'))));
|
||||
$info = htmlentities(strip_tags(trim(Tools::getValue('infoDelivery'))));
|
||||
$email = htmlentities(strip_tags(trim(Tools::getValue('email'))));
|
||||
$delivery_mode = htmlentities(strip_tags(Tools::strtoupper(trim(Tools::getValue('delivery_mode')))));
|
||||
|
||||
if ($phone && $soDelivery->telephone != $phone) {
|
||||
$soDelivery->telephone = pSQL(str_replace(' ', '', $phone));
|
||||
|
@ -891,7 +891,7 @@ div.multi_links_block_left h4{
|
||||
margin-bottom: 10px;
|
||||
text-indent: 10px;
|
||||
padding-bottom: 5px;
|
||||
margin-right: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
#editorial_block_center h4.active:after,
|
||||
div.multi_links_block_left h4.active:after{
|
||||
@ -970,7 +970,7 @@ div#page #header .content .top{
|
||||
background: linear-gradient(to bottom, rgba(100,97,150,1) 0%,rgba(76,72,126,1) 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#646196', endColorstr='#4c487e',GradientType=0 );
|
||||
|
||||
|
||||
|
||||
position: relative;
|
||||
-webkit-box-shadow: 0 5px 3px -3px #ccc;
|
||||
-moz-box-shadow: 0 5px 3px -3px #ccc;
|
||||
@ -989,7 +989,7 @@ body.logged div#page #header .content .top .logo_block{
|
||||
line-height:60px;
|
||||
display:inline-block;
|
||||
overflow:hidden;
|
||||
float:left;
|
||||
float:left;
|
||||
background: #e36ea2;
|
||||
border-bottom: 2px solid #c35e8b;
|
||||
}
|
||||
@ -1057,7 +1057,7 @@ div#page #header .content .top #header_user ul li:first-child i{
|
||||
div#page #header .content .top #header_user ul li a{
|
||||
display:block;
|
||||
text-align:center;
|
||||
position:relative;
|
||||
position:relative;
|
||||
width:100%;
|
||||
background-repeat: no-repeat;
|
||||
background-position:center 8px;
|
||||
@ -1200,7 +1200,7 @@ body#identity #columns .content #center_column h1,
|
||||
body#addresses #columns .content #center_column h1,
|
||||
body#order-slip #center_column h1,
|
||||
body#order-follow #center_column h1,
|
||||
body#history #center_column h1{
|
||||
body#history #center_column h1{
|
||||
color:#504c89;
|
||||
float: right;
|
||||
width: 100%;
|
||||
@ -1304,7 +1304,7 @@ body#index #columns #privatesales_block ul{
|
||||
}
|
||||
body#index #columns #privatesales_block ul li{
|
||||
/*height:260px;*/
|
||||
background:#fff;
|
||||
background:#fff;
|
||||
margin-bottom:20px;
|
||||
overflow:hidden;
|
||||
position: relative;
|
||||
@ -1327,7 +1327,7 @@ body#trailer #columns a.img_link{
|
||||
height:auto;
|
||||
text-align:center;
|
||||
}
|
||||
body#index #columns #privatesales_block .delivery_delay{
|
||||
body#index #columns #privatesales_block .delivery_delay{
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right:5px;
|
||||
@ -1382,7 +1382,7 @@ body#trailer #columns .links{
|
||||
line-height: 20px;
|
||||
}
|
||||
body#trailer #columns .links .short_desc{
|
||||
padding: 10px;
|
||||
padding: 10px;
|
||||
}
|
||||
body#index #columns #privatesales_block ul li .links .short_desc h3,
|
||||
body#trailer #columns .links .short_desc h3{
|
||||
@ -1417,13 +1417,13 @@ body#trailer #columns .links{
|
||||
right: 0;
|
||||
}
|
||||
body#index #columns #privatesales_block ul li .links .actions a,
|
||||
body#trailer #columns .links .actions a{
|
||||
body#trailer #columns .links .actions a{
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body#index #columns #privatesales_block #block_sales_home_future{
|
||||
body#index #columns #privatesales_block #block_sales_home_future{
|
||||
}
|
||||
body#index #columns #privatesales_block #block_sales_home div.nosale,
|
||||
body#index #columns #privatesales_block #block_sales_home_future div.nosale{
|
||||
@ -1437,7 +1437,7 @@ body#contact-form #page #columns .content #center_column h1{
|
||||
font-size:21px !important;
|
||||
}
|
||||
body#cms h1.title{
|
||||
line-height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
body#cms #columns .content #center_column .rte p{
|
||||
margin-bottom:10px;
|
||||
@ -1549,7 +1549,7 @@ body#product div.psales a.back{
|
||||
}
|
||||
body#category div#sale_end,
|
||||
body#product div#sale_end{
|
||||
background: url("../img/ico_time.png") no-repeat 10px center ;
|
||||
background: url("../img/ico_time.png") no-repeat 10px center ;
|
||||
color: #666666;
|
||||
float: right;
|
||||
font-family: Georgia;
|
||||
@ -1586,7 +1586,7 @@ body#product div.sale_img img{
|
||||
}
|
||||
body#category ul#product_list{
|
||||
list-style:none;
|
||||
width:100%;
|
||||
width:100%;
|
||||
}
|
||||
body#category ul#product_list li{
|
||||
width:100%;
|
||||
@ -1804,7 +1804,7 @@ body#product #primary_block form#buy_block div.quantity_and_submit #quantity_wan
|
||||
}
|
||||
body#order table#cart_summary tbody tr.cart_item .cart_description .cart_quantity label,
|
||||
body#product #primary_block form#buy_block div.quantity_and_submit #quantity_wanted_p label{
|
||||
display: block;
|
||||
display: block;
|
||||
padding-bottom:5px;
|
||||
font-family: Tahoma;
|
||||
}
|
||||
@ -2269,7 +2269,7 @@ body#order table#cart_summary tbody tr.cart_item td.cart_quantity label{
|
||||
background: #e36ea2;
|
||||
margin-top: 15px;
|
||||
padding: 10px;
|
||||
font-size: 12px;
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
@ -2309,7 +2309,7 @@ body#order table#cart_summary tfoot tr.economy .tleft{
|
||||
text-align: left;
|
||||
border-bottom: 0;
|
||||
margin-left: 15px;
|
||||
float: left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
body#order table#cart_summary tfoot tr.cart_total_voucher,
|
||||
@ -2362,15 +2362,16 @@ body#order table#cart_summary tfoot tr.cart_total_voucher td{
|
||||
font-size:12px;
|
||||
}
|
||||
|
||||
body#order #center_column #shipping_cost_third_step,
|
||||
body#order #center_column #safety-payment,
|
||||
body#order #center_column #shipping_cost_third_step,
|
||||
body#order #center_column #safety-payment,
|
||||
body#order #center_column #shipping_cost_third_step,
|
||||
body#order #center_column #cart_voucher_toggle_wrapper {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
body#order #center_column #shipping_cost_third_step i,
|
||||
body#order #center_column #cart_voucher_toggle_wrapper i,
|
||||
body#order #center_column .economy i{
|
||||
body#order #center_column .economy i{
|
||||
color: #e36ea2;
|
||||
font-size: 27px;
|
||||
float: left;
|
||||
@ -2455,7 +2456,7 @@ body#order #cart_voucher{
|
||||
font-family:Tahoma;
|
||||
}
|
||||
body#order #safety-payment{
|
||||
padding: 10px;
|
||||
padding: 10px;
|
||||
}
|
||||
body#order #shipping_cost_third_step{
|
||||
border-top: 1px solid #ccc;
|
||||
@ -2672,7 +2673,7 @@ p.notification sup{
|
||||
label sup{
|
||||
margin-left:5px;
|
||||
}
|
||||
body#order div.addresses{
|
||||
body#order div.addresses{
|
||||
font-size:13px;
|
||||
}
|
||||
|
||||
@ -2883,7 +2884,7 @@ body#order #HOOK_PAYMENT .payment_module{
|
||||
-moz-border-image: -moz-linear-gradient(top, #e1e3e2 0%, #f3f3f3 100%);
|
||||
-webkit-border-image: -webkit-linear-gradient(top, #e1e3e2 0%, #f3f3f3 100%);
|
||||
border-image: linear-gradient(to bottom, #e1e3e2 0%, #f3f3f3 100%);
|
||||
border-image-slice: 1;
|
||||
border-image-slice: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
body#order #HOOK_PAYMENT p a span.title_payment {
|
||||
@ -2900,9 +2901,9 @@ body#order #HOOK_PAYMENT .payment_module{
|
||||
font-weight: normal;
|
||||
}
|
||||
#order #center_column #HOOK_PAYMENT p a:hover { text-decoration: none; }
|
||||
.save_info { margin-top: 5px; font-size: 12px; clear: both; display: block; overflow: auto;}
|
||||
.save_info { margin-top: 5px; font-size: 12px; clear: both; display: block; overflow: auto;}
|
||||
.save_info input { float: left; position: relative; top: 3px;}
|
||||
|
||||
|
||||
|
||||
.paiement_info_lightbox {
|
||||
background: #333;
|
||||
@ -3392,7 +3393,7 @@ body#order-detail .order_delay h4 { margin-bottom: 10px;}
|
||||
body#order-detail .order_delay p {
|
||||
font-size: 12px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
body#order-detail div.history_carrier{
|
||||
padding-top:10px;
|
||||
@ -3614,7 +3615,7 @@ h2.title{
|
||||
-moz-box-shadow: 0 5px 3px -3px #ccc;
|
||||
box-shadow: 0 5px 3px -3px #ccc;
|
||||
}
|
||||
|
||||
|
||||
body#module-invite-invite-rules #columns .content #center_column h1 span,
|
||||
h1.title span,
|
||||
h2.title span{
|
||||
@ -3983,7 +3984,7 @@ body#index .jqibuttons span.gradient{
|
||||
text-align: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
|
||||
.action_quantity{
|
||||
width: 20%;
|
||||
}
|
||||
@ -4028,14 +4029,13 @@ body#index .jqibuttons span.gradient{
|
||||
background: url("../img/cart.png") no-repeat left 12px center #504D8B;
|
||||
background-size: 10%;
|
||||
}
|
||||
|
||||
.box_add_to_cart .content_best_sales {
|
||||
display: none;
|
||||
overflow: auto;
|
||||
background: #eaeaea;
|
||||
padding: 15px 20px;
|
||||
}
|
||||
.box_add_to_cart .content_best_sales h3{
|
||||
.box_add_to_cart .content_best_sales h3{
|
||||
border-color: #54508b;
|
||||
font-weight: normal;
|
||||
padding-bottom: 5px;
|
||||
@ -4049,7 +4049,7 @@ body#index .jqibuttons span.gradient{
|
||||
text-align: center;
|
||||
width: 140px;
|
||||
}
|
||||
.box_add_to_cart .content_best_sales li .product_link_sellers{
|
||||
.box_add_to_cart .content_best_sales li .product_link_sellers{
|
||||
display: block;
|
||||
height: 38px;
|
||||
color: #54508b;
|
||||
@ -4539,9 +4539,9 @@ body#order #form {
|
||||
body#order table#carrierTable tr td {
|
||||
height: 45px;
|
||||
}
|
||||
body#order table#carrierTable,
|
||||
body#order table#carrierTable thead,
|
||||
body#order table#carrierTable tfoot,
|
||||
body#order table#carrierTable,
|
||||
body#order table#carrierTable thead,
|
||||
body#order table#carrierTable tfoot,
|
||||
body#order table#carrierTable tbody {
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
@ -4553,9 +4553,9 @@ body#order table#carrierTable tbody tr {
|
||||
border: none;
|
||||
}
|
||||
body#order table#carrierTable thead tr th{
|
||||
color: #ffffff;
|
||||
background: #565485;
|
||||
padding: 5px 10px;
|
||||
color: #ffffff;
|
||||
background: #565485;
|
||||
padding: 5px 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
body#order table#carrierTable thead tr th.carrier_price{
|
||||
@ -4879,7 +4879,7 @@ body#product #best-sellers_block_product{
|
||||
width: 100%;
|
||||
}
|
||||
#box_error_cart .content .product_box #box_error_cart_text{
|
||||
text-align:center;
|
||||
text-align:center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
#box_error_cart .content .others_links{
|
||||
@ -4992,3 +4992,16 @@ body#product #best-sellers_block_product{
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/** Payment info module */
|
||||
#module-paymentinfo-manage .footer_links{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/** Order-payment selection registered cards */
|
||||
#order #center_column #HOOK_PAYMENT div.payment_paybox .account_payment .title {
|
||||
text-align: center;
|
||||
}
|
||||
#order #center_column #HOOK_PAYMENT div.payment_paybox .account_payment .box_account input{
|
||||
top:1px;
|
||||
}
|
||||
|
@ -87,17 +87,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box_add_to_cart box_paybox" style="display: none;">
|
||||
<div class="content">
|
||||
<p style="text-align: center;">
|
||||
<img src="/modules/paybox/paiement_{$cookie->id_lang}.png" alt="">
|
||||
<br />
|
||||
<span>{l s='Paiement en cours, veuillez patienter'}</span>
|
||||
<br />
|
||||
<img src="img/loader_payment.gif" alt="">
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
<script>
|
||||
var paiementErrorMessage = "{l s='You have to choose a paiement method' js=1}";
|
||||
</script>
|
||||
{literal}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.payment_module .inner').live('click', function(e) {
|
||||
$('.payment_module .inner').live('click', function(e) {
|
||||
$(this).children('.input_radio').children('input[name="paiement-method"]').attr('checked', true);
|
||||
});
|
||||
|
||||
|
||||
$('.submitPayment').live('click', function(e) {
|
||||
e.preventDefault();
|
||||
// check if selected
|
||||
@ -107,6 +119,11 @@
|
||||
}
|
||||
|
||||
if ($input.val()) {
|
||||
// LOADER POUR PAYBOX
|
||||
if ($input.attr('data-module-name') == "paybox-direct"){
|
||||
$('.overlay_bbb').fadeIn();
|
||||
$('.box_paybox').fadeIn();
|
||||
}
|
||||
window.location = $input.val();
|
||||
} else {
|
||||
// LOADER POUR PAYPAL
|
||||
@ -114,7 +131,7 @@
|
||||
$('.overlay_bbb').fadeIn();
|
||||
$('.box_paypal').fadeIn();
|
||||
}
|
||||
$form = $input.parent().children('div.hidden').children('form');
|
||||
$form = $input.parent().children('div.hidden').children('form');
|
||||
$form.submit();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user