diff --git a/admin/ajax_products_list.php b/admin/ajax_products_list.php index 98f9647cb..2971bdd42 100644 --- a/admin/ajax_products_list.php +++ b/admin/ajax_products_list.php @@ -60,22 +60,39 @@ $exclude_packs = (bool)Tools::getValue('exclude_packs', true); $bookingProduct = (int) Tools::getValue('booking_product'); +$idHotel = (int) Tools::getValue('id_hotel'); + $context = Context::getContext(); -$sql = 'SELECT p.`id_product`, pl.`link_rewrite`, p.`reference`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, p.`cache_default_attribute` - FROM `'._DB_PREFIX_.'product` p - '.Shop::addSqlAssociation('product', 'p').' - LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)$context->language->id.Shop::addSqlRestrictionOnLang('pl').') +$sqlSelect = 'SELECT p.`id_product`, pl.`link_rewrite`, p.`reference`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, p.`cache_default_attribute`'; + +$sqlFrom = ' FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p'); + +$sqlJoin =' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $context->language->id.Shop::addSqlRestrictionOnLang('pl').') LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop - ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.') - LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$context->language->id.') - WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'. + ON (image_shop.`id_product` = p.`id_product` AND image_shop.`cover`=1 AND image_shop.`id_shop`='.(int) $context->shop->id.') + LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int) $context->language->id.')'; + +$sqlWhere = ' WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'. (!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' '). (!empty($excludePackItself) ? ' AND p.id_product <> '.$excludePackItself.' ' : ' '). ($excludeVirtuals ? 'AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''). ($exclude_packs ? 'AND (p.cache_is_pack IS NULL OR p.cache_is_pack = 0)' : ''). - ($bookingProduct ? 'AND p.`booking_product` = '.(int) $bookingProduct : ''). - ' GROUP BY p.id_product'; + ($bookingProduct ? 'AND p.`booking_product` = '.(int) $bookingProduct : ''); + +$sqlGroupBy = ' GROUP BY p.id_product'; + +if ($idHotel && $bookingProduct) { + // To get hotel info for the booking product only + $sqlSelect .= ', hbil.`hotel_name`, hbil.`id` AS id_hotel '; + $sqlJoin .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt + ON hrt.`id_product` = p.`id_product` + LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil + ON pl.`id_lang` = hbil.`id_lang` AND hbil.`id` = hrt.`id_hotel`'; + $sqlWhere .= ' AND hbil.`id`='.(int) $idHotel ; +} + +$sql = $sqlSelect.' '.$sqlFrom.' '.$sqlJoin.' '.$sqlWhere.' '.$sqlGroupBy; $items = Db::getInstance()->executeS($sql); diff --git a/admin/themes/default/template/controllers/orders/_product_line.tpl b/admin/themes/default/template/controllers/orders/_product_line.tpl index 6247eb54e..18ceebacc 100644 --- a/admin/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin/themes/default/template/controllers/orders/_product_line.tpl @@ -227,27 +227,34 @@
- - - + {if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_cancelled} + + {else} + + + + {/if}
{/if} diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 933d0a6cc..66ab9c223 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -139,6 +139,7 @@ $('body').on('click', '.delete_hotel_cart_data', function(){ if (confirm("{l s='Are you sure?'}")) { + var idCart = $(this).data('id_cart'); $.ajax({ type:"POST", url: "{$link->getAdminLink('AdminOrders')|addslashes}", @@ -147,7 +148,7 @@ action: "deleteRoomProcess", del_id: $(this).data('id'), id_product: $(this).data('id_product'), - id_cart: $(this).data('id_cart'), + id_cart: idCart, id_room: $(this).data('id_room'), date_from: $(this).data('date_from'), date_to: $(this).data('date_to'), @@ -159,7 +160,7 @@ { showSuccessMessage("{l s='Remove successful'}"); if (data.cart_rooms) - location.reload(); + window.location.href = "{$link->getAdminLink('AdminOrders',true)}" + '&addorder&cart_id=' + idCart; else window.location.href = "{$link->getAdminLink('AdminHotelRoomsBooking',true)}"; } @@ -1731,539 +1732,540 @@
{block name="leadin"}{/block}
{include file='controllers/orders/_current_cart_details_data.tpl'} -
-
- - {l s='Customer'} -
-
- -
-
-
-
- - - - -
-
- -
-
-
-
-
-
- {*
- + {* If cart has errors the do not allow to proceed with this cart *} +
+
+ + {l s='Customer'} +
+
+ +
+
+
+
+ + + + +
+
+ +
+
+
+
+
+
+ {*
+ - -
-
- - - - - - - - - - - -
{l s='ID'}{l s='Date'}{l s='Total'}
-
-
- - - - - - - - - - - - - - -
{l s='ID'}{l s='Date'}{l s='Products'}{l s='Total paid'}{l s='Payment'}{l s='Status'}
-
-
-
-->*} -
+ +
+
+ + + + + + + + + + + +
{l s='ID'}{l s='Date'}{l s='Total'}
+
+
+ + + + + + + + + + + + + + +
{l s='ID'}{l s='Date'}{l s='Products'}{l s='Total paid'}{l s='Payment'}{l s='Status'}
+
+
+
-->*} +
- + {strip} {addJsDef max_child_age=$max_child_age} {addJsDef max_child_in_room=$max_child_in_room} diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index f28080e92..6c4efed72 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -869,7 +869,7 @@
 {l s='Rooms Booking Detail'} {$order_detail_data|@count} - {if !$order->hasBeenDelivered()} + {if !$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED')} diff --git a/admin/themes/default/template/controllers/orders/modals/_document_note.tpl b/admin/themes/default/template/controllers/orders/modals/_document_note.tpl index ecb8e98e5..2fbbb25bd 100644 --- a/admin/themes/default/template/controllers/orders/modals/_document_note.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_document_note.tpl @@ -18,7 +18,7 @@ *}