Merge branch 'ticket-14485-phileaMultiSingle' into develop
This commit is contained in:
commit
83e5247666
@ -53,9 +53,10 @@ SELECT
|
||||
d.date_from,
|
||||
d.date_to,
|
||||
l.id_order
|
||||
FROM ps_discount d, ps_loyalty l
|
||||
FROM `"._DB_PREFIX_."discount` d, "._DB_PREFIX_."loyalty l, "._DB_PREFIX_."order_discount
|
||||
LEFT OUTER JOIN `"._DB_PREFIX_."order_discount od ON (od.id_discount IS NULL)
|
||||
WHERE d.active=1 AND d.id_discount=l.id_discount
|
||||
/*AND d.date_to > '".$dateSqlStart."' AND d.date_to < '".$dateSqlEnd."'*/";
|
||||
AND d.date_to > '".$dateSqlStart."' AND d.date_to < '".$dateSqlEnd."'";
|
||||
|
||||
if ($optVerbose) {
|
||||
echo date('YmdHis')." - START ".$dateSelect->format('Y-m-d')." \n";
|
||||
@ -92,7 +93,6 @@ if ($nb > 0) {
|
||||
}
|
||||
// Send mail
|
||||
else {
|
||||
|
||||
$isSent = Mail::Send($id_lang, 'loyalty_discount_reminder',
|
||||
Mail::l('Your loyalty credits', $id_lang), $templateVars, $to,
|
||||
$customerModel->firstname.' '.$customerModel->lastname);
|
||||
|
@ -12,19 +12,20 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
public function postProcess() {
|
||||
if(Tools::getIsset('send_to_philea') && Tools::getValue('id_sale')) {
|
||||
$id_sale = (int)Tools::getValue('id_sale');
|
||||
$mode = Tools::getValue('mode', 0);
|
||||
if(Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'philea_sync`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
AND `status` = 7
|
||||
')) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'philea_sync`
|
||||
SET `status` = 8
|
||||
WHERE id_sale = '.(int) $id_sale.'
|
||||
LIMIT 1
|
||||
');
|
||||
echo '<p class="conf">'.$this->l('CDC for this Sale added to queue successfully').'</p><br />';
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'philea_sync`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
AND (`status` = 7 OR `status` = 9)
|
||||
')) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'philea_sync`
|
||||
SET `status` = 8, `mode` = '.(int) $mode.'
|
||||
WHERE id_sale = '.(int) $id_sale.'
|
||||
LIMIT 1
|
||||
');
|
||||
echo '<p class="conf">'.$this->l('CDC for this Sale added to queue successfully').'</p><br />';
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Sale is not ready').'</p><br />';
|
||||
}
|
||||
@ -93,6 +94,7 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
'.(int) $id_sale.',
|
||||
0,
|
||||
NOW(),
|
||||
0,
|
||||
0
|
||||
)
|
||||
');
|
||||
@ -729,7 +731,9 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
$auto_sync_btn = '<a title="' . $this->l('La vente est terminée') .'" class="text-' . ($auto_sync ? 'green-light' : 'rose') . '"><span style="opacity: 0.4;font-size:21px;" class="anticon anticon-rss2"></span></a>';
|
||||
}
|
||||
|
||||
$submit_link = (isset($CRR['id_shipping']) && $CRR['id_shipping']==1)?$upload_link:$upload_link.'&id_sale=' . (int) $CRR['id_sale'] . '&send_to_philea=1';
|
||||
$submit_link = (isset($CRR['id_shipping']) && $CRR['id_shipping']==1)?$upload_link:$upload_link.'&id_sale=' . (int) $CRR['id_sale'] . '&send_to_philea=1&mode=0';
|
||||
$submit_link_single = (isset($CRR['id_shipping']) && $CRR['id_shipping']==1)?'':$upload_link.'&id_sale=' . (int) $CRR['id_sale'] . '&send_to_philea=1&mode=1';
|
||||
$submit_link_mult = (isset($CRR['id_shipping']) && $CRR['id_shipping']==1)?'':$upload_link.'&id_sale=' . (int) $CRR['id_sale'] . '&send_to_philea=1&mode=2';
|
||||
|
||||
$art_reports = Db::getInstance()->executeS('
|
||||
SELECT `report_data`, `report_date`, `id_sale`
|
||||
@ -783,7 +787,12 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
}
|
||||
$form .= '</td>
|
||||
<td style="text-align: center;">
|
||||
<a class="text-purple-dark '.((isset($CRR['id_shipping']) && $CRR['id_shipping']==1)?'upload_link':'').'" data-id="' . (int) $CRR['id_sale'] . '" href="'.$submit_link.'" title="'.$this->l('Envoyer à Philéa').'"><i style="font-size:18px;" class="glyphicon glyphicon-send"></i></a>'.$auto_sync_btn.'
|
||||
<a class="text-purple-dark '.((isset($CRR['id_shipping']) && $CRR['id_shipping']==1)?'upload_link':'').'" data-id="' . (int) $CRR['id_sale'] . '" href="'.$submit_link.'" title="'.$this->l('Envoyer à Philéa').'"><i style="font-size:18px;" class="glyphicon glyphicon-send"></i></a>
|
||||
'.(empty($submit_link_single) && empty($submit_link_multi)
|
||||
?'<a class="text-green-light " href="'.$submit_link_single.'" title="'.$this->l('Envoyer Single').'"><i style="font-size:18px;" class="glyphicon glyphicon-send"></i></a>
|
||||
<a class="text-orange " href="'.$submit_link_multi.'" title="'.$this->l('Envoyer Multi').'"><i style="font-size:18px;" class="glyphicon glyphicon-send"></i></a>'
|
||||
:$auto_sync_btn
|
||||
).'
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<a class="text-purple-dark" data-toggle="collapse" data-target=".row_more_'.(int) $CRR['id_sale'].'"><span style="font-size:21px;cursor:pointer" class="anticon anticon-info"></span></a>
|
||||
@ -799,10 +808,11 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
<td align="center" colspan="2">';
|
||||
if(!empty($art_reports)){
|
||||
foreach($art_reports as $key => $report) {
|
||||
$form .= '<div>
|
||||
<a class="btn btn-primary btn-xs see_report" data-id="'. (int) $CRR['id_sale'] .'" data-key="'.(int)$key.'" data-type="ART" href="#" title="'.$this->l('See ART report').'"><span class="anticon anticon-file-text2"></span> '.date('d/m/Y H:i',strtotime($report['report_date'])).'</a>
|
||||
<div id="'.(int) $CRR['id_sale'].'_'.$key.'_ART" style="display:none">'.(!empty($report['report_data'])?$report['report_data']:'Pas encore de Rapport').'</div>
|
||||
</div>';
|
||||
$form .= '
|
||||
<div>
|
||||
<a class="btn btn-primary btn-xs see_report" data-id="'. (int) $CRR['id_sale'] .'" data-key="'.(int)$key.'" data-type="ART" href="#" title="'.$this->l('See ART report').'"><span class="anticon anticon-file-text2"></span> '.date('d/m/Y H:i',strtotime($report['report_date'])).'</a>
|
||||
<div id="'.(int) $CRR['id_sale'].'_'.$key.'_ART" style="display:none">'.(!empty($report['report_data'])?$report['report_data']:'Pas encore de Rapport').'</div>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
$form .= '</td>
|
||||
@ -844,10 +854,11 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
if(!empty($cdc_reports)){
|
||||
$form .= '<div class="reports">';
|
||||
foreach($cdc_reports as $key => $report) {
|
||||
$form .= '<div>
|
||||
<a class="btn btn-primary btn-xs see_report" data-id="'. (int) $CRR['id_sale'] .'" data-key="'.(int)$key.'" data-type="CDC" href="#" title="'.$this->l('See CDC report').'"><span class="anticon anticon-file-text2"></span> '.date('d/m/Y H:i',strtotime($report['report_date'])).'</a>
|
||||
<div id="'.(int) $CRR['id_sale'].'_'.$key.'_CDC" style="display:none">'.(!empty($report['report_data'])?$report['report_data']:'Pas encore de Rapport').'</div>
|
||||
</div>';
|
||||
$form .= '
|
||||
<div>
|
||||
<a class="btn btn-primary btn-xs see_report" data-id="'. (int) $CRR['id_sale'] .'" data-key="'.(int)$key.'" data-type="CDC" href="#" title="'.$this->l('See CDC report').'"><span class="anticon anticon-file-text2"></span> '.date('d/m/Y H:i',strtotime($report['report_date'])).'</a>
|
||||
<div id="'.(int) $CRR['id_sale'].'_'.$key.'_CDC" style="display:none">'.(!empty($report['report_data'])?$report['report_data']:'Pas encore de Rapport').'</div>
|
||||
</div>';
|
||||
}
|
||||
$form .= '</div>';
|
||||
} else {
|
||||
@ -858,10 +869,11 @@ class AdminPhileaMagistor extends AdminTab {
|
||||
if(!empty($crp_reports)){
|
||||
$form .= '<div class="reports">';
|
||||
foreach($crp_reports as $key => $report) {
|
||||
$form .= '<div>
|
||||
<a class="btn btn-primary btn-xs see_report" data-id="'. (int) $CRR['id_sale'] .'" data-key="'.(int)$key.'" data-type="CRP" href="#" title="'.$this->l('See CDC report').'"><span class="anticon anticon-file-text2"></span> '.date('d/m/Y H:i',strtotime($report['report_date'])).'</a>
|
||||
<div id="'.(int) $CRR['id_sale'].'_'.$key.'_CRP" style="display:none">'.(!empty($report['report_data'])?$report['report_data']:'Pas encore de Rapport').'</div>
|
||||
</div>';
|
||||
$form .= '
|
||||
<div>
|
||||
<a class="btn btn-primary btn-xs see_report" data-id="'. (int) $CRR['id_sale'] .'" data-key="'.(int)$key.'" data-type="CRP" href="#" title="'.$this->l('See CDC report').'"><span class="anticon anticon-file-text2"></span> '.date('d/m/Y H:i',strtotime($report['report_date'])).'</a>
|
||||
<div id="'.(int) $CRR['id_sale'].'_'.$key.'_CRP" style="display:none">'.(!empty($report['report_data'])?$report['report_data']:'Pas encore de Rapport').'</div>
|
||||
</div>';
|
||||
}
|
||||
$form .= '</div>';
|
||||
} else {
|
||||
|
@ -105,12 +105,11 @@ if($row = Db::getInstance()->getRow('
|
||||
WHERE `status` = 8
|
||||
ORDER BY `date_add` ASC
|
||||
')) {
|
||||
// SEND CDC02
|
||||
Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'philea_sync`
|
||||
SET `status` = 9
|
||||
WHERE `id_sync` = '.(int) $row['id_sync'].'
|
||||
LIMIT 1
|
||||
');
|
||||
system('cd '.dirname(__FILE__).'/script && php send_commande_after.php '.(int) $row['id_sale']);
|
||||
system('cd '.dirname(__FILE__).'/script && php send_commande_after.php '.(int) $row['id_sale'].' '.(int) $row['mode']);
|
||||
}
|
@ -9,6 +9,7 @@ include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
ini_set('memory_limit', '4G');
|
||||
|
||||
$id_sale = (int) $argv[1];
|
||||
$mode = isset($argv[2])?$argv[2]:0;
|
||||
|
||||
$_id_shipping = 1; // philea
|
||||
|
||||
@ -117,19 +118,30 @@ if($magistorModule->active) {
|
||||
$fileArchive = $repo_archive . 'CDC02' . date('ymdHis');
|
||||
|
||||
$data = '';
|
||||
$sent_order = array();
|
||||
foreach($orders as $o) {
|
||||
$order = new Order($o['id_order']);
|
||||
|
||||
$sales = array();
|
||||
$sales[(int)$id_sale] = (int) $id_sale;
|
||||
|
||||
$products = $order->getProducts();
|
||||
// ANTADIS
|
||||
$products_ids = array();
|
||||
foreach($products as $product) {
|
||||
if(!Db::getInstance()->getRow('
|
||||
SELECT `id_product`
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
AND `id_product` = '.(int) $product['product_id'].'
|
||||
') && $mode==1) {
|
||||
// si multi et que le mode est à 1 (envoi uniquement des singles) on ne gère pas la commande
|
||||
continue 2;
|
||||
}
|
||||
$products_ids[] = (int) $product['product_id'];
|
||||
}
|
||||
|
||||
$sent_order[] = $o['id_order'];
|
||||
$sales = array();
|
||||
$sales[(int)$id_sale] = (int) $id_sale;
|
||||
|
||||
$nbProducts = 0;
|
||||
$nbProducts = (int) Db::getInstance()->getValue('
|
||||
SELECT COUNT(d.`id_order_detail`)
|
||||
@ -432,7 +444,6 @@ if($magistorModule->active) {
|
||||
|
||||
require_once('connection_ftp.php');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cleanChar($string) {
|
||||
|
Loading…
Reference in New Issue
Block a user