From d2e03bd8fd5346bba1dc5b63bc9f81042bd9320f Mon Sep 17 00:00:00 2001 From: "lakshya.chauhan193" Date: Wed, 15 Mar 2023 20:02:11 +0530 Subject: [PATCH 1/6] resolved refund request payment calculation --- .../controllers/orders/_product_line.tpl | 2 +- classes/Product.php | 2 +- classes/order/Order.php | 56 +++- classes/order/OrderReturn.php | 61 +--- controllers/admin/AdminOrdersController.php | 45 +-- controllers/front/OrderDetailController.php | 7 +- install/data/xml/configuration.xml | 3 + .../classes/HotelBookingDemands.php | 10 + .../classes/HotelReservationSystemDb.php | 2 + .../RoomTypeServiceProductOrderDetail.php | 16 +- .../admin/AdminOrderRefundRulesController.php | 156 +++++++++- .../helpers/view/view.tpl | 4 +- .../helpers/options/index.php | 29 ++ .../helpers/options/options.tpl | 288 ++++++++++++++++++ .../hotel-reservation-theme/order-return.tpl | 4 +- 15 files changed, 588 insertions(+), 97 deletions(-) create mode 100644 modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/index.php create mode 100644 modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/options.tpl diff --git a/admin/themes/default/template/controllers/orders/_product_line.tpl b/admin/themes/default/template/controllers/orders/_product_line.tpl index 5f0af8220..bbb7ed3fb 100644 --- a/admin/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin/themes/default/template/controllers/orders/_product_line.tpl @@ -245,7 +245,7 @@   {/if} - + {* edit/delete controls *}
- + \ No newline at end of file diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/index.php b/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/index.php new file mode 100644 index 000000000..b1297ac0b --- /dev/null +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/index.php @@ -0,0 +1,29 @@ + +* @copyright 2010-2020 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/options.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/options.tpl new file mode 100644 index 000000000..6a6edf1a6 --- /dev/null +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/options.tpl @@ -0,0 +1,288 @@ +{** +* 2010-2023 Webkul. +* +* NOTICE OF LICENSE +* +* All right is reserved, +* Please go through LICENSE.txt file inside our module +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to newer +* versions in the future. If you wish to customize this module for your +* needs please refer to CustomizationPolicy.txt file inside our module for more information. +* +* @author Webkul IN +* @copyright 2010-2023 Webkul IN +* @license LICENSE.txt +*} + +{extends file="helpers/options/options.tpl"} + +{block name="input"} + {if $field['type'] == 'select'} +
+ {if $field['list']} + + {elseif isset($input.empty_message)} + {$input.empty_message} + {/if} +
+{elseif $field['type'] == 'group'} + {assign var=groups value=$field['values']} + {if count($groups) && isset($groups)} +
+
+ + + + + + + + + + {foreach $groups as $key => $group} + + + + + + {/foreach} + +
+ + + + {l s='ID'} + + {l s='Order States'} + +
+ {assign var=id_checkbox value=WK_ALLOW_ORDER_STATUS_TO_REFUND|cat:'_'|cat:$group['id_order_state']} + + {$group['id_order_state']} + +
+
+
+ {else} +

+ {l s='No group created'} +

+ {/if} +{elseif $field['type'] == 'bool'} +
+ + {strip} + + + + + {/strip} + + +
+{elseif $field['type'] == 'radio'} +
+ {foreach $field['choices'] AS $k => $v} +

+ {strip} + + {/strip} +

+ {/foreach} +
+ {elseif $field['type'] == 'checkbox'} +
+ {foreach $field['choices'] AS $k => $v} +

+ {strip} + + {/strip} +

+ {/foreach} +
+ {elseif $field['type'] == 'text'} +
{if isset($field['suffix'])}
+ {/if} + + {if isset($field['suffix'])} + + {$field['suffix']|strval} + + {/if} + {if isset($field['suffix'])} +
{/if} +
+ {elseif $field['type'] == 'password'} +
{if isset($field['suffix'])}
+ {/if} + + {if isset($field['suffix'])} + + {$field['suffix']|strval} + + {/if} + {if isset($field['suffix'])} +
{/if} +
+{elseif $field['type'] == 'textarea'} +
+ +
+{elseif $field['type'] == 'file'} +
{$field['file']}
+{elseif $field['type'] == 'color'} +
+
+ +
+
+{elseif $field['type'] == 'price'} +
+
+ {$currency_left_sign}{$currency_right_sign} {l s='(tax excl.)'} + +
+
+{elseif $field['type'] == 'textLang' || $field['type'] == 'textareaLang' || $field['type'] == 'selectLang'} + {if $field['type'] == 'textLang'} +
+
+ {foreach $field['languages'] AS $id_lang => $value} + {if $field['languages']|count > 1} +
+
+ {else} +
+ {/if} + + {if $field['languages']|count > 1} +
+
+ + +
+
+ {else} +
+ {/if} + {/foreach} +
+
+ {elseif $field['type'] == 'textareaLang'} +
+ {foreach $field['languages'] AS $id_lang => $value} +
+
+ +
+
+ + +
+ +
+ {/foreach} + +
+ {elseif $field['type'] == 'selectLang'} + {foreach $languages as $language} +
+ +
+ {/foreach} + {/if} +{/if} +{if isset($field['desc']) && !empty($field['desc'])} +
+
+ {if is_array($field['desc'])} + {foreach $field['desc'] as $p} + {if is_array($p)} + {$p.text}
+ {else} + {$p}
+ {/if} + {/foreach} + {else} + {$field['desc']} + {/if} +
+
+{/if} +{/block} \ No newline at end of file diff --git a/themes/hotel-reservation-theme/order-return.tpl b/themes/hotel-reservation-theme/order-return.tpl index f34eb786f..280918719 100644 --- a/themes/hotel-reservation-theme/order-return.tpl +++ b/themes/hotel-reservation-theme/order-return.tpl @@ -67,7 +67,7 @@ {$booking['date_from']|date_format:"%d-%m-%Y"} {l s='To'} {$booking['date_to']|date_format:"%d-%m-%Y"} {$booking['num_rooms']|escape:'htmlall':'UTF-8'} {displayPrice price=$booking['total_price_tax_incl'] currency=$orderCurrency['id']} - {displayPrice price=$booking['extra_demands_price_tax_incl'] currency=$orderCurrency['id']} + {displayPrice price=$booking['extra_demand_service_total_paid_amount'] currency=$orderCurrency['id']} {if $isRefundCompleted} {displayPrice price=$booking['refunded_amount'] currency=$orderCurrency['id']} @@ -142,4 +142,4 @@ + \ No newline at end of file From 08b8d39ad263ca805e57296083b4d294c1487527 Mon Sep 17 00:00:00 2001 From: "lakshya.chauhan193" Date: Fri, 24 Mar 2023 19:50:58 +0530 Subject: [PATCH 2/6] added is_cancelled column in orderdetail table --- .../controllers/orders/_product_line.tpl | 9 + .../orders/_rooms_informaion_table.tpl | 3 + .../controllers/orders/helpers/view/view.tpl | 96 +- classes/order/Order.php | 8 +- controllers/admin/AdminOrdersController.php | 7 + controllers/front/OrderDetailController.php | 28 +- install/data/xml/configuration.xml | 5 +- .../classes/HotelBookingDetail.php | 4 + .../classes/HotelReservationSystemDb.php | 3 +- .../RoomTypeServiceProductOrderDetail.php | 2 + .../admin/AdminOrderRefundRulesController.php | 151 -- .../helpers/options/index.php | 29 - .../helpers/options/options.tpl | 288 ---- .../hotel-reservation-theme/order-detail.tpl | 1326 +++++++++-------- 14 files changed, 774 insertions(+), 1185 deletions(-) delete mode 100644 modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/index.php delete mode 100644 modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/options.tpl diff --git a/admin/themes/default/template/controllers/orders/_product_line.tpl b/admin/themes/default/template/controllers/orders/_product_line.tpl index bbb7ed3fb..820be14dc 100644 --- a/admin/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin/themes/default/template/controllers/orders/_product_line.tpl @@ -231,6 +231,15 @@ {/if} {/if} + {if isset($isCancelledRoom) && $isCancelledRoom} + + {if $data.is_refunded == $orderCancelled} + {l s='Cancelled'} + {else} + {l s='Allotted'} + {/if} + + {/if} {if ($can_edit && !$order->hasBeenDelivered())} {if sizeof($invoices_collection)} diff --git a/admin/themes/default/template/controllers/orders/_rooms_informaion_table.tpl b/admin/themes/default/template/controllers/orders/_rooms_informaion_table.tpl index 0419ec9cd..3447ee940 100644 --- a/admin/themes/default/template/controllers/orders/_rooms_informaion_table.tpl +++ b/admin/themes/default/template/controllers/orders/_rooms_informaion_table.tpl @@ -20,6 +20,9 @@ {l s='Refund State'} {l s='Refunded amount'} {/if} + {if isset($isCancelledRoom) && $isCancelledRoom} + {l s='Room Status'} + {/if} {if ($can_edit && !$order->hasBeenDelivered())} {l s='Edit Order'} {/if} 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 8a2b5b313..ec31d8d51 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -281,55 +281,57 @@ {if isset($htl_booking_order_data) && $htl_booking_order_data} {foreach from=$htl_booking_order_data item=data} - - - {$data['room_num']} - - - - {$data['hotel_name']} - - - - {dateFormat date=$data['date_from']} - {dateFormat date=$data['date_to']} - - - - - {l s='Documents'} {$data.num_checkin_documents} - - - -
-
- + {if $data.is_refunded != $orderCancelled} + + + {$data['room_num']} + + + + {$data['hotel_name']} + + + + {dateFormat date=$data['date_from']} - {dateFormat date=$data['date_to']} + + + + + {l s='Documents'} {$data.num_checkin_documents} + + + + +
+ - {if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']} -

{l s='Checked in on'} {dateFormat date=$data['check_in']}

- {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} -

{l s='Checked out on'} {dateFormat date=$data['check_out']}

- {/if} + {if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']} +

{l s='Checked in on'} {dateFormat date=$data['check_in']}

+ {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} +

{l s='Checked out on'} {dateFormat date=$data['check_out']}

+ {/if} - {* field for the current date *} - + {* field for the current date *} + - - - - -
-
- -
- - - + + + + +
+
+ +
+ + + + {/if} {/foreach} {else} @@ -2057,4 +2059,4 @@ }); -{/block} +{/block} \ No newline at end of file diff --git a/classes/order/Order.php b/classes/order/Order.php index ae04fcf9d..eefa3bfe7 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -2553,8 +2553,8 @@ class OrderCore extends ObjectModel // $refundFlag [ORDER_RETURN_STATE_FLAG_REFUNDED || ORDER_RETURN_STATE_FLAG_DENIED] public function hasCompletelyRefunded($refundFlag = 0) { + $objHotelBooking = new HotelBookingdetail(); if ($refundBookings = OrderReturn::getOrdersReturnDetail($this->id)) { - $objHotelBooking = new HotelBookingdetail(); if ($orderBookings = $objHotelBooking->getOrderCurrentDataByOrderId($this->id)) { if (count($refundBookings) == count($orderBookings)) { if ($refundFlag) { @@ -2578,6 +2578,12 @@ class OrderCore extends ObjectModel return true; } } + } elseif ($orderBookings = $objHotelBooking->getOrderCurrentDataByOrderId($this->id)) { + if (count(array_unique(array_column($orderBookings, 'is_cancelled'))) === 1 + && array_unique(array_column($orderBookings, 'is_cancelled'))[0] != 0 + ) { + return true; + } } return false; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index b7e17703a..e5131748c 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -181,6 +181,7 @@ class AdminOrdersControllerCore extends AdminController $this->access_where = ' WHERE hbd.id_hotel IN ('.implode(',', $acsHtls).')'; } + parent::__construct(); } @@ -1660,6 +1661,10 @@ class AdminOrdersControllerCore extends AdminController $bookingOrderRoomInfo['num_checkin_documents'] = HotelBookingDocument::getCountByIdHtlBooking($bookingOrderRoomInfo['id']); } + $objHotelBookingDetail = new HotelBookingDetail(); + $htlBookingDetail = $objHotelBookingDetail->getOrderCurrentDataByOrderId($order->id); + $isCancelledRoom = in_array(HotelBookingDetail::ORDER_CANCELED, array_column($htlBookingDetail, 'is_cancelled')); + // hotel booking statuses $htlOrderStatus = HotelBookingDetail::getAllHotelOrderStatus(); $this->tpl_view_vars = array( @@ -1753,6 +1758,8 @@ class AdminOrdersControllerCore extends AdminController 'products' => $products, 'customer' => $customer) ), + 'orderCancelled' => HotelBookingDetail::ORDER_CANCELED, + 'isCancelledRoom' => $isCancelledRoom, ); return parent::renderView(); diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index ab77b6ff0..bdbc51175 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -242,7 +242,17 @@ class OrderDetailControllerCore extends FrontController } else { $hasError = 1; } + $res = true; if (!$hasError) { + if ((int)$order->total_paid_real == 0){ + foreach ($bookingRefunds as $idHtlBooking) { + $objHtlBooking = new HotelBookingDetail($idHtlBooking); + $objHtlBooking->is_cancelled = HotelBookingDetail::ORDER_CANCELLED; + $objHtlBooking->save(); + + } + } + $objOrderReturn = new OrderReturn(); $objOrderReturn->id_customer = $order->id_customer; $objOrderReturn->id_order = $order->id; @@ -402,6 +412,8 @@ class OrderDetailControllerCore extends FrontController } } + $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( @@ -575,6 +587,11 @@ class OrderDetailControllerCore extends FrontController $redirectTermsLink = $this->context->link->getCMSLink(new CMS(3, $this->context->language->id), null, $this->context->language->id); } + + $objHotelBookingDetail = new HotelBookingDetail(); + $htlBookingDetail = $objHotelBookingDetail->getOrderCurrentDataByOrderId($order->id); + $isCancelledRoom = in_array(HotelBookingDetail::ORDER_CANCELLED, array_column($htlBookingDetail, 'is_cancelled')); + $this->context->smarty->assign( array( 'id_cms_refund_policy' => Configuration::get('WK_GLOBAL_REFUND_POLICY_CMS'), @@ -590,6 +607,8 @@ class OrderDetailControllerCore extends FrontController 'cart_htl_data' => $cartHotelData, 'cart_service_products' => $cartServiceProducts, 'non_requested_rooms' => $nonRequestedRooms, + 'orderCancelled' => HotelBookingDetail::ORDER_CANCELLED, + 'isCancelledRoom' => $isCancelledRoom, ) ); // } @@ -599,16 +618,11 @@ class OrderDetailControllerCore extends FrontController if ($refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($order->id, 0, 1)) { $refundedAmount = $objOrderReturn->getRefundedAmount($order->id); } - $isRefundAllowed = (int)$order->isReturnable(); - if ($isRefundAllowed) { - $allowedOrderStatus = explode(',' ,Configuration::get('WK_ALLOW_ORDER_STATUS_TO_REFUND')); - $isRefundAllowed = $isRefundAllowed && in_array($order->current_state, $allowedOrderStatus); - } $this->context->smarty->assign( array( 'hasOrderPaid' => $order->hasBeenPaid(), // refund info - 'refund_allowed' => $isRefundAllowed, + 'refund_allowed' => (int) $order->isReturnable(), 'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id), 'refundReqBookings' => $refundReqBookings, 'hasCompletelyRefunded' => $order->hasCompletelyRefunded(), @@ -669,4 +683,4 @@ class OrderDetailControllerCore extends FrontController $this->addCSS(_THEME_CSS_DIR_.'addresses.css'); } } -} +} \ No newline at end of file diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml index 3ba2e8689..935de20ba 100644 --- a/install/data/xml/configuration.xml +++ b/install/data/xml/configuration.xml @@ -904,9 +904,6 @@ 1 - - - 8,2 - + \ No newline at end of file diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 08ee46466..613ecf838 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -44,6 +44,7 @@ class HotelBookingDetail extends ObjectModel public $is_back_order; public $id_status; public $is_refunded; + public $is_cancelled; // public $available_for_order; // hotel information/location/contact @@ -73,6 +74,8 @@ class HotelBookingDetail extends ObjectModel const ALLOTMENT_AUTO = 1; const ALLOTMENT_MANUAL = 2; + const ORDER_CANCELLED = 1; + // Search algorithm: Exact room types reults, All room types const SEARCH_EXACT_ROOM_TYPE_ALGO = 1; const SEARCH_ALL_ROOM_TYPE_ALGO = 2; @@ -107,6 +110,7 @@ class HotelBookingDetail extends ObjectModel 'total_price_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), 'total_paid_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'default' => 0, 'required' => true), 'is_refunded' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'is_cancelled' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), // 'available_for_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'is_back_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), diff --git a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php index e0189cef4..069ca850f 100644 --- a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php +++ b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php @@ -174,6 +174,7 @@ class HotelReservationSystemDb `children` smallint(6) NOT NULL DEFAULT '0', `child_ages` text NOT NULL, `is_refunded` tinyint(1) NOT NULL DEFAULT '0', + `is_cancelled` tinyint(1) NOT NULL DEFAULT '0', -- `available_for_order` tinyint(1) NOT NULL DEFAULT '0', `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, @@ -567,4 +568,4 @@ class HotelReservationSystemDb `'._DB_PREFIX_.'htl_access`' ); } -} +} \ No newline at end of file diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php index 75fe35ea2..08efd42b0 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php @@ -202,7 +202,9 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel } $sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd LEFT 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.`product_id` = rsod.`id_product`)'; + $sql .= ' WHERE hbd.`id` = '.(int)$idHotelBookingDetail; if ($getTotalPrice) { diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRulesController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRulesController.php index 42d53f25e..57a8c6965 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRulesController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRulesController.php @@ -27,17 +27,6 @@ class AdminOrderRefundRulesController extends ModuleAdminController } } - $orderStates = OrderState::getOrderStates($this->context->language->id); - $allowedOrderStatus = explode(',' ,Configuration::get('WK_ALLOW_ORDER_STATUS_TO_REFUND')); - if (count($allowedOrderStatus)) { - foreach ($orderStates as &$status) { - if (in_array($status['id_order_state'], $allowedOrderStatus)) { - $status['checked'] = true; - } else { - $status['checked'] = false; - } - } - } $this->fields_options = array( 'modulesetting' => array( 'title' => $this->l('Order Refund Setting'), @@ -57,14 +46,6 @@ class AdminOrderRefundRulesController extends ModuleAdminController 'identifier' => 'id_cms', 'hint' => $this->l('Select CMS for detailed refund policy for the customer.'), ), - 'WK_ALLOW_ORDER_STATUS_TO_REFUND' => array( - 'type' => 'group', - 'title' => $this->l('Allow order status for refund'), - 'values' => $orderStates, - 'name'=> 'WK_ALLOW_ORDER_STATUS_TO_REFUND', - 'required' => true, - 'hint' => $this->l('Select the order status at which customer will be able to create refund request.'), - ), ), 'submit' => array('title' => $this->l('Save')) ), @@ -124,138 +105,6 @@ class AdminOrderRefundRulesController extends ModuleAdminController ); } - public function processUpdateOptions() - { - $this->beforeUpdateOptions(); - - $languages = Language::getLanguages(false); - - $hide_multishop_checkbox = (Shop::getTotalShops(false, null) < 2) ? true : false; - foreach ($this->fields_options as $category_data) { - if (!isset($category_data['fields'])) { - continue; - } - - $fields = $category_data['fields']; - - foreach ($fields as $field => $values) { - if (isset($values['type']) && $values['type'] == 'selectLang') { - foreach ($languages as $lang) { - if (Tools::getValue($field.'_'.strtoupper($lang['iso_code']))) { - $fields[$field.'_'.strtoupper($lang['iso_code'])] = array( - 'type' => 'select', - 'cast' => 'strval', - 'identifier' => 'mode', - 'list' => $values['list'] - ); - } - } - } - } - - // Validate fields - foreach ($fields as $field => $values) { - if ($field != 'WK_ALLOW_ORDER_STATUS_TO_REFUND') { - // We don't validate fields with no visibility - if (!$hide_multishop_checkbox && Shop::isFeatureActive() && isset($values['visibility']) && $values['visibility'] > Shop::getContext()) { - continue; - } - - // Check if field is required - if ((!Shop::isFeatureActive() && isset($values['required']) && $values['required']) - || (Shop::isFeatureActive() && isset($_POST['multishopOverrideOption'][$field]) && isset($values['required']) && $values['required'])) { - if (isset($values['type']) && in_array($values['type'], array('textLang', 'textareaLang'))) { - foreach ($languages as $language) { - if (($value = Tools::getValue($field.'_'.$language['id_lang'])) == false && (string)$value != '0') { - $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $values['title']); - } - } - } elseif (($value = Tools::getValue($field)) == false && (string)$value != '0') { - $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $values['title']); - } - } - - // Check field validator - if (isset($values['type']) && in_array($values['type'], array('textLang', 'textareaLang'))) { - foreach ($languages as $language) { - if (Tools::getValue($field.'_'.$language['id_lang']) && isset($values['validation'])) { - $values_validation = $values['validation']; - if (!Validate::$values_validation(Tools::getValue($field.'_'.$language['id_lang']))) { - $this->errors[] = sprintf(Tools::displayError('field %s is invalid.'), $values['title']); - } - } - } - } elseif (Tools::getValue($field) && isset($values['validation'])) { - $values_validation = $values['validation']; - if (!Validate::$values_validation(Tools::getValue($field))) { - $this->errors[] = sprintf(Tools::displayError('field %s is invalid.'), $values['title']); - } - } - - // Set default value - if (Tools::getValue($field) === false && isset($values['default'])) { - $_POST[$field] = $values['default']; - } - } - } - - if (!count($this->errors)) { - foreach ($fields as $key => $options) { - if ($key != 'WK_ALLOW_ORDER_STATUS_TO_REFUND') { - if (Shop::isFeatureActive() && isset($options['visibility']) && $options['visibility'] > Shop::getContext()) { - continue; - } - - if (!$hide_multishop_checkbox && Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && empty($options['no_multishop_checkbox']) && empty($_POST['multishopOverrideOption'][$key])) { - Configuration::deleteFromContext($key); - continue; - } - - // check if a method updateOptionFieldName is available - $method_name = 'updateOption'.Tools::toCamelCase($key, true); - if (method_exists($this, $method_name)) { - $this->$method_name(Tools::getValue($key)); - } elseif (isset($options['type']) && in_array($options['type'], array('textLang', 'textareaLang'))) { - $list = array(); - foreach ($languages as $language) { - $key_lang = Tools::getValue($key.'_'.$language['id_lang']); - $val = (isset($options['cast']) ? $options['cast']($key_lang) : $key_lang); - if ($this->validateField($val, $options)) { - if (Validate::isCleanHtml($val)) { - $list[$language['id_lang']] = $val; - } else { - $this->errors[] = Tools::displayError('Can not add configuration '.$key.' for lang '.Language::getIsoById((int)$language['id_lang'])); - } - } - } - Configuration::updateValue($key, $list, isset($values['validation']) && isset($options['validation']) && $options['validation'] == 'isCleanHtml' ? true : false); - } else { - $val = (isset($options['cast']) ? $options['cast'](Tools::getValue($key)) : Tools::getValue($key)); - if ($this->validateField($val, $options)) { - if (Validate::isCleanHtml($val)) { - Configuration::updateValue($key, $val); - } else { - $this->errors[] = Tools::displayError('Can not add configuration '.$key); - } - } - } - } elseif ($key == 'WK_ALLOW_ORDER_STATUS_TO_REFUND') { - $allowedOrderStatus = implode(Tools::getValue('WK_ALLOW_ORDER_STATUS_TO_REFUND'), ','); - if (strlen($allowedOrderStatus)) { - Configuration::updateValue('WK_ALLOW_ORDER_STATUS_TO_REFUND', (string)$allowedOrderStatus); - } - } - } - } - } - - $this->display = 'list'; - if (empty($this->errors)) { - Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=6'); - } - - } - public function initContent() { parent::initContent(); diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/index.php b/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/index.php deleted file mode 100644 index b1297ac0b..000000000 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/options.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/options.tpl deleted file mode 100644 index 6a6edf1a6..000000000 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_rules/helpers/options/options.tpl +++ /dev/null @@ -1,288 +0,0 @@ -{** -* 2010-2023 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through LICENSE.txt file inside our module -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to CustomizationPolicy.txt file inside our module for more information. -* -* @author Webkul IN -* @copyright 2010-2023 Webkul IN -* @license LICENSE.txt -*} - -{extends file="helpers/options/options.tpl"} - -{block name="input"} - {if $field['type'] == 'select'} -
- {if $field['list']} - - {elseif isset($input.empty_message)} - {$input.empty_message} - {/if} -
-{elseif $field['type'] == 'group'} - {assign var=groups value=$field['values']} - {if count($groups) && isset($groups)} -
-
- - - - - - - - - - {foreach $groups as $key => $group} - - - - - - {/foreach} - -
- - - - {l s='ID'} - - {l s='Order States'} - -
- {assign var=id_checkbox value=WK_ALLOW_ORDER_STATUS_TO_REFUND|cat:'_'|cat:$group['id_order_state']} - - {$group['id_order_state']} - -
-
-
- {else} -

- {l s='No group created'} -

- {/if} -{elseif $field['type'] == 'bool'} -
- - {strip} - - - - - {/strip} - - -
-{elseif $field['type'] == 'radio'} -
- {foreach $field['choices'] AS $k => $v} -

- {strip} - - {/strip} -

- {/foreach} -
- {elseif $field['type'] == 'checkbox'} -
- {foreach $field['choices'] AS $k => $v} -

- {strip} - - {/strip} -

- {/foreach} -
- {elseif $field['type'] == 'text'} -
{if isset($field['suffix'])}
- {/if} - - {if isset($field['suffix'])} - - {$field['suffix']|strval} - - {/if} - {if isset($field['suffix'])} -
{/if} -
- {elseif $field['type'] == 'password'} -
{if isset($field['suffix'])}
- {/if} - - {if isset($field['suffix'])} - - {$field['suffix']|strval} - - {/if} - {if isset($field['suffix'])} -
{/if} -
-{elseif $field['type'] == 'textarea'} -
- -
-{elseif $field['type'] == 'file'} -
{$field['file']}
-{elseif $field['type'] == 'color'} -
-
- -
-
-{elseif $field['type'] == 'price'} -
-
- {$currency_left_sign}{$currency_right_sign} {l s='(tax excl.)'} - -
-
-{elseif $field['type'] == 'textLang' || $field['type'] == 'textareaLang' || $field['type'] == 'selectLang'} - {if $field['type'] == 'textLang'} -
-
- {foreach $field['languages'] AS $id_lang => $value} - {if $field['languages']|count > 1} -
-
- {else} -
- {/if} - - {if $field['languages']|count > 1} -
-
- - -
-
- {else} -
- {/if} - {/foreach} -
-
- {elseif $field['type'] == 'textareaLang'} -
- {foreach $field['languages'] AS $id_lang => $value} -
-
- -
-
- - -
- -
- {/foreach} - -
- {elseif $field['type'] == 'selectLang'} - {foreach $languages as $language} -
- -
- {/foreach} - {/if} -{/if} -{if isset($field['desc']) && !empty($field['desc'])} -
-
- {if is_array($field['desc'])} - {foreach $field['desc'] as $p} - {if is_array($p)} - {$p.text}
- {else} - {$p}
- {/if} - {/foreach} - {else} - {$field['desc']} - {/if} -
-
-{/if} -{/block} \ No newline at end of file diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl index 5e932891b..b57940698 100644 --- a/themes/hotel-reservation-theme/order-detail.tpl +++ b/themes/hotel-reservation-theme/order-detail.tpl @@ -23,684 +23,696 @@ * International Registered Trademark & Property of PrestaShop SA *} {if isset($order)} -
- {if isset($reorderingAllowed) && $reorderingAllowed} -
- - +
+ {if isset($reorderingAllowed) && $reorderingAllowed} + + + - {* {l s='Reorder'} -->