Merge branch 'ticket-9103-saleBg' into develop
This commit is contained in:
commit
d313207099
@ -1165,13 +1165,18 @@ class AdminOrders extends AdminTab
|
||||
echo '</fieldset><br />';
|
||||
|
||||
/* Display shipping infos */
|
||||
$sql = "SELECT `shipping_number`, `date_add` FROM `ps_lapostews` WHERE `id_order` =". $order->id;
|
||||
$sql = "SELECT `shipping_number`, `date_add` FROM `"._DB_PREFIX_."lapostews` WHERE `id_order` =". $order->id;
|
||||
$sql2 = "SELECT DISTINCT ppp.`shipping_number`, ppp.`date_add`
|
||||
FROM `ps_philea_parcel` ppp
|
||||
LEFT JOIN `ps_order_detail` od ON (od.`id_order_detail` = ppp.`id_order_detail`)
|
||||
FROM `"._DB_PREFIX_."philea_parcel` ppp
|
||||
LEFT JOIN `"._DB_PREFIX_."order_detail` od ON (od.`id_order_detail` = ppp.`id_order_detail`)
|
||||
WHERE od.`id_order` =". $order->id;
|
||||
$sql3 = 'SELECT lpr.`shipping_number`, lpr.`date_add`
|
||||
FROM '._DB_PREFIX_.'lapostews_return lpr
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = lpr.`id_order_detail`)
|
||||
WHERE od.`id_order` ='. $order->id;
|
||||
$numbers = Db::getInstance()->ExecuteS($sql);
|
||||
$numbers2 = Db::getInstance()->ExecuteS($sql2);
|
||||
$numbers3 = Db::getInstance()->ExecuteS($sql3);
|
||||
echo '
|
||||
<fieldset style="width:400px">';
|
||||
if(count($numbers) > 0){
|
||||
@ -1186,6 +1191,12 @@ class AdminOrders extends AdminTab
|
||||
echo '<p><b>Numéro de suivi </b> : '. $number['shipping_number'] .' ajouté le '. $date->format('d m Y') .'</p>';
|
||||
}
|
||||
}
|
||||
if(count($numbers3) > 0){
|
||||
foreach ($numbers3 as $key => $number) {
|
||||
$date = new DateTime($number['date_add']);
|
||||
echo '<p><b>Numéro de suivi </b> : '. $number['shipping_number'] .' ajouté le '. $date->format('d m Y') .'</p>';
|
||||
}
|
||||
}
|
||||
echo '<legend><img src="../img/admin/delivery.gif" /> '.$this->l('Shipping information').'</legend>
|
||||
'.$this->l('Total weight:').' <b>'.number_format($order->getTotalWeight(), 3).' '.Configuration::get('PS_WEIGHT_UNIT').'</b><br />
|
||||
'.$this->l('Carrier:').' <b>'.($carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name).'</b><br />
|
||||
|
@ -17,6 +17,66 @@ foreach(array_map(function($value) {
|
||||
|
||||
class AdminAntReturnprocess extends AdminTab
|
||||
{
|
||||
private function stripaccents($str) {
|
||||
return preg_replace(
|
||||
'~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);~i',
|
||||
'$1',
|
||||
htmlentities($str, ENT_NOQUOTES, 'UTF-8')
|
||||
);
|
||||
}
|
||||
|
||||
private function isoreplace($str) {
|
||||
// ISO/CEI 646
|
||||
return str_replace(array(
|
||||
'Ç', 'ü', 'é', 'â', 'ä', 'à',
|
||||
'å', 'ç', 'ê', 'ë', 'è', 'ï',
|
||||
'î', 'ì', 'Ä', 'Å', 'É', 'æ',
|
||||
'Æ', 'ô', 'ö', 'ò', 'û', 'ù',
|
||||
'ÿ', 'Ö', 'Ü', '¢', '£', '¥',
|
||||
'₧', 'ƒ', 'á', 'í', 'ó', 'ú',
|
||||
'ñ', 'Ñ', 'ª', 'º', '¿', '⌐',
|
||||
'¬', '½', '¼', '¡', '«', '»',
|
||||
'░', '▒', '▓', '│', '┤', '╡',
|
||||
'╢', '╖', '╕', '╣', '║', '╗',
|
||||
'╝', '╜', '╛', '┐', '└', '┴',
|
||||
'┬', '├', '─', '┼', '╞', '╟',
|
||||
'╚', '╔', '╩', '╦', '╠', '═',
|
||||
'╬', '╧', '╨', '╤', '╥', '╙',
|
||||
'╘', '╒', '╓', '╫', '╪', '┘',
|
||||
'┌', '█', '▄', '▌', '▐', '▀',
|
||||
'α', 'ß', 'Γ', 'π', 'Σ', 'σ',
|
||||
'µ', 'τ', 'Φ', 'Θ', 'Ω', 'δ',
|
||||
'∞', 'φ', 'ε', '∩', '≡', '±',
|
||||
'≥', '≤', '⌠', '⌡', '÷', '≈',
|
||||
'°', '∙', '·', '√', 'ⁿ', '²',
|
||||
'■',
|
||||
), array(
|
||||
chr(128), chr(129), chr(130), chr(131), chr(132), chr(133),
|
||||
chr(134), chr(135), chr(136), chr(137), chr(138), chr(139),
|
||||
chr(140), chr(141), chr(142), chr(143), chr(144), chr(145),
|
||||
chr(146), chr(147), chr(148), chr(149), chr(150), chr(151),
|
||||
chr(152), chr(153), chr(154), chr(155), chr(156), chr(157),
|
||||
chr(158), chr(159), chr(160), chr(161), chr(162), chr(163),
|
||||
chr(164), chr(165), chr(166), chr(167), chr(165), chr(166),
|
||||
chr(167), chr(168), chr(169), chr(170), chr(171), chr(172),
|
||||
chr(173), chr(174), chr(175), chr(176), chr(177), chr(178),
|
||||
chr(179), chr(180), chr(181), chr(182), chr(183), chr(184),
|
||||
chr(185), chr(186), chr(187), chr(188), chr(189), chr(190),
|
||||
chr(191), chr(192), chr(193), chr(194), chr(195), chr(196),
|
||||
chr(197), chr(198), chr(199), chr(200), chr(201), chr(202),
|
||||
chr(203), chr(204), chr(205), chr(206), chr(207), chr(208),
|
||||
chr(209), chr(210), chr(211), chr(209), chr(210), chr(211),
|
||||
chr(212), chr(213), chr(214), chr(215), chr(216), chr(217),
|
||||
chr(218), chr(219), chr(220), chr(221), chr(222), chr(223),
|
||||
chr(224), chr(225), chr(226), chr(227), chr(228), chr(229),
|
||||
chr(230), chr(231), chr(232), chr(233), chr(234), chr(235),
|
||||
chr(236), chr(237), chr(238), chr(239), chr(240), chr(241),
|
||||
chr(242), chr(243), chr(244), chr(245), chr(246), chr(247),
|
||||
chr(248), chr(249), chr(250), chr(251), chr(252), chr(253),
|
||||
chr(254),
|
||||
), $str);
|
||||
}
|
||||
|
||||
private function printLabel($data) {
|
||||
global $cookie;
|
||||
|
||||
@ -614,6 +674,7 @@ class AdminAntReturnprocess extends AdminTab
|
||||
$products_names[(int) $p['id_order_detail']] = $p['product_name'];
|
||||
}
|
||||
|
||||
$id_order_return = (int) Tools::getValue('id_order_return');
|
||||
$logistics_carriers[$parcel_carrier]->logParcel($result[1], $products, $id_order_return);
|
||||
|
||||
foreach($products as $k => $v) {
|
||||
@ -626,7 +687,6 @@ class AdminAntReturnprocess extends AdminTab
|
||||
|
||||
HelperFormBootstrap::displaySuccess('Etiquette envoyée à l\'imprimante');
|
||||
|
||||
$id_order_return = (int) Tools::getValue('id_order_return');
|
||||
$orderReturn = new OrderReturn($id_order_return);
|
||||
$orderReturn->state = 5; // return is ended
|
||||
if ($orderReturn->save())
|
||||
@ -749,6 +809,7 @@ class AdminAntReturnprocess extends AdminTab
|
||||
$carriers_mr = explode(',', Configuration::get('ANT_CARRIERS_MR'));
|
||||
$order = new Order($orderReturn->id_order);
|
||||
$cart = new Cart((int)$order->id_cart);
|
||||
$carrier = new Carrier((int)($order->id_carrier));
|
||||
$addressDelivery = new Address((int)$order->id_address_delivery);
|
||||
$addressInvoice = new Address((int)$order->id_address_invoice);
|
||||
$customer = new Customer((int)$order->id_customer);
|
||||
@ -1037,6 +1098,12 @@ class AdminAntReturnprocess extends AdminTab
|
||||
$html .= '<li><strong>'. $number['shipping_number'] .'</strong> ajouté le '. $date->format('d/m/Y') .'</li>';
|
||||
}
|
||||
}
|
||||
if(count($parcel_sent) > 0){
|
||||
foreach ($parcel_sent as $key => $number) {
|
||||
$date = new DateTime($number['date_add']);
|
||||
$html .= '<li><strong>'. $number['shipping_number'] .'</strong> ajouté le '. $date->format('d/m/Y') .'</li>';
|
||||
}
|
||||
}
|
||||
$html .= '</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -1092,7 +1159,7 @@ class AdminAntReturnprocess extends AdminTab
|
||||
);
|
||||
|
||||
$html .='
|
||||
<tr>
|
||||
<tr '.(in_array($product['product_id'],$productReturned)?'style="background:rgba(234, 161, 193, 0.45);"':'').'>
|
||||
<td style="vertical-align:middle;color:#444;">
|
||||
<a style="color:#444;" href="index.php?tab=AdminCatalog&id_product='.$product['product_id'].'&updateproduct&token='.$tokenCatalog.'">
|
||||
<span style="font-weight:bold;font-size:11px" class="productName">'.$product['product_name'].'</span><br />
|
||||
@ -1181,7 +1248,9 @@ class AdminAntReturnprocess extends AdminTab
|
||||
<div class="table-responsive">
|
||||
<table class="table table-custombordered">
|
||||
<tbody>';
|
||||
foreach ($returnProducts AS $k => $product) {
|
||||
$id_order_details = array();
|
||||
foreach ($order->getProducts() AS $k => $product) {
|
||||
$id_order_details[] = (int)($product['id_order_detail']);
|
||||
$img_path = '';
|
||||
$img = Db::getInstance()->getRow('
|
||||
SELECT id_image
|
||||
@ -1261,6 +1330,45 @@ class AdminAntReturnprocess extends AdminTab
|
||||
<tr>
|
||||
<td>'.$parcel['product_name'].'</td>
|
||||
<td style="text-align:center;">'.$parcel['quantity'].'</td>
|
||||
<td style="text-align:center;">'.(!empty($carrier->url) ? '<a href="'.str_replace('@', $parcel['shipping_number'], $carrier->url).'" target="_blank">'.$parcel['shipping_number'].'</a>':$parcel['shipping_number']).'</td>
|
||||
<td style="text-align:center;">'.date('d/m/Y H:i',strtotime($parcel['date_add'])).'</td>
|
||||
</tr>';
|
||||
}
|
||||
$html .= '</tbody>
|
||||
</table>';
|
||||
}
|
||||
$html .='
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">';
|
||||
$parcel_sent_other = Db::getInstance()->ExecuteS('
|
||||
SELECT lpr.*, od.`product_name`
|
||||
FROM '._DB_PREFIX_.'lapostews_return lpr
|
||||
LEFT JOIN '._DB_PREFIX_.'order_detail od ON (lpr.id_order_detail = od.id_order_detail)
|
||||
WHERE lpr.id_order_detail IN ('.implode(',', $id_order_details).')
|
||||
AND lpr.id_order_return != '.$orderReturn->id.'
|
||||
ORDER BY lpr.date_add DESC'
|
||||
);
|
||||
|
||||
if($parcel_sent_other && !empty($parcel_sent_other)) {
|
||||
$html .= '
|
||||
<p>Envoyé via un autre retour :</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.$this->l('Produit').'</th>
|
||||
<th style="text-align:center;">'.$this->l('Qté').'</th>
|
||||
<th style="text-align:center;">'.$this->l('Shipping number').'</th>
|
||||
<th style="text-align:center;">'.$this->l('date envoi').'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($parcel_sent_other as $key => $parcel) {
|
||||
$html .= '
|
||||
<tr>
|
||||
<td>'.$parcel['product_name'].' (retour <a href="index.php?tab=AdminAntReturnprocess&updateorder_return&id_order_return='.(int)$parcel['id_order_return'].'&token='.Tools::getAdminTokenLite('AdminAntReturnprocess').'" target="_blank">#'.(int)$parcel['id_order_return'].'</a>)</td>
|
||||
<td style="text-align:center;">'.$parcel['quantity'].'</td>
|
||||
<td style="text-align:center;">'.$parcel['shipping_number'].'</td>
|
||||
<td style="text-align:center;">'.date('d/m/Y H:i',strtotime($parcel['date_add'])).'</td>
|
||||
</tr>';
|
||||
|
@ -714,7 +714,7 @@ class LaposteCarrier {
|
||||
* @Override laposte WSU return
|
||||
*/
|
||||
foreach($products as $id_order_detail => $qty) {
|
||||
if($v > 0) {
|
||||
if($qty > 0) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT `'._DB_PREFIX_.'lapostews_return` VALUES (
|
||||
'.(int) $id_order_return.',
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div id="cookiesinfo">
|
||||
<div id="cookiescontent">
|
||||
<a href="{$cookies_link}" title="{l s='Voir les conditions' mod='cookiesinfos'}" alt="{l s='Voir les conditions' mod='cookiesinfos'}" style="color:#000">{$cookies_intro}</a>
|
||||
<a href="?cookie=1">{l s='Accepter les cookies' mod='cookiesinfos'}</a>
|
||||
<a class="accept-cookie" href="?cookie=1">{l s='Accepter les cookies' mod='cookiesinfos'}</a>
|
||||
</div>
|
||||
<span class="close">X</span>
|
||||
</div>
|
||||
|
@ -1,28 +1,19 @@
|
||||
<?php
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'www.bricoprive.com';
|
||||
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['SERVER_PORT'] = 80;
|
||||
|
||||
include(dirname(__FILE__) . '/../../../config/config.inc.php');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
|
||||
// $id_order_form = (int) $argv[1];
|
||||
|
||||
// $id_sale = (int)Db::getInstance()->getValue('
|
||||
// SELECT `id_sale`
|
||||
// FROM `'._DB_PREFIX_.'supplier_order`
|
||||
// WHERE `id_order_form` = '.(int) $id_order_form.'
|
||||
// ');
|
||||
|
||||
// if($id_order_form == 0) {
|
||||
// exit;
|
||||
// }
|
||||
|
||||
$id_sale = (int) $argv[1];
|
||||
if($id_sale == 0)
|
||||
exit;
|
||||
|
||||
$_id_shipping = 1; // philea
|
||||
$dateNow = date('ymdHis');
|
||||
|
||||
## FILE FORMAT
|
||||
/**
|
||||
* CHAMPS VALEURS COMMENTAIRES DEBUT LONGUEUR
|
||||
@ -38,8 +29,6 @@ if($id_sale == 0)
|
||||
* EAN_UVC NUMERIQUE Code ean de l'article (pour l'unité ou pièce) 429 14
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
@ini_set('display_errors', 'on');
|
||||
|
||||
@ -48,89 +37,6 @@ if($magistorModule->active) {
|
||||
$regex_file_out = '@^REC01(.*)\.(BAL|DAT)@';
|
||||
@set_time_limit(0);
|
||||
|
||||
$db = Db::getInstance();
|
||||
|
||||
|
||||
// $sent_order_forms = array();
|
||||
// $supplier_order_sent = Db::getInstance()->executeS('
|
||||
// SELECT `id_order_form`, `id_sale`, `date_add`
|
||||
// FROM `' . _DB_PREFIX_ . 'philea_supplier_order_sync` so
|
||||
// WHERE so.`id_sale` = ' . (int) $id_sale . '
|
||||
// GROUP BY `id_order_form`
|
||||
// ORDER BY `date_add` DESC');
|
||||
// if ($supplier_order_sent && count($supplier_order_sent)){
|
||||
// foreach ($supplier_order_sent as $row)
|
||||
// $sent_order_forms[] = (int) $row['id_order_form'];
|
||||
// if (count($sent_order_forms) >= 1)
|
||||
// $last_sent = array_shift($sent_order_forms);
|
||||
// }
|
||||
|
||||
## GET ALL ORDER FORMS FOR THIS SALE
|
||||
$order_forms = $db->executeS('
|
||||
SELECT DISTINCT(so.`id_order_form`)
|
||||
FROM `'._DB_PREFIX_.'supplier_order` so
|
||||
LEFT JOIN `'._DB_PREFIX_.'philea_supplier_order_sync` psos
|
||||
ON psos.`id_order_form` = so.`id_order_form`
|
||||
WHERE so.`id_sale` = ' . (int) $id_sale .'
|
||||
AND so.`id_order_state` IN (3,4,5,6,7)
|
||||
AND psos.`id_order_form` IS NULL
|
||||
');
|
||||
|
||||
// $order_forms = $db->executeS('
|
||||
// SELECT DISTINCT(so.`id_order_form`)
|
||||
// FROM `'._DB_PREFIX_.'supplier_order` so
|
||||
// LEFT JOIN `'._DB_PREFIX_.'philea_supplier_order_sync` psos
|
||||
// ON psos.`id_order_form` = so.`id_order_form`
|
||||
// WHERE so.`id_sale` = ' . (int) $id_sale .'
|
||||
// '.(isset($sent_order_forms) && count($sent_order_forms) ? 'AND psos.`id_order_form` NOT IN ('.implode(',', $sent_order_forms).')' : '').'
|
||||
// ');
|
||||
|
||||
|
||||
// $order_forms = $db->executeS('
|
||||
// SELECT DISTINCT(so.`id_order_form`)
|
||||
// FROM `'._DB_PREFIX_.'supplier_order` so
|
||||
// WHERE so.`id_sale` = ' . (int) $id_sale .'
|
||||
// ');
|
||||
|
||||
|
||||
## GET TOTAL QTY FOR MONO PRODUCT ORDERS
|
||||
$mono_sale_qties = array();
|
||||
// Only one product of the current sale in the order
|
||||
$sql = 'SELECT
|
||||
od.`id_order`,
|
||||
od.`product_id`,
|
||||
od.`product_attribute_id`,
|
||||
SUM(od.`product_quantity` - od.`product_quantity_refunded`) as `qty`
|
||||
FROM `' . _DB_PREFIX_ . 'order_detail` od
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'product_ps_cache` ppc
|
||||
ON ppc.`id_product` = od.`product_id`
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'order_state_current` osc
|
||||
ON osc.`id_order` = od.`id_order`
|
||||
WHERE ppc.`id_sale` = ' . (int) $id_sale . '
|
||||
AND osc.`id_order_state` IN (2, 3, 4, 9, 13, 17)
|
||||
GROUP BY od.`id_order`
|
||||
HAVING COUNT(od.`id_order`) = 1
|
||||
AND `qty` = 1';
|
||||
|
||||
foreach (Db::getInstance()->executeS($sql) as $mono_sale_detail) {
|
||||
$index = (int) $mono_sale_detail['product_id'] . '-' . (int) $mono_sale_detail['product_attribute_id'];
|
||||
// init index to 0
|
||||
if (!isset($mono_sale_qties[$index]))
|
||||
$mono_sale_qties[$index] = 0;
|
||||
if ((int) $mono_sale_detail['qty'] < 0)
|
||||
$mono_sale_detail['qty'] = 0;
|
||||
$mono_sale_qties[$index] += (int) $mono_sale_detail['qty'];
|
||||
}
|
||||
// $order_forms = $db->executeS('
|
||||
// SELECT DISTINCT(so.`id_order_form`)
|
||||
// FROM `'._DB_PREFIX_.'supplier_order` so
|
||||
// WHERE so.id_sale = ' . (int) $id_sale
|
||||
// );
|
||||
|
||||
$code_societe = 90;
|
||||
|
||||
$fileName = dirname(__FILE__) . '/OUT/REC01' . date('ymdHis');
|
||||
|
||||
$repo_archive = dirname(__FILE__) . '/archives/OUT/RECEP/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
@ -139,78 +45,148 @@ if($magistorModule->active) {
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
$fileArchive = $repo_archive . 'REC01' . date('ymdHis');
|
||||
$code_societe = (int)(Configuration::get('PHILEA_MAGISTOR_CODE_STE'));
|
||||
$db = Db::getInstance();
|
||||
$products = $db->ExecuteS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)(Configuration::get('PS_LANG_DEFAULT')).'
|
||||
)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c
|
||||
ON c.`id_product` = p.`id_product`
|
||||
WHERE c.`id_sale` = '.(int) $id_sale.'
|
||||
ORDER BY p.`id_product` ASC
|
||||
');
|
||||
if (!$products) {
|
||||
$products = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Override check pack items
|
||||
*/
|
||||
$product_ids = array_map(function($product){ return $product['id_product']; }, $products);
|
||||
foreach(Db::getInstance()->executeS('
|
||||
SELECT p.*, pl.*, s.*
|
||||
FROM `'._DB_PREFIX_.'pack` pp
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (pp.`id_product_item` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)(Configuration::get('PS_LANG_DEFAULT')).'
|
||||
)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON (c.`id_product` = pp.`id_product_pack`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale_shipping_sale` s ON (s.`id_sale` = c.`id_sale`)
|
||||
WHERE s.`id_shipping` = '.(int) $_id_shipping.'
|
||||
AND s.`id_sale` = '.(int) $id_sale.'
|
||||
ORDER BY p.`id_product` ASC
|
||||
') as $row){
|
||||
// do not add product item it's in product list
|
||||
if (!in_array($row['id_product'], $product_ids)){
|
||||
$products[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$fileName = dirname(__FILE__) . '/OUT/REC01' . $dateNow;
|
||||
$fileArchive = $repo_archive . 'REC01' . $dateNow;
|
||||
|
||||
foreach($products as $product) {
|
||||
|
||||
/**
|
||||
* @Override check pack items
|
||||
* Do not add pack item (only content items)
|
||||
*/
|
||||
if (isset($product['cache_is_pack']) && $product['cache_is_pack']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$attributes = $db->ExecuteS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'product_attribute`
|
||||
WHERE `id_product` = '.$product['id_product'].'
|
||||
');
|
||||
if(count($attributes) > 0) {
|
||||
foreach($attributes as $attribute) {
|
||||
if(isset($attribute['ean13']) && !empty($attribute['ean13'])) {
|
||||
$ean = $attribute['ean13'];
|
||||
} else {
|
||||
$ean = $attribute['supplier_reference'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data = '';
|
||||
$orderform_insert = array();
|
||||
foreach ($order_forms as $order_form) {
|
||||
foreach( $products as $product ) {
|
||||
/**
|
||||
* @Override check pack items
|
||||
* Do not add pack item (only content items)
|
||||
*/
|
||||
if (isset($product['cache_is_pack']) && $product['cache_is_pack']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$id_order_form = (int)$order_form['id_order_form'];
|
||||
|
||||
$products = $db->ExecuteS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'supplier_order_detail` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'supplier_order_detail_lang` pl
|
||||
ON (
|
||||
p.`id_order_detail` = pl.`id_order_detail`
|
||||
AND pl.`id_lang` = '.(int)(Configuration::get('PS_LANG_DEFAULT')).'
|
||||
)
|
||||
WHERE p.`id_order_form` = '.(int) $id_order_form.'
|
||||
ORDER BY p.`id_product` ASC
|
||||
$attributes = $db->ExecuteS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'product_attribute`
|
||||
WHERE `id_product` = '.$product['id_product'].'
|
||||
');
|
||||
|
||||
foreach( $products as $product ) {
|
||||
if($product['quantity'] > 0) {
|
||||
if(isset($product['ean13']) && !empty($product['ean13']))
|
||||
$ean = $product['ean13'];
|
||||
else
|
||||
//$ean = '';
|
||||
$ean = substr($product['supplier_reference'], 0, 13);
|
||||
|
||||
$ref = !empty($product['ean13'])? $product['ean13']: $product['supplier_reference'];
|
||||
|
||||
|
||||
/* @Override Brico */
|
||||
if (isset($product['id_product_attribute']) && $product['id_product_attribute']){
|
||||
if($code_societe == 78) {
|
||||
$ref = !empty($product['ean13'])? $product['ean13']: $product['supplier_reference'];
|
||||
} else {
|
||||
$ref = $product['id_product'].'_'.$product['id_product_attribute'];
|
||||
}
|
||||
if(count($attributes) > 0) {
|
||||
foreach($attributes as $attribute) {
|
||||
if(isset($attribute['ean13']) && !empty($attribute['ean13'])) {
|
||||
$ean = $attribute['ean13'];
|
||||
} else {
|
||||
$ean = $attribute['supplier_reference'];
|
||||
}
|
||||
else{
|
||||
if($code_societe == 78) {
|
||||
$ref = !empty($product['ean13'])? $product['ean13']: $product['supplier_reference'];
|
||||
} else {
|
||||
$ref = $product['id_product'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## GET TOTAL QTY FOR MONO PRODUCT ORDERS
|
||||
// Total ordered qty for order regarding only this product in this sale
|
||||
$id_product_attribute = ((isset($product['id_product_attribute']) && $product['id_product_attribute']) ? (int) $product['id_product_attribute'] : 0);
|
||||
$index = (int) $product['id_product'] . '-' . (int) $id_product_attribute;
|
||||
$qty_mono = (isset($mono_sale_qties[$index]) && $mono_sale_qties[$index]) ? (int) $mono_sale_qties[$index] : 0;
|
||||
|
||||
$data .= str_pad('REC01', 10, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $code_societe, 20, ' ', STR_PAD_RIGHT );
|
||||
// $data .= str_pad( (int) $id_order_form, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( 'OP'.(int) $id_sale, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= date('Ymd', time() + 86400*3);
|
||||
$data .= str_pad( substr(utf8_decode(str_replace(array("\r", "\n"), "", $ref)),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $product['quantity'], 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( $qty_mono, 10, '0', STR_PAD_LEFT );
|
||||
$data .= date('Ymd');
|
||||
$data .= str_pad( substr(utf8_decode(str_replace(array("\r", "\n"), "", $product['id_product'].'_'.$attribute['id_product_attribute'])),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $attribute['quantity'], 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( '', 250, ' ', STR_PAD_LEFT );
|
||||
$data .= str_pad( (int) $id_order_form, 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( str_replace(array("\r", "\n"), "", $ean), 14, ' ', STR_PAD_LEFT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( str_replace(array("\r", "\n"), "", $attribute['ean13']), 14, ' ', STR_PAD_LEFT );
|
||||
$data .= PHP_EOL;
|
||||
}
|
||||
} //End if send_philea
|
||||
} else {
|
||||
if(isset($product['ean13']) && !empty($product['ean13'])) {
|
||||
$ean = $product['ean13'];
|
||||
} else {
|
||||
$ean = $product['supplier_reference'];
|
||||
}
|
||||
|
||||
$orderform_insert[] = '(' . (int) $id_order_form . ', ' . (int) $id_sale . ', NOW())';
|
||||
$data .= str_pad('REC01', 10, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $code_societe, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( 'OP'.(int) $id_sale, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= date('Ymd');
|
||||
$data .= str_pad( substr(utf8_decode(str_replace(array("\r", "\n"), "", $product['id_product'])),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $product['quantity'], 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( '', 250, ' ', STR_PAD_LEFT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( str_replace(array("\r", "\n"), "", $product['ean13']), 14, ' ', STR_PAD_LEFT );
|
||||
$data .= PHP_EOL;
|
||||
}
|
||||
}
|
||||
if($data != '') {
|
||||
$file = 'REC01'.$dateNow.'.DAT';
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_syncreport` (`id_sale`, `filename`, `date_add`)
|
||||
VALUES (
|
||||
'.(int)$id_sale.',
|
||||
"'.pSQL($file).'",
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `' . _DB_PREFIX_ . 'philea_stock_sync`
|
||||
VALUES (DEFAULT,' . (int) $id_sale . ',0, NOW())
|
||||
');
|
||||
|
||||
if (count($orderform_insert)){
|
||||
file_put_contents($fileName . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
file_put_contents($fileName . '.BAL', '');
|
||||
file_put_contents($fileArchive . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
@ -221,10 +197,6 @@ if($magistorModule->active) {
|
||||
unset($data);
|
||||
|
||||
require_once('connection_ftp.php');
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `' . _DB_PREFIX_ . 'philea_supplier_order_sync`
|
||||
VALUES ' . implode(', ', $orderform_insert) . '
|
||||
');
|
||||
}
|
||||
echo 'fin';
|
||||
}
|
||||
|
@ -1144,7 +1144,7 @@ class AdminPrivateSalesSales extends AdminTab {
|
||||
|
||||
foreach(Language::getLanguages(FALSE) as $language) {
|
||||
foreach(array_keys($this->imagelist) as $img) {
|
||||
if((int)$language['id_lang'] == 3 && ($img == 'liston' || $img == 'listoff' || $img == 'thumb')
|
||||
if((int)$language['id_lang'] == 3 && ($img == 'liston' || $img == 'listoff' || $img == 'thumb' || $img == 'salebg')
|
||||
&& (!isset($_FILES['img_'.$img.'_'.$language['id_lang']]) || $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] == '')
|
||||
&& (isset($_FILES['img_'.$img.'_2']) && $_FILES['img_'.$img.'_2']['name'] != '')
|
||||
) {
|
||||
@ -1220,7 +1220,7 @@ class AdminPrivateSalesSales extends AdminTab {
|
||||
|
||||
foreach(Language::getLanguages(FALSE) as $language) {
|
||||
foreach(array_keys($this->imagelist) as $img) {
|
||||
if((int)$language['id_lang'] == 3 && ($img == 'liston' || $img == 'listoff' || $img == 'thumb')
|
||||
if((int)$language['id_lang'] == 3 && ($img == 'liston' || $img == 'listoff' || $img == 'thumb' || $img == 'salebg')
|
||||
&& (!isset($_FILES['img_'.$img.'_'.$language['id_lang']]) || $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] == '')
|
||||
&& (isset($_FILES['img_'.$img.'_2']) && $_FILES['img_'.$img.'_2']['name'] != '')
|
||||
) {
|
||||
|
@ -221,6 +221,8 @@ class ParentOrderController extends ParentOrderControllerCore {
|
||||
if (count($carriers_ah) > 0) {
|
||||
unset($carriers);
|
||||
$carriers = $carriers_ah;
|
||||
} elseif(count($carriers_ooh) == 0) {
|
||||
$carriers_ah = $carriers;
|
||||
}
|
||||
|
||||
}
|
||||
@ -232,6 +234,7 @@ class ParentOrderController extends ParentOrderControllerCore {
|
||||
'carriers' => $carriers,
|
||||
'carriers_ah' => $carriers_ah,
|
||||
'carriers_ooh' => $carriers_ooh,
|
||||
'carrier_dropshipping' => $carrier_dropshipping ? $carrier_dropshipping:0,
|
||||
'carrier_shipping_cost' => $carrier_shipping_cost ? $carrier_shipping_cost:0,
|
||||
'sale_delivery' => array_unique($sale_delivery),
|
||||
'default_carrier' => (int)(Configuration::get('PS_CARRIER_DEFAULT')),
|
||||
|
@ -145,7 +145,7 @@
|
||||
<label for="id_carrier{$carrier.id_carrier|intval}">
|
||||
{if $only_gifts}E-mail{else}
|
||||
{if $carrier.img}
|
||||
{if $cookie->id_lang == 3 || $country_delivery == 6}
|
||||
{if ($cookie->id_lang == 3 || $country_delivery == 6) && $carrier.id_carrier != $carrier_dropshipping}
|
||||
<img src="/img/s/seur.jpg" alt="{$carrier.name|escape:'htmlall':'UTF-8'}" />
|
||||
{else}
|
||||
<img src="{$carrier.img|escape:'htmlall':'UTF-8'}" alt="{$carrier.name|escape:'htmlall':'UTF-8'}" />
|
||||
|
@ -5299,3 +5299,10 @@ h3.gift_title {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* cookie close */
|
||||
#cookiesinfo a.accept-cookie{
|
||||
display: block;
|
||||
}
|
||||
#cookiesinfo .close{
|
||||
display: none;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user