Merge branch 'fix/500-module-invite' of gitlab.antadis.net:dev-antadis/bebeboutik into develop

This commit is contained in:
Christophe LATOUR 2017-12-05 16:21:53 +01:00
commit 6a994070bd
8 changed files with 246 additions and 108 deletions

View File

@ -1532,7 +1532,7 @@ class AdminOrders extends AdminTab
<p class="col-md-12" style="font-size:11px; margin:0 0 10px 0;"><i>* Le chiffre de gauche correspond à la quantité remboursée pré-envoi et celui de droite post-envoi</i></p>';
$html .= '
<div class="col-md-offset-9 col-md-3">';
<div class="col-md-offset-9 col-md-3" style="padding-left:5px;">';
if ($order->hasBeenDelivered() AND Configuration::get('PS_ORDER_RETURN')){
$html .= '<input type="checkbox" id="reinjectQuantities" name="reinjectQuantities" class="button" />&nbsp;<label for="reinjectQuantities" style="float:none; font-weight:normal;">'.$this->l('Re-stock products').'</label><br />';
}
@ -1983,6 +1983,11 @@ class AdminOrders extends AdminTab
public function viewDetails()
{
$authorized_ip = array(
'88.163.22.99',
'90.63.178.63',
);
if((int)Configuration::get('ANT_BOOTSTRAP_TPL') == 1){
return $this->_viewDetails();
}

View File

@ -1548,59 +1548,187 @@ class LaposteCarrier {
$history = new OrderHistory();
$history->id_order = (int) $order->id;
$fully_sent = TRUE;
$fully_sent = FALSE;
$products_sent = array();
$to_send = array();
$shipping_numbers = array();
$order_details = array();
foreach(Db::getInstance()->ExecuteS('
SELECT `id_order_detail`
FROM `'._DB_PREFIX_.'order_detail`
WHERE `id_order` = '.(int) $order->id.'
') as $row) {
$order_details[] = (int) $row['id_order_detail'];
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`, s.`shipping_number`
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'lapostews` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if($quantity_remain['shipping_number']) {
$shipping_numbers[] = pSQL($quantity_remain['shipping_number']);
}
if((int) $quantity_remain['remain'] > 0) {
$fully_sent = FALSE;
$to_send[] = (int) $quantity_remain['id_order_detail'];
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
$_to_send = array();
foreach($to_send as $p) {
$id_sale = (int) Db::getInstance()->getValue('
SELECT `id_sale`
FROM `'._DB_PREFIX_.'product_ps_cache`
WHERE `id_product` = (
SELECT `product_id`
FROM `'._DB_PREFIX_.'order_detail`
WHERE `id_order` = '.(int) $order->id.'
AND `id_order_detail` = '.(int) $p.'
)
');
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'exapaqws` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
if(!Db::getInstance()->getValue('
SELECT `id_order`
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'mondialrelay_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'philea_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
$remaining = array();
foreach($order_details as $d) {
if(!in_array($d, $products_sent)) {
$remaining[] = (int) $d;
}
}
if(count($remaining) == 0) {
$fully_sent = TRUE;
} else {
$id_sales = array();
foreach(Db::getInstance()->ExecuteS('
SELECT DISTINCT c.`id_sale`
FROM `'._DB_PREFIX_.'product_ps_cache` c
LEFT JOIN `'._DB_PREFIX_.'order_detail` d
ON c.`id_product` = d.`product_id`
WHERE d.`id_order_detail` IN ('.implode(', ', $remaining).')
') as $row) {
$id_sales[] = (int) $row['id_sale'];
}
$sent_sales = array();
foreach(Db::getInstance()->ExecuteS('
SELECT DISTINCT `id_sale`
FROM `'._DB_PREFIX_.'shipping_history`
WHERE `id_order` = '.(int) $order->id.'
AND `id_sale` = '.(int) $id_sale.'
AND `shipping_number` NOT IN ("'.implode('", "', $shipping_numbers).'")
')) {
$_to_send[] = $p;
AND `id_sale` IN ('.implode(', ', $id_sales).')
') as $row) {
$sent_sales[] = (int) $row['id_sale'];
}
$remaining = array();
foreach($id_sales as $s) {
if(!in_array($s, $sent_sales)) {
$remaining[] = (int) $s;
break;
}
}
$fully_sent = (count($remaining) == 0);
}
if(count($_to_send) === 0) {
$fully_sent = TRUE;
}
// $fully_sent = TRUE;
// $products_sent = array();
// $to_send = array();
// $shipping_numbers = array();
// foreach(Db::getInstance()->ExecuteS('
// SELECT d.`id_order_detail`, IF(
// (d.`product_quantity` - IF(
// d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
// ) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
// ) AS `remain`, s.`shipping_number`
// FROM `'._DB_PREFIX_.'order_detail` d
// LEFT OUTER JOIN `'._DB_PREFIX_.'lapostews` s
// ON s.`id_order_detail` = d.`id_order_detail`
// WHERE d.`id_order` = '.(int) $order->id.'
// GROUP BY d.`id_order_detail`
// ') as $quantity_remain) {
// if($quantity_remain['shipping_number']) {
// $shipping_numbers[] = pSQL($quantity_remain['shipping_number']);
// }
// if((int) $quantity_remain['remain'] > 0) {
// $fully_sent = FALSE;
// $to_send[] = (int) $quantity_remain['id_order_detail'];
// }
// }
// $_to_send = array();
// foreach($to_send as $p) {
// $id_sale = (int) Db::getInstance()->getValue('
// SELECT `id_sale`
// FROM `'._DB_PREFIX_.'product_ps_cache`
// WHERE `id_product` = (
// SELECT `product_id`
// FROM `'._DB_PREFIX_.'order_detail`
// WHERE `id_order` = '.(int) $order->id.'
// AND `id_order_detail` = '.(int) $p.'
// )
// ');
// $shipping_order = Db::getInstance()->getValue('
// SELECT `id_order`
// FROM `'._DB_PREFIX_.'shipping_history`
// WHERE `id_order` = '.(int) $order->id.'
// AND `id_sale` = '.(int) $id_sale.'
// AND `shipping_number` NOT IN ("'.implode('", "', $shipping_numbers).'")
// ');
// $dropshipping_parcel = Db::getInstance()->getValue('
// SELECT COUNT(*)
// FROM `'._DB_PREFIX_.'ant_dropshipping_parcel`
// WHERE `id_order_detail` = '.(int) $p.'
// ');
// if((int)$shipping_order==0 && (int)$dropshipping_parcel==0){
// $_to_send[] = $p;
// }
// }
// if(count($_to_send) === 0) {
// $fully_sent = TRUE;
// }
//mail('perron@antadis.com', 'test logistics', (int) $order->id);

View File

@ -689,7 +689,6 @@ class PayPal extends PaymentModule
public function hookAdminOrderNew($params)
{
if (Tools::isSubmit('submitPayPalRefund')){
echo '<pre>';var_dump('test');echo '</pre>';die();
$this->_doTotalRefund($params['id_order']);
}
}

View File

@ -2203,6 +2203,7 @@ class Sale {
(int)$current_sale['delivery_delay'] != (int)$adding_sale['delivery_delay']
|| (
(int)$current_sale['delivery_delay'] == (int)$adding_sale['delivery_delay']
&& ((int)$current_sale['shipping'] == 1 || (int)$adding_sale['shipping'] == 1)
&& (int)$current_sale['shipping'] != (int)$adding_sale['shipping']
)
)

View File

@ -6,8 +6,8 @@ require_once(dirname(__FILE__).'/../../init.php');
require_once(_PS_MODULE_DIR_.'privatesales/Sale.php');
require_once('AdminPrivateSalesLogistique.php');
require_once dirname(__FILE__).'/classes/SaleStats.php';
ini_set('memory_limit', '4096M');
ini_set('max_execution_time', 0);
ini_set('memory_limit', '5G');
ini_set('max_execution_time', -1);
set_include_path(get_include_path() . PATH_SEPARATOR . _PS_MODULE_DIR_.'privatesales_logistique/classes/');
include_once('PHPExcel.php');
@ -246,7 +246,8 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
// $authorized_ip = array(
// '80.13.158.176',
// '88.120.248.124'
// '88.120.248.124',
// '88.163.22.99'
// );
// if(in_array($_SERVER['REMOTE_ADDR'], $authorized_ip))
// {

View File

@ -191,78 +191,81 @@ class Order extends OrderCore {
public static function getIfSended($ids) {
$data = array();
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
d.`id_order_detail`,
IF(
(SELECT COUNT(p.`id_order_detail`)
FROM `'._DB_PREFIX_.'lapostews` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
(SELECT SUM(p.`quantity`)
FROM `'._DB_PREFIX_.'lapostews` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
0
) as `total_send`
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`id_order_detail` IN ('.implode(',', $ids).')
') as $key => $info) {
$data[$info['id_order_detail']] = $info['total_send'];
}
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
d.`id_order_detail`,
IF(
(SELECT COUNT(p.`id_order_detail`)
FROM `'._DB_PREFIX_.'mondialrelay_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
(SELECT SUM(p.`quantity`)
FROM `'._DB_PREFIX_.'mondialrelay_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
0
) as `total_send`
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`id_order_detail` IN ('.implode(',', $ids).')
') as $key => $info) {
if($data[$info['id_order_detail']]==0){
if (is_array($ids) && !empty($ids)) {
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
d.`id_order_detail`,
IF(
(SELECT COUNT(p.`id_order_detail`)
FROM `'._DB_PREFIX_.'lapostews` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
(SELECT SUM(p.`quantity`)
FROM `'._DB_PREFIX_.'lapostews` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
0
) as `total_send`
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`id_order_detail` IN ('.implode(',', $ids).')
') as $key => $info) {
$data[$info['id_order_detail']] = $info['total_send'];
}
}
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
d.`id_order_detail`,
IF(
(SELECT COUNT(p.`id_order_detail`)
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
(SELECT SUM(p.`quantity`)
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
0
) as `total_send`
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`id_order_detail` IN ('.implode(',', $ids).')
') as $key => $info) {
if($data[$info['id_order_detail']]==0){
$data[$info['id_order_detail']] = $info['total_send'];
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
d.`id_order_detail`,
IF(
(SELECT COUNT(p.`id_order_detail`)
FROM `'._DB_PREFIX_.'mondialrelay_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
(SELECT SUM(p.`quantity`)
FROM `'._DB_PREFIX_.'mondialrelay_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
0
) as `total_send`
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`id_order_detail` IN ('.implode(',', $ids).')
') as $key => $info) {
if($data[$info['id_order_detail']]==0){
$data[$info['id_order_detail']] = $info['total_send'];
}
}
}
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
d.`id_order_detail`,
IF(
(SELECT COUNT(p.`id_order_detail`)
FROM `'._DB_PREFIX_.'philea_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
(SELECT SUM(p.`quantity`)
FROM `'._DB_PREFIX_.'philea_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
0
) as `total_send`
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`id_order_detail` IN ('.implode(',', $ids).')
') as $key => $info) {
if($data[$info['id_order_detail']]==0){
$data[$info['id_order_detail']] = $info['total_send'];
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
d.`id_order_detail`,
IF(
(SELECT COUNT(p.`id_order_detail`)
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
(SELECT SUM(p.`quantity`)
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
0
) as `total_send`
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`id_order_detail` IN ('.implode(',', $ids).')
') as $key => $info) {
if($data[$info['id_order_detail']]==0){
$data[$info['id_order_detail']] = $info['total_send'];
}
}
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
d.`id_order_detail`,
IF(
(SELECT COUNT(p.`id_order_detail`)
FROM `'._DB_PREFIX_.'philea_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
(SELECT SUM(p.`quantity`)
FROM `'._DB_PREFIX_.'philea_parcel` p
WHERE d.`id_order_detail` = p.`id_order_detail`),
0
) as `total_send`
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`id_order_detail` IN ('.implode(',', $ids).')
') as $key => $info) {
if($data[$info['id_order_detail']]==0){
$data[$info['id_order_detail']] = $info['total_send'];
}
}
}
return $data;

View File

@ -100,6 +100,8 @@
$storeAllTaxes = array();
$id_country = (int)Country::getDefaultCountryId();
foreach ($products AS $key => $product)
{
$productQuantity = (int)(Product::getQuantity((int)($product['id_product']), ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL)));
@ -117,7 +119,6 @@
$price_wt = Product::getPriceStatic((int)($product['id_product']), true, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), 2, NULL, false, true, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
/* Store tax info */
$id_country = (int)Country::getDefaultCountryId();
$id_state = 0;
$id_county = 0;
$rate = 0;

View File

@ -24,7 +24,7 @@
</div>
{elseif $delivery_delay == 8}
<div class="delivery_delay">
<img src="{$img_ps_dir}delay/48h_noel_{$cookie->id_lang}.png" alt="72h">
<img src="{$img_ps_dir}delay/48h_noel_{$cookie->id_lang}.png" alt="48h">
</div>
{elseif $delivery_delay == 10}
<div class="delivery_delay">