From 28ab2693f8d7a645f67c91639e6db30e4b61394c Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 24 Jun 2023 18:28:54 +0530 Subject: [PATCH 01/69] Resolved:Issues in Availability & Rates search API response while partial available rooms are present in the response data. --- .../WebserviceSpecificManagementHotelAri.php | 71 ++++++++++++++++--- 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementHotelAri.php b/modules/hotelreservationsystem/classes/WebserviceSpecificManagementHotelAri.php index a81daf4c6..bfdbfdce8 100644 --- a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementHotelAri.php +++ b/modules/hotelreservationsystem/classes/WebserviceSpecificManagementHotelAri.php @@ -500,20 +500,45 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser } elseif ($key == 'partially_available') { $nodeRoomAvailability = 'partial_available'; } + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader($nodeRoomAvailability, array()); - if ($roomsInfo) { - foreach ($roomsInfo as $roomInfo) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room', array(), array('id' => $roomInfo['id_room'])); + if ($key == 'partially_available') { + foreach ($roomsInfo as $dateIndex => $partialRoomsInfo) { + if (isset($partialRoomsInfo['rooms']) && $partialRoomsInfo['rooms']) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rooms', array(), array('date_from' => $partialRoomsInfo['date_from'], 'date_to' => $partialRoomsInfo['date_to'])); - $field = array('sqlId' => 'id_room', 'value' => $roomInfo['id_room']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); + foreach ($partialRoomsInfo['rooms'] as $roomInfo) { + $roomDetail = array(); + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room', array(), array('id' => $roomInfo['id_room'])); - $field = array('sqlId' => 'room_number', 'value' => $roomInfo['room_num']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); + $field = array('sqlId' => 'id_room', 'value' => $roomInfo['id_room']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room', array()); + $field = array('sqlId' => 'room_number', 'value' => $roomInfo['room_num']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room', array()); + } + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rooms', array()); + } + } + } else { + if ($roomsInfo) { + foreach ($roomsInfo as $roomInfo) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room', array(), array('id' => $roomInfo['id_room'])); + + $field = array('sqlId' => 'id_room', 'value' => $roomInfo['id_room']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $field = array('sqlId' => 'room_number', 'value' => $roomInfo['room_num']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room', array()); + } } } + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter($nodeRoomAvailability, array()); } @@ -604,6 +629,10 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser 'value' => $objRoomType->name[$idLang] ); } + // if only one lang than do not set name as array and set only value of the room + if (count($ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['name']) == 1) { + $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['name'] = $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['name'][0]['value']; + } // rooms info of the room type if (isset($roomTypeInfo['data']) && $roomTypeInfo['data']) { @@ -620,12 +649,32 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser } elseif ($key == 'partially_available') { $keyRoomAvailability = 'partially_available'; } + if ($roomsInfo) { - foreach ($roomsInfo as $roomIndex => $roomInfo) { - $roomsAriInfo[$roomIndex]['id_room'] = $roomInfo['id_room']; - $roomsAriInfo[$roomIndex]['room_number'] = $roomInfo['room_num']; + if ($key == 'partially_available') { + foreach ($roomsInfo as $dateIndex => $partialRoomsInfo) { + if (isset($partialRoomsInfo['rooms']) && $partialRoomsInfo['rooms']) { + $roomsAriInfo[$dateIndex]['date_from'] = $partialRoomsInfo['date_from']; + $roomsAriInfo[$dateIndex]['date_to'] = $partialRoomsInfo['date_to']; + + $roomsAriInfo[$dateIndex]['rooms'] = array(); + foreach ($partialRoomsInfo['rooms'] as $roomInfo) { + $roomDetail = array(); + $roomDetail['id_room'] = $roomInfo['id_room']; + $roomDetail['room_number'] = $roomInfo['room_num']; + + $roomsAriInfo[$dateIndex]['rooms'][] = $roomDetail; + } + } + } + } else { + foreach ($roomsInfo as $roomIndex => $roomInfo) { + $roomsAriInfo[$roomIndex]['id_room'] = $roomInfo['id_room']; + $roomsAriInfo[$roomIndex]['room_number'] = $roomInfo['room_num']; + } } } + $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['rooms'][$keyRoomAvailability] = array_values($roomsAriInfo); } } From 13e16c37920e1789fc1d9d5b37f49a855da67088 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Thu, 20 Jul 2023 19:14:01 +0530 Subject: [PATCH 02/69] Resolved: Fatal error when set Awaiting Payment order status as logable and creating partial payment with bankwire --- classes/PaymentModule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 3e89319f2..55cc2178d 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -1006,7 +1006,7 @@ abstract class PaymentModuleCore extends Module $new_history = new OrderHistory(); $new_history->id_order = (int)$order->id; if ($order_status->logable && $order->is_advance_payment && $order->advance_paid_amount < $order->total_paid_tax_incl) { - $new_history->changeIdOrderState((int)Configuration::get('PS_OS_PARTIAL_PAYMENT'), $order, true); + $new_history->changeIdOrderState((int)Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED'), $order, true); } else { $new_history->changeIdOrderState((int)$id_order_state, $order, true); } From 4592b8c4c5d6f9df53dea68bc9c7bf4040f906cf Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Fri, 21 Jul 2023 12:45:38 +0530 Subject: [PATCH 03/69] Order payment status submitted even after clicking Cancel button with Bulk actions in order list --- controllers/admin/AdminOrdersController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 63a271ecd..20d2c67fa 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -464,6 +464,11 @@ class AdminOrdersControllerCore extends AdminController public function processBulkUpdateOrderStatus() { + // if process to cancelled the redirect to the original order page + if (Tools::getIsset('cancel')) { + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); + } + if (Tools::isSubmit('submitUpdateOrderStatus') && ($id_order_state = (int)Tools::getValue('id_order_state'))) { if ($this->tabAccess['edit'] !== '1') { From a49650efbea20ca35eaebbb45e2213ad84614414 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 7 Aug 2023 16:15:10 +0530 Subject: [PATCH 04/69] Do not allow voucher code duplications for same customer --- classes/CartRule.php | 5 +++-- classes/PaymentModule.php | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/classes/CartRule.php b/classes/CartRule.php index 9086135ad..c965e3f36 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -421,7 +421,7 @@ class CartRuleCore extends ObjectModel * @param $name * @return bool */ - public static function cartRuleExists($name) + public static function cartRuleExists($code, $id_customer = 0) { if (!CartRule::isFeatureActive()) { return false; @@ -430,7 +430,8 @@ class CartRuleCore extends ObjectModel return (bool)Db::getInstance()->getValue(' SELECT `id_cart_rule` FROM `'._DB_PREFIX_.'cart_rule` - WHERE `code` = \''.pSQL($name).'\''); + WHERE `code` = \''.pSQL($code).'\''. + ($id_customer ? 'AND `id_customer` = '.(int) $id_customer : '')); } /** diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 3e89319f2..0e3ccbfdd 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -669,6 +669,13 @@ abstract class PaymentModuleCore extends Module $voucher->code = preg_replace('/'.$matches[0].'$/', '-'.(intval($matches[1]) + 1), $voucher->code); } + // If ABCDEFGH-2 already exists for customer use ABCDEFGH-3 + while (CartRule::cartRuleExists($voucher->code, $order->id_customer)) { + if (preg_match('/\-([0-9]{1,2})$/', $voucher->code, $matches)) { + $voucher->code = preg_replace('/'.$matches[1].'$/', (intval($matches[1]) + 1), $voucher->code); + } + } + // Set the new voucher value $voucher->reduction_amount = $remaining_amount; if ($voucher->reduction_tax) { @@ -1782,4 +1789,4 @@ abstract class PaymentModuleCore extends Module } return $result; } -} +} \ No newline at end of file From 37c62b626e3e70024d2501673cd344a635860691 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 9 Aug 2023 12:59:55 +0530 Subject: [PATCH 05/69] Allow group input field name to be changed --- admin/themes/default/template/helpers/form/form_group.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/themes/default/template/helpers/form/form_group.tpl b/admin/themes/default/template/helpers/form/form_group.tpl index d04103cac..66bb72fa0 100644 --- a/admin/themes/default/template/helpers/form/form_group.tpl +++ b/admin/themes/default/template/helpers/form/form_group.tpl @@ -31,13 +31,13 @@ - + {l s='ID'} - {l s='Group name'} + {if isset($input['groups_title']) && $input['groups_title']}{$input['groups_title']}{else}{l s='Group name'}{/if} @@ -46,8 +46,8 @@ {foreach $groups as $key => $group} - {assign var=id_checkbox value=groupBox|cat:'_'|cat:$group['id_group']} - + {assign var=id_checkbox value=$input['name']|cat:'_'|cat:$group['id_group']} + {$group['id_group']} From 28b90136addc9914365d49f6219128ed514df583 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 18 Aug 2023 17:42:03 +0530 Subject: [PATCH 06/69] Fix issue when displaying order at guest history page --- controllers/front/GuestTrackingController.php | 623 +++++++++--------- .../guest-tracking.tpl | 12 + 2 files changed, 323 insertions(+), 312 deletions(-) diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php index 806e2dfa5..3cc86d316 100644 --- a/controllers/front/GuestTrackingController.php +++ b/controllers/front/GuestTrackingController.php @@ -207,224 +207,258 @@ class GuestTrackingControllerCore extends FrontController $nonRequestedRooms = 0; $anyBackOrder = 0; - $processedProducts = array(); - $cartHotelData = array(); - } - foreach ($order_list as &$order) { - $idOrder = $order->id; - /** @var Order $order */ - $order->id_order_state = (int)$order->getCurrentState(); - $order->invoice = (OrderState::invoiceAvailable((int)$order->id_order_state) && $order->invoice_number); - $order->order_history = $order->getHistory((int)$this->context->language->id, false, true); - $order->carrier = new Carrier((int)$order->id_carrier, (int)$order->id_lang); - $order->address_invoice = new Address((int)$order->id_address_invoice); - $order->address_delivery = new Address((int)$order->id_address_delivery); - $order->inv_adr_fields = AddressFormat::getOrderedAddressFields($order->address_invoice->id_country); - $order->dlv_adr_fields = AddressFormat::getOrderedAddressFields($order->address_delivery->id_country); - $order->invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($order->address_invoice, $order->inv_adr_fields); - $order->deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($order->address_delivery, $order->dlv_adr_fields); - $order->currency = new Currency($order->id_currency); - $order->discounts = $order->getCartRules(); - $order->invoiceState = (Validate::isLoadedObject($order->address_invoice) && $order->address_invoice->id_state) ? new State((int)$order->address_invoice->id_state) : false; - $order->deliveryState = (Validate::isLoadedObject($order->address_delivery) && $order->address_delivery->id_state) ? new State((int)$order->address_delivery->id_state) : false; - $order->products = $order->getProducts(); - $order->customizedDatas = Product::getAllCustomizedDatas((int)$order->id_cart); - Product::addCustomizationPrice($order->products, $order->customizedDatas); - $order->total_old = $order->total_discounts > 0 ? (float)$order->total_paid - (float)$order->total_discounts : false; + foreach ($order_list as &$order) { + $idOrder = $order->id; - if ($order->carrier->url && $order->shipping_number) { - $order->followup = str_replace('@', $order->shipping_number, $order->carrier->url); - } - $order->hook_orderdetaildisplayed = Hook::exec('displayOrderDetail', array('order' => $order)); + $processedProducts = array(); + $cartHotelData = array(); - // enter the details of the booking the order - if ($hotelresInstalled) { - if ($orderProducts = $order->getProducts()) { - $total_demands_price_te = 0; - $total_demands_price_ti = 0; - $total_convenience_fee_te = 0; - $total_convenience_fee_ti = 0; - foreach ($orderProducts as $type_key => $type_value) { - if (in_array($type_value['product_id'], $processedProducts)) { - continue; - } - if ($type_value['is_booking_product']) { - $processedProducts[] = $type_value['product_id']; + $order->id_order_state = (int)$order->getCurrentState(); + $order->invoice = (OrderState::invoiceAvailable((int)$order->id_order_state) && $order->invoice_number); + $order->order_history = $order->getHistory((int)$this->context->language->id, false, true); + $order->carrier = new Carrier((int)$order->id_carrier, (int)$order->id_lang); + $order->address_invoice = new Address((int)$order->id_address_invoice); + $order->address_delivery = new Address((int)$order->id_address_delivery); + $order->inv_adr_fields = AddressFormat::getOrderedAddressFields($order->address_invoice->id_country); + $order->dlv_adr_fields = AddressFormat::getOrderedAddressFields($order->address_delivery->id_country); + $order->invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($order->address_invoice, $order->inv_adr_fields); + $order->deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($order->address_delivery, $order->dlv_adr_fields); + $order->currency = new Currency($order->id_currency); + $order->discounts = $order->getCartRules(); + $order->invoiceState = (Validate::isLoadedObject($order->address_invoice) && $order->address_invoice->id_state) ? new State((int)$order->address_invoice->id_state) : false; + $order->deliveryState = (Validate::isLoadedObject($order->address_delivery) && $order->address_delivery->id_state) ? new State((int)$order->address_delivery->id_state) : false; + $order->products = $order->getProducts(); + $order->customizedDatas = Product::getAllCustomizedDatas((int)$order->id_cart); + Product::addCustomizationPrice($order->products, $order->customizedDatas); + $order->total_old = $order->total_discounts > 0 ? (float)$order->total_paid - (float)$order->total_discounts : false; - $product = new Product($type_value['product_id'], false, $this->context->language->id); - $cover_image_arr = $product->getCover($type_value['product_id']); + if ($order->carrier->url && $order->shipping_number) { + $order->followup = str_replace('@', $order->shipping_number, $order->carrier->url); + } + $order->hook_orderdetaildisplayed = Hook::exec('displayOrderDetail', array('order' => $order)); - if (!empty($cover_image_arr)) { - $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); - } else { - $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); + // enter the details of the booking the order + if ($hotelresInstalled) { + if ($orderProducts = $order->getProducts()) { + $total_demands_price_te = 0; + $total_demands_price_ti = 0; + $total_convenience_fee_te = 0; + $total_convenience_fee_ti = 0; + foreach ($orderProducts as $type_key => $type_value) { + if (in_array($type_value['product_id'], $processedProducts)) { + continue; } + if ($type_value['is_booking_product']) { + $processedProducts[] = $type_value['product_id']; - if (isset($customer->id)) { - $obj_cart = new Cart($order->id_cart); - $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $obj_cart->id_guest, $type_value['product_id'], $customer->id); - } else { - $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']); - } - $cartHotelData[$type_key]['id_product'] = $type_value['product_id']; - $cartHotelData[$type_key]['cover_img'] = $cover_img; + $product = new Product($type_value['product_id'], false, $this->context->language->id); + $cover_image_arr = $product->getCover($type_value['product_id']); - - $objBookingDemand = new HotelBookingDemands(); - foreach ($order_bk_data as $data_k => $data_v) { - $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); - - $cartHotelData[$type_key]['adults'] = $data_v['adults']; - $cartHotelData[$type_key]['children'] = $data_v['children']; - /*Product price when order was created*/ - $order_details_obj = new OrderDetail($data_v['id_order_detail']); - $cartHotelData[$type_key]['name'] = $order_details_obj->product_name; - $cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity; - $cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity; - - if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1; - - $num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days']; - $var_quant = (int) $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm']; - - $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults']; - $cartHotelData[$type_key]['date_diff'][$date_join]['children'] += $data_v['children']; - - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] += $data_v['total_price_tax_excl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; - if ($data_v['is_back_order']) { - $anyBackOrder = 1; - } - if ($data_v['is_refunded']) { - $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] += 1; - } - if ($data_v['is_cancelled']) { - $cartHotelData[$type_key]['date_diff'][$date_join]['count_cancelled'] += 1; - $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] -= 1; - } + if (!empty($cover_image_arr)) { + $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); } else { - $num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']); - $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1; - $cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; - $cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; - $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; - $cartHotelData[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; + $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); + } - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; - if ($data_v['is_back_order']) { - $anyBackOrder = 1; + if (isset($customer->id)) { + $obj_cart = new Cart($order->id_cart); + $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $obj_cart->id_guest, $type_value['product_id'], $customer->id); + } else { + $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']); + } + $cartHotelData[$type_key]['id_product'] = $type_value['product_id']; + $cartHotelData[$type_key]['cover_img'] = $cover_img; + + + $objBookingDemand = new HotelBookingDemands(); + foreach ($order_bk_data as $data_k => $data_v) { + $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); + + $cartHotelData[$type_key]['adults'] = $data_v['adults']; + $cartHotelData[$type_key]['children'] = $data_v['children']; + /*Product price when order was created*/ + $order_details_obj = new OrderDetail($data_v['id_order_detail']); + $cartHotelData[$type_key]['name'] = $order_details_obj->product_name; + $cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity; + $cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity; + + if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1; + + $num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days']; + $var_quant = (int) $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults']; + $cartHotelData[$type_key]['date_diff'][$date_join]['children'] += $data_v['children']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] += $data_v['total_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; + if ($data_v['is_back_order']) { + $anyBackOrder = 1; + } + if ($data_v['is_refunded']) { + $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] += 1; + } + if ($data_v['is_cancelled']) { + $cartHotelData[$type_key]['date_diff'][$date_join]['count_cancelled'] += 1; + $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] -= 1; + } + } else { + $num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']); + $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1; + $cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; + $cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; + $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; + $cartHotelData[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; + if ($data_v['is_back_order']) { + $anyBackOrder = 1; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['count_cancelled'] = 0; + $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] = 0; + if ($data_v['is_refunded']) { + $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] += 1; + } + if ($data_v['is_cancelled']) { + $cartHotelData[$type_key]['date_diff'][$date_join]['count_cancelled'] += 1; + $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] -= 1; + } } - $cartHotelData[$type_key]['date_diff'][$date_join]['count_cancelled'] = 0; - $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] = 0; - if ($data_v['is_refunded']) { - $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] += 1; + + $cartHotelData[$type_key]['date_diff'][$date_join]['is_refunded'] = $data_v['is_refunded']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $type_value['product_id'], + 0, + $data_v['date_from'], + $data_v['date_to'] + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0; } - if ($data_v['is_cancelled']) { - $cartHotelData[$type_key]['date_diff'][$date_join]['count_cancelled'] += 1; - $cartHotelData[$type_key]['date_diff'][$date_join]['count_refunded'] -= 1; + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $type_value['product_id'], + $data_v['id_room'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 1, + 1 + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0; } + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $type_value['product_id'], + $data_v['id_room'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 1, + 0 + ); + $total_demands_price_ti += $extraDemandPriceTI; + $total_demands_price_te += $extraDemandPriceTE; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl; + + $feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']); + $cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff; + + $cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name']; + // add additional services products in hotel detail. + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'] + ); + + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $additionalServicesPriceTI = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 1 + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $additionalServicesPriceTE = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 0 + ); + // get auto added price to be displayed with room price + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 1, + 1, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 0, + 1, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ); } - - $cartHotelData[$type_key]['date_diff'][$date_join]['is_refunded'] = $data_v['is_refunded']; - - $cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id']; - - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( - $idOrder, - $type_value['product_id'], - 0, - $data_v['date_from'], - $data_v['date_to'] - ); - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0; - } - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands( - $idOrder, - $type_value['product_id'], - $data_v['id_room'], - $data_v['date_from'], - $data_v['date_to'], - 0, - 1, - 1 - ); - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0; - } - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands( - $idOrder, - $type_value['product_id'], - $data_v['id_room'], - $data_v['date_from'], - $data_v['date_to'], - 0, - 1, - 0 - ); - $total_demands_price_ti += $extraDemandPriceTI; - $total_demands_price_te += $extraDemandPriceTE; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl; - - $feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']); - $cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff; - - $cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name']; - // add additional services products in hotel detail. - $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( - $idOrder, - 0, - 0, - $type_value['product_id'], - $data_v['date_from'], - $data_v['date_to'] - ); - - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0; - } - $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $additionalServicesPriceTI = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( - $idOrder, - 0, - 0, - $type_value['product_id'], - $data_v['date_from'], - $data_v['date_to'], - $data_v['id_room'], - 1, - 1 - ); - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0; - } - $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $additionalServicesPriceTE = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( - $idOrder, - 0, - 0, - $type_value['product_id'], - $data_v['date_from'], - $data_v['date_to'], - $data_v['id_room'], - 1, - 0 - ); // get auto added price to be displayed with room price if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) { $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0; @@ -458,121 +492,86 @@ class GuestTrackingControllerCore extends FrontController 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM ); - } - // get auto added price to be displayed with room price - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0; - } - $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( - $idOrder, - 0, - 0, - $type_value['product_id'], - $data_v['date_from'], - $data_v['date_to'], - $data_v['id_room'], - 1, - 1, - 1, - Product::PRICE_ADDITION_TYPE_WITH_ROOM - ); - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0; - } - $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( - $idOrder, - 0, - 0, - $type_value['product_id'], - $data_v['date_from'], - $data_v['date_to'], - $data_v['id_room'], - 1, - 0, - 1, - Product::PRICE_ADDITION_TYPE_WITH_ROOM - ); - // calculate averages now - foreach ($cartHotelData[$type_key]['date_diff'] as $key => &$value) { - $value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $value['num_rm'], 6); - $value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6); + // calculate averages now + foreach ($cartHotelData[$type_key]['date_diff'] as $key => &$value) { + $value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $value['num_rm'], 6); + $value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6); - $value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6)); - $value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6)); - } - } else if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) { - if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) { - $total_convenience_fee_ti += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( - $idOrder, - $type_value['product_id'], - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1 - ); - $total_convenience_fee_te += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( - $idOrder, - $type_value['product_id'], - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1 - ); - } - } else { - // get all products that are independent. - if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) { - $product = new Product($type_value['product_id'], false, $this->context->language->id); - $cover_image_arr = $product->getCover($type_value['product_id']); - - if (!empty($cover_image_arr)) { - $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); - } else { - $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); + $value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6)); + $value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6)); + } + } else if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) { + if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) { + $total_convenience_fee_ti += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + $type_value['product_id'], + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1 + ); + $total_convenience_fee_te += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + $type_value['product_id'], + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1 + ); + } + } else { + // get all products that are independent. + if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) { + $product = new Product($type_value['product_id'], false, $this->context->language->id); + $cover_image_arr = $product->getCover($type_value['product_id']); + + if (!empty($cover_image_arr)) { + $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); + } else { + $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); + } + $cartServiceProducts[] = $type_value; } - $cartServiceProducts[] = $type_value; } } } } + // end booking details entries + $redirectTermsLink = $this->context->link->getCMSLink( + new CMS(3, $this->context->language->id), + null, $this->context->language->id + ); + + $customerGuestDetail = false; + if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) { + $customerGuestDetail = new OrderCustomerGuestDetail($id_customer_guest_detail); + } + + // set order specific values + $order->total_convenience_fee_ti = $total_convenience_fee_ti; + $order->total_convenience_fee_te = $total_convenience_fee_te; + $order->total_demands_price_ti = $total_demands_price_ti; + $order->total_demands_price_te = $total_demands_price_te; + $order->any_back_order = $anyBackOrder; + $order->shw_bo_msg = Configuration::get('WK_SHOW_MSG_ON_BO'); + $order->back_ord_msg = Configuration::get('WK_BO_MESSAGE'); + $order->order_has_invoice = $order->hasInvoice(); + $order->cart_htl_data = $cartHotelData; + $order->non_requested_rooms = $nonRequestedRooms; + $order->customerGuestDetail = $customerGuestDetail; + //end + + Hook::exec('actionOrderDetail', array('carrier' => $order->carrier, 'order' => $order)); + } - // end booking details entries - $redirectTermsLink = $this->context->link->getCMSLink( - new CMS(3, $this->context->language->id), - null, $this->context->language->id - ); - - $customerGuestDetail = false; - if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) { - $customerGuestDetail = new OrderCustomerGuestDetail($id_customer_guest_detail); - } - - $this->context->smarty->assign( - array( - 'total_convenience_fee_ti' => $total_convenience_fee_ti, - 'total_convenience_fee_te' => $total_convenience_fee_te, - 'total_demands_price_ti' => $total_demands_price_ti, - 'total_demands_price_te' => $total_demands_price_te, - 'any_back_order' => $anyBackOrder, - 'shw_bo_msg' => Configuration::get('WK_SHOW_MSG_ON_BO'), - 'back_ord_msg' => Configuration::get('WK_BO_MESSAGE'), - 'order_has_invoice' => $order->hasInvoice(), - 'cart_htl_data' => $cartHotelData, - 'non_requested_rooms' => $nonRequestedRooms, - 'customerGuestDetail' => $customerGuestDetail, - ) - ); - //end - - Hook::exec('actionOrderDetail', array('carrier' => $order->carrier, 'order' => $order)); } $this->context->smarty->assign(array( diff --git a/themes/hotel-reservation-theme/guest-tracking.tpl b/themes/hotel-reservation-theme/guest-tracking.tpl index 4ed9b1b57..34ef93ab7 100644 --- a/themes/hotel-reservation-theme/guest-tracking.tpl +++ b/themes/hotel-reservation-theme/guest-tracking.tpl @@ -46,6 +46,18 @@ {assign var=products value=$order->products} {assign var=customizedDatas value=$order->customizedDatas} {assign var=HOOK_ORDERDETAILDISPLAYED value=$order->hook_orderdetaildisplayed} + {assign var=total_convenience_fee_ti value=$order->total_convenience_fee_ti} + {assign var=total_convenience_fee_te value=$order->total_convenience_fee_te} + {assign var=total_demands_price_ti value=$order->total_demands_price_ti} + {assign var=total_demands_price_te value=$order->total_demands_price_te} + {assign var=any_back_order value=$order->any_back_order} + {assign var=shw_bo_msg value=$order->shw_bo_msg} + {assign var=back_ord_msg value=$order->back_ord_msg} + {assign var=order_has_invoice value=$order->order_has_invoice} + {assign var=cart_htl_data value=$order->cart_htl_data} + {assign var=non_requested_rooms value=$order->non_requested_rooms} + {assign var=customerGuestDetail value=$order->customerGuestDetail} + {if isset($order->total_old)} {assign var=total_old value=$order->total_old} {/if} From 27a8ae8338542a5c2f30a437f4459bf2ca3755ac Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Fri, 25 Aug 2023 11:58:33 +0530 Subject: [PATCH 07/69] Fixed: Getting PS exception when admin sends
- - - + *} diff --git a/controllers/admin/AdminLoginController.php b/controllers/admin/AdminLoginController.php index 4daeaadf0..78331bd0c 100644 --- a/controllers/admin/AdminLoginController.php +++ b/controllers/admin/AdminLoginController.php @@ -45,6 +45,18 @@ class AdminLoginControllerCore extends AdminController } } + public function init() + { + parent::init(); + + if ($this->ajax && Tools::getValue('action') == 'checkLoginStatus') { + $this->ajaxDie(json_encode(array( + 'status' => true, + 'is_logged_in' => $this->context->employee->isLoggedBack(), + ))); + } + } + public function setMedia() { $this->addJquery(); diff --git a/js/admin.js b/js/admin.js index 4d474721a..7b16f76bf 100644 --- a/js/admin.js +++ b/js/admin.js @@ -1219,6 +1219,26 @@ function sendBulkAction(form, action) $(form).submit(); } +function checkIfEmployeeIsLoggedIn() { + return new Promise(function (resolve) { + $.ajax({ + url : window.location.pathname, + type: 'POST', + dataType: 'JSON', + data : { + ajax : '1', + controller : 'AdminLogin', + action : 'checkLoginStatus', + }, + success : function(response) { + if (response.status) { + resolve(response.is_logged_in); + } + } + }); + }); +} + function openModulesList() { if (!modules_list_loaded) From 9ceee02abfc23d5de76ef11d907130600cf14824 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 23 Oct 2023 12:55:47 +0530 Subject: [PATCH 34/69] Fix click issue --- admin/themes/default/sass/partials/_icons.sass | 2 +- classes/controller/AdminController.php | 2 ++ controllers/admin/AdminModulesCatalogController.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/sass/partials/_icons.sass b/admin/themes/default/sass/partials/_icons.sass index 6788aad63..df946e757 100644 --- a/admin/themes/default/sass/partials/_icons.sass +++ b/admin/themes/default/sass/partials/_icons.sass @@ -362,7 +362,7 @@ @extend .icon-edit .process-icon-newAttributes, .process-icon-new, .process-icon-new-url @extend .icon-plus-sign - .process-icon-modules-list + .process-icon-modules-list, .process-icon-puzzle-piece @extend .icon-puzzle-piece .process-icon-save-date @extend .icon-download diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index ea3a469f7..e4a79846b 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2171,6 +2171,8 @@ class AdminControllerCore extends Controller */ protected function initTabModuleList() { + $this->tab_modules_list = Tab::getTabModulesList($this->id); + if (is_array($this->tab_modules_list['default_list']) && count($this->tab_modules_list['default_list'])) { $this->filter_modules_list = $this->tab_modules_list['default_list']; } elseif (is_array($this->tab_modules_list['slider_list']) && count($this->tab_modules_list['slider_list'])) { diff --git a/controllers/admin/AdminModulesCatalogController.php b/controllers/admin/AdminModulesCatalogController.php index 6b8e7f953..72888b9d8 100644 --- a/controllers/admin/AdminModulesCatalogController.php +++ b/controllers/admin/AdminModulesCatalogController.php @@ -235,7 +235,7 @@ class AdminModulesCatalogControllerCore extends AdminController $this->page_header_toolbar_btn['addons'] = array( 'href' => 'https://qloapps.com/addons/', 'desc' => $this->l('Explore all Addons'), - 'imgclass' => 'modules-list', + 'imgclass' => 'puzzle-piece', 'target' => true ); } From 36aee10ef8b572130d6532c63573b08e85ac691b Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 24 Oct 2023 17:05:14 +0530 Subject: [PATCH 35/69] Updated: Allow service products to be associated from room type edit page --- .../controllers/products/serviceproduct.tpl | 133 ++++++---- classes/Product.php | 16 ++ controllers/admin/AdminProductsController.php | 243 ++++++++++-------- js/admin/products.js | 65 +---- .../classes/RoomTypeServiceProduct.php | 76 ++++-- .../classes/RoomTypeServiceProductPrice.php | 6 +- 6 files changed, 301 insertions(+), 238 deletions(-) diff --git a/admin/themes/default/template/controllers/products/serviceproduct.tpl b/admin/themes/default/template/controllers/products/serviceproduct.tpl index 668c5e0d6..e25bc5f68 100644 --- a/admin/themes/default/template/controllers/products/serviceproduct.tpl +++ b/admin/themes/default/template/controllers/products/serviceproduct.tpl @@ -3,19 +3,20 @@

{l s='Service Products'}

- {if isset($service_products) && $service_products} + {if isset($all_service_products) && $all_service_products}
- + + - - - {foreach from=$service_products key=key item=service_product} - - - - - + + + + + - + - - - +
+ {l s='Default price: %s' sprintf={displayPrice price=$service_product.association_info.default_price currency=$currency->id}} +
+ + + + + {else} + + + + + + + + + + + {/if} {/foreach} diff --git a/classes/Product.php b/classes/Product.php index 9af80ed4f..be1b3c21d 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -1414,6 +1414,22 @@ class ProductCore extends ObjectModel return $result; } + public static function getAllServiceProducts($activeOnly = true, $idLang = null) + { + if (!$idLang) { + $idLang = Context::getContext()->language->id; + } + + $sql = 'SELECT p.*, pl.* + FROM `'._DB_PREFIX_.'product` p + LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON + (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $idLang.') + WHERE p.`booking_product` = 0'.($activeOnly ? ' AND p.`active` = 1' : '').' + ORDER BY p.`id_product`'; + + return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); + } + public function getAvailableServiceProductsCategories($id_lang, $front = false, $active = true, Context $context = null) { if (!$context) { diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 542c4bdb6..ca3ad1b54 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1106,9 +1106,12 @@ class AdminProductsControllerCore extends AdminController $idElement = Tools::getValue('id_element'); $idProduct = Tools::getValue('id_product'); if ($idElement && $idProduct) { - $position = Tools::getValue('position'); - $toRowIndex = Tools::getValue('to_row_index'); - if (RoomTypeServiceProduct:: changePositions($idProduct, $idElement, $toRowIndex, $position)) { + $newPosition = Tools::getValue('new_position'); + if (RoomTypeServiceProduct::changePositions( + $idProduct, + $idElement, + $newPosition - 1 + )) { $response['msg'] = $this->l('Updated Successfully'); $response['success'] = true; } @@ -1116,83 +1119,6 @@ class AdminProductsControllerCore extends AdminController die(json_encode($response)); } - public function ajaxProcessUpdatedServiceProductPrice() - { - $response = array(); - if ($this->tabAccess['edit'] === '1') { - // process price update - $idProduct = Tools::getValue('id_product'); - $idServiceProduct = Tools::getValue('service_product_id'); - $price = Tools::getValue('price'); - $id_tax_rules_group = Tools::getValue('id_tax_rules_group'); - - if (!$idProduct) { - $error = $this->l('Invalid room type.'); - } else { - $objRoomType = new HotelRoomType(); - if (!Product::isBookingProduct($idProduct)) { - $error = $this->l('Room Type details not found. Save room type details before updating price.'); - } - } - if (!$idServiceProduct) { - $error = $this->l('Service Product not found.'); - } - - if (!$price) { - $error = $this->l('Service product price must not be empty'); - } elseif (!Validate::isPrice($price)) { - $error = $this->l('Service product price is invalid'); - } - - if (!isset($error)) { - $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); - $priceExists = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( - $idServiceProduct, - $idProduct, - RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE - ); - - if ($priceExists) { - $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice($priceExists['id_room_type_service_product_price']); - } else { - $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); - $objRoomTypeServiceProductPrice->id_product = $idServiceProduct; - $objRoomTypeServiceProductPrice->id_element = $idProduct; - $objRoomTypeServiceProductPrice->element_type = RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE; - } - - $objRoomTypeServiceProductPrice->price = $price; - $objRoomTypeServiceProductPrice->id_tax_rules_group = $id_tax_rules_group; - - if (!$objRoomTypeServiceProductPrice->save()) { - $error = $this->l('Unable to save price, please try again.'); - } else { - $response['price'] = Tools::DisplayPrice($price); - if (Validate::isLoadedObject($objTaxRuleGroup = new TaxRulesGroup( - $objRoomTypeServiceProductPrice->id_tax_rules_group, - $this->context->language->id - ))) { - $response['tax_rules_group_name'] = $objTaxRuleGroup->name; - } else { - $response['tax_rules_group_name'] = $this->l('No tax'); - } - } - } - } else { - $error = Tools::displayError('You do not have permission to edit this.'); - } - - if (isset($error)) { - $response['status'] = 'error'; - $response['message'] = $error; - } else { - $response['status'] = 'ok'; - $response['message'] = $this->l('Price Updated Successfully'); - } - - die(json_encode($response)); - } - public function initProcess() { if (Tools::isSubmit('submitAddproductAndStay') || Tools::isSubmit('submitAddproduct')) { @@ -1851,6 +1777,9 @@ class AdminProductsControllerCore extends AdminController StockAvailable::setProductDependsOnStock((int)$this->object->id, $depends_on_stock, $this->context->shop->id); } + // update service products + $this->updateServiceProducts($object); + PrestaShopLogger::addLog(sprintf($this->l('%s modification', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id); if (in_array($this->context->shop->getContext(), array(Shop::CONTEXT_SHOP, Shop::CONTEXT_ALL))) { if ($this->isTabSubmitted('Shipping')) { @@ -1953,6 +1882,70 @@ class AdminProductsControllerCore extends AdminController } } + public function updateServiceProducts($object) + { + $availableServiceProducts = Tools::getValue('available_service_products'); + foreach ($availableServiceProducts as $idServiceProduct) { + $prefix = 'service_product_'.$idServiceProduct.'_'; + $isAssociated = in_array(Tools::getValue($prefix.'associated'), array('on', 'true', '1')); + if ($isAssociated) { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + + // if already associated + if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct( + $object->id, + $idServiceProduct + )) { + $price = Tools::getValue($prefix.'price'); + $id_tax_rules_group = Tools::getValue($prefix.'id_tax_rules_group'); + + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $priceInfo = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( + $idServiceProduct, + $object->id, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + ); + + $objRoomTypeServiceProductPrice = null; + if ($priceInfo) { + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice($priceInfo['id_room_type_service_product_price']); + } else { + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $objRoomTypeServiceProductPrice->id_product = $idServiceProduct; + $objRoomTypeServiceProductPrice->id_element = $object->id; + $objRoomTypeServiceProductPrice->element_type = RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE; + } + + $objRoomTypeServiceProductPrice->price = $price; + $objRoomTypeServiceProductPrice->id_tax_rules_group = $id_tax_rules_group; + + $objRoomTypeServiceProductPrice->save(); + } else { + // create new association + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $objRoomTypeServiceProduct->addRoomProductLink( + $idServiceProduct, + $object->id, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + ); + } + } else { + // remove association + RoomTypeServiceProduct::deleteRoomProductLink( + $idServiceProduct, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE, + $object->id + ); + + RoomTypeServiceProductPrice::deleteRoomProductPrices( + $idServiceProduct, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE, + $object->id + ); + } + } + } + /** * Check that a saved product is valid */ @@ -2828,53 +2821,77 @@ class AdminProductsControllerCore extends AdminController $objRoomType = new HotelRoomType(); if ($hotelRoomType = $objRoomType->getRoomTypeInfoByIdProduct($obj->id)) { + $allServiceProducts = Product::getAllServiceProducts(false); + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); - $serviceProducts = $objRoomTypeServiceProduct->getProductsForRoomType( - $obj->id - ); - foreach ($serviceProducts as &$serviceProduct) { - $product = new Product($serviceProduct['id_product'], false, $this->context->language->id); - $serviceProductPriceInfo = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( - $product->id, - $obj->id, - RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE - ); - $serviceProduct['id_product'] = $product->id; - $serviceProduct['name'] = $product->name; - $serviceProduct['auto_add_to_cart'] = $product->auto_add_to_cart; - $serviceProduct['category'] = $product->category; - $serviceProduct['default_price'] = $product->price; - $serviceProduct['id_tax_rules_group'] = $product->id_tax_rules_group; - if ($serviceProductPriceInfo) { - $serviceProduct['custom_price'] = $serviceProductPriceInfo['price']; - $serviceProduct['id_tax_rules_group'] = $serviceProductPriceInfo['id_tax_rules_group']; - if ($serviceProductPriceInfo['id_tax_rules_group'] == 0) { - $serviceProduct['tax_rules_group_name'] = 'No tax'; + + // change index of array to id_product for faster search + $tmpServiceProducts = $objRoomTypeServiceProduct->getProductsForRoomType($obj->id); + $roomTypeServiceProducts = array(); + foreach ($tmpServiceProducts as $serviceProduct) { + $roomTypeServiceProducts[$serviceProduct['id_product']] = $serviceProduct; + } + + $idsRoomTypeServiceProduct = array_column($roomTypeServiceProducts, 'id_product'); + foreach ($allServiceProducts as &$serviceProduct) { + if (in_array($serviceProduct['id_product'], $idsRoomTypeServiceProduct)) { + $associationInfo = array(); + + $objProduct = new Product($serviceProduct['id_product'], false, $this->context->language->id); + $serviceProductPriceInfo = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( + $objProduct->id, + $obj->id, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + ); + + $associationInfo['id_room_type_service_product'] = $roomTypeServiceProducts[$serviceProduct['id_product']]['id_room_type_service_product']; + $associationInfo['position'] = $roomTypeServiceProducts[$serviceProduct['id_product']]['position']; + $associationInfo['id_product'] = $objProduct->id; + $associationInfo['name'] = $objProduct->name; + $associationInfo['auto_add_to_cart'] = $objProduct->auto_add_to_cart; + $associationInfo['category'] = $objProduct->category; + $associationInfo['default_price'] = $objProduct->price; + $associationInfo['id_tax_rules_group'] = $objProduct->id_tax_rules_group; + if ($serviceProductPriceInfo) { + $associationInfo['custom_price'] = $serviceProductPriceInfo['price']; + $associationInfo['id_tax_rules_group'] = $serviceProductPriceInfo['id_tax_rules_group']; + if ($serviceProductPriceInfo['id_tax_rules_group'] == 0) { + $associationInfo['tax_rules_group_name'] = 'No tax'; + } else { + $objTaxRuleGroup = new TaxRulesGroup( + $serviceProductPriceInfo['id_tax_rules_group'], + $this->context->language->id + ); + $associationInfo['tax_rules_group_name'] = $objTaxRuleGroup->name; + } + $associationInfo['id_room_type_service_product_price'] = $serviceProductPriceInfo['id_room_type_service_product_price']; + } + + if ($objProduct->id_tax_rules_group == 0) { + $associationInfo['default_tax_rules_group_name'] = 'No tax'; } else { $objTaxRuleGroup = new TaxRulesGroup( - $serviceProductPriceInfo['id_tax_rules_group'], + $objProduct->id_tax_rules_group, $this->context->language->id ); - $serviceProduct['tax_rules_group_name'] = $objTaxRuleGroup->name; + $associationInfo['default_tax_rules_group_name'] = $objTaxRuleGroup->name; } - $serviceProduct['id_room_type_service_product_price'] = $serviceProductPriceInfo['id_room_type_service_product_price']; - } - if ($product->id_tax_rules_group == 0) { - $serviceProduct['default_tax_rules_group_name'] = 'No tax'; + $serviceProduct['is_associated'] = true; + $serviceProduct['association_info'] = $associationInfo; } else { - $objTaxRuleGroup = new TaxRulesGroup( - $product->id_tax_rules_group, - $this->context->language->id - ); - $serviceProduct['default_tax_rules_group_name'] = $objTaxRuleGroup->name; + $serviceProduct['is_associated'] = false; + + $objTaxRulesGroup = new TaxRulesGroup($serviceProduct['id_tax_rules_group'], $this->context->language->id); + $serviceProduct['tax_rules_group_name'] = $objTaxRulesGroup->name; } } + $data->assign(array( 'product' => $obj, 'currency' => $this->context->currency, - 'service_products' => $serviceProducts, + 'all_service_products' => $allServiceProducts, 'tax_rules_groups' => $tax_rules_groups, 'taxesRatesByGroup' => $tax_rates, )); diff --git a/js/admin/products.js b/js/admin/products.js index 8dd79764e..5648913e2 100644 --- a/js/admin/products.js +++ b/js/admin/products.js @@ -432,12 +432,12 @@ product_tabs['ServiceProduct'] = new function(){ dragHandle: 'dragHandle', onDragClass: 'myDragClass', onDrop: function (table, row) { - id_product = $(row).attr("id_product"); - id_element = $(row).attr("id_element"); - id_row = $(row).attr("id"); - position = $(row).attr("position"); - // id_slider_image = $(row).attr("id_slider_image"); - var to_row_index = $('#' + id_row).index(); + let rowId = $(row).attr('id'); + + let idProduct = parseInt($(row).attr('id_product')); + let idElement = parseInt($(row).attr('id_element')); + let newPosition = parseInt($('#' + rowId).index()) - 1; + $.ajax({ method: 'POST', url: $(row).data('roomtype_url'), @@ -446,13 +446,10 @@ product_tabs['ServiceProduct'] = new function(){ data: { ajax: true, action: 'changeServicePosition', - changeServicePosition: "1", - id_product: id_product, - id_element: id_element, - position: position, - to_row_index: to_row_index + id_product: idProduct, + id_element: idElement, + new_position: newPosition, }, - success: function (response) { if (response.success) { $($('.hotel-roomtype-link-table tbody')).find('tr').each(function (index, value) { @@ -479,12 +476,12 @@ product_tabs['ServiceProduct'] = new function(){ }); } - $(this).on('click', '.button-edit-price', function(e){ + $(document).on('click', '.button-edit-price', function(e){ e.preventDefault(); togglelinkedProductEditForm(this, true); }); - $(this).on('click', '.btn-cancel', function(e){ + $(document).on('click', '.btn-cancel', function(e){ e.preventDefault(); togglelinkedProductEditForm(this, false); }); @@ -494,46 +491,6 @@ product_tabs['ServiceProduct'] = new function(){ $(triggeredElement).closest('tr').find('.field-edit').toggle(showform); $(triggeredElement).closest('tr').find('.field-view').toggle(!showform);; } - - $(this).on('click', '.btn-save', function(e){ - e.preventDefault(); - selectedElement = this; - var price = $(this).closest('tr').find('.service-product-price').val(); - var id_tax_rules_group = $(this).closest('tr').find('.service_product_id_tax_rules_group').val(); - if (!price) { - showErrorMessage(); - return; - } - $.ajax({ - url: $(this).data('roomtype_url'), - data: { - id_product: id_product, - service_product_id : $(this).data('id_product'), - price: price, - id_tax_rules_group: id_tax_rules_group, - action: 'updatedServiceProductPrice', - ajax: true - }, - dataType: 'json', - success: function(data) { - if (data.status == 'ok') - { - $(selectedElement).closest('tr').find('.service-product-price-text').text(data.price); - $(selectedElement).closest('tr').find('.service_product_tax_text').text(data.tax_rules_group_name); - - togglelinkedProductEditForm(selectedElement, false); - showSuccessMessage(data.message); - } - else - { - showErrorMessage(data.message); - } - }, - error : function(data){ - showErrorMessage(("[TECHNICAL ERROR]")); - } - }); - }); } } diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index 4cb2df0e2..1866d06b6 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -47,7 +47,7 @@ class RoomTypeServiceProduct extends ObjectModel ) ); - public static function deleteRoomProductLink($idProduct, $elementType = 0) + public static function deleteRoomProductLink($idProduct, $elementType = 0, $idElement = 0) { $where = '`id_product`='.(int)$idProduct; @@ -55,6 +55,10 @@ class RoomTypeServiceProduct extends ObjectModel $where .= ' AND `element_type`='.(int)$elementType; } + if ($idElement) { + $where .= ' AND `id_element` = '.(int) $idElement; + } + return Db::getInstance()->delete( 'htl_room_type_service_product', $where @@ -71,7 +75,7 @@ class RoomTypeServiceProduct extends ObjectModel foreach($values as $value) { $rowData[] = array( 'id_product' => $idProduct, - 'position' => self::getHigherPosition(), + 'position' => self::getHigherPosition($value, $elementType), 'id_element' => $value, 'element_type' => $elementType ); @@ -216,10 +220,13 @@ class RoomTypeServiceProduct extends ObjectModel return $serviceProductsCategories; } - public static function getHigherPosition() + public static function getHigherPosition($idElement, $elementType) { $position = DB::getInstance()->getValue( - 'SELECT MAX(`position`) FROM `'._DB_PREFIX_.'htl_room_type_service_product`' + 'SELECT MAX(rsp.`position`) + FROM `'._DB_PREFIX_.'htl_room_type_service_product` AS rsp + WHERE rsp.`id_element` = '.(int) $idElement.' + AND rsp.`element_type` = '.(int) $elementType ); $result = (is_numeric($position)) ? $position : -1; return $result + 1; @@ -244,22 +251,49 @@ class RoomTypeServiceProduct extends ObjectModel * @param int $idPosition * @return boolean */ - public static function changePositions($idProduct, $idElement, $toRowIndex, $idPosition) - { - if ($toRowIndex >= $idPosition) { - Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` SET `position` = position -1 - WHERE `id_product` != '.(int) $idProduct.' AND `id_element` ='.(int) $idElement .' AND `element_type` = '.self::WK_ELEMENT_TYPE_ROOM_TYPE.' - AND `position` <= '.(int) ($toRowIndex). ' AND `position` >= ' .(int) $idPosition); - - return Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` SET `position` = '.(int) ($toRowIndex).' - WHERE `id_product` = '.(int) $idProduct.' AND `id_element` ='.(int) $idElement .' AND `element_type` = '.self::WK_ELEMENT_TYPE_ROOM_TYPE); - } elseif ($toRowIndex < $idPosition) { - Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` SET `position` = position +1 - WHERE `id_product` != '.(int) $idProduct.' AND `id_element` ='.(int) $idElement .' AND `element_type` = '.self::WK_ELEMENT_TYPE_ROOM_TYPE.' - AND `position` >= '. (int) $toRowIndex. ' AND `position` <= ' .(int) $idPosition); - - return Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` SET `position` = '.$toRowIndex.' - WHERE `id_product` = '.(int) $idProduct.' AND `id_element` ='.(int) $idElement .' AND `element_type` = '.self::WK_ELEMENT_TYPE_ROOM_TYPE); + public static function changePositions( + $idProduct, + $idElement, + $newPosition, + $elementType = self::WK_ELEMENT_TYPE_ROOM_TYPE + ) { + if (!$result = Db::getInstance()->executeS( + 'SELECT rsp.`id_product`, rsp.`position` + FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp + WHERE rsp.`id_element` = '.(int) $idElement.' + AND rsp.`element_type` = '.(int) $elementType.' + ORDER BY rsp.`position` ASC' + )) { + return false; } + + $movedBlock = false; + foreach ($result as $block) { + if ((int) $block['id_product'] == (int) $idProduct) { + $movedBlock = $block; + } + } + + if ($movedBlock === false) { + return false; + } + + $way = ($newPosition >= $movedBlock['position']) ? 0 : 1; + + return (Db::getInstance()->execute( + 'UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` rsp + SET rsp.`position` = `position` '.($way ? '- 1' : '+ 1').' + WHERE rsp.`id_element` = '.(int) $idElement.' + AND rsp.`element_type` = '.(int) $elementType.' + AND rsp.`position`'.($way ? '> '. + (int) $movedBlock['position'].' AND rsp.`position` <= '.(int) $position : '< '. + (int) $movedBlock['position'].' AND rsp.`position` >= '.(int) $position) + ) && Db::getInstance()->execute( + 'UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` rsp + SET rsp.`position` = '.(int) $position.' + WHERE rsp.`id_element` = '.(int) $idElement.' + AND rsp.`element_type` = '.(int) $elementType.' + AND rsp.`id_product` = '.(int) $movedBlock['id_product'] + )); } -} \ No newline at end of file +} diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php index ea8879f6e..fc4235a05 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php @@ -49,7 +49,7 @@ class RoomTypeServiceProductPrice extends ObjectModel ) ); - public static function deleteRoomProductPrices($idProduct, $elementType = 0) + public static function deleteRoomProductPrices($idProduct, $elementType = 0, $idElement = 0) { $where = '`id_product`='.(int)$idProduct; @@ -57,6 +57,10 @@ class RoomTypeServiceProductPrice extends ObjectModel $where .= ' AND `element_type`='.(int)$elementType; } + if ($idElement) { + $where .= ' AND `id_element` = '.(int) $idElement; + } + return Db::getInstance()->delete( 'htl_room_type_service_product_price', $where From 310188bd3039bb85ce080dd7567eedc5c967806c Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 9 Nov 2023 15:19:48 +0530 Subject: [PATCH 36/69] Display errors --- classes/controller/AdminController.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 712650a5c..511cdcb80 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -4009,21 +4009,29 @@ class AdminControllerCore extends Controller * @return bool true if success * @throws PrestaShopException */ - protected function processBulkStatusSelection($status, $redirect = true) + protected function processBulkStatusSelection($status) { $result = true; if (is_array($this->boxes) && !empty($this->boxes)) { foreach ($this->boxes as $id) { /** @var ObjectModel $object */ - $object = new $this->className((int)$id); - $object->setFieldsToUpdate(array('active' => true)); - $object->active = (int)$status; - $result &= $object->update(); - } - } + $object = new $this->className((int) $id); + $object->active = (int) $status; + $isUpdated = (bool) $object->update(); + $result &= $isUpdated; - if ($redirect && $result) { - $this->redirect_after = self::$currentIndex.'&conf=5&token='.$this->token; + if (!$isUpdated) { + $this->errors[] = sprintf($this->l('Can\'t update #%d status.'), (int) $id); + } + } + + if ($result) { + $this->redirect_after = self::$currentIndex.'&conf=5&token='.$this->token; + } else { + $this->errors[] = $this->l('An error occurred while updating the status.'); + } + } else { + $this->errors[] = $this->l('You must select at least one item to perform a bulk action.'); } return $result; From b760fcee3af32fc0f86ab9df92b0742eb4d81df1 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 15 Nov 2023 13:38:26 +0530 Subject: [PATCH 37/69] Hide long button texts --- themes/hotel-reservation-theme/css/global.css | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/hotel-reservation-theme/css/global.css b/themes/hotel-reservation-theme/css/global.css index 3cd05730d..1fe680c84 100644 --- a/themes/hotel-reservation-theme/css/global.css +++ b/themes/hotel-reservation-theme/css/global.css @@ -6540,6 +6540,7 @@ table.table_block td { } .input-occupancy, .form-control .input-occupancy { text-align: left; + overflow: hidden; } .page-product-box { From 25fb492e189f624cd05dfdc32381085b2a52cb9f Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 20 Nov 2023 13:32:24 +0530 Subject: [PATCH 38/69] Remove 'status' field --- controllers/admin/AdminLoginController.php | 1 - js/admin.js | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/controllers/admin/AdminLoginController.php b/controllers/admin/AdminLoginController.php index 78331bd0c..f48096f05 100644 --- a/controllers/admin/AdminLoginController.php +++ b/controllers/admin/AdminLoginController.php @@ -51,7 +51,6 @@ class AdminLoginControllerCore extends AdminController if ($this->ajax && Tools::getValue('action') == 'checkLoginStatus') { $this->ajaxDie(json_encode(array( - 'status' => true, 'is_logged_in' => $this->context->employee->isLoggedBack(), ))); } diff --git a/js/admin.js b/js/admin.js index 7b16f76bf..9704d959f 100644 --- a/js/admin.js +++ b/js/admin.js @@ -1231,9 +1231,7 @@ function checkIfEmployeeIsLoggedIn() { action : 'checkLoginStatus', }, success : function(response) { - if (response.status) { - resolve(response.is_logged_in); - } + resolve(response.is_logged_in); } }); }); From a556eecf23a387a1a0c620d52c63eadf3faec732 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 20 Nov 2023 17:45:33 +0530 Subject: [PATCH 39/69] Add warning on order edit --- .../controllers/orders/_cart_booking_demands.tpl | 2 +- .../controllers/orders/_room_services_block.tpl | 7 +++++-- .../template/controllers/orders/helpers/view/view.tpl | 11 +++++++++++ .../classes/RoomTypeServiceProductOrderDetail.php | 5 ++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl index fc7204f50..3ab29983b 100644 --- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl +++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl @@ -135,7 +135,7 @@ {if $product.allow_multiple_quantity}
-

+

{l s='Maximum allowed quantity: %s' sprintf=$product.max_quantity}

diff --git a/admin/themes/default/template/controllers/orders/_room_services_block.tpl b/admin/themes/default/template/controllers/orders/_room_services_block.tpl index c0b3ef515..d096a0125 100644 --- a/admin/themes/default/template/controllers/orders/_room_services_block.tpl +++ b/admin/themes/default/template/controllers/orders/_room_services_block.tpl @@ -53,10 +53,13 @@ {l s='Convenience fee'} {/if} - + {if $service['allow_multiple_quantity']}
- + +

+ {l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']} +

{else} -- 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 57b1384ae..89d5a6fc3 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -1753,6 +1753,17 @@ $('#room_extra_demand_content #back_to_service_btn').hide(); }); + $(document).on('change', '#rooms_type_extra_demands .room_ordered_services .qty', function(e) { + let quantityInputField = this; + let maximumQuantity = parseInt($(quantityInputField).attr('data-max-quantity')); + let currentQuantity = parseInt($(quantityInputField).val()); + if (currentQuantity > maximumQuantity) { + $(quantityInputField).siblings('p').show(); + } else { + $(quantityInputField).siblings('p').hide(); + } + }); + $(document).on('focusout', '#rooms_type_extra_demands .room_ordered_services .qty', function(e) { var qty_wntd = $(this).val(); if (qty_wntd == '' || !$.isNumeric(qty_wntd) || qty_wntd < 1) { diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php index 4557cb4f0..b26cf751d 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php @@ -196,13 +196,14 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel $sql = 'SELECT rsod.*'; if (!$getTotalPrice) { - $sql .= ', hbd.`id_product` as `room_type_id_product`, hbd.`id_room`, od.`product_allow_multiple_quantity`, + $sql .= ', hbd.`id_product` as `room_type_id_product`, hbd.`id_room`, od.`product_allow_multiple_quantity`, p.`max_quantity`, od.`product_auto_add`, od.`product_price_calculation_method`, od.`product_price_addition_type`'; } $sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rsod ON(rsod.`id_htl_booking_detail` = hbd.`id`)'; $sql .= ' LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON(od.`id_order_detail` = rsod.`id_order_detail`)'; + $sql .= ' INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rsod.`id_product`)'; $sql .= ' WHERE hbd.`id` = '.(int)$idHotelBookingDetail; @@ -229,6 +230,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel 'name' => $product['name'], 'quantity' => $product['quantity'], 'allow_multiple_quantity' => $product['product_allow_multiple_quantity'], + 'max_quantity' => $product['max_quantity'], 'product_auto_add' => $product['product_auto_add'], 'product_price_addition_type' => $product['product_price_addition_type'], 'product_price_calculation_method' => $product['product_price_calculation_method'], @@ -253,6 +255,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel 'name' => $product['name'], 'quantity' => $product['quantity'], 'allow_multiple_quantity' => $product['product_allow_multiple_quantity'], + 'max_quantity' => $product['max_quantity'], 'product_auto_add' => $product['product_auto_add'], 'product_price_addition_type' => $product['product_price_addition_type'], 'product_price_calculation_method' => $product['product_price_calculation_method'], From 6c8d4da6a6d1d68f6c9366b1f8c7eea6c61569c0 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 29 Nov 2023 16:59:39 +0530 Subject: [PATCH 40/69] Remove unused country trusted modal --- .../modules/modal_not_trusted_country.tpl | 3 +-- controllers/admin/AdminModulesController.php | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/admin/themes/default/template/controllers/modules/modal_not_trusted_country.tpl b/admin/themes/default/template/controllers/modules/modal_not_trusted_country.tpl index d750085b2..12e28438f 100644 --- a/admin/themes/default/template/controllers/modules/modal_not_trusted_country.tpl +++ b/admin/themes/default/template/controllers/modules/modal_not_trusted_country.tpl @@ -40,8 +40,7 @@

{l s='If you are unsure about this module, you can look for similar modules on the official marketplace.'} - {l s='Click here to browse PrestaShop Addons.'} - {* {l s='Click here to browse PrestaShop Addons.'} *} + {l s='Click here to browse PrestaShop Addons.'}

diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 0eae6b275..147ce99e5 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -1378,13 +1378,13 @@ class AdminModulesControllerCore extends AdminController 'modal_content' => $modal_content ); - $modal_content = $this->context->smarty->fetch('controllers/modules/modal_not_trusted_country.tpl'); - $this->modals[] = array( - 'modal_id' => 'moduleNotTrustedCountry', - 'modal_class' => 'modal-lg', - 'modal_title' => $this->l('This module is Untrusted for your country'), - 'modal_content' => $modal_content - ); + // $modal_content = $this->context->smarty->fetch('controllers/modules/modal_not_trusted_country.tpl'); + // $this->modals[] = array( + // 'modal_id' => 'moduleNotTrustedCountry', + // 'modal_class' => 'modal-lg', + // 'modal_title' => $this->l('This module is Untrusted for your country'), + // 'modal_content' => $modal_content + // ); } public function initContent() From 43f5bf6fb7158d583e8751ad78cff06435c9b710 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 30 Nov 2023 12:59:06 +0530 Subject: [PATCH 41/69] CHange hook positions --- .../admin/add_hotel/helpers/form/form.tpl | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 6232af305..c16c3f95e 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -34,30 +34,30 @@ {/if} {hook h='displayAdminAddHotelFormTop' id_hotel=$hook_arg_id_hotel} {if count($languages) > 1} -
- - - - -

{l s='Change language here to update information in multiple languages.' mod='hotelreservationsystem'}

-
+
+
+ + + + +

{l s='Change language here to update information in multiple languages.' mod='hotelreservationsystem'}

+
+
{/if} - + {hook h='displayAdminAddHotelFormTabsBefore' id_hotel=$hook_arg_id_hotel}
- {hook h='displayAdminAddHotelFormTabsBefore' id_hotel=$hook_arg_id_hotel} -
- {hook h='displayAdminAddHotelFormRefundPoliciesBefore' id_hotel=$hook_arg_id_hotel} + {hook h='displayAdminAddHotelFormRefundPoliciesTabBefore' id_hotel=$hook_arg_id_hotel} {if isset($hotel_info.id) && $hotel_info.id}
@@ -467,7 +467,7 @@
{/if} - {hook h='displayAdminAddHotelFormRefundPoliciesAfter' id_hotel=$hook_arg_id_hotel} + {hook h='displayAdminAddHotelFormRefundPoliciesTabAfter' id_hotel=$hook_arg_id_hotel}
{hook h='displayAdminAddHotelFormTabContent' id_hotel=$hook_arg_id_hotel}
From a3307750fee86c8cd9e2fdcad6cd9233148fcb35 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 30 Nov 2023 13:34:36 +0530 Subject: [PATCH 42/69] Improve --- classes/controller/AdminController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index ea3a469f7..7e71d8701 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -4018,9 +4018,23 @@ class AdminControllerCore extends Controller $object = new $this->className((int)$id); $object->setFieldsToUpdate(array('active' => true)); $object->active = (int)$status; - $result &= $object->update(); + $isUpdated = (bool) $object->update(); + $result &= $isUpdated; + + if (!$isUpdated) { + $this->errors[] = sprintf($this->l('Can\'t update #%d status.'), (int) $id); + } } + + if ($result) { + $this->redirect_after = self::$currentIndex.'&conf=5&token='.$this->token; + } else { + $this->errors[] = $this->l('An error occurred while updating the status.'); + } + } else { + $this->errors[] = $this->l('You must select at least one item to perform a bulk action.'); } + return $result; } From b69cac25d9c26c79eb1de3699b61b19f1b8f8dad Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 30 Nov 2023 13:36:48 +0530 Subject: [PATCH 43/69] Revert "Improve" This reverts commit a3307750fee86c8cd9e2fdcad6cd9233148fcb35. --- classes/controller/AdminController.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 7e71d8701..ea3a469f7 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -4018,23 +4018,9 @@ class AdminControllerCore extends Controller $object = new $this->className((int)$id); $object->setFieldsToUpdate(array('active' => true)); $object->active = (int)$status; - $isUpdated = (bool) $object->update(); - $result &= $isUpdated; - - if (!$isUpdated) { - $this->errors[] = sprintf($this->l('Can\'t update #%d status.'), (int) $id); - } + $result &= $object->update(); } - - if ($result) { - $this->redirect_after = self::$currentIndex.'&conf=5&token='.$this->token; - } else { - $this->errors[] = $this->l('An error occurred while updating the status.'); - } - } else { - $this->errors[] = $this->l('You must select at least one item to perform a bulk action.'); } - return $result; } From 5b0d6db6c5b240e50221af0bc98e4f6f941a5395 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 30 Nov 2023 14:53:23 +0530 Subject: [PATCH 44/69] Add setFieldsToUpdate --- classes/controller/AdminController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 511cdcb80..7e71d8701 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -4015,8 +4015,9 @@ class AdminControllerCore extends Controller if (is_array($this->boxes) && !empty($this->boxes)) { foreach ($this->boxes as $id) { /** @var ObjectModel $object */ - $object = new $this->className((int) $id); - $object->active = (int) $status; + $object = new $this->className((int)$id); + $object->setFieldsToUpdate(array('active' => true)); + $object->active = (int)$status; $isUpdated = (bool) $object->update(); $result &= $isUpdated; From b524322747d772151259c8d598c28d7f38056bdc Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 4 Dec 2023 13:33:24 +0530 Subject: [PATCH 45/69] Update message --- modules/blockcart/blockcart.tpl | 2 +- themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl index 1c1552e3d..a7f62fe15 100644 --- a/modules/blockcart/blockcart.tpl +++ b/modules/blockcart/blockcart.tpl @@ -438,7 +438,7 @@ {addJsDefL name=duration_txt}{l s='Duration' mod='blockcart' js=1}{/addJsDefL} {addJsDefL name=capacity_txt}{l s='Capacity' mod='blockcart' js=1}{/addJsDefL} {addJsDefL name=remove_rm_title}{l s='Remove this room from my cart' mod='blockcart' js=1}{/addJsDefL} -{addJsDefL name=no_internet_txt}{l s='No internet. Please try later.' mod='blockcart' js=1}{/addJsDefL} +{addJsDefL name=no_internet_txt}{l s='No internet. Please check your internet connection.' mod='blockcart' js=1}{/addJsDefL} {addJsDef rm_avail_process_lnk = $link->getModuleLink('blockcart', 'checkroomavailabilityajaxprocess')} {addJsDef pagename = $current_page} diff --git a/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl b/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl index 1c1552e3d..a7f62fe15 100644 --- a/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl +++ b/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl @@ -438,7 +438,7 @@ {addJsDefL name=duration_txt}{l s='Duration' mod='blockcart' js=1}{/addJsDefL} {addJsDefL name=capacity_txt}{l s='Capacity' mod='blockcart' js=1}{/addJsDefL} {addJsDefL name=remove_rm_title}{l s='Remove this room from my cart' mod='blockcart' js=1}{/addJsDefL} -{addJsDefL name=no_internet_txt}{l s='No internet. Please try later.' mod='blockcart' js=1}{/addJsDefL} +{addJsDefL name=no_internet_txt}{l s='No internet. Please check your internet connection.' mod='blockcart' js=1}{/addJsDefL} {addJsDef rm_avail_process_lnk = $link->getModuleLink('blockcart', 'checkroomavailabilityajaxprocess')} {addJsDef pagename = $current_page} From 1f9b7098e62429658dfb98b6aa31635aaf40b0e5 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 8 Dec 2023 17:32:22 +0530 Subject: [PATCH 46/69] Add 'Save and stay' buttons for Customer and Address forms at back office --- controllers/admin/AdminAddressesController.php | 12 ++++++++++++ controllers/admin/AdminCustomersController.php | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index beac77b2d..45fcf1769 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -177,6 +177,18 @@ class AdminAddressesControllerCore extends AdminController ) ); + if (!Tools::getValue('liteDisplaying')) { + $this->fields_form['buttons'] = array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ) + ); + } + $this->fields_value['address_type'] = (int)Tools::getValue('address_type', 1); $id_customer = (int)Tools::getValue('id_customer'); diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index b7078a0f1..f5570e282 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -597,6 +597,18 @@ class AdminCustomersControllerCore extends AdminController 'title' => $this->l('Save'), ); + if (!Tools::getValue('liteDisplaying')) { + $this->fields_form['buttons'] = array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ) + ); + } + $birthday = explode('-', $this->getFieldValue($obj, 'birthday')); $this->fields_value = array( From 55653377185f3a1e1b26ae7cfa197fcad856e488 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 11 Dec 2023 12:00:57 +0530 Subject: [PATCH 47/69] Add breadcrumbs for Hotel Booking and Reservation System module controllers unders Settings --- modules/hotelreservationsystem/hotelreservationsystem.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index e1240de49..8e6a12da2 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -550,9 +550,9 @@ class HotelReservationSystem extends Module ); // Controllers without tabs - $this->installTab('AdminHotelGeneralSettings', 'Hotel General configuration', false, false); - $this->installTab('AdminHotelFeaturePricesSettings', 'Advanced Price Rules', false, false); - $this->installTab('AdminRoomTypeGlobalDemand', 'Additional Demand Configuration', false, false); + $this->installTab('AdminHotelGeneralSettings', 'Hotel General Configuration', 'AdminHotelConfigurationSetting', false); + $this->installTab('AdminHotelFeaturePricesSettings', 'Advanced Price Rules', 'AdminHotelConfigurationSetting', false); + $this->installTab('AdminRoomTypeGlobalDemand', 'Additional Demand Configuration', 'AdminHotelConfigurationSetting', false); $this->installTab('AdminAssignHotelFeatures', 'Assign Hotel Features', false, false); $this->installTab('AdminBookingDocument', 'Booking Documents', false, false); From b080e9bc6fd8ded1b8f77c761d49449a9ee0a7d2 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 26 Dec 2023 19:06:07 +0530 Subject: [PATCH 48/69] Added: Hook actionObject<>GetDefinition in ObjectModel --- classes/ObjectModel.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index bd6cb4bbe..e61094944 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -1885,6 +1885,8 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa ); } + Hook::exec('actionObject'.$class.'GetDefinition', array('definition' => &$definition)); + if ($field) { return isset($definition['fields'][$field]) ? $definition['fields'][$field] : null; } From 83ec4b4306271f9545684a3ae0ea25b8a07618ae Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 15 Jan 2024 12:52:37 +0530 Subject: [PATCH 49/69] Fix voucher code issue --- classes/PaymentModule.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 8c1841308..ce2801e26 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -664,12 +664,9 @@ abstract class PaymentModuleCore extends Module unset($voucher->id); // Set a new voucher code + // For a customer, applying voucher ABCD will create partial vouchers ABCD-2, ABCD-3 and so on, and + // applying voucher ABCD-2 will create vouchers ABCD-2-2, ABCD-2-3 and so on $voucher->code = empty($voucher->code) ? substr(md5($order->id.'-'.$order->id_customer.'-'.$cart_rule['obj']->id), 0, 16) : $voucher->code.'-2'; - if (preg_match('/\-([0-9]{1,2})\-([0-9]{1,2})$/', $voucher->code, $matches) && $matches[1] == $matches[2]) { - $voucher->code = preg_replace('/'.$matches[0].'$/', '-'.(intval($matches[1]) + 1), $voucher->code); - } - - // If ABCDEFGH-2 already exists for customer use ABCDEFGH-3 while (CartRule::cartRuleExists($voucher->code, $order->id_customer)) { if (preg_match('/\-([0-9]{1,2})$/', $voucher->code, $matches)) { $voucher->code = preg_replace('/'.$matches[1].'$/', (intval($matches[1]) + 1), $voucher->code); From e3afb4c6ec05abcd0f1d665f385625a04a3cdb99 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 15 Jan 2024 12:53:46 +0530 Subject: [PATCH 50/69] Undo newline removal --- classes/PaymentModule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index ce2801e26..8cdbec966 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -1786,4 +1786,4 @@ abstract class PaymentModuleCore extends Module } return $result; } -} \ No newline at end of file +} From 87e45007bf0ff806d10dedbc40d10971d183e16a Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 16 Jan 2024 17:09:13 +0530 Subject: [PATCH 51/69] Add 'Save and stay' button on missing pages at back office --- .../admin/AdminCmsCategoriesController.php | 25 +++++++++++-- controllers/admin/AdminCmsController.php | 7 ++++ controllers/admin/AdminContactsController.php | 11 +++++- .../admin/AdminCountriesController.php | 10 ++++++ .../admin/AdminCurrenciesController.php | 10 ++++++ .../admin/AdminEmployeesController.php | 10 ++++++ controllers/admin/AdminFeaturesController.php | 16 +++++++-- controllers/admin/AdminGendersController.php | 11 +++++- controllers/admin/AdminGroupsController.php | 9 +++++ controllers/admin/AdminImagesController.php | 11 +++++- .../admin/AdminLanguagesController.php | 10 ++++++ controllers/admin/AdminMetaController.php | 11 +++++- .../admin/AdminOrderMessageController.php | 11 +++++- controllers/admin/AdminProfilesController.php | 11 +++++- .../admin/AdminQuickAccessesController.php | 11 +++++- .../AdminSpecificPriceRuleController.php | 9 +++++ controllers/admin/AdminStatesController.php | 11 +++++- controllers/admin/AdminStatusesController.php | 35 ++++++++++++++++--- controllers/admin/AdminTabsController.php | 11 +++++- controllers/admin/AdminTaxesController.php | 26 ++++++++++++-- controllers/admin/AdminThemesController.php | 18 ++++++++-- .../AdminOrderRefundRequestsController.php | 18 +++++++--- .../helpers/view/view.tpl | 3 ++ .../AdminFeaturesModuleSettingController.php | 26 +++++++++++--- 24 files changed, 299 insertions(+), 32 deletions(-) diff --git a/controllers/admin/AdminCmsCategoriesController.php b/controllers/admin/AdminCmsCategoriesController.php index ccc36eb41..de046954d 100644 --- a/controllers/admin/AdminCmsCategoriesController.php +++ b/controllers/admin/AdminCmsCategoriesController.php @@ -105,7 +105,19 @@ class AdminCmsCategoriesControllerCore extends AdminController $object = parent::postProcess(); $this->updateAssoShop((int)Tools::getValue('id_cms_category')); if ($object !== false) { - Tools::redirectAdmin(self::$currentIndex.'&conf=3&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token')); + if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) { + if ($this->id_object) { + Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&conf=4&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token')); + } else { + Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&conf=3&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token')); + } + } else { + if ($this->id_object) { + Tools::redirectAdmin(self::$currentIndex.'&conf=4&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token')); + } else { + Tools::redirectAdmin(self::$currentIndex.'&conf=3&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token')); + } + } } return $object; } @@ -289,7 +301,16 @@ class AdminCmsCategoriesControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); if (Shop::isFeatureActive()) { diff --git a/controllers/admin/AdminCmsController.php b/controllers/admin/AdminCmsController.php index 9ca65f327..b39f8bf66 100644 --- a/controllers/admin/AdminCmsController.php +++ b/controllers/admin/AdminCmsController.php @@ -218,6 +218,13 @@ class AdminCmsControllerCore extends AdminController 'title' => $this->l('Save'), ), 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), 'save_and_preview' => array( 'name' => 'viewcms', 'type' => 'submit', diff --git a/controllers/admin/AdminContactsController.php b/controllers/admin/AdminContactsController.php index 89917f7fc..3d7ae5b25 100644 --- a/controllers/admin/AdminContactsController.php +++ b/controllers/admin/AdminContactsController.php @@ -113,7 +113,16 @@ class AdminContactsControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); if (Shop::isFeatureActive()) { diff --git a/controllers/admin/AdminCountriesController.php b/controllers/admin/AdminCountriesController.php index 94dd066ac..becf523cb 100644 --- a/controllers/admin/AdminCountriesController.php +++ b/controllers/admin/AdminCountriesController.php @@ -368,6 +368,16 @@ class AdminCountriesControllerCore extends AdminController 'title' => $this->l('Save') ); + $this->fields_form['buttons'] = array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ) + ); + return parent::renderForm(); } diff --git a/controllers/admin/AdminCurrenciesController.php b/controllers/admin/AdminCurrenciesController.php index 2dcd9f445..6f6e1ded2 100644 --- a/controllers/admin/AdminCurrenciesController.php +++ b/controllers/admin/AdminCurrenciesController.php @@ -231,6 +231,16 @@ class AdminCurrenciesControllerCore extends AdminController 'title' => $this->l('Save'), ); + $this->fields_form['buttons'] = array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ) + ); + return parent::renderForm(); } diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php index ab1a12d45..c736e1865 100644 --- a/controllers/admin/AdminEmployeesController.php +++ b/controllers/admin/AdminEmployeesController.php @@ -403,6 +403,16 @@ class AdminEmployeesControllerCore extends AdminController 'title' => $this->l('Save'), ); + $this->fields_form['buttons'] = array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ) + ); + $this->fields_value['passwd'] = false; $this->fields_value['bo_theme_css'] = $obj->bo_theme.'|'.$obj->bo_css; diff --git a/controllers/admin/AdminFeaturesController.php b/controllers/admin/AdminFeaturesController.php index 1f7ee775b..c581d2604 100644 --- a/controllers/admin/AdminFeaturesController.php +++ b/controllers/admin/AdminFeaturesController.php @@ -216,6 +216,16 @@ class AdminFeaturesControllerCore extends AdminController 'title' => $this->l('Save'), ); + $this->fields_form['buttons'] = array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ) + ); + return parent::renderForm(); } @@ -544,9 +554,9 @@ class AdminFeaturesControllerCore extends AdminController if ($this->table == 'feature_value' && ($this->display == 'edit' || $this->display == 'add')) { $this->redirect_after = self::$currentIndex.'&addfeature_value&id_feature='.(int)Tools::getValue('id_feature').'&token='.$this->token; } else { - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.(int) $object->id.'&conf=3&update'.$this->table.'&token='.$this->token; } - } elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && count($this->errors)) { + } elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && count($this->errors) && $this->table == 'feature_value') { // enter only if feature is submitted $this->display = 'editFeatureValue'; } @@ -562,7 +572,7 @@ class AdminFeaturesControllerCore extends AdminController $object = parent::processUpdate(); if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) { - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.(int) Tools::getValue('id_feature').'&conf=4&update'.$this->table.'&token='.$this->token; } return $object; diff --git a/controllers/admin/AdminGendersController.php b/controllers/admin/AdminGendersController.php index 8a008e119..57a9ef514 100644 --- a/controllers/admin/AdminGendersController.php +++ b/controllers/admin/AdminGendersController.php @@ -173,7 +173,16 @@ class AdminGendersControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); /** @var Gender $obj */ diff --git a/controllers/admin/AdminGroupsController.php b/controllers/admin/AdminGroupsController.php index 54ea51ffd..d901fb449 100644 --- a/controllers/admin/AdminGroupsController.php +++ b/controllers/admin/AdminGroupsController.php @@ -232,6 +232,15 @@ class AdminGroupsControllerCore extends AdminController 'submit' => array( 'title' => $this->l('Save'), ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), 'input' => array( array( 'type' => 'text', diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php index 82368b712..914802c9d 100644 --- a/controllers/admin/AdminImagesController.php +++ b/controllers/admin/AdminImagesController.php @@ -403,7 +403,16 @@ class AdminImagesControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save') - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); parent::__construct(); diff --git a/controllers/admin/AdminLanguagesController.php b/controllers/admin/AdminLanguagesController.php index 56fca56ad..f655284a7 100644 --- a/controllers/admin/AdminLanguagesController.php +++ b/controllers/admin/AdminLanguagesController.php @@ -262,6 +262,16 @@ class AdminLanguagesControllerCore extends AdminController 'title' => $this->l('Save'), ); + $this->fields_form['buttons'] = array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ); + /** @var Language $obj */ if (!($obj = $this->loadObject(true))) { return; diff --git a/controllers/admin/AdminMetaController.php b/controllers/admin/AdminMetaController.php index 6ca06e6d8..cb47df23b 100644 --- a/controllers/admin/AdminMetaController.php +++ b/controllers/admin/AdminMetaController.php @@ -381,7 +381,16 @@ class AdminMetaControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save') - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); return parent::renderForm(); } diff --git a/controllers/admin/AdminOrderMessageController.php b/controllers/admin/AdminOrderMessageController.php index 19844d602..b6eb07604 100644 --- a/controllers/admin/AdminOrderMessageController.php +++ b/controllers/admin/AdminOrderMessageController.php @@ -91,7 +91,16 @@ class AdminOrderMessageControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); parent::__construct(); diff --git a/controllers/admin/AdminProfilesController.php b/controllers/admin/AdminProfilesController.php index 887022217..56d9f04d3 100644 --- a/controllers/admin/AdminProfilesController.php +++ b/controllers/admin/AdminProfilesController.php @@ -76,7 +76,16 @@ class AdminProfilesControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); $list_profile = array(); diff --git a/controllers/admin/AdminQuickAccessesController.php b/controllers/admin/AdminQuickAccessesController.php index 38923e60d..1f4b5bab9 100644 --- a/controllers/admin/AdminQuickAccessesController.php +++ b/controllers/admin/AdminQuickAccessesController.php @@ -118,7 +118,16 @@ class AdminQuickAccessesControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); parent::__construct(); diff --git a/controllers/admin/AdminSpecificPriceRuleController.php b/controllers/admin/AdminSpecificPriceRuleController.php index a1185a717..07421466f 100644 --- a/controllers/admin/AdminSpecificPriceRuleController.php +++ b/controllers/admin/AdminSpecificPriceRuleController.php @@ -285,6 +285,15 @@ class AdminSpecificPriceRuleControllerCore extends AdminController 'submit' => array( 'title' => $this->l('Save') ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); if (($value = $this->getFieldValue($this->object, 'price')) != -1) { $price = number_format($value, 6); diff --git a/controllers/admin/AdminStatesController.php b/controllers/admin/AdminStatesController.php index c3972a846..6c549289f 100644 --- a/controllers/admin/AdminStatesController.php +++ b/controllers/admin/AdminStatesController.php @@ -199,7 +199,16 @@ class AdminStatesControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); return parent::renderForm(); diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index 6958b0735..3dca34847 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -238,8 +238,13 @@ class AdminStatusesControllerCore extends AdminController 'show_admin_template' => $mailToSuperadmin || $mailToEmployee || $mailToHotelier, ); } else { + $name = array(); + foreach ($this->_languages as $language) { + $name[$language['id_lang']] = $this->getFieldValue($order_return_state, 'name', $language['id_lang']); + } + $this->fields_value = array( - 'name' => $this->getFieldValue($order_return_state, 'name'), + 'name' => $name, 'color' => "#ffffff", ); } @@ -478,7 +483,16 @@ class AdminStatusesControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); return $this->renderOrderStatusForm(); } elseif (Tools::isSubmit('updateorder_return_state') @@ -683,7 +697,16 @@ class AdminStatusesControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); return parent::renderForm(); @@ -789,7 +812,11 @@ class AdminStatusesControllerCore extends AdminController if (!$order_return_state->save()) { $this->errors[] = Tools::displayError('An error has occurred: Can\'t save the current order\'s refund status.'); } else { - Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); + if (Tools::isSubmit('submitAddorder_return_stateAndStay')) { + Tools::redirectAdmin(self::$currentIndex.'&updateorder_return_state&id_order_return_state='.$id_order_return_state.'&conf=4&token='.$this->token); + } else { + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); + } } } } diff --git a/controllers/admin/AdminTabsController.php b/controllers/admin/AdminTabsController.php index 5dc3401ac..0085cd815 100644 --- a/controllers/admin/AdminTabsController.php +++ b/controllers/admin/AdminTabsController.php @@ -183,7 +183,16 @@ class AdminTabsControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); $this->fields_form['input'][] = array( diff --git a/controllers/admin/AdminTaxesController.php b/controllers/admin/AdminTaxesController.php index d5696d819..8a1640a19 100644 --- a/controllers/admin/AdminTaxesController.php +++ b/controllers/admin/AdminTaxesController.php @@ -233,7 +233,16 @@ class AdminTaxesControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save') - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); return parent::renderForm(); @@ -258,7 +267,11 @@ class AdminTaxesControllerCore extends AdminController if (!$result) { $this->errors[] = Tools::displayError('An error occurred while updating an object.').' '.$this->table.''; } elseif ($this->postImage($object->id)) { - Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token); + if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) { + Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token); + } else { + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); + } } } else { $this->errors[] = Tools::displayError('An error occurred while updating an object.').' '.$this->table.' '.Tools::displayError('(cannot load object)'); @@ -272,10 +285,17 @@ class AdminTaxesControllerCore extends AdminController $this->copyFromPost($object, $this->table); if (!$object->add()) { $this->errors[] = Tools::displayError('An error occurred while creating an object.').' '.$this->table.''; - } elseif (($_POST['id_'.$this->table] = $object->id /* voluntary */) && $this->postImage($object->id) && $this->_redirect) { + } elseif ($this->postImage($object->id)) { + if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) { + Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token); + } else { + Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token); + } Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token); } } + } else { + $this->display = 'add'; } } else { parent::postProcess(); diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index 4a3a306c7..ce428e008 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -358,7 +358,16 @@ class AdminThemesControllerCore extends AdminController ), 'submit' => array( 'title' => $this->l('Save'), - ) + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), ); // adding a new theme, you can create a directory, and copy from an existing theme if ($this->display == 'add' || !Validate::isLoadedObject($this->object)) { @@ -644,7 +653,12 @@ class AdminThemesControllerCore extends AdminController } $theme->update(); } - Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminThemes').'&conf=29'); + + if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) { + Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&id_theme='.$theme->id.'&token='.$this->token.'&conf=4'); + } else { + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4'); + } } } diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index 28c9b1ba6..6b917f75b 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -271,7 +271,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController } /*If Admin update the status of the order cancellation request*/ - if (Tools::isSubmit('submitRefundReqBookings')) { + if (Tools::isSubmit('submitRefundReqBookings') || Tools::isSubmit('submitRefundReqBookingsAndStay')) { $idOrderReturn = Tools::getValue('id_order_return'); $idsReturnDetail = Tools::getValue('id_order_return_detail'); if (Validate::isLoadedObject($objOrderReturn = new OrderReturn($idOrderReturn))) { @@ -611,10 +611,18 @@ class AdminOrderRefundRequestsController extends ModuleAdminController } elseif ($objRefundState->refunded) { $confirmation = 102; } - Tools::redirectAdmin( - self::$currentIndex.'&conf='.$confirmation.'&id_order_return='.$idOrderReturn. - '&vieworder_return&token='.$this->token - ); + + if (Tools::isSubmit('submitRefundReqBookingsAndStay')) { + Tools::redirectAdmin( + self::$currentIndex.'&conf='.$confirmation.'&id_order_return='.$idOrderReturn. + '&vieworder_return&token='.$this->token + ); + } else { + Tools::redirectAdmin( + self::$currentIndex.'&conf='.$confirmation.'&id_order='.$objOrder->id. + '&id_order_return='.$idOrderReturn.'&vieworder_return&token='.$this->token + ); + } } } diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl index 6c760e4d7..8ed126d27 100644 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl @@ -358,6 +358,9 @@ {l s='Cancel' mod='hotelreservationsystem'} + diff --git a/modules/wkhotelfeaturesblock/controllers/admin/AdminFeaturesModuleSettingController.php b/modules/wkhotelfeaturesblock/controllers/admin/AdminFeaturesModuleSettingController.php index 1cfd97200..12877fc1b 100644 --- a/modules/wkhotelfeaturesblock/controllers/admin/AdminFeaturesModuleSettingController.php +++ b/modules/wkhotelfeaturesblock/controllers/admin/AdminFeaturesModuleSettingController.php @@ -224,7 +224,17 @@ class AdminFeaturesModuleSettingController extends ModuleAdminController ), 'submit' => array( 'title' => $this->l('Save') - )); + ), + 'buttons' => array( + 'save-and-stay' => array( + 'title' => $this->l('Save and stay'), + 'name' => 'submitAdd'.$this->table.'AndStay', + 'type' => 'submit', + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + ), + ), + ); return parent::renderForm(); } @@ -318,10 +328,18 @@ class AdminFeaturesModuleSettingController extends ModuleAdminController ); } - if ($hotelAmenityId) { - Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); + if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) { + if ($hotelAmenityId) { + Tools::redirectAdmin(self::$currentIndex.'&id_features_block='.(int) $hotelAmenityId.'&update'.$this->table.'&conf=4&token='.$this->token); + } else { + Tools::redirectAdmin(self::$currentIndex.'&id_features_block='.(int) $objFeatureData->id.'&update'.$this->table.'&conf=3&token='.$this->token); + } } else { - Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token); + if ($hotelAmenityId) { + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); + } else { + Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token); + } } } else { if ($hotelAmenityId) { From b795406ad31fead21dc7b7a8aaf9676d2ecf33fe Mon Sep 17 00:00:00 2001 From: abhishek-webkul <84142535+abhishek-webkul@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:21:05 +0530 Subject: [PATCH 52/69] Remove unused code --- .../views/js/wkHotelFeaturesBlockFront.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/wkhotelfeaturesblock/views/js/wkHotelFeaturesBlockFront.js b/modules/wkhotelfeaturesblock/views/js/wkHotelFeaturesBlockFront.js index 3bfcc9f08..b16e69c78 100644 --- a/modules/wkhotelfeaturesblock/views/js/wkHotelFeaturesBlockFront.js +++ b/modules/wkhotelfeaturesblock/views/js/wkHotelFeaturesBlockFront.js @@ -45,12 +45,6 @@ $(document).ready(function() { } }); -$(window).load(function() { - if ($('.home_amenities_wrapper').length) { - setAmenitiesWrapperHeight(); - } -}); - $(window).resize(function() { if ($('.home_amenities_wrapper').length) { setAmenitiesWrapperHeight(); From 4cdbca6865c769f2a379a67852aa29754439a0eb Mon Sep 17 00:00:00 2001 From: abhishek-webkul <84142535+abhishek-webkul@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:55:02 +0530 Subject: [PATCH 53/69] Update hook name --- classes/ObjectModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index e61094944..310a4b236 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -1885,7 +1885,7 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa ); } - Hook::exec('actionObject'.$class.'GetDefinition', array('definition' => &$definition)); + Hook::exec('actionObject'.$class.'DefinitionModifier', array('definition' => &$definition)); if ($field) { return isset($definition['fields'][$field]) ? $definition['fields'][$field] : null; From 7150daa5988ac1e886a6326b7a1388356ab63d62 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Thu, 18 Jan 2024 14:40:51 +0530 Subject: [PATCH 54/69] Dashboard testing issues resolved --- controllers/admin/AdminStatsController.php | 48 ++++++++++++++++++---- modules/dashinsights/dashinsights.php | 2 +- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index c095fd8be..1c71dc6ae 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1322,7 +1322,7 @@ class AdminStatsControllerCore extends AdminStatsTabController $cacheKey = 'AdminStats::getRoomsRevenueForDiscreteDates'.'_'.(int) $discreteDate['timestamp_from'].'_'. (!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel)); if (!Cache::isStored($cacheKey) || !$useCache) { - $sql = 'SELECT IFNULL(SUM(hbd.`total_price_tax_excl` / DATEDIFF(hbd.`date_to`, hbd.`date_from`)), 0) + $sql = 'SELECT IFNULL(SUM((hbd.`total_price_tax_excl` / o.`conversion_rate`) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)), 0) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) @@ -1643,7 +1643,7 @@ class AdminStatsControllerCore extends AdminStatsTabController return $totalRevenue ? (($directRevenue / $totalRevenue) * 100) : 0; } - public static function getOperatingExpensesForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) + public static function getOperatingExpensesForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true, $onlyRooms = 0) { $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; @@ -1664,7 +1664,8 @@ class AdminStatsControllerCore extends AdminStatsTabController $cacheKey = 'AdminStats::getOperatingExpensesForDiscreteDates'.'_'.(int) $discreteDate['timestamp_from'].'_'. (!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel)); if (!Cache::isStored($cacheKey) || !$useCache) { - $sql = 'SELECT + // sql for rooms expenses + $roomsSql = 'SELECT IFNULL(SUM( CASE WHEN od.`original_wholesale_price` <> "0.000000" @@ -1683,8 +1684,36 @@ class AdminStatsControllerCore extends AdminStatsTabController AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); - $value = Db::getInstance()->getValue($sql); - Cache::store($cacheKey, $value); + $roomsExpenses = Db::getInstance()->getValue($roomsSql); + + // sql for services expenses + $servicesExpenses = 0; + if (!$onlyRooms) { + $servicesSql = 'SELECT + IFNULL(SUM( + CASE + WHEN od.`original_wholesale_price` <> "0.000000" + THEN od.`original_wholesale_price` + WHEN p.`wholesale_price` <> "0.000000" + THEN p.`wholesale_price` + END + ), 0) + FROM `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rtspod + LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd + ON (rtspod.`id_htl_booking_detail` = hbd.`id`) + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hbd.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'order_detail` od + ON (od.`id_order_detail` = rtspod.`id_order_detail`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); + + $servicesExpenses = Db::getInstance()->getValue($servicesSql); + } + + Cache::store($cacheKey, ($roomsExpenses + $servicesExpenses)); } $result[$discreteDate['timestamp_from']] = Cache::retrieve($cacheKey); @@ -1736,7 +1765,7 @@ class AdminStatsControllerCore extends AdminStatsTabController return $totalProfit ? ($totalProfit / $totalRooms) : 0; } - public static function getRoomNightsData($dateFrom, $dateTo = null, $idHotel = null, $useCache = true, $average = false) + public static function getRoomNightsData($dateFrom, $dateTo = null, $idHotel = null, $useCache = true, $average = false, $roundAvg = false) { $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; @@ -1776,6 +1805,9 @@ class AdminStatsControllerCore extends AdminStatsTabController if ($totalHotels > 1) { foreach ($result as $timestamp => &$value) { $value = $value / $totalHotels; + if ($roundAvg) { + $value = Tools::ps_round($value, 2); + } } } } @@ -1805,7 +1837,7 @@ class AdminStatsControllerCore extends AdminStatsTabController SELECT IF(DATEDIFF(hbd.`date_from`, \''.pSQL($dateFrom).'\') < 0, \''.pSQL($dateFrom).'\', hbd.`date_from`) AS date_from_final, IF(DATEDIFF(\''.pSQL($dateTo).'\', hbd.`date_to`) < 0, \''.pSQL($dateToNext).'\', hbd.`date_to`) AS date_to_final FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`is_refunded` = 0 - AND hbd.`date_from` < \''.pSQL($dateTo).'\' AND hbd.`date_to` > \''.pSQL($dateFrom).'\''. + AND hbd.`date_from` <= \''.pSQL($dateTo).'\' AND hbd.`date_to` > \''.pSQL($dateFrom).'\''. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').' ) AS t ) AS t1'; @@ -1961,4 +1993,4 @@ class AdminStatsControllerCore extends AdminStatsTabController return $result; } -} +} \ No newline at end of file diff --git a/modules/dashinsights/dashinsights.php b/modules/dashinsights/dashinsights.php index 81039fbde..e589eb147 100644 --- a/modules/dashinsights/dashinsights.php +++ b/modules/dashinsights/dashinsights.php @@ -232,7 +232,7 @@ class DashInsights extends Module } if (count($idsHotel) > 0) { // display average series only if other hotels are available - $averageRoomNightsData = AdminStatsController::getRoomNightsData($dateFrom, $dateTo, $idsHotel, true, true); + $averageRoomNightsData = AdminStatsController::getRoomNightsData($dateFrom, $dateTo, $idsHotel, true, true, true); $averageSeriesInfo = array( 'data' => $averageRoomNightsData, 'label' => $this->l('Others Average'), From 772f63975145532f7a2d0181e17a14ac5235e24c Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Sat, 20 Jan 2024 19:11:19 +0530 Subject: [PATCH 55/69] Make Service Products tab submit --- .../controllers/products/serviceproduct.tpl | 176 ++++++++------- classes/Product.php | 32 +-- controllers/admin/AdminProductsController.php | 206 +++++++++++------- js/admin/products.js | 23 +- .../classes/RoomTypeServiceProduct.php | 8 +- .../AdminHotelRoomsBookingController.php | 2 +- 6 files changed, 253 insertions(+), 194 deletions(-) diff --git a/admin/themes/default/template/controllers/products/serviceproduct.tpl b/admin/themes/default/template/controllers/products/serviceproduct.tpl index e25bc5f68..76a5f6def 100644 --- a/admin/themes/default/template/controllers/products/serviceproduct.tpl +++ b/admin/themes/default/template/controllers/products/serviceproduct.tpl @@ -3,12 +3,14 @@

{l s='Service Products'}

- {if isset($all_service_products) && $all_service_products} + {if (isset($associated_service_products) && $associated_service_products) || (isset($unassociated_service_products) && $unassociated_service_products)}
- + @@ -21,96 +23,106 @@ - - - - {foreach from=$all_service_products key=key item=service_product} - {assign var=inputs_prefix value="service_product_`$service_product.id_product`_"} + {foreach from=$associated_service_products item=service_product} + + {assign var=inputs_prefix value="service_product_`$service_product.id_product`_"} + - + + + + + + + + + {/foreach} - {if isset($service_product.is_associated) && $service_product.is_associated} - - - - - - + {assign var=inputs_prefix value="service_product_`$service_product.id_product`_"} + + + + + + + + - - - - - {else} - - - - - - - - - - - {/if} + +
+ {l s='Default price: %s' sprintf={displayPrice price=$service_product.price currency=$currency->id}} +
+ + + {/foreach} diff --git a/classes/Product.php b/classes/Product.php index be1b3c21d..10c571359 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -1470,23 +1470,25 @@ class ProductCore extends ObjectModel return $result; } - public function getServiceProducts($idLang, $front = false, $context = false) + public function getServiceProducts($active = null, $serviceProductType = null, $idLang = null, $orderBy = 'pl.name', $orderWay = 'ASC') { - if (!$context) { - $context = Context::getContext(); + if (!$idLang) { + $idLang = Context::getContext()->language->id; } - $sql = 'SELECT p.*, product_shop.*, pl.*, image_shop.`id_image` id_image, il.`legend` as legend - FROM `'._DB_PREFIX_.'product` p - '.Shop::addSqlAssociation('product', 'p').' - LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.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)$idLang.')'; - $sql .= 'WHERE pl.`id_lang` = '.(int)$idLang.' AND p.`booking_product` = 0 - AND p.`service_product_type` = '.Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE.' - ORDER BY pl.`name`'; + + $sql = 'SELECT p.*, pl.*, i.`id_image`, il.`legend` AS legend + FROM `'._DB_PREFIX_.'product` p + LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $idLang.') + LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) + LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (il.`id_image` = i.`id_image` AND il.`id_lang` = '.(int) $idLang.') + WHERE p.`booking_product` = 0'. + (!is_null($active) ? ' AND p.`active` = '.(int) $active : ''). + ($serviceProductType ? ' AND p.`service_product_type` = '.(int) $serviceProductType : ''); + + if (Validate::isOrderBy($orderBy) && Validate::isOrderBy($orderWay)) { + $sql .= ' ORDER BY '.$orderBy.' '.$orderWay; + } + return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index ca3ad1b54..4ba79987c 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1110,9 +1110,9 @@ class AdminProductsControllerCore extends AdminController if (RoomTypeServiceProduct::changePositions( $idProduct, $idElement, - $newPosition - 1 + $newPosition )) { - $response['msg'] = $this->l('Updated Successfully'); + $response['msg'] = $this->l('Positions updated successfully.'); $response['success'] = true; } } @@ -1777,9 +1777,6 @@ class AdminProductsControllerCore extends AdminController StockAvailable::setProductDependsOnStock((int)$this->object->id, $depends_on_stock, $this->context->shop->id); } - // update service products - $this->updateServiceProducts($object); - PrestaShopLogger::addLog(sprintf($this->l('%s modification', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id); if (in_array($this->context->shop->getContext(), array(Shop::CONTEXT_SHOP, Shop::CONTEXT_ALL))) { if ($this->isTabSubmitted('Shipping')) { @@ -1814,6 +1811,9 @@ class AdminProductsControllerCore extends AdminController if ($this->isTabSubmitted('Occupancy')) { $this->processOccupancy(); } + if ($this->isTabSubmitted('ServiceProduct')) { + $this->processServiceProduct(); + } if ($this->isTabSubmitted('LengthOfStay')) { $this->processLengthOfStay(); } @@ -1882,70 +1882,6 @@ class AdminProductsControllerCore extends AdminController } } - public function updateServiceProducts($object) - { - $availableServiceProducts = Tools::getValue('available_service_products'); - foreach ($availableServiceProducts as $idServiceProduct) { - $prefix = 'service_product_'.$idServiceProduct.'_'; - $isAssociated = in_array(Tools::getValue($prefix.'associated'), array('on', 'true', '1')); - if ($isAssociated) { - $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - - // if already associated - if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct( - $object->id, - $idServiceProduct - )) { - $price = Tools::getValue($prefix.'price'); - $id_tax_rules_group = Tools::getValue($prefix.'id_tax_rules_group'); - - $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); - $priceInfo = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( - $idServiceProduct, - $object->id, - RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE - ); - - $objRoomTypeServiceProductPrice = null; - if ($priceInfo) { - $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice($priceInfo['id_room_type_service_product_price']); - } else { - $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); - $objRoomTypeServiceProductPrice->id_product = $idServiceProduct; - $objRoomTypeServiceProductPrice->id_element = $object->id; - $objRoomTypeServiceProductPrice->element_type = RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE; - } - - $objRoomTypeServiceProductPrice->price = $price; - $objRoomTypeServiceProductPrice->id_tax_rules_group = $id_tax_rules_group; - - $objRoomTypeServiceProductPrice->save(); - } else { - // create new association - $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - $objRoomTypeServiceProduct->addRoomProductLink( - $idServiceProduct, - $object->id, - RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE - ); - } - } else { - // remove association - RoomTypeServiceProduct::deleteRoomProductLink( - $idServiceProduct, - RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE, - $object->id - ); - - RoomTypeServiceProductPrice::deleteRoomProductPrices( - $idServiceProduct, - RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE, - $object->id - ); - } - } - } - /** * Check that a saved product is valid */ @@ -2789,7 +2725,6 @@ class AdminProductsControllerCore extends AdminController { $data = $this->createTemplate($this->tpl_form); if ($obj->id) { - $address = new Address(); $address->id_country = (int)$this->context->country->id; $tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true); @@ -2821,18 +2756,21 @@ class AdminProductsControllerCore extends AdminController $objRoomType = new HotelRoomType(); if ($hotelRoomType = $objRoomType->getRoomTypeInfoByIdProduct($obj->id)) { - $allServiceProducts = Product::getAllServiceProducts(false); + $allServiceProducts = $obj->getServiceProducts(); $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); - // change index of array to id_product for faster search + // change index of array to id_product for faster access $tmpServiceProducts = $objRoomTypeServiceProduct->getProductsForRoomType($obj->id); $roomTypeServiceProducts = array(); foreach ($tmpServiceProducts as $serviceProduct) { $roomTypeServiceProducts[$serviceProduct['id_product']] = $serviceProduct; } + // classify all service products into associated and unassociated groups + $associatedServiceProducts = array(); + $unassociatedServiceProducts = array(); $idsRoomTypeServiceProduct = array_column($roomTypeServiceProducts, 'id_product'); foreach ($allServiceProducts as &$serviceProduct) { if (in_array($serviceProduct['id_product'], $idsRoomTypeServiceProduct)) { @@ -2853,11 +2791,13 @@ class AdminProductsControllerCore extends AdminController $associationInfo['category'] = $objProduct->category; $associationInfo['default_price'] = $objProduct->price; $associationInfo['id_tax_rules_group'] = $objProduct->id_tax_rules_group; + + // assign custom price only if it is saved for service product if ($serviceProductPriceInfo) { $associationInfo['custom_price'] = $serviceProductPriceInfo['price']; $associationInfo['id_tax_rules_group'] = $serviceProductPriceInfo['id_tax_rules_group']; if ($serviceProductPriceInfo['id_tax_rules_group'] == 0) { - $associationInfo['tax_rules_group_name'] = 'No tax'; + $associationInfo['tax_rules_group_name'] = $this->l('No tax'); } else { $objTaxRuleGroup = new TaxRulesGroup( $serviceProductPriceInfo['id_tax_rules_group'], @@ -2869,7 +2809,7 @@ class AdminProductsControllerCore extends AdminController } if ($objProduct->id_tax_rules_group == 0) { - $associationInfo['default_tax_rules_group_name'] = 'No tax'; + $associationInfo['default_tax_rules_group_name'] = $this->l('No tax'); } else { $objTaxRuleGroup = new TaxRulesGroup( $objProduct->id_tax_rules_group, @@ -2880,18 +2820,25 @@ class AdminProductsControllerCore extends AdminController $serviceProduct['is_associated'] = true; $serviceProduct['association_info'] = $associationInfo; + + $associatedServiceProducts[$associationInfo['position']] = $serviceProduct; } else { $serviceProduct['is_associated'] = false; $objTaxRulesGroup = new TaxRulesGroup($serviceProduct['id_tax_rules_group'], $this->context->language->id); $serviceProduct['tax_rules_group_name'] = $objTaxRulesGroup->name; + + $unassociatedServiceProducts[] = $serviceProduct; } } + ksort($associatedServiceProducts); + $data->assign(array( 'product' => $obj, 'currency' => $this->context->currency, - 'all_service_products' => $allServiceProducts, + 'associated_service_products' => $associatedServiceProducts, + 'unassociated_service_products' => $unassociatedServiceProducts, 'tax_rules_groups' => $tax_rules_groups, 'taxesRatesByGroup' => $tax_rates, )); @@ -2903,6 +2850,115 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['custom_form'] = $data->fetch(); } + public function processServiceProduct() + { + $idProduct = Tools::getValue('id_product'); + + if (!$idProduct || !Validate::isUnsignedInt($idProduct) || !Product::isBookingProduct($idProduct)) { + $this->errors[] = $this->l('Something went wrong while saving service products.'); + } + + if (Validate::isLoadedObject($objProduct = new Product($idProduct))) { + // validate submitted details + $availableServiceProducts = Tools::getValue('available_service_products'); + $objServiceProducts = array(); + foreach ($availableServiceProducts as $idServiceProduct) { + $prefix = 'service_product_'.$idServiceProduct.'_'; + + $isAssociated = in_array(Tools::getValue($prefix.'associated'), array('on', 'true', '1')); + $price = Tools::getValue($prefix.'price'); + $idTaxRulesGroup = Tools::getValue($prefix.'id_tax_rules_group'); + + if ($isAssociated) { + $objServiceProduct = new Product($idServiceProduct, false, $this->context->language->id); + if (Validate::isLoadedObject($objServiceProduct)) { + // cache for faster access in next foreach loop + $objServiceProducts[$idServiceProduct] = $objServiceProduct; + + if (!$price) { + $this->errors[] = sprintf($this->l('Price for service product \'%s\' is empty.'), $objServiceProduct->name); + } elseif (!Validate::isPrice($price)) { + $this->errors[] = sprintf($this->l('Price for service product \'%s\' is invalid.'), $objServiceProduct->name); + } + } else{ + $this->errors[] = sprintf($this->l('Service product #%s is not available.'), $idServiceProduct); + } + } + } + + if (!count($this->errors)) { + // save submitted details + foreach ($availableServiceProducts as $idServiceProduct) { + $prefix = 'service_product_'.$idServiceProduct.'_'; + + $isAssociated = in_array(Tools::getValue($prefix.'associated'), array('on', 'true', '1')); + $price = Tools::getValue($prefix.'price'); + $idTaxRulesGroup = Tools::getValue($prefix.'id_tax_rules_group'); + + if ($isAssociated) { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + + // if already associated + if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($idProduct, $idServiceProduct)) { + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $priceInfo = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( + $idServiceProduct, + $idProduct, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + ); + + $objRoomTypeServiceProductPrice = null; + if ($priceInfo) { + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice($priceInfo['id_room_type_service_product_price']); + } else { + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $objRoomTypeServiceProductPrice->id_product = $idServiceProduct; + $objRoomTypeServiceProductPrice->id_element = $idProduct; + $objRoomTypeServiceProductPrice->element_type = RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE; + } + + $objRoomTypeServiceProductPrice->price = $price; + $objRoomTypeServiceProductPrice->id_tax_rules_group = $idTaxRulesGroup; + + $objRoomTypeServiceProductPrice->save(); + } else { + // create new association + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $objRoomTypeServiceProduct->addRoomProductLink( + $idServiceProduct, + $idProduct, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + ); + + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $objRoomTypeServiceProductPrice->id_product = $idServiceProduct; + $objRoomTypeServiceProductPrice->id_element = $idProduct; + $objRoomTypeServiceProductPrice->element_type = RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE; + $objRoomTypeServiceProductPrice->price = $price; + $objRoomTypeServiceProductPrice->id_tax_rules_group = $idTaxRulesGroup; + $objRoomTypeServiceProductPrice->save(); + } + } else { + // remove association + RoomTypeServiceProduct::deleteRoomProductLink( + $idServiceProduct, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE, + $idProduct + ); + + RoomTypeServiceProductPrice::deleteRoomProductPrices( + $idServiceProduct, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE, + $idProduct + ); + } + } + } + } else { + $this->errors[] = $this->l('Please save room type details before saving service products.'); + } + } + // send information for the occupancy tab public function initFormOccupancy($obj) { diff --git a/js/admin/products.js b/js/admin/products.js index 5648913e2..4c9fef1e8 100644 --- a/js/admin/products.js +++ b/js/admin/products.js @@ -436,7 +436,7 @@ product_tabs['ServiceProduct'] = new function(){ let idProduct = parseInt($(row).attr('id_product')); let idElement = parseInt($(row).attr('id_element')); - let newPosition = parseInt($('#' + rowId).index()) - 1; + let newPosition = parseInt($('#' + rowId).index()); $.ajax({ method: 'POST', @@ -475,22 +475,6 @@ product_tabs['ServiceProduct'] = new function(){ }] }); } - - $(document).on('click', '.button-edit-price', function(e){ - e.preventDefault(); - togglelinkedProductEditForm(this, true); - }); - - $(document).on('click', '.btn-cancel', function(e){ - e.preventDefault(); - togglelinkedProductEditForm(this, false); - }); - - function togglelinkedProductEditForm(triggeredElement, showform) - { - $(triggeredElement).closest('tr').find('.field-edit').toggle(showform); - $(triggeredElement).closest('tr').find('.field-view').toggle(!showform);; - } } } @@ -887,4 +871,9 @@ $(document).ready(function() { $('#modal-duplicate-options .submit-duplicate').on('click', function (e) { $('#modal-duplicate-options form.duplicate-options').submit(); }); + + $(document).on('click', 'input.bulk-service-products-status', function () { + let checked = $('input.bulk-service-products-status').is(':checked'); + $('table.hotel-roomtype-link-table tr input.is-associated').prop('checked', checked); + }); }); diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index 1866d06b6..c2e2f0bcd 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -278,7 +278,7 @@ class RoomTypeServiceProduct extends ObjectModel return false; } - $way = ($newPosition >= $movedBlock['position']) ? 0 : 1; + $way = ($newPosition >= $movedBlock['position']) ? 1 : 0; return (Db::getInstance()->execute( 'UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` rsp @@ -286,11 +286,11 @@ class RoomTypeServiceProduct extends ObjectModel WHERE rsp.`id_element` = '.(int) $idElement.' AND rsp.`element_type` = '.(int) $elementType.' AND rsp.`position`'.($way ? '> '. - (int) $movedBlock['position'].' AND rsp.`position` <= '.(int) $position : '< '. - (int) $movedBlock['position'].' AND rsp.`position` >= '.(int) $position) + (int) $movedBlock['position'].' AND rsp.`position` <= '.(int) $newPosition : '< '. + (int) $movedBlock['position'].' AND rsp.`position` >= '.(int) $newPosition) ) && Db::getInstance()->execute( 'UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` rsp - SET rsp.`position` = '.(int) $position.' + SET rsp.`position` = '.(int) $newPosition.' WHERE rsp.`id_element` = '.(int) $idElement.' AND rsp.`element_type` = '.(int) $elementType.' AND rsp.`id_product` = '.(int) $movedBlock['id_product'] diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index 6146e43f4..276f5a5f4 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -725,7 +725,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController public function assignServiceProductsForm() { $objProduct = new Product(); - $serviceProducts = $objProduct->getServiceProducts($this->context->language->id); + $serviceProducts = $objProduct->getServiceProducts(null, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE); $hotelAddressInfo = HotelBranchInformation::getAddress($this->id_hotel); $serviceProducts = Product::getProductsProperties($this->context->language->id, $serviceProducts); $this->context->smarty->assign(array( From b49020ee9a6632e156e8f151e95fc20fcaafc1af Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sun, 21 Jan 2024 10:58:10 +0530 Subject: [PATCH 56/69] Fixed:synopsis issues and image issue in Hotel API --- .../classes/HotelBranchInformation.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php index 45eccc623..8a59f4c80 100644 --- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php +++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php @@ -85,8 +85,8 @@ class HotelBranchInformation extends ObjectModel 'update' => 'updateWs', ), 'fields' => array( - 'phone' => array(), - 'address' => array(), + 'phone' => array('required' => true), + 'address' => array('required' => true), 'id_country' => array( 'required' => true, 'xlink_resource'=> 'countries', @@ -871,7 +871,7 @@ class HotelBranchInformation extends ObjectModel } // Webservice:: function to prepare id parameter for hotel images in a hotel api - public function getWsHotelImages() + public function getWsImages() { $ids = array(); if ($hotelImages = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'htl_image` WHERE `id_hotel` = '.(int)$this->id)) { @@ -1115,14 +1115,14 @@ class HotelBranchInformation extends ObjectModel } } /* Check zip code format */ - if ($objCountry->zip_code_format && !$objCountry->checkZipCode($this->zipcode)) { - $message = sprintf(Tools::displayError('The Zip/Postal code you have entered is invalid. It must follow this format: %s'), str_replace('C', $objCountry->iso_code, str_replace('N', '0', str_replace('L', 'A', $objCountry->zip_code_format)))); + if (empty($this->zipcode) && $objCountry->need_zip_code) { + $message = Tools::displayError('A Zip / Postal code is required.'); if ($die) { throw new PrestaShopException($message); } return $error_return ? $message : false; - } elseif (empty($this->zipcode) && $objCountry->need_zip_code) { - $message = Tools::displayError('A Zip / Postal code is required.'); + } elseif ($objCountry->zip_code_format && !$objCountry->checkZipCode($this->zipcode)) { + $message = sprintf(Tools::displayError('The Zip/Postal code you have entered is invalid. It must follow this format: %s'), str_replace('C', $objCountry->iso_code, str_replace('N', '0', str_replace('L', 'A', $objCountry->zip_code_format)))); if ($die) { throw new PrestaShopException($message); } From a92b4a52700dba81c8abbb0640a107407f81c710 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 31 Jan 2024 20:24:04 +0530 Subject: [PATCH 57/69] Allow group id title to be changed --- admin/themes/default/template/helpers/form/form_group.tpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/themes/default/template/helpers/form/form_group.tpl b/admin/themes/default/template/helpers/form/form_group.tpl index 66bb72fa0..580df3844 100644 --- a/admin/themes/default/template/helpers/form/form_group.tpl +++ b/admin/themes/default/template/helpers/form/form_group.tpl @@ -34,7 +34,11 @@ - {l s='ID'} + + + {if isset($input['groups_id_title']) && $input['groups_id_title']}{$input['groups_id_title']}{else}{l s='ID'}{/if} + + {if isset($input['groups_title']) && $input['groups_title']}{$input['groups_title']}{else}{l s='Group name'}{/if} From da558ee02fcb270b91cbe064d1ccfcdf968074b4 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 6 Feb 2024 18:28:56 +0530 Subject: [PATCH 58/69] Remove commented code --- classes/controller/AdminController.php | 10 ---------- controllers/admin/AdminModulesController.php | 8 -------- 2 files changed, 18 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index dd4894501..bc593e16c 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2344,16 +2344,6 @@ class AdminControllerCore extends Controller //Force override translation key Context::getContext()->override_controller_name_for_translations = 'AdminModules'; - // $this->modals[] = array( - // 'modal_id' => 'modal_addons_connect', - // 'modal_class' => 'modal-md', - // 'modal_title' => ' PrestaShop Addons', - // 'modal_content' => $this->context->smarty->fetch('controllers/modules/login_addons.tpl'), - // ); - //After override translation, remove it Context::getContext()->override_controller_name_for_translations = null; } diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 147ce99e5..8091158dc 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -1377,14 +1377,6 @@ class AdminModulesControllerCore extends AdminController 'modal_title' => ($this->context->mode == Context::MODE_HOST) ? $this->l('This module cannot be installed') : $this->l('Important Notice'), 'modal_content' => $modal_content ); - - // $modal_content = $this->context->smarty->fetch('controllers/modules/modal_not_trusted_country.tpl'); - // $this->modals[] = array( - // 'modal_id' => 'moduleNotTrustedCountry', - // 'modal_class' => 'modal-lg', - // 'modal_title' => $this->l('This module is Untrusted for your country'), - // 'modal_content' => $modal_content - // ); } public function initContent() From 0caf791d93a529e7e1194e58de0a19cbf859bdd7 Mon Sep 17 00:00:00 2001 From: abhishek-webkul <84142535+abhishek-webkul@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:24:27 +0530 Subject: [PATCH 59/69] Remove Unused method Product::getAllServiceProducts() --- classes/Product.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/classes/Product.php b/classes/Product.php index 10c571359..f0145ee0e 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -1414,22 +1414,6 @@ class ProductCore extends ObjectModel return $result; } - public static function getAllServiceProducts($activeOnly = true, $idLang = null) - { - if (!$idLang) { - $idLang = Context::getContext()->language->id; - } - - $sql = 'SELECT p.*, pl.* - FROM `'._DB_PREFIX_.'product` p - LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON - (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $idLang.') - WHERE p.`booking_product` = 0'.($activeOnly ? ' AND p.`active` = 1' : '').' - ORDER BY p.`id_product`'; - - return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); - } - public function getAvailableServiceProductsCategories($id_lang, $front = false, $active = true, Context $context = null) { if (!$context) { From 491e92d29575bf5da913a5904e33314e2f2fdb22 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 9 Feb 2024 17:28:57 +0530 Subject: [PATCH 60/69] Update positions after delete --- .../template/controllers/products/serviceproduct.tpl | 2 +- .../classes/RoomTypeServiceProduct.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/products/serviceproduct.tpl b/admin/themes/default/template/controllers/products/serviceproduct.tpl index 76a5f6def..b3e6248ee 100644 --- a/admin/themes/default/template/controllers/products/serviceproduct.tpl +++ b/admin/themes/default/template/controllers/products/serviceproduct.tpl @@ -12,7 +12,7 @@ - {l s='ID Product'} + {l s='ID'} {l s='Name'} diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index c2e2f0bcd..2e78243ff 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -59,10 +59,20 @@ class RoomTypeServiceProduct extends ObjectModel $where .= ' AND `id_element` = '.(int) $idElement; } - return Db::getInstance()->delete( + $result = Db::getInstance()->delete( 'htl_room_type_service_product', $where ); + + // Update positions + Db::getInstance()->execute('SET @i = -1', false); + $result &= Db::getInstance()->execute( + 'UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` + SET `position` = @i:=@i+1 + ORDER BY `position` ASC' + ); + + return $result; } public function addRoomProductLink($idProduct, $values, $elementType) From 86938a8d98c974b8d6d9b09c1bdbd7ab1466c353 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 9 Feb 2024 17:49:05 +0530 Subject: [PATCH 61/69] Fix position issue --- .../hotelreservationsystem/classes/RoomTypeServiceProduct.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index 2e78243ff..ab61222af 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -50,13 +50,16 @@ class RoomTypeServiceProduct extends ObjectModel public static function deleteRoomProductLink($idProduct, $elementType = 0, $idElement = 0) { $where = '`id_product`='.(int)$idProduct; + $where2 = ''; if ($elementType) { $where .= ' AND `element_type`='.(int)$elementType; + $where2 .= ' `element_type`='.(int)$elementType; } if ($idElement) { $where .= ' AND `id_element` = '.(int) $idElement; + $where2 .= ' AND `id_element` = '.(int) $idElement; } $result = Db::getInstance()->delete( @@ -69,6 +72,7 @@ class RoomTypeServiceProduct extends ObjectModel $result &= Db::getInstance()->execute( 'UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` SET `position` = @i:=@i+1 + WHERE '.$where2.' ORDER BY `position` ASC' ); From 364825e82700514e244939c02d1b8e045db9bebd Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 17 Feb 2024 10:52:44 +0530 Subject: [PATCH 62/69] Issue in Netprofit calculation resolved --- controllers/admin/AdminStatsController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 1c71dc6ae..16670b951 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -468,8 +468,8 @@ class AdminStatsControllerCore extends AdminStatsTabController LEFT(`invoice_date`, 10) as date, SUM(od.`product_quantity` * IF( od.`purchase_supplier_price` > 0, - od.`purchase_supplier_price` / `conversion_rate`, - od.`original_product_price` * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100 + od.`purchase_supplier_price`, + (od.`original_product_price` / `conversion_rate`) * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100 )) as total_purchase_price FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order @@ -487,8 +487,8 @@ class AdminStatsControllerCore extends AdminStatsTabController return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT SUM(od.`product_quantity` * IF( od.`purchase_supplier_price` > 0, - od.`purchase_supplier_price` / `conversion_rate`, - od.`original_product_price` * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100 + od.`purchase_supplier_price`, + (od.`original_product_price` / `conversion_rate`) * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100 )) as total_purchase_price FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order @@ -1993,4 +1993,4 @@ class AdminStatsControllerCore extends AdminStatsTabController return $result; } -} \ No newline at end of file +} From b3b8c5992509e8d9da5c836ac882e3626f6d752a Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 20 Feb 2024 14:42:22 +0530 Subject: [PATCH 63/69] Keep default value pre-filled --- .../default/template/controllers/products/serviceproduct.tpl | 4 ++-- .../hotelreservationsystem/classes/RoomTypeServiceProduct.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/themes/default/template/controllers/products/serviceproduct.tpl b/admin/themes/default/template/controllers/products/serviceproduct.tpl index b3e6248ee..c15eb216c 100644 --- a/admin/themes/default/template/controllers/products/serviceproduct.tpl +++ b/admin/themes/default/template/controllers/products/serviceproduct.tpl @@ -102,7 +102,7 @@
{$currency->prefix}{$currency->suffix} - +
@@ -114,7 +114,7 @@ + {assign var=price_value value=0} + {if isset($smarty.post["{$inputs_prefix}price"])} + {assign var=price_value value=$smarty.post["{$inputs_prefix}price"]} + {else} + {if isset($service_product.association_info.custom_price)} + {assign var=price_value value=$service_product.association_info.custom_price} + {elseif isset($service_product.association_info.default_price)} + {assign var=price_value value=$service_product.association_info.default_price} + {/if} + {/if} +
diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index b9c184cdc..32cc27f4b 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -2791,18 +2791,53 @@ class AdminNormalProductsControllerCore extends AdminController public function updateLinkedHotelsAndRooms($product) { if (Validate::isLoadedObject($product)) { - RoomTypeServiceProduct::deleteRoomProductLink($product->id); - + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $associatedRoomTypes = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id)['room_types']; if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product->service_product_type) { - $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - // add product link for room types - if ($selectedRoomTypes = Tools::getValue('roomTypeBox')) { + $selectedRoomTypes = Tools::getValue('roomTypeBox'); + + // Generate list of new associations + $newRoomTypes = array(); + foreach ($selectedRoomTypes as $selectedRoomType) { + if (!in_array($selectedRoomType, $associatedRoomTypes)) { + $newRoomTypes[] = $selectedRoomType; + } + } + + // Generate list of associations to remove + $removedRoomTypes = array(); + foreach ($associatedRoomTypes as $associatedRoomType) { + if (!in_array($associatedRoomType, $selectedRoomTypes)) { + $removedRoomTypes[] = $associatedRoomType; + } + } + + // Remove associations + foreach ($removedRoomTypes as $removedRoomType) { + RoomTypeServiceProduct::deleteRoomProductLink( + $product->id, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE, + $removedRoomType + ); + } + + // Save new associations + if ($newRoomTypes) { $objRoomTypeServiceProduct->addRoomProductLink( $product->id, - $selectedRoomTypes, + $newRoomTypes, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE ); } + } else { + // Remove associations + foreach ($associatedRoomTypes as $associatedRoomType) { + RoomTypeServiceProduct::deleteRoomProductLink( + $product->id, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE, + $associatedRoomType + ); + } } } } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 4ba79987c..84e809df5 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1107,10 +1107,11 @@ class AdminProductsControllerCore extends AdminController $idProduct = Tools::getValue('id_product'); if ($idElement && $idProduct) { $newPosition = Tools::getValue('new_position'); - if (RoomTypeServiceProduct::changePositions( + if (RoomTypeServiceProduct::updatePosition( $idProduct, $idElement, - $newPosition + $newPosition, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE )) { $response['msg'] = $this->l('Positions updated successfully.'); $response['success'] = true; diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index eacfe4a5b..4b38b4c9b 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -50,31 +50,28 @@ class RoomTypeServiceProduct extends ObjectModel public static function deleteRoomProductLink($idProduct, $elementType = 0, $idElement = 0) { $where = '`id_product`='.(int)$idProduct; - $where2 = ''; if ($elementType) { $where .= ' AND `element_type`='.(int)$elementType; - $where2 .= ' `element_type`='.(int)$elementType; } if ($idElement) { $where .= ' AND `id_element` = '.(int) $idElement; - $where2 .= ' AND `id_element` = '.(int) $idElement; } + $elements = Db::getInstance()->executeS( + 'SELECT rsp.`id_element`, rsp.`element_type` + FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp + WHERE '.$where.' + GROUP BY rsp.`element_type`, rsp.`id_element`' + ); + $result = Db::getInstance()->delete( 'htl_room_type_service_product', $where ); - // Update positions - Db::getInstance()->execute('SET @i = -1', false); - $result &= Db::getInstance()->execute( - 'UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` - SET `position` = @i:=@i+1'. - ($where2 ? ' WHERE '.$where2 : '').' - ORDER BY `position` ASC' - ); + $result &= self::cleanPositions($elements); return $result; } @@ -246,14 +243,21 @@ class RoomTypeServiceProduct extends ObjectModel return $result + 1; } - public function cleanPositions($idProductRoomType) + public static function cleanPositions($elements) { - Db::getInstance()->execute('SET @i = -1', false); - $sql = 'UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` SET `position` = @i:=@i+1 - WHERE `element_type` = '.self::WK_ELEMENT_TYPE_ROOM_TYPE.' AND `id_element` = '.(int)$idProductRoomType.' - ORDER BY `position` ASC'; + $result = true; + foreach ($elements as $element) { + Db::getInstance()->execute('SET @i = -1', false); + $result &= Db::getInstance()->execute( + 'UPDATE `'._DB_PREFIX_.'htl_room_type_service_product` rsp + SET rsp.`position` = @i:=@i+1 + WHERE rsp.`element_type` = '.(int) $element['element_type'].' + AND rsp.`id_element` = '.(int) $element['id_element'].' + ORDER BY rsp.`position` ASC' + ); + } - return Db::getInstance()->execute($sql); + return $result; } /** @@ -265,11 +269,11 @@ class RoomTypeServiceProduct extends ObjectModel * @param int $idPosition * @return boolean */ - public static function changePositions( + public static function updatePosition( $idProduct, $idElement, $newPosition, - $elementType = self::WK_ELEMENT_TYPE_ROOM_TYPE + $elementType ) { if (!$result = Db::getInstance()->executeS( 'SELECT rsp.`id_product`, rsp.`position` From fdc635b56f296fc66a972006fb72dd82d1276d06 Mon Sep 17 00:00:00 2001 From: abhishek-webkul <84142535+abhishek-webkul@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:38:05 +0530 Subject: [PATCH 66/69] Add comments --- .../classes/RoomTypeServiceProduct.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index 4b38b4c9b..b73c190d4 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -47,6 +47,9 @@ class RoomTypeServiceProduct extends ObjectModel ) ); + /** + * This method deletes passed associations and cleans positions of remaining associations + */ public static function deleteRoomProductLink($idProduct, $elementType = 0, $idElement = 0) { $where = '`id_product`='.(int)$idProduct; @@ -59,6 +62,7 @@ class RoomTypeServiceProduct extends ObjectModel $where .= ' AND `id_element` = '.(int) $idElement; } + // Get the list of elements before deleting associations to clean positions of remaining associations $elements = Db::getInstance()->executeS( 'SELECT rsp.`id_element`, rsp.`element_type` FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp @@ -71,6 +75,7 @@ class RoomTypeServiceProduct extends ObjectModel $where ); + // Clean positions of remaining associations after deletion $result &= self::cleanPositions($elements); return $result; From 8980a4e77880e81278a1e206d48914b185b05a82 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 6 Mar 2024 20:18:55 +0530 Subject: [PATCH 67/69] Fixed::Issue while saving hotel with name starts with numeric values --- classes/Address.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Address.php b/classes/Address.php index afd5df5ba..a43408405 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -125,8 +125,8 @@ class AddressCore extends ObjectModel 'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'), 'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255), - 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), - 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), + 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), + 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), 'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128), 'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128), From 42bb3f52b879cbcdcf817d1ee84b9f56a393fc41 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Thu, 7 Mar 2024 14:46:05 +0530 Subject: [PATCH 68/69] Fixed:Super admin profile id is used instead of Superadmin employees ids while sending Order-Confirmation and Refund emails --- classes/PaymentModule.php | 42 +++++++++++++++--------------- classes/order/OrderReturn.php | 48 ++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 43 deletions(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 3e89319f2..6ceac9edf 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -1237,25 +1237,27 @@ abstract class PaymentModuleCore extends Module } if (Configuration::get('PS_ORDER_CONF_MAIL_TO_SUPERADMIN')){ // send superadmin information - if (Validate::isLoadedObject($superAdmin = new Employee(_PS_ADMIN_PROFILE_))) { - if (Validate::isEmail($superAdmin->email)) { - $data['{customer_name}'] = $this->context->customer->firstname.' '.$this->context->customer->lastname; - $data['{customer_email}'] = $this->context->customer->email; - $data['{firstname}'] = $superAdmin->firstname; - $data['{lastname}'] = $superAdmin->lastname; - $data['{email}'] = $superAdmin->email; - Mail::Send( - (int)$order->id_lang, - 'order_conf_admin', - Mail::l('Order confirmation', (int)$order->id_lang), - $data, - $superAdmin->email, - $superAdmin->firstname.' '.$superAdmin->lastname, - null, - null, - $file_attachement, - null, _PS_MAIL_DIR_, false, (int)$order->id_shop - ); + if ($superAdminEmployees = Employee::getEmployeesByProfile(_PS_ADMIN_PROFILE_, true)) { + foreach ($superAdminEmployees as $superAdminEmployee) { + if (Validate::isEmail($superAdminEmployee['email'])) { + $data['{customer_name}'] = $this->context->customer->firstname.' '.$this->context->customer->lastname; + $data['{customer_email}'] = $this->context->customer->email; + $data['{firstname}'] = $superAdminEmployee['firstname']; + $data['{lastname}'] = $superAdminEmployee['lastname']; + $data['{email}'] = $superAdminEmployee['email']; + Mail::Send( + (int)$order->id_lang, + 'order_conf_admin', + Mail::l('Order confirmation', (int)$order->id_lang), + $data, + $superAdminEmployee['email'], + $superAdminEmployee['firstname'].' '.$superAdminEmployee['lastname'], + null, + null, + $file_attachement, + null, _PS_MAIL_DIR_, false, (int)$order->id_shop + ); + } } } } @@ -1289,7 +1291,7 @@ abstract class PaymentModuleCore extends Module $data['{customer_name}'] = $this->context->customer->firstname.' '.$this->context->customer->lastname; $data['{customer_email}'] = $this->context->customer->email; foreach ($htlAccesses as $access) { - if ($access['id_profile'] != _PS_ADMIN_PROFILE_) { + if ($access['access'] && $access['id_profile'] != _PS_ADMIN_PROFILE_) { if ($htlEmployees = Employee::getEmployeesByProfile($access['id_profile'])) { foreach ($htlEmployees as $empl) { if (Validate::isEmail($empl['email'])) { diff --git a/classes/order/OrderReturn.php b/classes/order/OrderReturn.php index f9dc27eca..36614990c 100644 --- a/classes/order/OrderReturn.php +++ b/classes/order/OrderReturn.php @@ -510,29 +510,31 @@ class OrderReturnCore extends ObjectModel // send mail to the super admin if ($objOrderReturnState->send_email_to_superadmin) { - // send superadmin information - if (Validate::isLoadedObject($superAdmin = new Employee(_PS_ADMIN_PROFILE_))) { - if (Validate::isEmail($superAdmin->email)) { - $data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname; - $data['{customer_email}'] = $objCustomer->email; - $data['{firstname}'] = $superAdmin->firstname; - $data['{lastname}'] = $superAdmin->lastname; + // Get all the employees with super admin profile + if ($superAdminEmployees = Employee::getEmployeesByProfile(_PS_ADMIN_PROFILE_, true)) { + foreach ($superAdminEmployees as $superAdminEmployee) { + if (Validate::isEmail($superAdminEmployee['email'])) { + $data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname; + $data['{customer_email}'] = $objCustomer->email; + $data['{firstname}'] = $superAdminEmployee['firstname']; + $data['{lastname}'] = $superAdminEmployee['lastname']; - Mail::Send( - (int)$idLang, - $objOrderReturnState->admin_template, - $objOrderReturnState->name, - $data, - $superAdmin->email, - $superAdmin->firstname.' '.$superAdmin->lastname, - null, - null, - null, - null, - _PS_MAIL_DIR_, - false, - (int)$objOrder->id_shop - ); + Mail::Send( + (int)$idLang, + $objOrderReturnState->admin_template, + $objOrderReturnState->name, + $data, + $superAdminEmployee['email'], + $superAdminEmployee['firstname'].' '.$superAdminEmployee['lastname'], + null, + null, + null, + null, + _PS_MAIL_DIR_, + false, + (int)$objOrder->id_shop + ); + } } } } @@ -570,7 +572,7 @@ class OrderReturnCore extends ObjectModel $data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname; $data['{customer_email}'] = $objCustomer->email; foreach ($htlAccesses as $access) { - if ($access['id_profile'] != _PS_ADMIN_PROFILE_) { + if ($access['access'] && $access['id_profile'] != _PS_ADMIN_PROFILE_) { if ($htlEmployees = Employee::getEmployeesByProfile($access['id_profile'])) { foreach ($htlEmployees as $empl) { if (Validate::isEmail($empl['email'])) { From 647dca8f5ce3e6f71e29b1dd127337a54eb9f8b2 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Fri, 8 Mar 2024 15:35:49 +0530 Subject: [PATCH 69/69] dashgoals:show message that targets will always work for all the hotels. --- modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl b/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl index 38f3c165a..c072cd3c3 100644 --- a/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl +++ b/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl @@ -57,6 +57,7 @@

{l s='Set your targets by clicking the configuration button at right position of the header in this section.' mod='dashgoals'}

+

{l s='Note' mod='dashgoals'}: {l s='Targets will be set and data will be displayed for all the hotels.' mod='dashgoals'}