From a2198c7e4f061695bf7a5bd99c91204554116f2b Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 1 May 2024 14:37:02 +0530 Subject: [PATCH 01/67] Updated: The Navigation links having CMS pages work flow. Also the inactive or not existing cms pages will redirect to page not found. --- controllers/front/CmsController.php | 5 +- .../blocknavigationmenu.php | 41 +++++++++++++ .../classes/WkCustomNavigationLink.php | 9 +++ ...nCustomNavigationLinkSettingController.php | 58 ++++++++++++++++++- .../views/js/admin/wk_navigation_link.js | 56 +++++++++++++----- .../helpers/form/form.tpl | 20 ++++++- 6 files changed, 171 insertions(+), 18 deletions(-) diff --git a/controllers/front/CmsController.php b/controllers/front/CmsController.php index 01a4726bb..4eca2e8f6 100644 --- a/controllers/front/CmsController.php +++ b/controllers/front/CmsController.php @@ -79,8 +79,7 @@ class CmsControllerCore extends FrontController } elseif (Validate::isLoadedObject($this->cms_category) && $this->cms_category->active && $this->cms_category->isAssociatedToShop()) { $this->assignCase = 2; } else { - header('HTTP/1.1 404 Not Found'); - header('Status: 404 Not Found'); + Tools::redirect($this->context->link->getPageLink('pagenotfound')); } } @@ -134,6 +133,8 @@ class CmsControllerCore extends FrontController 'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '', 'body_classes' => array($this->php_self.'-'.$this->cms_category->id, $this->php_self.'-'.$this->cms_category->link_rewrite) )); + } else { + Tools::redirect($this->context->link->getPageLink('pagenotfound')); } $this->setTemplate(_PS_THEME_DIR_.'cms.tpl'); diff --git a/modules/blocknavigationmenu/blocknavigationmenu.php b/modules/blocknavigationmenu/blocknavigationmenu.php index b6d2437b5..0c75505cc 100644 --- a/modules/blocknavigationmenu/blocknavigationmenu.php +++ b/modules/blocknavigationmenu/blocknavigationmenu.php @@ -103,6 +103,45 @@ class blocknavigationmenu extends Module } } + public function hookActionObjectCMSUpdateAfter($params) + { + $id_cms = $params['object']->id; + // Disabling all the related navigation links to disabled CMS page + if (!$params['object']->active) { + $this->disableRelatedLinks($id_cms); + } + } + + public function hookActionObjectCMSDeleteAfter($params) + { + $id_cms = $params['object']->id; + // Disabling all the related navigation links to deleted CMS page + $this->deleteRelatedLinks($id_cms); + } + + public function disableRelatedLinks($id_cms) + { + $objCustomNavigationLink = new WkCustomNavigationLink(); + if ($navLinks = $objCustomNavigationLink->getRelatedNavLinksByIdCMS($id_cms)) { + foreach ($navLinks as $navLink) { + $objCustomNavigationLink = new WkCustomNavigationLink((int) $navLink['id_navigation_link']); + $objCustomNavigationLink->active = 0; + $objCustomNavigationLink->save(); + } + } + } + + public function deleteRelatedLinks($id_cms) + { + $objCustomNavigationLink = new WkCustomNavigationLink(); + if ($navLinks = $objCustomNavigationLink->getRelatedNavLinksByIdCMS($id_cms)) { + foreach ($navLinks as $navLink) { + $objCustomNavigationLink = new WkCustomNavigationLink((int) $navLink['id_navigation_link']); + $objCustomNavigationLink->delete(); + } + } + } + public function install() { $objModuleDb = new WkBlockNavigationMenuDb(); @@ -125,6 +164,8 @@ class blocknavigationmenu extends Module array ( 'footer', 'actionObjectLanguageAddAfter', + 'actionObjectCMSUpdateAfter', + 'actionObjectCMSDeleteAfter', 'displayDefaultNavigationHook', 'displayNavigationHook', 'top', diff --git a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php index b7e62b93e..8fc7a70f8 100644 --- a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php +++ b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php @@ -237,4 +237,13 @@ class WkCustomNavigationLink extends ObjectModel $objCustomNavigationLink->save(); return true; } + + public function getRelatedNavLinksByIdCMS($idCMS) + { + return Db::getInstance()->executeS(' + SELECT * FROM `'._DB_PREFIX_.'htl_custom_navigation_link` + WHERE `id_cms`='.(int) $idCMS + ); + } + } diff --git a/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php b/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php index 6e1668b84..fda9152e1 100644 --- a/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php +++ b/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php @@ -179,6 +179,16 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController if (Validate::isLoadedObject($objNavigationLink)) { $smartyVars['navigationLinkInfo'] = (array) $objNavigationLink; $smartyVars['edit'] = 1; + if (!$objNavigationLink->is_custom_link + && Validate::isLoadedObject($objCMS = new CMS($objNavigationLink->id_cms)) + ) { + $smartyVars['id_cms_category'] = $objCMS->id_cms_category; + if (empty($this->errors) + && !$objCMS->active + ) { + $this->warnings[] = $this->l('To enable this link you need to enable the related CMS page first'); + } + } } // send theme's front pages $themePages = array(); @@ -196,7 +206,31 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController $smartyVars['themePages'] = $themePages; $smartyVars['languages'] = Language::getLanguages(false); $smartyVars['currentLang'] = Language::getLanguage((int) Configuration::get('PS_LANG_DEFAULT')); - $smartyVars['cmsPages'] = CMS::getCMSPages($smartyVars['currentLang'], 1); + $categoryWiseCmsPages = array(); + if ($cmsPages = CMS::getCMSPages($smartyVars['currentLang'], null, false)) { + foreach ($cmsPages as $page) { + $cmsPage['id_cms'] = $page['id_cms']; + $cmsPage['meta_title'] = $page['meta_title']; + $categoryWiseCmsPages[$page['id_cms_category']][] = $cmsPage; + } + } + + if ($cmsCategories = CMSCategory::getCategories($this->context->language->id, false, false)) { + foreach ($cmsCategories as $cmsCatKey => $cmsCategory) { + if (!isset($categoryWiseCmsPages[$cmsCategory['id_cms_category']])) { + unset($cmsCategories[$cmsCatKey]); + } + } + } + + Media::addJsDef( + array( + 'catFormatCmsPages' => json_encode($categoryWiseCmsPages) + ) + ); + + $smartyVars['cmsPages'] = $cmsPages; + $smartyVars['categories'] = $cmsCategories; $this->context->smarty->assign($smartyVars); $this->fields_form = array( 'submit' => array( @@ -261,6 +295,10 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController } if ($isCmsPage) { $objCustomNavigationLink->id_cms = $idCms; + $objCMS = new CMS((int) $idCms); + if (!$objCMS->active) { + $active = $objCMS->active; + } } else { $objCustomNavigationLink->id_cms = 0; foreach ($languages as $language) { @@ -381,6 +419,24 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController } } + public function processStatus() + { + if (Validate::isLoadedObject($this->loadObject()) + && !$this->object->is_custom_link //Check for CMS related navigation link + ) { + $objCMS = new CMS($this->object->id_cms); + if (!$objCMS->active) { + $this->errors[] = $this->l('Please activate the relate CMS page to activate this link'); + } + } + + if (empty($this->errors)) { + return parent::processStatus(); + } + + return $this->object; + } + public function setMedia() { parent::setMedia(); diff --git a/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js b/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js index db7a3ff7e..b6339aaa4 100644 --- a/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js +++ b/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js @@ -18,24 +18,17 @@ */ $(document).ready(function() { + setCategoryWiseCmsPages(); $("input[name='is_cms_block_link").on('change', function () { - if (parseInt($(this).val())) { - $("#cms_block_content").removeClass('hidden'); - $("#non_cms_block_content").addClass('hidden'); - } else { - $("#cms_block_content").addClass('hidden'); - $("#non_cms_block_content").removeClass('hidden'); - } + toggleElements(this, "#cms_block_content", "#non_cms_block_content"); }); $("input[name='is_custom_redirect_link").on('change', function () { - if (parseInt($(this).val())) { - $(".custom_redirect_link_div").removeClass('hidden'); - $(".custom_redirect_page_div").addClass('hidden'); - } else { - $(".custom_redirect_link_div").addClass('hidden'); - $(".custom_redirect_page_div").removeClass('hidden'); - } + toggleElements(this, ".custom_redirect_link_div", ".custom_redirect_page_div"); + }); + + $(document).on('change', '#id_cms_category', function(){ + setCategoryWiseCmsPages(); }); }); @@ -45,4 +38,39 @@ function showNavigationLinkLangField(lang_iso_code, id_lang) $('.navigation_link_name_all').hide(); $('#navigation_link_name_'+id_lang).show(); +} + +function toggleElements(element, selectorFirst, selectorSecond) +{ + if (parseInt($(element).val())) { + $(selectorFirst).removeClass('hidden'); + $(selectorSecond).addClass('hidden'); + } else { + $(selectorFirst).addClass('hidden'); + $(selectorSecond).removeClass('hidden'); + } +} + +function setCategoryWiseCmsPages() +{ + var selectedPage = parseInt($('input[name="id_cms"]:checked').val()); + var selectedCategory = parseInt($('#id_cms_category').val()); + var formattedData = JSON.parse(catFormatCmsPages); + if (!isNaN(selectedCategory)) { + formattedData = formattedData[selectedCategory]; + var html = ''; + $.each(formattedData, function(i, v) { + html += ''; + html += ''; + html += ''+v['id_cms']+''; + html += '' + html += ''; + }); + $('table.cms_pages tbody').html(html); + } + + if (!isNaN(selectedPage)) { + $('input[name="id_cms"][value="'+selectedPage+'"]').attr('checked', 'checked'); + } + } \ No newline at end of file diff --git a/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl b/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl index fe9ceefc0..eedc9d62a 100644 --- a/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl +++ b/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl @@ -52,6 +52,24 @@ {* Feilds of cms page *}
+
+
+ +
+ +
+
+
{*Display CMS Pages*} {if isset($cmsPages)}
@@ -62,7 +80,7 @@
- +
- - + + @@ -77,7 +77,7 @@ - + diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index 67412d3fc..ac4ce1231 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -33,8 +33,8 @@ - - + + @@ -101,7 +101,7 @@ - + From 2081d72d74a4377553bfd8cc064ca28414239159 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 18:48:19 +0530 Subject: [PATCH 10/67] Fixed: Showing status booked on header even after all bookings are refunded on order detail page in back-office --- .../default/template/controllers/orders/helpers/view/view.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 74eb8d437..9f884e2b1 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -28,9 +28,9 @@ {block name=pageTitle}

{if is_array($title)}{$title|end|strip_tags}{else}{$title|strip_tags}{/if} - {if $currentState == Configuration::get('PS_OS_REFUND')} + {if $currentState->id == Configuration::get('PS_OS_REFUND')} {l s='Refunded'} - {elseif $currentState == Configuration::get('PS_OS_CANCELED')} + {elseif $currentState->id == Configuration::get('PS_OS_CANCELED')} {l s='Cancelled'} {else} {l s='Booked'} From 3433aec4b222d5fb79e33c9575b30608ff119b83 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 27 May 2024 12:00:37 +0530 Subject: [PATCH 11/67] Updated: The google maps will now display the store icon insted of the default marker --- controllers/front/StoresController.php | 6 +++++- modules/hotelreservationsystem/hotelreservationsystem.php | 7 +++++++ .../views/js/HotelReservationAdmin.js | 1 + .../hotelreservationsystem/views/js/searchResultsMap.js | 1 + themes/hotel-reservation-theme/js/contact-form.js | 1 + themes/hotel-reservation-theme/js/order-detail.js | 1 + themes/hotel-reservation-theme/js/product.js | 1 + 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/controllers/front/StoresController.php b/controllers/front/StoresController.php index 89f21c5ac..901f5ec7d 100644 --- a/controllers/front/StoresController.php +++ b/controllers/front/StoresController.php @@ -208,8 +208,12 @@ class StoresControllerCore extends FrontController */ protected function assignStores() { - $this->context->smarty->assign('hasStoreIcon', Tools::file_get_contents($this->context->link->getMediaLink(_PS_IMG_DIR_.Configuration::get('PS_STORES_ICON')))); // by webkul to get media link. + $hasStoreIcon = false; + if (Tools::file_get_contents($this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')))) { // by webkul to get media link. + $hasStoreIcon = true; + } + $this->context->smarty->assign('hasStoreIcon', $hasStoreIcon); $distance_unit = Configuration::get('PS_DISTANCE_UNIT'); if (!in_array($distance_unit, array('km', 'mi'))) { $distance_unit = 'km'; diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index bf6473245..0466fcf00 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -87,6 +87,9 @@ class HotelReservationSystem extends Module public function hookActionFrontControllerSetMedia() { + Media::addJsDef(array( + 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')) + )); if (Configuration::get('WK_CUSTOMER_SUPPORT_PHONE_NUMBER') != '' || Configuration::get('WK_CUSTOMER_SUPPORT_EMAIL') != '' ) { @@ -492,6 +495,10 @@ class HotelReservationSystem extends Module public function hookDisplayBackOfficeHeader() { + Media::addJsDef(array( + 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')) + )); + $this->context->controller->addCSS($this->_path.'views/css/admin/css/hotel_admin_tab_logo.css'); } diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index c923b0eea..160df0a5f 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -217,6 +217,7 @@ var GoogleMapsManager = { position: latLng, map: that.map, draggable: true, + icon: PS_STORES_ICON }); that.markers.push(marker); marker.addListener('dragend', function(e) { diff --git a/modules/hotelreservationsystem/views/js/searchResultsMap.js b/modules/hotelreservationsystem/views/js/searchResultsMap.js index cc58afebd..f24c762c4 100644 --- a/modules/hotelreservationsystem/views/js/searchResultsMap.js +++ b/modules/hotelreservationsystem/views/js/searchResultsMap.js @@ -34,6 +34,7 @@ function initMap() { position: hotelLocation, map: map, title: hotel_name, + icon: PS_STORES_ICON }); marker.addListener('click', function() { diff --git a/themes/hotel-reservation-theme/js/contact-form.js b/themes/hotel-reservation-theme/js/contact-form.js index 8a77661d6..4f8f51dc2 100644 --- a/themes/hotel-reservation-theme/js/contact-form.js +++ b/themes/hotel-reservation-theme/js/contact-form.js @@ -93,6 +93,7 @@ function initMap() { map: map, title: location.hotel_name, animation: google.maps.Animation.DROP, + icon: PS_STORES_ICON }); // Allow each marker to have an info window diff --git a/themes/hotel-reservation-theme/js/order-detail.js b/themes/hotel-reservation-theme/js/order-detail.js index 6a54f74b0..26d1fcb99 100644 --- a/themes/hotel-reservation-theme/js/order-detail.js +++ b/themes/hotel-reservation-theme/js/order-detail.js @@ -115,6 +115,7 @@ function initMap() { position: hotelLocation, map: map, title: hotel_name, + icon: PS_STORES_ICON }); marker.addListener('click', function() { diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js index 4974d31e2..4d340fcf9 100644 --- a/themes/hotel-reservation-theme/js/product.js +++ b/themes/hotel-reservation-theme/js/product.js @@ -1275,6 +1275,7 @@ function initMap() { const marker = new google.maps.Marker({ position: hotelLatLng, map: map, + icon: PS_STORES_ICON }); const uiContent = $('#room-info-map-ui-content .hotel-info-wrap').get(0); From cbf7a64e114c07fd008c7a4e75f75f894063fd30 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 28 May 2024 17:09:18 +0530 Subject: [PATCH 12/67] Added: option to view new customers in Admin Customer list using the KPI and the new customers option in dashboard --- .../admin/AdminCustomersController.php | 20 +++++++++++++++++++ controllers/admin/AdminStatsController.php | 2 +- modules/dashactivity/views/js/dashactivity.js | 4 ++++ .../templates/hook/dashboard_zone_one.tpl | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 6c763f10c..cdc291da4 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -217,6 +217,23 @@ class AdminCustomersControllerCore extends AdminController $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); } + if (Tools::getValue('action') == 'filterOnlyNewCustomer') { + if (($dateFrom = Tools::getValue('date_from')) + && ($dateTo = Tools::getValue('date_to')) + && strtotime($dateTo) >= strtotime($dateFrom) + ) { + $this->processResetFilters(); + $this->context->cookie->{'submitFilter'.$this->table} = true; + $prefix = $this->getCookieFilterPrefix(); + //Updating the date format of the filter dates to the desired format. + $dateFrom = date('Y-m-d', strtotime($dateFrom)); + $dateTo = date('Y-m-d', strtotime($dateTo)); + $this->context->cookie->{$prefix.$this->table.'Filter_date_add'} = json_encode(array($dateFrom, $dateTo)); + } + + $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); + } + parent::postProcess(); } @@ -739,6 +756,9 @@ class AdminCustomersControllerCore extends AdminController $helper->color = 'color4'; $helper->title = $this->l('New Customers', null, null, false); $nbDaysNewCustomers = Validate::isUnsignedInt(Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS')) ? Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS') : 30; + $date_from = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day')); + $date_to = date('Y-m-d'); + $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&filterOnlyNewCustomer=1&date_from='.$date_from.'&date_to='.$date_to; $helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysNewCustomers); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_new_customers'; $helper->tooltip = $this->l('The total number of new customers who registered in given period of time.', null, null, false); diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 2de11a362..86e20a67f 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1885,7 +1885,7 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getTotalNewCustomers($nbDaysNewCustomers) { - $maxDateAdd = date('Y-m-d H:i:s', strtotime('-'.$nbDaysNewCustomers.' day')); + $maxDateAdd = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day')); $sql = 'SELECT COUNT(c.`id_customer`) FROM `'._DB_PREFIX_.'customer` c WHERE c.`date_add` >= "'.pSQL($maxDateAdd).'" AND c.`deleted` = 0'; diff --git a/modules/dashactivity/views/js/dashactivity.js b/modules/dashactivity/views/js/dashactivity.js index a84820e02..8343efa89 100644 --- a/modules/dashactivity/views/js/dashactivity.js +++ b/modules/dashactivity/views/js/dashactivity.js @@ -58,6 +58,8 @@ $(document).ready(function() { $('#date-start').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); end = Date.parseDate($('#date-end').val(), 'Y-m-d'); + var url = $('#dash_filter_new_customers').data('href') + '&date_from='+start.format('Y-m-d')+ '&date_to='+ end.format('Y-m-d'); + $('#dash_filter_new_customers').attr('href', url); $('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); $('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); @@ -66,6 +68,8 @@ $(document).ready(function() { $('#date-end').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); end = Date.parseDate($('#date-end').val(), 'Y-m-d'); + var url = $('#dash_filter_new_customers').data('href') + '&date_from='+start.format('Y-m-d')+ '&date_to='+ end.format('Y-m-d'); + $('#dash_filter_new_customers').attr('href', url); $('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); $('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); diff --git a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl index 95cee2cd3..a0d0a48c8 100644 --- a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl +++ b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl @@ -121,7 +121,7 @@
  • - + {l s="New Customers" mod='dashactivity'} From 19e74a7ff27d66dd1c05a19046668e7faf95dca8 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 29 May 2024 09:56:56 +0530 Subject: [PATCH 13/67] Added: Admin can now filter the using banned status of the customer in the listing in the admin customer controller --- controllers/admin/AdminCustomersController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index cdc291da4..3344f23a2 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -170,6 +170,11 @@ class AdminCustomersControllerCore extends AdminController 'type' => 'datetime', 'search' => false, 'havingFilter' => true + ), + 'deleted' => array( + 'title' => $this->l('Banned'), + 'type' => 'bool', + 'displayed' => false, ) )); @@ -217,14 +222,14 @@ class AdminCustomersControllerCore extends AdminController $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); } - if (Tools::getValue('action') == 'filterOnlyNewCustomer') { + $prefix = $this->getCookieFilterPrefix(); + if (Tools::getValue('filterOnlyNewCustomer')) { if (($dateFrom = Tools::getValue('date_from')) && ($dateTo = Tools::getValue('date_to')) && strtotime($dateTo) >= strtotime($dateFrom) ) { $this->processResetFilters(); $this->context->cookie->{'submitFilter'.$this->table} = true; - $prefix = $this->getCookieFilterPrefix(); //Updating the date format of the filter dates to the desired format. $dateFrom = date('Y-m-d', strtotime($dateFrom)); $dateTo = date('Y-m-d', strtotime($dateTo)); @@ -235,6 +240,10 @@ class AdminCustomersControllerCore extends AdminController } parent::postProcess(); + $filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_'); + if (isset($filters[$prefix.$this->table.'Filter_deleted']) && $filters[$prefix.$this->table.'Filter_deleted'] == 1) { + $this->deleted = false; + } } public function initContent() From 04132d354cc2c6cd2ccf14b07c3615318c58dae3 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 1 Jun 2024 13:57:13 +0530 Subject: [PATCH 14/67] Fixed: Text mentioned in the manual allotment is not visible on the order detail page in back-office --- .../controllers/orders/helpers/view/view.tpl | 6 ++- .../orders/modals/_room_allotment_comment.tpl | 28 +++++++++++ controllers/admin/AdminOrdersController.php | 24 ++++++++++ js/admin/orders.js | 46 +++++++++++++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl 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 9f884e2b1..ab8516fb5 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -125,7 +125,7 @@

{/foreach} diff --git a/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl b/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl new file mode 100644 index 000000000..859ee5cb0 --- /dev/null +++ b/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl @@ -0,0 +1,28 @@ +{* +* Since 2010 Webkul. +* +* NOTICE OF LICENSE +* +* All right is reserved, +* Please go through this link for complete license : https://store.webkul.com/license.html +* +* 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 https://store.webkul.com/customisation-guidelines/ for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*} + + diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index c08b5f111..ef9e6ad44 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -779,6 +779,30 @@ class AdminOrdersControllerCore extends AdminController die(Tools::jsonEncode($response)); } + public function ajaxProcessInitRoomAllotmentCommentModal() + { + $response['hasError'] = 1; + if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail(Tools::getValue('id_hotel_booking')))) { + if ($objBookingDetail->booking_type == HotelBookingDetail::ALLOTMENT_MANUAL) { + // get booking information by order + $this->context->smarty->assign('comment', $objBookingDetail->comment); + $modal = array( + 'modal_id' => 'room-allotment-comment-modal', + 'modal_class' => 'modal-md order_detail_modal', + 'modal_title' => '  '.$this->l('Room Manual Allotment Comment'), + 'modal_content' => $this->context->smarty->fetch('controllers/orders/modals/_room_allotment_comment.tpl'), + 'modal_actions' => array(), + ); + + $this->context->smarty->assign($modal); + $response['hasError'] = 0; + $response['modalHtml'] = $this->context->smarty->fetch('modal.tpl'); + } + } + + die(Tools::jsonEncode($response)); + } + public function ajaxProcessInitRoomReallocationModal() { // set modal details diff --git a/js/admin/orders.js b/js/admin/orders.js index 25d8111a3..4eaab342f 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1705,6 +1705,18 @@ $(document).ready(function() { // End: RoomStatusModal: Processes // ====================================== + + // Start: RoomAllotmentCommentModal: Processes + $(document).on('click', '.manual_allotment_comment', function(e){ + e.preventDefault(); + + RoomAllotmentCommentModal.show(this); + }); + // End: RoomAllotmentCommentModal: Processes + // ====================================== + + + // Start: RoomReallocationModal: Processes // For processing room reallocation and swapping $(document).on('click', '.room_reallocate_swap', function(e) { @@ -2718,6 +2730,40 @@ const CancelRoomBookingModal = { } }; +// Modal object to handle comment on rooms for manual cancellation +const RoomAllotmentCommentModal = { + show: function(element) { + $(".loading_overlay").show(); + let idHtlBooking = parseInt($(element).attr('data-id_hotel_booking_detail')); + $.ajax({ + type: 'POST', + headers: { + "cache-control": "no-cache" + }, + url: admin_order_tab_link, + dataType: 'JSON', + cache: false, + data: 'ajax=true&id_hotel_booking='+idHtlBooking+'&action=initRoomAllotmentCommentModal', + success: function(result) { + if (result.hasError == 0 && result.modalHtml) { + $('#footer').next('.bootstrap').append(result.modalHtml); + + $('#room-allotment-comment-modal').modal('show'); + + } else { + showErrorMessage(txtSomeErr); + } + }, + complete: function() { + $(".loading_overlay").hide(); + } + }); + }, + close: function() { + $('#room-allotment-comment-modal').modal('hide'); + } +}; + function updateAdditionalServices(element) { var id_room_type_service_product_order_detail = $(element).data('id_room_type_service_product_order_detail'); From 0dbd6290480ccaaf7beae25b0282ee57fa51ba1f Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 1 Jun 2024 15:31:21 +0530 Subject: [PATCH 15/67] Fixed:Should have some gap between Refund status and refund amount on order detail page. --- admin/themes/default/sass/controllers/_order.sass | 5 ++++- .../template/controllers/orders/helpers/view/view.tpl | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/admin/themes/default/sass/controllers/_order.sass b/admin/themes/default/sass/controllers/_order.sass index c32768ed0..d061c8615 100644 --- a/admin/themes/default/sass/controllers/_order.sass +++ b/admin/themes/default/sass/controllers/_order.sass @@ -79,4 +79,7 @@ white-space: normal #noteContent - max-height: 200px \ No newline at end of file + max-height: 200px + +.panel-refund-request .refunded_amount + margin-top: 2px \ No newline at end of file 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 ab8516fb5..1ddf349a9 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -785,7 +785,7 @@ {/if} -
+
 {l s='Refund Requests'}
@@ -816,7 +816,7 @@
From 4740b83032f86d0e95cc7bf6a6ef73103aacd77a Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 1 Jun 2024 15:58:26 +0530 Subject: [PATCH 16/67] Fixed: Children's age with Under 1 showing 0 in order detail page in back-office --- .../controllers/orders/_overbookings.tpl | 10 +++++++--- .../controllers/orders/_product_line.tpl | 6 +++++- .../classes/HotelBookingDetail.php | 16 ++++++++++------ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_overbookings.tpl b/admin/themes/default/template/controllers/orders/_overbookings.tpl index b2b89fa6c..154adbccf 100644 --- a/admin/themes/default/template/controllers/orders/_overbookings.tpl +++ b/admin/themes/default/template/controllers/orders/_overbookings.tpl @@ -43,15 +43,19 @@ + @@ -125,25 +126,28 @@ - + {/foreach} @@ -1250,10 +1254,9 @@ {addJsDefL name='select_room_txt'}{l s='Select room' js=1}{/addJsDefL} {addJsDef max_child_age=$max_child_age|escape:'quotes':'UTF-8'} {addJsDef max_child_in_room=$max_child_in_room|escape:'quotes':'UTF-8'} - {addJsDef ROOM_STATUS_ALLOTED=$ROOM_STATUS_ALLOTED|escape:'quotes':'UTF-8'} {addJsDef ROOM_STATUS_CHECKED_IN=$ROOM_STATUS_CHECKED_IN|escape:'quotes':'UTF-8'} {addJsDef ROOM_STATUS_CHECKED_OUT=$ROOM_STATUS_CHECKED_OUT|escape:'quotes':'UTF-8'} - + {addJsDef ALLOTMENT_MANUAL=$ALLOTMENT_MANUAL|escape:'quotes':'UTF-8'} {addJsDefL name=txt_booking_document_upload_success}{l s='Document uploaded successfully.' js=1}{/addJsDefL} {addJsDefL name=txt_booking_document_delete_confirm}{l s='Are you sure?' js=1}{/addJsDefL} {addJsDefL name=txt_booking_document_delete_success}{l s='Document deleted successfully.' js=1}{/addJsDefL} diff --git a/admin/themes/default/template/controllers/orders/modals/_room_reallocation.tpl b/admin/themes/default/template/controllers/orders/modals/_room_reallocation.tpl index 3f2e32f8c..e74ccb1f4 100644 --- a/admin/themes/default/template/controllers/orders/modals/_room_reallocation.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_room_reallocation.tpl @@ -28,15 +28,25 @@
+
+
+ +
 
+
+
+ +
+
+
 
 
-
- -
 
+
+ +
@@ -90,15 +100,25 @@
+
+
+ +
 
+
+
+ +
+
+
 
 
-
- -
 
+
+ +

diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index b7b60278b..08f42a0ac 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2950,9 +2950,9 @@ class AdminOrdersControllerCore extends AdminController ), 'isCancelledRoom' => $isCancelledRoom, 'orderDocuments' => $order->getDocuments(), - 'ROOM_STATUS_ALLOTED' => HotelBookingDetail::STATUS_ALLOTED, 'ROOM_STATUS_CHECKED_IN' => HotelBookingDetail::STATUS_CHECKED_IN, 'ROOM_STATUS_CHECKED_OUT' => HotelBookingDetail::STATUS_CHECKED_OUT, + 'ALLOTMENT_MANUAL' => HotelBookingDetail::ALLOTMENT_MANUAL, ); return parent::renderView(); diff --git a/js/admin/orders.js b/js/admin/orders.js index 4eaab342f..a792c3e59 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -306,11 +306,17 @@ function init() e.preventDefault(); }); + // voucher modal show and close $('#add_voucher').unbind('click').click(function(e) { e.preventDefault(); VoucherModal.show(); }); + $(document).on('hidden.bs.modal', '#voucher-modal', function(){ + $('#voucher-modal').remove(); + }); + // End: voucher modal show and close + $(document).on('change','#discount_type', function(e) { // Percent type if ($(this).val() == 1) @@ -342,11 +348,18 @@ function init() $('select[name=discount_invoice]').attr('disabled', false); }); + // payment information modal show and close $('.open_payment_information').unbind('click').click(function(e) { e.preventDefault(); OrderPaymentDetailModal.show($(this)); }); + $(document).on('hidden.bs.modal', '#payment-detail-modal', function(){ + $('#payment-detail-modal').remove(); + }); + // End: payment information modal show and close + + initRoomEvents(); initProductEvents(); } @@ -1168,15 +1181,21 @@ function initRoomEvents() e.preventDefault(); }); + // order-payment-modal hide and show $('#add_new_payment').on('click', function(e) { e.preventDefault(); OrderPaymentModal.show(); }); + $(document).on('hidden.bs.modal', '#order-payment-modal', function(){ + $('#order-payment-modal').remove(); + }); + $('#cancle_add_payment').on('click', function(e) { e.preventDefault(); OrderPaymentModal.hide(); }); + // end order-payment-modal hide and show } function addRoomRefreshTotal() { var quantity = parseInt($('#add_product_product_quantity').val()); @@ -1644,6 +1663,10 @@ $(document).ready(function() { DocumentNoteModal.show($(this)); }); + $(document).on('hidden.bs.modal', '#document-note-modal', function(){ + $('#document-note-modal').remove(); + }); + $(document).on('click', '.submitDocumentNote', function(e) { e.preventDefault(); DocumentNoteModal.submit(); @@ -1658,6 +1681,10 @@ $(document).ready(function() { TravellerModal.show(); }); + $(document).on('hidden.bs.modal', '#traveller-modal', function(){ + $('#traveller-modal').remove(); + }); + $(document).on('click', '.submitTravellerInfo', function(e) { e.preventDefault(); TravellerModal.submit(); @@ -1698,6 +1725,10 @@ $(document).ready(function() { RoomStatusModal.show($(this)); }); + $(document).on('hidden.bs.modal', '#room-status-modal', function(){ + $('#room-status-modal').remove(); + }); + $(document).on('click', '.submitRoomStatus', function(e) { e.preventDefault(); RoomStatusModal.submit(); @@ -1712,11 +1743,13 @@ $(document).ready(function() { RoomAllotmentCommentModal.show(this); }); + + $(document).on('hidden.bs.modal', '#room-allotment-comment-modal', function(){ + $('#room-allotment-comment-modal').remove(); + }); // End: RoomAllotmentCommentModal: Processes // ====================================== - - // Start: RoomReallocationModal: Processes // For processing room reallocation and swapping $(document).on('click', '.room_reallocate_swap', function(e) { @@ -1822,6 +1855,10 @@ $(document).ready(function() { CancelRoomBookingModal.show(); }); + $(document).on('hidden.bs.modal', '#cancel-room-booking-modal', function(){ + $('#cancel-room-booking-modal').remove(); + }); + $(document).on('click', '.submitCancelBooking', function(e) { e.preventDefault(); CancelRoomBookingModal.submit(); @@ -2304,18 +2341,25 @@ const RoomReallocationModal = { success: function(result) { if (result.hasError == 0 && result.modalHtml) { $('#footer').next('.bootstrap').append(result.modalHtml); - $(".modal_id_htl_booking").val(roomObj.data('id_htl_booking')); $("input.modal_curr_room_num").val(roomObj.data('room_num')); $("span.modal_curr_room_num").text(roomObj.data('room_num') + ', ' + roomObj.data('room_type_name')); $(".cust_name").text(roomObj.data('cust_name')); $(".cust_email").text(roomObj.data('cust_email')); + $(".modal_curr_allotent_type").text(roomObj.data('allotment_type_label')); // reset price difference fields $("#reallocation_price_diff").val(0); $("#reallocation_price_diff_block").hide(); $(".realloc_roomtype_change_message").hide(); + if (roomObj.data('allotment_type') == ALLOTMENT_MANUAL) { + $(".allotment_comment_block .modal_curr_allotment_comment").text(roomObj.data('comment')); + $(".allotment_comment_block").show(); + } else { + $(".allotment_comment_block").hide(); + } + // For Rooms Swapping var json_arr_rm_swp = roomObj.data('avail_rm_swap'); if (roomObj.data('avail_rm_swap') != 'false' && json_arr_rm_swp.length != 0) { From 190907346b24d1eb4d197026a345480b3be2a2ab Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 5 Jun 2024 16:21:22 +0530 Subject: [PATCH 18/67] Updated: decimal maximum limit is removed from price validation Validate::isPrice() --- classes/Validate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Validate.php b/classes/Validate.php index 63dcacc75..9a080dd61 100644 --- a/classes/Validate.php +++ b/classes/Validate.php @@ -233,7 +233,7 @@ class ValidateCore */ public static function isPrice($price) { - return preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', $price); + return preg_match('/^[0-9]{1,10}(\.[0-9]{1,})?$/', $price); } /** @@ -244,7 +244,7 @@ class ValidateCore */ public static function isNegativePrice($price) { - return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,9})?$/', $price); + return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,})?$/', $price); } /** From 2a1e2df946f6284c4a0c4b5866e75dd009ef4d73 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Thu, 6 Jun 2024 15:29:13 +0530 Subject: [PATCH 19/67] Updated: Set the order currency at first element of currencies in Add Payment form in Back-office order detail page --- controllers/admin/AdminOrdersController.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 08f42a0ac..970e130f1 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -630,11 +630,23 @@ class AdminOrdersControllerCore extends AdminController $payment_methods[] = $module->displayName; } } + + // Set the order currency at first element of currencies + if ($currencies = Currency::getCurrenciesByIdShop($objOrder->id_shop)) { + foreach ($currencies as $key => $currency) { + if ($currency['id_currency'] == $objOrder->id_currency) { + unset($currencies[$key]); + array_unshift($currencies, $currency); + break; + } + } + } + $this->context->smarty->assign( array( 'current_index' => self::$currentIndex, 'order' => $objOrder, - 'currencies' => Currency::getCurrenciesByIdShop($objOrder->id_shop), + 'currencies' => $currencies, 'payment_methods' => $payment_methods, 'payment_types' => $this->getPaymentsTypes(), 'invoices_collection' => $objOrder->getInvoicesCollection(), From 5098c0ce678fd1287e6752c45dd2884190d31c79 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Fri, 7 Jun 2024 11:32:15 +0530 Subject: [PATCH 20/67] Fixed: Add room booking modal element comes multiple time in the html when open the modal multiple times --- js/admin/orders.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/admin/orders.js b/js/admin/orders.js index cfb99a362..bda5ba196 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1802,6 +1802,10 @@ $(document).ready(function() { $('.submitAddRoom').attr('disabled', true); } }); + + $(document).on('hidden.bs.modal', '#add-room-booking-modal', function(){ + $('#add-room-booking-modal').remove(); + }); // End: AddRoomBookingModal: Processes // ====================================== From ba321cbf16d08d9d39750b6b80dccf2c5d9c8896 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 7 Jun 2024 12:53:58 +0530 Subject: [PATCH 21/67] Added measurement unit with the average lead time in the KPI --- controllers/admin/AdminStatsController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 86e20a67f..cdcfcca53 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -959,6 +959,12 @@ class AdminStatsControllerCore extends AdminStatsTabController case 'average_lead_time': $dateToday = date('Y-m-d'); $value = Tools::ps_round(AdminStatsController::getAverageLeadTime(), 2); + if ($value && $value <= 1) { + $value .= ' '.$this->l('day'); + } else { + $value .= ' '.$this->l('days'); + } + break; case 'average_guest_in_booking': $dateToday = date('Y-m-d'); From c1bb83eefc4c70f25c812755bfc2d9e4025a6094 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 11 Jun 2024 11:51:22 +0530 Subject: [PATCH 22/67] Updated: Detailed price and tax information in total costs section in Order Detail page of Back-office --- .../controllers/orders/helpers/view/view.tpl | 100 +++++++++++------- 1 file changed, 59 insertions(+), 41 deletions(-) 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 6fc92ec12..047541e76 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -924,7 +924,7 @@ {assign var=additional_service_price_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTI)} {if $room_price_tax_excl}
- + @@ -933,34 +933,16 @@ {/if} {if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0} - + {/if} - {* {if $room_price_tax_excl} - - - - - - {/if} - {if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0} - - - - - - {/if} *} {if $service_products_price_tax_excl} - + @@ -968,10 +950,64 @@ {/if} + {if isset($totalConvenienceFeeTE) && $totalConvenienceFeeTE > 0} + + + + + + {/if} + + {if $room_price_tax_excl} + + + + + + {/if} + {if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0} + + + + + + {/if} + {if isset($totalConvenienceFeeTE) && $totalConvenienceFeeTE > 0} + + + + + + {/if} + + {* {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} *} + + + + + + {* {/if} *} total_discounts_tax_incl == 0}style="display: none;"{/if}> - + + + + total_discounts_tax_incl == 0}style="display: none;"{/if}> + + @@ -982,24 +1018,6 @@ - {if isset($totalConvenienceFeeTI) && $totalConvenienceFeeTI > 0} - - - - - - {/if} - {* {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} *} - - - - - - {* {/if} *} + {foreach $cmsPages as $cmsPage} + + + + + + {/foreach} + +
From 646f45c78393cc085d227efbca3d1b6c71c87bd1 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 7 May 2024 13:07:36 +0530 Subject: [PATCH 02/67] Fixed: The noticies on the Admin controllers when the identifier provided manually by editing the url does not exists in the database --- classes/order/Order.php | 2 +- controllers/admin/AdminCmsContentController.php | 6 ++++-- controllers/admin/AdminFeaturesController.php | 5 ++--- controllers/admin/AdminNormalProductsController.php | 6 ++++++ controllers/admin/AdminOrdersController.php | 10 +++++----- controllers/admin/AdminProductsController.php | 6 ++++++ controllers/admin/AdminRequestSqlController.php | 6 ++---- .../admin/AdminOrderRefundRequestsController.php | 2 +- 8 files changed, 27 insertions(+), 16 deletions(-) diff --git a/classes/order/Order.php b/classes/order/Order.php index a4e7a5e6b..dc29f2652 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -1804,7 +1804,7 @@ class OrderCore extends ObjectModel SELECT opd.`amount` as `real_paid_amount`, opd.*, op.* FROM `'._DB_PREFIX_.'order_payment_detail` opd INNER JOIN `'._DB_PREFIX_.'order_payment` op ON (opd.`id_order_payment` = op.`id_order_payment`) - WHERE `id_order` = '.$this->id + WHERE `id_order` = '.(int) $this->id ); } diff --git a/controllers/admin/AdminCmsContentController.php b/controllers/admin/AdminCmsContentController.php index 9bf088b58..6708fa987 100644 --- a/controllers/admin/AdminCmsContentController.php +++ b/controllers/admin/AdminCmsContentController.php @@ -85,6 +85,7 @@ class AdminCmsContentControllerCore extends AdminController public function initContent() { + $this->loadObject(true); $this->initTabModuleList(); $this->renderPageHeaderToolbar(); @@ -151,8 +152,9 @@ class AdminCmsContentControllerCore extends AdminController if (Tools::getValue('addcms') !== false) { $this->toolbar_title[] = $this->l('Add new'); - } elseif ($id_cms_page) { - $cms_page = new CMS($id_cms_page); + } elseif ($id_cms_page + && Validate::isLoadedObject($cms_page = new CMS($id_cms_page)) + ) { $this->toolbar_title[] = sprintf($this->l('Edit: %s'), $cms_page->meta_title[$this->context->employee->id_lang]); } } else { diff --git a/controllers/admin/AdminFeaturesController.php b/controllers/admin/AdminFeaturesController.php index c581d2604..c57d5d807 100644 --- a/controllers/admin/AdminFeaturesController.php +++ b/controllers/admin/AdminFeaturesController.php @@ -452,10 +452,9 @@ class AdminFeaturesControllerCore extends AdminController $this->initToolbar(); $this->initPageHeaderToolbar(); if ($this->display == 'edit' || $this->display == 'add') { - if (!$this->loadObject(true)) { - return; + if ($this->loadObject(true)) { + $this->content .= $this->renderForm(); } - $this->content .= $this->renderForm(); } elseif ($this->display == 'view') { // Some controllers use the view action without an object if ($this->className) { diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index 87a959951..6cd378dbf 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -398,6 +398,12 @@ class AdminNormalProductsControllerCore extends AdminController $bo_theme = 'default'; } + Media::addJsDef( + array( + 'tb_pathToImage' => '../img/loadingAnimation.gif' + ) + ); + $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js'); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 9c6d1fe61..870ac9432 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -482,8 +482,7 @@ class AdminOrdersControllerCore extends AdminController { if ($this->display == 'view') { /** @var Order $order */ - $order = $this->loadObject(); - + $order = new Order(Tools::getValue($this->identifier)); // hotel link in header if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { $this->toolbar_btn['hotel'] = array( @@ -997,7 +996,9 @@ class AdminOrdersControllerCore extends AdminController $this->addJS(_PS_JS_DIR_.'vendor/d3.v3.min.js'); if ($this->tabAccess['edit'] == 1 && $this->display == 'view') { - $this->addJS(_PS_JS_DIR_.'admin/orders.js'); + if ($this->loadObject(true)) { + $this->addJS(_PS_JS_DIR_.'admin/orders.js'); + } // $this->addJS(_PS_JS_DIR_.'admin/orders-product-event.js'); // $this->addJS(_PS_JS_DIR_.'admin/orders-room-event.js'); $this->addJS(_PS_JS_DIR_.'tools.js'); @@ -2477,11 +2478,10 @@ class AdminOrdersControllerCore extends AdminController { $order = new Order(Tools::getValue('id_order')); if (!Validate::isLoadedObject($order)) { - $this->errors[] = Tools::displayError('The order cannot be found within your database.'); + return false; } $this->content .= $this->renderKpis(); - $customer = new Customer($order->id_customer); $carrier = new Carrier($order->id_carrier); $products = $this->getProducts($order); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 811207d39..4f4277bdb 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -468,6 +468,12 @@ class AdminProductsControllerCore extends AdminController $bo_theme = 'default'; } + Media::addJsDef( + array( + 'tb_pathToImage' => '../img/loadingAnimation.gif' + ) + ); + $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js'); diff --git a/controllers/admin/AdminRequestSqlController.php b/controllers/admin/AdminRequestSqlController.php index a8e5507b1..068face35 100644 --- a/controllers/admin/AdminRequestSqlController.php +++ b/controllers/admin/AdminRequestSqlController.php @@ -283,11 +283,9 @@ class AdminRequestSqlControllerCore extends AdminController $this->initToolbar(); $this->initPageHeaderToolbar(); if ($this->display == 'edit' || $this->display == 'add') { - if (!$this->loadObject(true)) { - return; + if ($this->loadObject(true)) { + $this->content .= $this->renderForm(); } - - $this->content .= $this->renderForm(); } elseif ($this->display == 'view') { // Some controllers use the view action without an object if ($this->className) { diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index f6eb2fb5f..916e6c1c2 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -135,7 +135,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController public function renderView() { - if (!($objOrderReturn = $this->loadObject(true))) { + if (!($objOrderReturn = $this->loadObject())) { return; } $refundStatuses = OrderReturnStateCore::getOrderReturnStates($this->context->language->id); From 084b3c34ed5e65f9e71eaff08fe99324e9032d1c Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 14 May 2024 11:30:19 +0530 Subject: [PATCH 03/67] Fixed: The admin was unable to change the customer after any error is displayed while creating new address for the customer, also fixed the back button --- .../template/controllers/addresses/helpers/form/form.tpl | 2 +- controllers/admin/AdminAddressesController.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl index ec102910d..e46200e15 100644 --- a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl @@ -88,7 +88,7 @@
- +
{/if} {else} diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 83a646cb6..6e052f39b 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -190,10 +190,10 @@ class AdminAddressesControllerCore extends AdminController $token_customer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id); } + $this->fields_value['email'] = Tools::getValue('email'); $this->tpl_form_vars = array( - 'customer' => isset($customer) ? $customer : null, - 'tokenCustomer' => isset($token_customer) ? $token_customer : null, - 'back_url' => urldecode(Tools::getValue('back')) + 'customer' => (isset($customer) && $this->object->id) ? $customer : null, + 'tokenCustomer' => isset($token_customer) ? $token_customer : null ); // Order address fields depending on country format From 0d64da3315e29b0095cec6742f71df529b3f2e44 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 21 May 2024 10:48:42 +0530 Subject: [PATCH 04/67] Removed: Non required email templates from the order status email template dropdrown --- controllers/admin/AdminStatusesController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index e10140b77..01a1d9c0d 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -707,6 +707,14 @@ class AdminStatusesControllerCore extends AdminController $theme = new Theme($this->context->shop->id_theme); $default_path = '../mails/'; $theme_path = '../themes/'.$theme->directory.'/mails/'; // Mail templates can also be found in the theme folder + $templatesToIgnore = array( + 'footer.html', + 'header.html', + 'shipped.html', + 'in_transit.html', + 'download_products.html', + 'test.html' + ); $array = array(); foreach (Language::getLanguages(false) as $language) { @@ -722,7 +730,9 @@ class AdminStatusesControllerCore extends AdminController // We merge all available emails in one array $templates = array_unique(array_merge(scandir(_PS_ADMIN_DIR_.'/'.$default_path.$iso_code), $theme_templates)); foreach ($templates as $key => $template) { - if (!strncmp(strrev($template), 'lmth.', 5)) { + if (!strncmp(strrev($template), 'lmth.', 5) + && !in_array($template, $templatesToIgnore) + ) { $search_result = array_search($template, $theme_templates); $array[$iso_code][] = array( 'id' => substr($template, 0, -5), From c91935a28d7eac3d08f5db3c00b0fe8e09858b32 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 21 May 2024 17:50:06 +0530 Subject: [PATCH 05/67] Fixed:The option to select children's age is not showing in the popup while editing occupancy on the order detail page. --- .../controllers/orders/modals/_edit_room_tab_content.tpl | 2 ++ js/admin/orders.js | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl index 444182bab..02d5ae38c 100644 --- a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl @@ -89,6 +89,8 @@ + +

diff --git a/js/admin/orders.js b/js/admin/orders.js index 8a551b4fa..25d8111a3 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -523,15 +523,12 @@ function initProductEvents() $(this).val(max_child_in_room); if (elementVal == 1) { showOccupancyError(no_children_allowed_txt, $(this).closest(".occupancy_info_block")); - haserror = true; } else { showOccupancyError(max_children_txt, $(this).closest(".occupancy_info_block")); - haserror = true; } } else if (elementVal > max_allowed_for_current) { $(this).val(max_allowed_for_current); showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block")); - haserror = true; } } else { max_adults_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_adults').val(); From f9ccc67a4e7ffb6da88e69210aafc75d9be14973 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 12:23:38 +0530 Subject: [PATCH 06/67] Fixed:During addition of rooms in booking from backoffice, scrolling the page displaces the suggested room types from input in the modal --- admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss b/admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss index 8240fa4ad..a126c3986 100644 --- a/admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss +++ b/admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss @@ -9,7 +9,7 @@ // Kill the scroll on the body .modal-open { - overflow-x: hidden; + overflow: hidden; } // Container that the modal scrolls within From c19a195d8b26ef134eb58d8206324f75e998f33e Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 15:22:54 +0530 Subject: [PATCH 07/67] Fixed: Time is not shown with date for check-In and check-out status in Room Status section in back-office order detail page --- .../default/template/controllers/orders/helpers/view/view.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index f28080e92..f20d03ea1 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -127,9 +127,9 @@ {if $data['id_status'] == $hotel_order_status['STATUS_ALLOTED']['id_status']} {l s='Alloted'} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']} - {l s='Checked in on'} {dateFormat date=$data['check_in']} + {l s='Checked in on'} {dateFormat date=$data['check_in'] full=1} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} - {l s='Checked out on'} {dateFormat date=$data['check_out']} + {l s='Checked out on'} {dateFormat date=$data['check_out'] full=1} {/if}
From e7f3fd1beb23b3fb8cb5d5b9f5009f075c85f9fd Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 15:48:16 +0530 Subject: [PATCH 08/67] add scrollbar in Private note on order detail page --- admin/themes/default/sass/controllers/_order.sass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/themes/default/sass/controllers/_order.sass b/admin/themes/default/sass/controllers/_order.sass index c5315218e..c32768ed0 100644 --- a/admin/themes/default/sass/controllers/_order.sass +++ b/admin/themes/default/sass/controllers/_order.sass @@ -77,3 +77,6 @@ .room_status_info_form .room_status white-space: normal + +#noteContent + max-height: 200px \ No newline at end of file From e879c6638d58917c81d47198a71510865fb33da0 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 18:40:30 +0530 Subject: [PATCH 09/67] Fixed:At the time of room edit mention price is tax included or excluded --- .../controllers/orders/modals/_add_room_booking.tpl | 4 ++-- .../controllers/orders/modals/_edit_room_tab_content.tpl | 2 +- .../modals/_extra_services_facilities_tab_content.tpl | 6 +++--- .../modals/_extra_services_service_products_tab_content.tpl | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl b/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl index 63d96c205..92beca110 100644 --- a/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl @@ -49,7 +49,7 @@
- +
{if $currency->format % 2}
{$currency->sign}
{/if} @@ -57,7 +57,7 @@
- +
{if $currency->format % 2}
{$currency->sign}
{/if} diff --git a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl index 02d5ae38c..932b0bc19 100644 --- a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl @@ -50,7 +50,7 @@
- +
{if $currency->format % 2}
{$currency->sign}
{/if} diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_facilities_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_facilities_tab_content.tpl index 1231752ca..4dee95332 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_facilities_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_facilities_tab_content.tpl @@ -31,8 +31,8 @@
{l s='Name'}{l s='Unit Price'}{l s='Total Price'}{l s='Unit Price (tax excl.)'}{l s='Total Price (tax excl.)'} {l s='Action'}
{l s='Name'} {l s='Option'}{l s='Unit Price'}{l s='Unit Price (tax excl.)'}
{l s='Name'} {l s='Quantity'}{l s='Unit Price'}{l s='Total Price'}{l s='Unit Price (tax excl.)'}{l s='Total Price (tax excl.)'} {l s='Action'}
{l s='Name'} {l s='Quantity'}{l s='Unit Price'}{l s='Unit Price (tax excl.)'}
{if $data['id_status'] == $hotel_order_status['STATUS_ALLOTED']['id_status']} - {l s='Alloted'} + {l s='Alloted'} {if $data['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL}({l s='Manually'}){/if} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']} {l s='Checked in on'} {dateFormat date=$data['check_in'] full=1} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} @@ -140,6 +140,10 @@ {/if} + + {if $data['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL && $data['comment'] != ''} + + {/if}
{$return_info.state_name} {if $return_info.refunded_amount > 0} -  {displayPrice price=$return_info.refunded_amount currency=$currency->id} +  {displayPrice price=$return_info.refunded_amount currency=$currency->id} {/if}
{if $order->with_occupancy && $data['children']} {l s='Duration'} {l s='Documents'} {l s='Room Status'}{l s='Allotment'} {l s='Action'}
{if $data['id_status'] == $hotel_order_status['STATUS_ALLOTED']['id_status']} - {l s='Alloted'} {if $data['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL}({l s='Manually'}){/if} + {l s='Alloted'} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']} {l s='Checked in on'} {dateFormat date=$data['check_in'] full=1} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} {l s='Checked out on'} {dateFormat date=$data['check_out'] full=1} {/if} + + {if $data['booking_type'] == $ALLOTMENT_MANUAL} + {l s='Manual'}  {if $data['comment'] != ''}{/if} + {else} + {l s='Auto'} + {/if} + {if $data.is_refunded || $data.is_cancelled} {if $data.is_cancelled}{l s='Cancelled'}{else}{l s='Refunded'}{/if} {else} - + {l s='Edit'} {/if} - - {if $data['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL && $data['comment'] != ''} - - {/if}
{l s='Total Rooms Cost (tax excl.)'}{l s='Total Rooms Cost (Tax excl.)'} {displayPrice price=$room_price_tax_excl currency=$currency->id}
{l s='Total Extra services (tax excl.)'}{l s='Total Extra services (Tax excl.)'} {displayPrice price=($additional_service_price_tax_excl - $totalConvenienceFeeTE) currency=$currency->id}
{l s='Total Rooms Tax'} - {displayPrice price=($room_price_tax_incl - $room_price_tax_excl) currency=$currency->id} -
{l s='Extra services Tax'} - {displayPrice price=($additional_service_price_tax_incl - $additional_service_price_tax_excl) currency=$currency->id} -
{l s='Total service products cost (tax excl.)'}{l s='Total service products cost (Tax excl.)'} {displayPrice price=$service_products_price_tax_excl currency=$currency->id}
{l s='Convenience Fee (Tax excl.)'} + {displayPrice price=$totalConvenienceFeeTE currency=$currency->id} +
{l s='Total Rooms Tax'} + {displayPrice price=($room_price_tax_incl - $room_price_tax_excl) currency=$currency->id} +
{l s='Extra services Tax'} + {displayPrice price=(($additional_service_price_tax_incl - $additional_service_price_tax_excl) - ($totalConvenienceFeeTI - $totalConvenienceFeeTE)) currency=$currency->id} +
{l s='Convenience Fee Tax'} + {displayPrice price=($totalConvenienceFeeTI - $totalConvenienceFeeTE) currency=$currency->id} +
{l s='Total Taxes'} + {displayPrice price=(($order->total_paid_tax_incl + $order->total_discounts_tax_incl) - ($order->total_paid_tax_excl + $order->total_discounts_tax_excl)) currency=$currency->id} +
{l s='Discounts'}{l s='Total Booking Amount'} - -{displayPrice price=$order_discount_price currency=$currency->id} + {displayPrice price=($order->total_paid_tax_incl + $order->total_discounts_tax_incl) currency=$currency->id} +
{l s='Discounts'} + -{displayPrice price=$order->total_discounts_tax_incl currency=$currency->id}
{l s='Convenience Fee'} - {displayPrice price=$totalConvenienceFeeTE currency=$currency->id} -
{l s='Total Taxes'} - {displayPrice price=($order->total_paid_tax_incl - $order->total_paid_tax_excl) currency=$currency->id} -
{l s='Final Booking Total'} From df643828f0a8e5104bea2bcd5c82d273125b3ca0 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 12 Jun 2024 15:21:31 +0530 Subject: [PATCH 23/67] updated the customer delete and ban process --- .../customers/helpers/view/view.tpl | 24 ++++++++++++++----- classes/Customer.php | 5 +++- .../admin/AdminCustomersController.php | 10 ++++++-- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 88da2734e..294f6dd69 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -146,15 +146,27 @@

- {if $customer->active} - - - {l s='Active'} + {if !$customer->deleted} + {if $customer->active} + + + {l s='Active'} + + {else} + + + {l s='Inactive'} + + {/if} + {else if $customer->deleted == Customer::STATUS_BANNED} + + + {l s='Banned'} - {else} + {else if $customer->deleted == Customer::STATUS_DELETED} - {l s='Inactive'} + {l s='Deleted'} {/if}

diff --git a/classes/Customer.php b/classes/Customer.php index a8c4c3609..fd46a853a 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -135,6 +135,9 @@ class CustomerCore extends ObjectModel public $groupBox; + const STATUS_BANNED = 1; + const STATUS_DELETED = 2; + protected $webserviceParameters = array( 'fields' => array( 'id_default_group' => array('xlink_resource' => 'groups'), @@ -179,7 +182,7 @@ class CustomerCore extends ObjectModel 'id_risk' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false), 'max_payment_days' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), - 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), + 'deleted' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false), 'note' => array('type' => self::TYPE_HTML, 'validate' => 'isCleanHtml', 'size' => 65000, 'copy_post' => false), 'is_guest' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false), diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 3344f23a2..58527d92f 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -236,6 +236,11 @@ class AdminCustomersControllerCore extends AdminController $this->context->cookie->{$prefix.$this->table.'Filter_date_add'} = json_encode(array($dateFrom, $dateTo)); } + $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); + } else if (Tools::getValue('filterOnlyBannedCustomer')) { + $this->processResetFilters(); + $this->context->cookie->{'submitFilter'.$this->table} = true; + $this->context->cookie->{$prefix.$this->table.'Filter_deleted'} = Customer::STATUS_BANNED; $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); } @@ -779,6 +784,7 @@ class AdminCustomersControllerCore extends AdminController $helper->color = 'color2'; $helper->title = $this->l('Banned Customers', null, null, false); $helper->subtitle = $this->l('All Time', null, null, false); + $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&filterOnlyBannedCustomer=1'; $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_banned_customers'; $helper->tooltip = $this->l('The total number of banned customers.', null, null, false); $kpis[] = $helper; @@ -988,7 +994,7 @@ class AdminCustomersControllerCore extends AdminController if (Validate::isLoadedObject($objCustomer = $this->loadObject())) { if ($this->delete_mode == 'real' && Order::getCustomerOrders($objCustomer->id, true)) { $objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::getShopDomain(); - $objCustomer->deleted = 1; + $objCustomer->deleted = Customer::STATUS_DELETED; if (!$objCustomer->update()) { $this->errors[] = Tools::displayError('Some error ocurred while deleting the Customer'); return; @@ -1029,7 +1035,7 @@ class AdminCustomersControllerCore extends AdminController // check if customer has orders for email change else customer will be deleted if (Order::getCustomerOrders($objCustomer->id, true)) { $objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::getShopDomain(); - $objCustomer->deleted = 1; + $objCustomer->deleted = Customer::STATUS_DELETED; if ($objCustomer->update()) { // unset the customer which is processed // not processed customers will be deleted with default process if no errors are there From 67dcad12e4e163b1bd18ed867be1969ecea50a31 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 12 Jun 2024 19:04:43 +0530 Subject: [PATCH 24/67] Removed extra spaces to fix error caused by smarty --- .../template/controllers/customers/helpers/view/view.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 294f6dd69..18145ce07 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -158,12 +158,12 @@ {l s='Inactive'} {/if} - {else if $customer->deleted == Customer::STATUS_BANNED} + {elseif $customer->deleted == Customer::STATUS_BANNED} {l s='Banned'} - {else if $customer->deleted == Customer::STATUS_DELETED} + {elseif $customer->deleted == Customer::STATUS_DELETED} {l s='Deleted'} From 5d5071b487644a4d7d7a59304e59543af1061715 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 13 Jun 2024 09:58:22 +0530 Subject: [PATCH 25/67] Updated the newsletter deletion process for the deleted customers with new flow --- modules/blocknewsletter/blocknewsletter.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/blocknewsletter/blocknewsletter.php b/modules/blocknewsletter/blocknewsletter.php index a7a0612d6..d4ab3bbe2 100644 --- a/modules/blocknewsletter/blocknewsletter.php +++ b/modules/blocknewsletter/blocknewsletter.php @@ -84,11 +84,23 @@ class Blocknewsletter extends Module 'actionCustomerAccountAdd', 'registerGDPRConsent', 'actionExportGDPRData', + 'actionObjectCustomerUpdateBefore', 'actionDeleteGDPRCustomer' ) ); } + public function hookActionObjectCustomerUpdateBefore($params) + { + $objCustomer = new Customer ($params['object']->id); + if ($params['object']->deleted == Customer::STATUS_DELETED + && ($register_status = $this->isNewsletterRegistered($objCustomer->email)) + && $register_status > 0 + ) { + $this->unregister($objCustomer->email, $register_status); + } + } + public function hookActionExportGDPRData($customer) { if (!Tools::isEmpty($customer['email']) && Validate::isEmail($customer['email'])) { From 134a25e324f1ab89f896a4cdeaaf6d702ea496ba Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 14 Jun 2024 12:47:26 +0530 Subject: [PATCH 26/67] revert changes made for new customer KPI to keep this pr focus only on new flow of banned customer --- .../admin/AdminCustomersController.php | 19 +------------------ controllers/admin/AdminStatsController.php | 7 +------ modules/dashactivity/views/js/dashactivity.js | 5 ----- .../templates/hook/dashboard_zone_one.tpl | 2 +- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 58527d92f..350e822d1 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -223,21 +223,7 @@ class AdminCustomersControllerCore extends AdminController } $prefix = $this->getCookieFilterPrefix(); - if (Tools::getValue('filterOnlyNewCustomer')) { - if (($dateFrom = Tools::getValue('date_from')) - && ($dateTo = Tools::getValue('date_to')) - && strtotime($dateTo) >= strtotime($dateFrom) - ) { - $this->processResetFilters(); - $this->context->cookie->{'submitFilter'.$this->table} = true; - //Updating the date format of the filter dates to the desired format. - $dateFrom = date('Y-m-d', strtotime($dateFrom)); - $dateTo = date('Y-m-d', strtotime($dateTo)); - $this->context->cookie->{$prefix.$this->table.'Filter_date_add'} = json_encode(array($dateFrom, $dateTo)); - } - - $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); - } else if (Tools::getValue('filterOnlyBannedCustomer')) { + if (Tools::getValue('filterOnlyBannedCustomer')) { $this->processResetFilters(); $this->context->cookie->{'submitFilter'.$this->table} = true; $this->context->cookie->{$prefix.$this->table.'Filter_deleted'} = Customer::STATUS_BANNED; @@ -770,9 +756,6 @@ class AdminCustomersControllerCore extends AdminController $helper->color = 'color4'; $helper->title = $this->l('New Customers', null, null, false); $nbDaysNewCustomers = Validate::isUnsignedInt(Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS')) ? Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS') : 30; - $date_from = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day')); - $date_to = date('Y-m-d'); - $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&filterOnlyNewCustomer=1&date_from='.$date_from.'&date_to='.$date_to; $helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysNewCustomers); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_new_customers'; $helper->tooltip = $this->l('The total number of new customers who registered in given period of time.', null, null, false); diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 87d5fdcd5..d7d233e26 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -965,11 +965,6 @@ class AdminStatsControllerCore extends AdminStatsTabController case 'average_lead_time': $dateToday = date('Y-m-d'); $value = Tools::ps_round(AdminStatsController::getAverageLeadTime(), 2); - if ($value && $value <= 1) { - $value .= ' '.$this->l('day'); - } else { - $value .= ' '.$this->l('days'); - } break; case 'average_guest_in_booking': @@ -1897,7 +1892,7 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getTotalNewCustomers($nbDaysNewCustomers) { - $maxDateAdd = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day')); + $maxDateAdd = date('Y-m-d H:i:s', strtotime('-'.$nbDaysNewCustomers.' day')); $sql = 'SELECT COUNT(c.`id_customer`) FROM `'._DB_PREFIX_.'customer` c WHERE c.`date_add` >= "'.pSQL($maxDateAdd).'" AND c.`deleted` = 0'; diff --git a/modules/dashactivity/views/js/dashactivity.js b/modules/dashactivity/views/js/dashactivity.js index 8343efa89..1bdf4e422 100644 --- a/modules/dashactivity/views/js/dashactivity.js +++ b/modules/dashactivity/views/js/dashactivity.js @@ -58,9 +58,6 @@ $(document).ready(function() { $('#date-start').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); end = Date.parseDate($('#date-end').val(), 'Y-m-d'); - var url = $('#dash_filter_new_customers').data('href') + '&date_from='+start.format('Y-m-d')+ '&date_to='+ end.format('Y-m-d'); - $('#dash_filter_new_customers').attr('href', url); - $('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); $('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); }); @@ -68,8 +65,6 @@ $(document).ready(function() { $('#date-end').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); end = Date.parseDate($('#date-end').val(), 'Y-m-d'); - var url = $('#dash_filter_new_customers').data('href') + '&date_from='+start.format('Y-m-d')+ '&date_to='+ end.format('Y-m-d'); - $('#dash_filter_new_customers').attr('href', url); $('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); $('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); diff --git a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl index a0d0a48c8..95cee2cd3 100644 --- a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl +++ b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl @@ -121,7 +121,7 @@
  • - + {l s="New Customers" mod='dashactivity'} From a66501186c125a4fc45a3d11ba54ecf89d83869c Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 18 Jun 2024 17:58:28 +0530 Subject: [PATCH 27/67] Fixed: Occupancy not selected properly while adding room to the order from back-office --- js/admin/orders.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/admin/orders.js b/js/admin/orders.js index bda5ba196..307495a03 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -2580,6 +2580,10 @@ const AddRoomBookingModal = { $('#add_product_product_price_tax_incl').val(data.price_tax_incl); $('#add_product_product_price_tax_excl').val(data.price_tax_excl); + $("#new_product .max_adults").val(data.room_type_info.max_adults); + $("#new_product .max_children").val(data.room_type_info.max_children); + $("#new_product .max_guests").val(data.room_type_info.max_guests); + //Added by webkul to set curent date in the date fields by default var date_in = $.datepicker.formatDate('dd-mm-yy', new Date()); var date_out = $.datepicker.formatDate('dd-mm-yy', new Date(new Date().getTime()+24*60*60*1000)); From e1fbeebd7f16b4675596366f17299461c6083378 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 18 Jun 2024 18:39:50 +0530 Subject: [PATCH 28/67] Added: Variable send_emails in validatOrder function call of the payment module to prevent the emails on the order validation process --- classes/PaymentModule.php | 63 +++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index d7e75b7d2..79fe1a90b 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -162,7 +162,7 @@ abstract class PaymentModuleCore extends Module */ public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown', $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false, - $secure_key = false, Shop $shop = null) + $secure_key = false, Shop $shop = null, $send_mails = true) { if (self::DEBUG_MODE) { PrestaShopLogger::addLog('PaymentModule::validateOrder - Function called', 1, null, 'Cart', (int)$id_cart, true); @@ -420,6 +420,7 @@ abstract class PaymentModuleCore extends Module && number_format($cart_total_paid, _PS_PRICE_COMPUTE_PRECISION_) != number_format($amount_paid, _PS_PRICE_COMPUTE_PRECISION_) && $this->name != 'wsorder' && $this->name != 'bo_order' + && (!isset($this->ValidateOrderAmount) || $this->validateOrderAmount) ) { // if customer is paying full payment amount $id_order_state = Configuration::get('PS_OS_ERROR'); @@ -684,24 +685,25 @@ abstract class PaymentModuleCore extends Module if ($voucher->add()) { // If the voucher has conditions, they are now copied to the new voucher CartRule::copyConditions($cart_rule['obj']->id, $voucher->id); - - $params = array( - '{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false), - '{voucher_num}' => $voucher->code, - '{firstname}' => $this->context->customer->firstname, - '{lastname}' => $this->context->customer->lastname, - '{id_order}' => $order->reference, - '{order_name}' => $order->getUniqReference() - ); - Mail::Send( - (int)$order->id_lang, - 'voucher', - sprintf(Mail::l('New voucher for your order %s', (int)$order->id_lang), $order->reference), - $params, - $this->context->customer->email, - $this->context->customer->firstname.' '.$this->context->customer->lastname, - null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop - ); + if ($send_mails) { + $params = array( + '{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false), + '{voucher_num}' => $voucher->code, + '{firstname}' => $this->context->customer->firstname, + '{lastname}' => $this->context->customer->lastname, + '{id_order}' => $order->reference, + '{order_name}' => $order->getUniqReference() + ); + Mail::Send( + (int)$order->id_lang, + 'voucher', + sprintf(Mail::l('New voucher for your order %s', (int)$order->id_lang), $order->reference), + $params, + $this->context->customer->email, + $this->context->customer->firstname.' '.$this->context->customer->lastname, + null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop + ); + } } } @@ -1050,10 +1052,12 @@ abstract class PaymentModuleCore extends Module // Set the order status $new_history = new OrderHistory(); $new_history->id_order = (int)$order->id; - $new_history->changeIdOrderState((int)$id_order_state, $order, true); - - $new_history->addWithemail(true, $extra_vars); + if ($send_mails) { + $new_history->addWithemail(true, $extra_vars); + } else { + $new_history->add(true); + } // Switch to back order if needed $objHotelBookingDetail = new HotelBookingDetail(); @@ -1089,7 +1093,11 @@ abstract class PaymentModuleCore extends Module $history = new OrderHistory(); $history->id_order = (int)$order->id; $history->changeIdOrderState($id_order_state, $order, true); - $history->addWithemail(); + if ($send_mails) { + $history->addWithemail(); + } else { + $history->add(); + } } unset($order_detail); @@ -1240,7 +1248,9 @@ abstract class PaymentModuleCore extends Module // Send order confirmation/overbooking mails to the reciepients according to the order mail configuration $overBookingStates = OrderState::getOverBookingStates(); $isOverBookingStatus = in_array($id_order_state, $overBookingStates); - if (Configuration::get('PS_ORDER_CONF_MAIL_TO_CUSTOMER')){ + if (Configuration::get('PS_ORDER_CONF_MAIL_TO_CUSTOMER') + && $send_mails + ){ // If order currenct state is overbooking, the send overbooking email or send order confirmation email if ($isOverBookingStatus) { $subject = Mail::l('Order Not Confirmed', (int)$order->id_lang); @@ -1292,7 +1302,9 @@ abstract class PaymentModuleCore extends Module } } } - if (Configuration::get('PS_ORDER_CONF_MAIL_TO_SUPERADMIN')){ + if (Configuration::get('PS_ORDER_CONF_MAIL_TO_SUPERADMIN') + && $send_mails + ){ // get superadmin employees if ($superAdminEmployees = Employee::getEmployeesByProfile(_PS_ADMIN_PROFILE_, true)) { // If order currenct state is overbooking, the send overbooking email or send order confirmation email @@ -1329,6 +1341,7 @@ abstract class PaymentModuleCore extends Module } if ($idHotel && Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel)) + && $send_mails ) { if (Configuration::get('PS_ORDER_CONF_MAIL_TO_HOTEL_MANAGER')){ // If order currenct state is overbooking, the send overbooking email or send order confirmation email From e2875cfac6358f40d32b6467e9814f0074e1aef9 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 18 Jun 2024 18:53:30 +0530 Subject: [PATCH 29/67] Fixed: check-in and check-out both must be visible with date and time in order detail page --- .../controllers/orders/helpers/view/view.tpl | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) 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 047541e76..ed5046dd3 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -97,11 +97,10 @@ - - + - - + + @@ -111,26 +110,24 @@ {foreach from=$htl_booking_order_data item=data} - '; html += ''; html += ''; From 8639f90189b09ee05050aef537e889fb114447d7 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 2 Jul 2024 16:41:18 +0530 Subject: [PATCH 37/67] Updated the store icon name to location icon to make it more relevant for QloApps --- controllers/admin/AdminThemesController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index 3a25fe8bb..971be0c5b 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -186,8 +186,8 @@ class AdminThemesControllerCore extends AdminController 'thumb' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_FAVICON').(Tools::getValue('conf') ? sprintf('?%04d', rand(0, 9999)) : '')) ), 'PS_STORES_ICON' => array( - 'title' => $this->l('Store icon'), - 'hint' => $this->l('Will appear on the store locator (inside Google Maps).').'
    '.$this->l('Suggested size: 30x30, transparent GIF.'), + 'title' => $this->l('Location icon'), + 'hint' => $this->l('Will appear at hotel locations on Google Maps.').'
    '.$this->l('Suggested size: 30x30, transparent GIF.'), 'type' => 'file', 'name' => 'PS_STORES_ICON', 'tab' => 'icons', From 151b68577726b8f477fab0fabad33b596be3b1c8 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 4 Jul 2024 12:13:08 +0530 Subject: [PATCH 38/67] Updated the banned customer filter process using banned customer KPI --- controllers/admin/AdminCustomersController.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 350e822d1..17671e5f8 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -222,15 +222,8 @@ class AdminCustomersControllerCore extends AdminController $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); } - $prefix = $this->getCookieFilterPrefix(); - if (Tools::getValue('filterOnlyBannedCustomer')) { - $this->processResetFilters(); - $this->context->cookie->{'submitFilter'.$this->table} = true; - $this->context->cookie->{$prefix.$this->table.'Filter_deleted'} = Customer::STATUS_BANNED; - $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); - } - parent::postProcess(); + $prefix = $this->getCookieFilterPrefix(); $filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_'); if (isset($filters[$prefix.$this->table.'Filter_deleted']) && $filters[$prefix.$this->table.'Filter_deleted'] == 1) { $this->deleted = false; @@ -767,7 +760,7 @@ class AdminCustomersControllerCore extends AdminController $helper->color = 'color2'; $helper->title = $this->l('Banned Customers', null, null, false); $helper->subtitle = $this->l('All Time', null, null, false); - $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&filterOnlyBannedCustomer=1'; + $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&customerFilter_deleted=1'; $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_banned_customers'; $helper->tooltip = $this->l('The total number of banned customers.', null, null, false); $kpis[] = $helper; From 8f524f0daa8bf466259a11c80a1a502e3c1e6be7 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 5 Jul 2024 12:09:20 +0530 Subject: [PATCH 39/67] Fixed admin was able to create the address for banned user --- .../template/controllers/addresses/helpers/form/form.tpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl index cb9d740f7..7cd7a9ad0 100644 --- a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl @@ -50,11 +50,15 @@ {/if} {else if $input.type == 'select' && $input.name == 'id_customer'} {$smarty.block.parent} + -
    -
    -  {l s='Guest Address'} - {if $can_edit} - {if $idGuestAddress} - - {l s='Edit'} - - {else} - - {l s='Add Address'} - - {/if} - {/if} -
    -
    - {if $guestFormatedAddress} - {$guestFormatedAddress} - {else} -
    -
    - - {l s='Guest address not found.'} -
    -
    - {/if} -
    -
    - {* Order Internal notes *} {if (sizeof($messages))}
    diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 8710cc160..e1d0df03b 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2892,15 +2892,7 @@ class AdminOrdersControllerCore extends AdminController // Overbookings information of the order $orderOverBookings = $objHotelBookingDetail->getOverbookedRooms($order->id, 0, '', '', 0, 0, 1); - // Guest address info - $guestFormatedAddress = ''; - if ($idGuestAddress = Customer::getCustomerIdAddress($order->id_customer)) { - $guestFormatedAddress = AddressFormat::generateAddress(new Address($idGuestAddress), array(), "
    "); - } - $this->tpl_view_vars = array( - 'guestFormatedAddress' => $guestFormatedAddress, - 'idGuestAddress' => $idGuestAddress, 'totalRefundedRooms' => $totalRefundedRooms, 'orderOverBookings' => $orderOverBookings, // refund info diff --git a/js/admin/orders.js b/js/admin/orders.js index d85d8c93b..ac60ba167 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1248,22 +1248,7 @@ function setRoomTypeGuestOccupancy(booking_occupancy_wrapper) /* Refund system script */ var flagRefund = ''; -// when submit from ajax from guest address controller the function will be called from the controller header -function getSummary() -{ - return; -} $(document).ready(function() { - // when click edit/add guest address we have to initialize fancybox - $('.fancybox').fancybox({ - 'type': 'iframe', - 'width': '90%', - 'height': '90%', - afterClose: function() { - location.reload(); - }, - }); - // when change order state to cancel or refund then show modal of bookings cancellation $(document).on('change', '#id_order_state', function(e) { if ($(this).val() == PS_OS_CANCELED || $(this).val() == PS_OS_REFUND) { From 778e097cfff18491e3225c34faf80740b46db846 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 9 Jul 2024 18:23:33 +0530 Subject: [PATCH 43/67] Optimized code for invalid id in url for the admin --- controllers/admin/AdminNormalProductsController.php | 11 ++++------- controllers/admin/AdminProductsController.php | 7 +------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index 0521be007..9db549acb 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -396,12 +396,6 @@ class AdminNormalProductsControllerCore extends AdminController $bo_theme = 'default'; } - Media::addJsDef( - array( - 'tb_pathToImage' => '../img/loadingAnimation.gif' - ) - ); - $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js'); @@ -1399,7 +1393,10 @@ class AdminNormalProductsControllerCore extends AdminController parent::postProcess(); } - if ($this->display == 'edit' || $this->display == 'add') { + if (in_array($this->display, array('add', 'edit')) + && $this->tabAccess[$this->display] == '1' + && $this->loadObject(true) + ) { $this->addJqueryUI(array( 'ui.core', 'ui.widget' diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 63ed01393..3587c6bf3 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -469,12 +469,6 @@ class AdminProductsControllerCore extends AdminController $bo_theme = 'default'; } - Media::addJsDef( - array( - 'tb_pathToImage' => '../img/loadingAnimation.gif' - ) - ); - $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js'); @@ -1463,6 +1457,7 @@ class AdminProductsControllerCore extends AdminController if (in_array($this->display, array('add', 'edit')) && $this->tabAccess[$this->display] == '1' + && $this->loadObject(true) ) { $this->addJqueryUI(array( 'ui.core', From afdb1b588e3f04bbd085fdaccf61c17144e995f6 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 10 Jul 2024 10:14:02 +0530 Subject: [PATCH 44/67] Added requried comment in the admin customers controller to the code used to display the deleted customers --- controllers/admin/AdminCustomersController.php | 1 + controllers/admin/AdminStatsController.php | 1 - modules/dashactivity/views/js/dashactivity.js | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index bef4cd9c9..ffbd77fe6 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -223,6 +223,7 @@ class AdminCustomersControllerCore extends AdminController } parent::postProcess(); + // Added this to check if the filter for the banned(deleted) is used, since $this->delete = true will not display the deleted customers. $prefix = $this->getCookieFilterPrefix(); $filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_'); if (isset($filters[$prefix.$this->table.'Filter_deleted']) && $filters[$prefix.$this->table.'Filter_deleted'] == 1) { diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index d7d233e26..782f989f8 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -965,7 +965,6 @@ class AdminStatsControllerCore extends AdminStatsTabController case 'average_lead_time': $dateToday = date('Y-m-d'); $value = Tools::ps_round(AdminStatsController::getAverageLeadTime(), 2); - break; case 'average_guest_in_booking': $dateToday = date('Y-m-d'); diff --git a/modules/dashactivity/views/js/dashactivity.js b/modules/dashactivity/views/js/dashactivity.js index 1bdf4e422..a84820e02 100644 --- a/modules/dashactivity/views/js/dashactivity.js +++ b/modules/dashactivity/views/js/dashactivity.js @@ -58,6 +58,7 @@ $(document).ready(function() { $('#date-start').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); end = Date.parseDate($('#date-end').val(), 'Y-m-d'); + $('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); $('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); }); From 38568afb0bb188b1a5a74e22d958adfc417ca9f7 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 10 Jul 2024 10:27:05 +0530 Subject: [PATCH 45/67] Added validateOrderAmount variable in the payment module class --- classes/BoOrder.php | 2 +- classes/PaymentModule.php | 3 ++- classes/webservice/WebserviceOrder.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/classes/BoOrder.php b/classes/BoOrder.php index edb935abc..b6046c5c8 100644 --- a/classes/BoOrder.php +++ b/classes/BoOrder.php @@ -26,6 +26,6 @@ class BoOrder extends PaymentModule public function __construct() { $this->displayName = $this->l('Back office order'); - $this->ValidateOrderAmount = false; + $this->validateOrderAmount = false; } } \ No newline at end of file diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 312b226ed..cea68af08 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -33,6 +33,7 @@ abstract class PaymentModuleCore extends Module public $currencies = true; public $currencies_mode = 'checkbox'; public $payment_type = OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT; + public $validateOrderAmount = true; public function install() { @@ -418,7 +419,7 @@ abstract class PaymentModuleCore extends Module // If webservice order request then no need to impose equal amounts(total cart and sent amount) condition if ($order_status->logable && number_format($cart_total_paid, _PS_PRICE_COMPUTE_PRECISION_) != number_format($amount_paid, _PS_PRICE_COMPUTE_PRECISION_) - && (!isset($this->ValidateOrderAmount) || $this->validateOrderAmount) + && ($this->validateOrderAmount) ) { // if customer is paying full payment amount $id_order_state = Configuration::get('PS_OS_ERROR'); diff --git a/classes/webservice/WebserviceOrder.php b/classes/webservice/WebserviceOrder.php index 53f9edbee..860fcc0c0 100644 --- a/classes/webservice/WebserviceOrder.php +++ b/classes/webservice/WebserviceOrder.php @@ -26,6 +26,6 @@ class WebserviceOrderCore extends PaymentModule public function __construct() { $this->displayName = $this->l('Order from API'); - $this->ValidateOrderAmount = false; + $this->validateOrderAmount = false; } } From 69056e4ed85f3e93c8ef06c2a966fed575ad40ef Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 10 Jul 2024 12:07:41 +0530 Subject: [PATCH 46/67] optimized the function getCustomers() to get the customers list for address creation --- classes/Customer.php | 40 +++++++++---------- .../admin/AdminAddressesController.php | 11 ++--- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/classes/Customer.php b/classes/Customer.php index 4a55fa55d..645c80ae6 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -296,16 +296,28 @@ class CustomerCore extends ObjectModel /** * Return customers list * - * @param null|bool $only_active Returns only active customers when true + * @param null|bool $only_active Returns customers by active status + * @param null|bool $havingAddress Returns customers having | not having address + * @param null|bool $deleted Returns customers by deleted status * @return array Customers */ - public static function getCustomers($only_active = null) + public static function getCustomers($only_active = null, $havingAddress = null, $deleted = null) { - $sql = 'SELECT `id_customer`, `email`, `firstname`, `lastname` - FROM `'._DB_PREFIX_.'customer` - WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER). - ($only_active ? ' AND `active` = 1' : '').' - ORDER BY `id_customer` ASC'; + $sqlSelect = 'SELECT c.`id_customer`, c.`email`, c.`firstname`, c.`lastname` '; + $sqlFrom = ' FROM `'._DB_PREFIX_.'customer` c'; + $sqlWhere = 'WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER). + (!is_null($only_active) ? ' AND c.`active` = '.(int) $only_active: ' ' ). + (!is_null($deleted) ? ' AND c.`deleted` = '.(int) $deleted : ' '); + $sqlOrderBY = 'ORDER BY c.`id_customer` ASC'; + + if (!is_null($havingAddress)) { + $sqlFrom .= ' LEFT JOIN `'._DB_PREFIX_.'address` a + ON a.`id_customer` = c.`id_customer` AND a.`deleted`=0'; + $sqlWhere .= (($havingAddress) ? ' AND a.`id_address` !='.(int) 0: ' AND ISNULL(a.`id_address`)'); + } + + $sql = $sqlSelect .' '. $sqlFrom.' '. $sqlWhere.' '.$sqlOrderBY; + return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); } @@ -952,18 +964,4 @@ class CustomerCore extends ObjectModel return parent::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit); } - public static function getAllCustomers($withAddress = null, $active = null, $deleted = null) - { - return Db::getInstance()->executeS( - 'SELECT c.`firstname`, c.`lastname`, c.`id_customer`, c.`email`, a.`id_address` - FROM `'._DB_PREFIX_.'customer` c - LEFT JOIN `'._DB_PREFIX_.'address` a - ON a.`id_customer` = c.`id_customer` AND a.`deleted`=0 - WHERE 1 '. - (!is_null($deleted) ? ' AND c.`deleted` = '.(int) $deleted : ' '). - (!is_null($active) ? ' AND c.`active` = '.(int) $active: ' ' ). - (!is_null($withAddress) ? (($withAddress) ? ' AND a.`id_address` !='.(int) 0: ' AND ISNULL(a.`id_address`)'): ' ' ) - ); - } - } diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index a963d6709..8c4033a88 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -112,7 +112,7 @@ class AdminAddressesControllerCore extends AdminController public function renderForm() { - $customerSelectField =array( + $customerField =array( 'type' => 'text_customer', 'label' => $this->l('Customer'), 'name' => 'id_customer', @@ -120,14 +120,15 @@ class AdminAddressesControllerCore extends AdminController ); if ($this->loadObject(true) && !$this->object->id + && !Tools::getValue('liteDisplaying') ) { $customerEmails = array(array( 'email' => $this->l('Select Customer'), 'id_customer' => 0, 'id_address'=> 0 )); - $customerEmails = array_merge($customerEmails, Customer::getAllCustomers(false, null, 0)); - $customerSelectField = array( + $customerEmails = array_merge($customerEmails, Customer::getCustomers(null, false, 0)); + $customerField = array( 'type' => 'select', 'label' => $this->l('Customer'), 'name' => 'id_customer', @@ -146,7 +147,7 @@ class AdminAddressesControllerCore extends AdminController 'icon' => 'icon-envelope-alt' ), 'input' => array( - $customerSelectField, + $customerField, array( 'type' => 'text', 'label' => $this->l('Identification Number'), @@ -214,7 +215,7 @@ class AdminAddressesControllerCore extends AdminController } $this->tpl_form_vars = array( - 'customer' => (isset($customer) && $this->object->id) ? $customer : null, + 'customer' => (isset($customer) && ($this->object->id || Tools::getValue('liteDisplaying'))) ? $customer : null, 'tokenCustomer' => isset($token_customer) ? $token_customer : null ); From 5e4cae78e06cf6740fb6cdeaadb01b56df869e01 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 10 Jul 2024 12:37:51 +0530 Subject: [PATCH 47/67] Revert the changes made to the ajaxprocess in the admin address controller --- .../addresses/helpers/form/form.tpl | 16 ++++++++------ .../admin/AdminAddressesController.php | 22 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl index 7cd7a9ad0..fbcda13d1 100644 --- a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl @@ -60,22 +60,24 @@ var email = $(this).find('[value="'+id_customer+'"]').text(); $('#email').val(email); var data = {}; - data.id_customer = id_customer; + data.email = email; data.token = "{$token|escape:'html':'UTF-8'}"; data.ajax = 1; data.controller = "AdminAddresses"; - data.action = "loadCustomer"; + data.action = "loadNames"; $.ajax({ type: "POST", url: "ajax-tab.php", data: data, dataType: 'json', async : true, - success: function(response) { - if (response.status) { - $('input[name=firstname]').val(response.firstname); - $('input[name=lastname]').val(response.lastname); - $('input[name=company]').val(response.company); + success: function(msg) { + if (msg) { + var infos = msg.infos.replace("\\'", "'").split('_'); + $('input[name=firstname]').val(infos[0]); + $('input[name=lastname]').val(infos[1]); + $('input[name=company]').val(infos[2]); + $('input[name=id_customer]').val(infos[3]); } else { resetCustomerRelatedAddressFields(); } diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 8c4033a88..daf71152d 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -527,22 +527,20 @@ class AdminAddressesControllerCore extends AdminController } /** - * Method called when an ajax request is made to load the customer info for the selected email + * Method called when an ajax request is made * @see AdminController::postProcess() */ - public function ajaxProcessLoadCustomer() + public function ajaxProcess() { - $response = array('status' => false); - if (Tools::getValue('id_customer') - && Validate::isLoadedObject($objCustomer = new Customer(Tools::getValue('id_customer'))) - ) { - $response['status'] = true; - $response['firstname'] = $objCustomer->firstname; - $response['lastname'] = $objCustomer->lastname; - $response['company'] = $objCustomer->company; + if (Tools::isSubmit('email')) { + $email = pSQL(Tools::getValue('email')); + $customer = Customer::searchByName($email); + if (!empty($customer)) { + $customer = $customer['0']; + echo json_encode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company']).'_'.pSQL($customer['id_customer']))); + } } - - $this->ajaxDie(json_encode($response)); + die; } /** From 2c84f098217d98ff7c778450607d35c8c7869afb Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 10 Jul 2024 15:29:40 +0530 Subject: [PATCH 48/67] Optimized function getCustomers() for easy understanding --- .../addresses/helpers/form/form.tpl | 17 ++++------- classes/Customer.php | 30 +++++++++++-------- .../admin/AdminAddressesController.php | 3 +- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl index fbcda13d1..9fd0f69e6 100644 --- a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl @@ -29,22 +29,15 @@ {if $input.name == 'vat_number'}
    {/if} - - {if $input.type == 'text_customer' && !isset($customer)} - - {else} - {$smarty.block.parent} - {/if} + {$smarty.block.parent} {/block} -{block name="field"} +{block name="input"} {if $input.type == 'text_customer'} {if isset($customer)} - + + {$customer->lastname} {$customer->firstname} ({$customer->email}) + {/if} diff --git a/classes/Customer.php b/classes/Customer.php index 645c80ae6..a1ef3279e 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -294,33 +294,37 @@ class CustomerCore extends ObjectModel } /** - * Return customers list + * Returns a list of customers. * - * @param null|bool $only_active Returns customers by active status - * @param null|bool $havingAddress Returns customers having | not having address - * @param null|bool $deleted Returns customers by deleted status - * @return array Customers + * @param null|bool $active Optional. Filter customers by their active status. If null, no filter is applied. + * @param null|bool $deleted Optional. Filter customers by their deleted status. If null, no filter is applied. + * @param null|bool $havingAddress Optional. Filter customers having|not having address. If true, only customers having an address are returned. + * If false, only customers without an address are returned. If null, no filter is applied. + * @return array List of customers matching the specified criteria. */ - public static function getCustomers($only_active = null, $havingAddress = null, $deleted = null) + public static function getCustomers($active = null, $deleted = null, $havingAddress = null) { - $sqlSelect = 'SELECT c.`id_customer`, c.`email`, c.`firstname`, c.`lastname` '; - $sqlFrom = ' FROM `'._DB_PREFIX_.'customer` c'; + $sqlSelect = 'SELECT c.`id_customer`, c.`email`, c.`firstname`, c.`lastname`'; + $sqlFrom = 'FROM `'._DB_PREFIX_.'customer` c'; + $sqlJoin = ''; $sqlWhere = 'WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER). - (!is_null($only_active) ? ' AND c.`active` = '.(int) $only_active: ' ' ). + (!is_null($active) ? ' AND c.`active` = '.(int) $active: ' ' ). (!is_null($deleted) ? ' AND c.`deleted` = '.(int) $deleted : ' '); - $sqlOrderBY = 'ORDER BY c.`id_customer` ASC'; + $sqlOrderBy = 'ORDER BY c.`id_customer` ASC'; + $sqlGroupBy = 'GROUP BY c.`id_customer`'; if (!is_null($havingAddress)) { - $sqlFrom .= ' LEFT JOIN `'._DB_PREFIX_.'address` a + $sqlJoin .= ' LEFT JOIN `'._DB_PREFIX_.'address` a ON a.`id_customer` = c.`id_customer` AND a.`deleted`=0'; - $sqlWhere .= (($havingAddress) ? ' AND a.`id_address` !='.(int) 0: ' AND ISNULL(a.`id_address`)'); + $sqlWhere .= (($havingAddress) ? ' AND a.`id_address` IS NOT NULL': ' AND a.`id_address` IS NULL'); } - $sql = $sqlSelect .' '. $sqlFrom.' '. $sqlWhere.' '.$sqlOrderBY; + $sql = $sqlSelect .' '. $sqlFrom.' '.$sqlJoin.' '.$sqlWhere.' '.$sqlGroupBy.' '.$sqlOrderBy; return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); } + /** * Return customer instance from its e-mail (optionnaly check password) * diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index daf71152d..5f6bb472d 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -127,11 +127,12 @@ class AdminAddressesControllerCore extends AdminController 'id_customer' => 0, 'id_address'=> 0 )); - $customerEmails = array_merge($customerEmails, Customer::getCustomers(null, false, 0)); + $customerEmails = array_merge($customerEmails, Customer::getCustomers(null, 0, 0)); $customerField = array( 'type' => 'select', 'label' => $this->l('Customer'), 'name' => 'id_customer', + 'required' => true, 'class' => 'chosen', 'options' => array( 'query' => $customerEmails, From bdb0f298bc64ca55596d45cb9051cab90782d235 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 10 Jul 2024 17:48:18 +0530 Subject: [PATCH 49/67] optmized code for cms page option while adding/editing navigation link --- ...nCustomNavigationLinkSettingController.php | 19 +++---- .../views/js/admin/wk_navigation_link.js | 57 +++++++------------ .../helpers/form/form.tpl | 52 +++++++++-------- 3 files changed, 56 insertions(+), 72 deletions(-) diff --git a/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php b/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php index f1c7ba3d0..1942aae85 100644 --- a/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php +++ b/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php @@ -186,7 +186,8 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController if (empty($this->errors) && !$objCMS->active ) { - $this->warnings[] = $this->l('The selected CMS page is currently disabled. Please enable it first in order to activate this navigation link.'); + $cmsEditLink = $this->context->link->getAdminLink('AdminCmsContent').'&updatecms&id_cms='.(int) $objCMS->id; + $this->warnings[] = $this->l('Please enable linked').' '.$this->l('CMS page').' '.$this->l('to enable this navigation link.'); } } } @@ -223,13 +224,7 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController } } - Media::addJsDef( - array( - 'categoryWiseCmsPages' => json_encode($categoryWiseCmsPages) - ) - ); - - $smartyVars['cmsPages'] = $cmsPages; + $smartyVars['categoryWiseCmsPages'] = $categoryWiseCmsPages; $smartyVars['categories'] = $cmsCategories; $this->context->smarty->assign($smartyVars); $this->fields_form = array( @@ -403,7 +398,7 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController if (isset($pos[2]) && (int) $pos[2] === $idNavigationLink) { if ($objFeatureBlock = new WkCustomNavigationLink((int) $pos[2])) { if (isset($position) - && $objFeatureBlock->updatePosition($way, $position, $idNavigationLink) + && $objFeatureBlock->updatePosition($way, $position) ) { echo 'ok position '.(int) $position.' for custom navigation link '.(int) $pos[1].'\r\n'; } else { @@ -422,13 +417,13 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController public function processStatus() { if (Validate::isLoadedObject($this->loadObject()) - && !$this->object->is_custom_link //Check for CMS related navigation link + && $this->object->id_cms + && Validate::isLoadedObject($objCMS = new CMS($this->object->id_cms)) ) { - $objCMS = new CMS($this->object->id_cms); if (!$objCMS->active && !$this->object->active ) { - $this->errors[] = $this->l('Please activate the relate CMS page to activate this link'); + $this->errors[] = $this->l('Please activate the linked CMS page to enable this navigation link.'); } } diff --git a/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js b/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js index e6da30dfc..0cbb83a86 100644 --- a/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js +++ b/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js @@ -18,17 +18,29 @@ */ $(document).ready(function() { - setCategoryWiseCmsPages(); + displayCategoryWiseCmsPages(); $("input[name='is_cms_block_link").on('change', function () { - toggleElements(this, "#cms_block_content", "#non_cms_block_content"); + if (parseInt($(this).val())) { + $("#cms_block_content").removeClass('hidden'); + $("#non_cms_block_content").addClass('hidden'); + } else { + $("#cms_block_content").addClass('hidden'); + $("#non_cms_block_content").removeClass('hidden'); + } }); $("input[name='is_custom_redirect_link").on('change', function () { - toggleElements(this, ".custom_redirect_link_div", ".custom_redirect_page_div"); + if (parseInt($(this).val())) { + $(".custom_redirect_link_div").removeClass('hidden'); + $(".custom_redirect_page_div").addClass('hidden'); + } else { + $(".custom_redirect_link_div").addClass('hidden'); + $(".custom_redirect_page_div").removeClass('hidden'); + } }); $(document).on('change', '#id_cms_category', function(){ - setCategoryWiseCmsPages(); + displayCategoryWiseCmsPages(); }); }); @@ -40,37 +52,12 @@ function showNavigationLinkLangField(lang_iso_code, id_lang) $('#navigation_link_name_'+id_lang).show(); } -function toggleElements(element, selectorFirst, selectorSecond) +function displayCategoryWiseCmsPages() { - if (parseInt($(element).val())) { - $(selectorFirst).removeClass('hidden'); - $(selectorSecond).addClass('hidden'); - } else { - $(selectorFirst).addClass('hidden'); - $(selectorSecond).removeClass('hidden'); - } -} - -function setCategoryWiseCmsPages() -{ - var selectedPage = parseInt($('input[name="id_cms"]:checked').val()); var selectedCategory = parseInt($('#id_cms_category').val()); - var cmsPages = JSON.parse(categoryWiseCmsPages); - if (!isNaN(selectedCategory)) { - cmsPages = cmsPages[selectedCategory]; - var html = ''; - $.each(cmsPages, function(i, v) { - html += '
    '; - html += ''; - html += ''; - html += '' - html += ''; - }); - $('table.cms_pages tbody').html(html); - } + $(document).find('.cms_pages').each(function(){ + $(this).hide(); + }); - if (!isNaN(selectedPage)) { - $('input[name="id_cms"][value="'+selectedPage+'"]').attr('checked', 'checked'); - } - -} \ No newline at end of file + $('#cms_pages_'+selectedCategory).show(); +} diff --git a/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl b/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl index eedc9d62a..68fdea195 100644 --- a/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl +++ b/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl @@ -71,7 +71,7 @@ {*Display CMS Pages*} - {if isset($cmsPages)} + {if isset($categoryWiseCmsPages)}
    -
    -
    {l s='Room No.'}{l s='Room Type'}{l s='Room'} {l s='Duration'}{l s='Documents'}{l s='Room Status'}{l s='Check-In'}{l s='Check-Out'} {l s='Allotment'} {l s='Action'}
    - {$data['room_num']} - + {$data['room_num']}
    {$data['room_type_name']|escape:'html':'UTF-8'}
    {dateFormat date=$data['date_from']} - {dateFormat date=$data['date_to']} - - {if $data.num_checkin_documents > 0}{$data.num_checkin_documents}{else}{l s='Upload'}{/if} {l s='Documents'} - + {if ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']) || ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status'])} + {l s='Checked in on'}
    {dateFormat date=$data['check_in'] full=1}
    + {else} + -- + {/if}
    - {if $data['id_status'] == $hotel_order_status['STATUS_ALLOTED']['id_status']} - {l s='Alloted'} - {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']} - {l s='Checked in on'} {dateFormat date=$data['check_in'] full=1} - {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} - {l s='Checked out on'} {dateFormat date=$data['check_out'] full=1} + {if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} + {l s='Checked out on'}
    {dateFormat date=$data['check_out'] full=1}
    + {else} + -- {/if}
    @@ -141,6 +138,10 @@ {/if} + + {if $data.num_checkin_documents > 0}{$data.num_checkin_documents} {else}{/if} + + {if $data.is_refunded || $data.is_cancelled} {if $data.is_cancelled}{l s='Cancelled'}{else}{l s='Refunded'}{/if} {else} From e6b3dfaeeb55372cd1ac50748baf5e1e774d7c9a Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 18 Jun 2024 19:17:50 +0530 Subject: [PATCH 30/67] Updated: The Address creation process for the customer from the admin office --- .../addresses/helpers/form/form.tpl | 53 ++++++++-------- classes/Customer.php | 15 +++++ .../admin/AdminAddressesController.php | 60 +++++++++++++------ 3 files changed, 82 insertions(+), 46 deletions(-) diff --git a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl index e46200e15..cb9d740f7 100644 --- a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl @@ -47,50 +47,47 @@ - {else} - - -
    - - -
    - {/if} + function resetCustomerRelatedAddressFields() { + $('input[name=firstname]').val(''); + $('input[name=lastname]').val(''); + $('input[name=company]').val(''); + $('input[name=id_customer]').val(''); + } + {else} {$smarty.block.parent} {/if} diff --git a/classes/Customer.php b/classes/Customer.php index a8c4c3609..4a55fa55d 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -951,4 +951,19 @@ class CustomerCore extends ObjectModel $sql_filter .= Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'main'); return parent::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit); } + + public static function getAllCustomers($withAddress = null, $active = null, $deleted = null) + { + return Db::getInstance()->executeS( + 'SELECT c.`firstname`, c.`lastname`, c.`id_customer`, c.`email`, a.`id_address` + FROM `'._DB_PREFIX_.'customer` c + LEFT JOIN `'._DB_PREFIX_.'address` a + ON a.`id_customer` = c.`id_customer` AND a.`deleted`=0 + WHERE 1 '. + (!is_null($deleted) ? ' AND c.`deleted` = '.(int) $deleted : ' '). + (!is_null($active) ? ' AND c.`active` = '.(int) $active: ' ' ). + (!is_null($withAddress) ? (($withAddress) ? ' AND a.`id_address` !='.(int) 0: ' AND ISNULL(a.`id_address`)'): ' ' ) + ); + } + } diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 6e052f39b..a963d6709 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -112,18 +112,41 @@ class AdminAddressesControllerCore extends AdminController public function renderForm() { + $customerSelectField =array( + 'type' => 'text_customer', + 'label' => $this->l('Customer'), + 'name' => 'id_customer', + 'required' => false, + ); + if ($this->loadObject(true) + && !$this->object->id + ) { + $customerEmails = array(array( + 'email' => $this->l('Select Customer'), + 'id_customer' => 0, + 'id_address'=> 0 + )); + $customerEmails = array_merge($customerEmails, Customer::getAllCustomers(false, null, 0)); + $customerSelectField = array( + 'type' => 'select', + 'label' => $this->l('Customer'), + 'name' => 'id_customer', + 'class' => 'chosen', + 'options' => array( + 'query' => $customerEmails, + 'id' => 'id_customer', + 'name' => 'email' + ), + ); + } + $this->fields_form = array( 'legend' => array( 'title' => $this->l('Addresses'), 'icon' => 'icon-envelope-alt' ), 'input' => array( - array( - 'type' => 'text_customer', - 'label' => $this->l('Customer'), - 'name' => 'id_customer', - 'required' => false, - ), + $customerSelectField, array( 'type' => 'text', 'label' => $this->l('Identification Number'), @@ -190,7 +213,6 @@ class AdminAddressesControllerCore extends AdminController $token_customer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id); } - $this->fields_value['email'] = Tools::getValue('email'); $this->tpl_form_vars = array( 'customer' => (isset($customer) && $this->object->id) ? $customer : null, 'tokenCustomer' => isset($token_customer) ? $token_customer : null @@ -503,21 +525,23 @@ class AdminAddressesControllerCore extends AdminController return $out; } - /** - * Method called when an ajax request is made + /** + * Method called when an ajax request is made to load the customer info for the selected email * @see AdminController::postProcess() */ - public function ajaxProcess() + public function ajaxProcessLoadCustomer() { - if (Tools::isSubmit('email')) { - $email = pSQL(Tools::getValue('email')); - $customer = Customer::searchByName($email); - if (!empty($customer)) { - $customer = $customer['0']; - echo json_encode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company']).'_'.pSQL($customer['id_customer']))); - } + $response = array('status' => false); + if (Tools::getValue('id_customer') + && Validate::isLoadedObject($objCustomer = new Customer(Tools::getValue('id_customer'))) + ) { + $response['status'] = true; + $response['firstname'] = $objCustomer->firstname; + $response['lastname'] = $objCustomer->lastname; + $response['company'] = $objCustomer->company; } - die; + + $this->ajaxDie(json_encode($response)); } /** From 38c8b6d8bf36adfe1545a085aecb54c798c25d5c Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 18 Jun 2024 20:13:30 +0530 Subject: [PATCH 31/67] Updated: ROOMS STATUS section display for documents and allotment message --- .../template/controllers/orders/helpers/view/view.tpl | 2 +- .../controllers/orders/modals/_room_allotment_comment.tpl | 2 +- controllers/admin/AdminOrdersController.php | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) 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 ed5046dd3..7b9b78b28 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -139,7 +139,7 @@
    - {if $data.num_checkin_documents > 0}{$data.num_checkin_documents} {else}{/if} + {if $data.num_checkin_documents > 0}{$data.num_checkin_documents}{else}0{/if} {if $data.is_refunded || $data.is_cancelled} diff --git a/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl b/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl index 859ee5cb0..6fbec41ee 100644 --- a/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl @@ -18,7 +18,7 @@ *}
    '+v['id_cms']+'
    '+v['id_cms']+'
    - - - - - - - - - {foreach $cmsPages as $cmsPage} + {foreach $categoryWiseCmsPages as $idCMSCategory => $cmsPages} +
    +
    - {l s='ID' mod='blocknavigationmenu'} - - {l s='CMS Page Name' mod='blocknavigationmenu'} - -
    + - - - + + + - {/foreach} - -
    - {$cmsPage.id_cms|escape:'htmlall':'UTF-8'} + {l s='ID' mod='blocknavigationmenu'} + + {l s='CMS Page Name' mod='blocknavigationmenu'} + +
    -
+ +
+ {$cmsPage.id_cms|escape:'htmlall':'UTF-8'}
+
+ {/foreach}
{/if}
From 2cac5680d8622a85775269c12389c67cf0f0e374 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Sat, 13 Jul 2024 10:24:21 +0530 Subject: [PATCH 50/67] Updated the defination lable of the store icon to map icon --- controllers/admin/AdminThemesController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index 971be0c5b..09470ad22 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -186,8 +186,8 @@ class AdminThemesControllerCore extends AdminController 'thumb' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_FAVICON').(Tools::getValue('conf') ? sprintf('?%04d', rand(0, 9999)) : '')) ), 'PS_STORES_ICON' => array( - 'title' => $this->l('Location icon'), - 'hint' => $this->l('Will appear at hotel locations on Google Maps.').'
'.$this->l('Suggested size: 30x30, transparent GIF.'), + 'title' => $this->l('Map icon'), + 'hint' => $this->l('This icon will be displayed at hotel locations on Google Maps.').'
'.$this->l('Suggested size: 30x30, transparent GIF.'), 'type' => 'file', 'name' => 'PS_STORES_ICON', 'tab' => 'icons', From 03fcae193229c49402741aca44477609b3fdd7cb Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 13 Jul 2024 10:26:17 +0530 Subject: [PATCH 51/67] Fixed: Unused code removed came from merging the conflicts with develop branch --- controllers/admin/AdminOrdersController.php | 1 + js/admin/orders.js | 210 -------------------- 2 files changed, 1 insertion(+), 210 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index e1d0df03b..73f3b62de 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -4860,6 +4860,7 @@ class AdminOrdersControllerCore extends AdminController 'tax_excl' => $totalRoomPriceAfterTE, 'tax_incl' => $totalRoomPriceAfterTI, ); + if ($update_htl_tables = $obj_booking_detail->UpdateHotelCartHotelOrderOnOrderEdit( $id_order, $id_room, diff --git a/js/admin/orders.js b/js/admin/orders.js index ac60ba167..850efcacc 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1757,38 +1757,6 @@ $(document).ready(function() { // End: RoomAllotmentCommentModal: Processes // ====================================== - // Start: RoomReallocationModal: Processes - // For processing room reallocation and swapping - $(document).on('click', '.room_reallocate_swap', function(e) { - e.preventDefault(); - RoomReallocationModal.show($(this)); - }); - - $(document).on('hidden.bs.modal', '#room-reallocation-modal', function(){ - location.reload(); - }); - - /*For reallocating rooms in the modal*/ - $(document).on('click', '#realloc_allocated_rooms', function(e){ - if (RoomReallocationModal.reallocate() == false) { - return false; - } - }); - /*For swaping rooms in the modal*/ - $(document).on('click', '#swap_allocated_rooms', function(){ - if (RoomReallocationModal.swap() == false) { - return false; - } - }); - - // change room type for reallocation - $(document).on("change", "#realloc_avail_room_type", function(e) { - e.preventDefault(); - RoomReallocationModal.changeRoomType($(this)); - }); - // End: RoomReallocationModal: Processes - // ====================================== - // Start: AddRoomBookingModal: Processes /*For adding rooms to the order*/ $(document).on('click', '#add_room', function(e){ @@ -2345,184 +2313,6 @@ const RoomStatusModal = { } }; -// Modal object to handle room reallocation processes -const RoomReallocationModal = { - show: function(roomObj) { - $(".loading_overlay").show(); - $.ajax({ - type: 'POST', - headers: { - "cache-control": "no-cache" - }, - url: admin_order_tab_link, - dataType: 'JSON', - cache: false, - data: 'ajax=true&id_order='+id_order+'&action=InitRoomReallocationModal', - success: function(result) { - if (result.hasError == 0 && result.modalHtml) { - $('#footer').next('.bootstrap').append(result.modalHtml); - $(".modal_id_htl_booking").val(roomObj.data('id_htl_booking')); - $("input.modal_curr_room_num").val(roomObj.data('room_num')); - $("span.modal_curr_room_num").text(roomObj.data('room_num') + ', ' + roomObj.data('room_type_name')); - $(".cust_name").text(roomObj.data('cust_name')); - $(".cust_email").text(roomObj.data('cust_email')); - $(".modal_curr_allotent_type").text(roomObj.data('allotment_type_label')); - - // reset price difference fields - $("#reallocation_price_diff").val(0); - $("#reallocation_price_diff_block").hide(); - $(".realloc_roomtype_change_message").hide(); - - if (roomObj.data('allotment_type') == ALLOTMENT_MANUAL) { - $(".allotment_comment_block .modal_curr_allotment_comment").text(roomObj.data('comment')); - $(".allotment_comment_block").show(); - } else { - $(".allotment_comment_block").hide(); - } - - // For Rooms Swapping - var json_arr_rm_swp = roomObj.data('avail_rm_swap'); - if (roomObj.data('avail_rm_swap') != 'false' && json_arr_rm_swp.length != 0) { - html = ''; - $(".swap_avail_rooms_container").empty().append(html); - } else { - $(".swap_avail_rooms_container").empty().text(no_swap_rm_avail_txt).addClass('text-danger'); - $("#swap_room_tab .modal-footer").hide(); - } - - // For Rooms Reallocation - var json_arr_realloc_room_types = roomObj.data('avail_realloc_room_types'); - if (roomObj.data('avail_realloc_room_types') != 'false' && json_arr_realloc_room_types.length != 0) { - var idCurrentRoomType = roomObj.data('id_room_type'); - var roomsTypesHtml = ''; - - setRoomsForReallocation(json_arr_realloc_room_types[idCurrentRoomType]['rooms']); - - $(".realloc_avail_room_type_container").empty().append(roomsTypesHtml); - } else { - $(".realloc_avail_rooms_container").empty().text(no_realloc_rm_avail_txt).addClass('text-danger'); - $(".realloc_avail_room_type_container").empty().text(no_realloc_rm_type_avail_txt).addClass('text-danger'); - $("#reallocate_room_tab .modal-footer").hide(); - } - - $('#room-reallocation-modal').modal('show'); - } else { - showErrorMessage(txtSomeErr); - } - }, - complete: function() { - $(".loading_overlay").hide(); - } - }); - }, - swap: function() { - $(".error_text").text(''); - var room_to_swap = $('#swap_avail_rooms').val(); - if (typeof room_to_swap == 'undefined' || room_to_swap == 0) { - $("#swap_sel_rm_err_p").text(slct_rm_err); - return false; - } - - return true; - }, - reallocate: function(reallocateBtnObj) { - $(".error_text").text(''); - var room_to_reallocate = $('#realloc_avail_rooms').val(); - var room_type_to_reallocate = $('#realloc_avail_room_type').val(); - - if (typeof room_type_to_reallocate == 'undefined' || room_type_to_reallocate == 0) { - $("#realloc_sel_rm_type_err_p").text(slct_rm_type_err); - return false; - } - - if (typeof room_to_reallocate == 'undefined' || room_to_reallocate == 0) { - $("#realloc_sel_rm_err_p").text(slct_rm_err); - return false; - } - - return true; - }, - changeRoomType: function(roomTypeObj) { - $(".loading_overlay").show(); - var idHotelBooking = roomTypeObj.data('id_htl_booking'); - $("#reallocation_price_diff").val(0); - $("#reallocation_price_diff_block").hide(); - if (parseInt(idHotelBooking) > 0) { - var optionSelected = roomTypeObj.find('option:selected'); - var roomsAvailable = JSON.parse(optionSelected.attr('rooms_available')); - - // set the rooms of the selceted room type - setRoomsForReallocation(roomsAvailable); - - // send an ajax for fetching if price has changes in the new room type seleceted - $.ajax({ - type: 'POST', - headers: { - "cache-control": "no-cache" - }, - url: admin_order_tab_link, - dataType: 'JSON', - cache: false, - data: { - id_htl_booking: idHotelBooking, - id_new_room_type: roomTypeObj.val(), - action: 'changeRoomTypeToReallocate', - ajax: true - }, - success: function(result) { - if (result.success == 1) { - // has room type changed for reallocation - if (result.has_room_type_change == 1) { - $(".realloc_roomtype_change_message").show(); - // has room type price changed for reallocation - if (result.has_price_changes == 1) { - $("#reallocation_price_diff").val(result.price_diff); - $("#reallocation_price_diff_block").show(); - } - } else { - $(".realloc_roomtype_change_message").hide(); - } - $('#room_type_change_info').empty(); - if (result.is_changes_present == 1) { - } - } else if (typeof(result.error) != 'undefinded' && result.error) { - showErrorMessage(result.error); - } else { - showErrorMessage(txtSomeErr); - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) { - showErrorMessage(txtSomeErr); - }, - complete: function() { - $(".loading_overlay").hide(); - } - }); - } else { - $(".loading_overlay").hide(); - showErrorMessage(txtSomeErr); - return false; - } - }, - close: function() { - $('#room-reallocation-modal').modal('hide'); - }, - submit: function() { - } -}; - // Modal object to handle adding rooms to order processes const AddRoomBookingModal = { show: function() { From 881d21437f5957acf8f1df53854033144b4860e5 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Sat, 13 Jul 2024 10:28:53 +0530 Subject: [PATCH 52/67] added header_order_conf email templates to ignore while selecting the template for the order status --- controllers/admin/AdminStatusesController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index 01a1d9c0d..aadb4ee44 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -713,6 +713,7 @@ class AdminStatusesControllerCore extends AdminController 'shipped.html', 'in_transit.html', 'download_products.html', + 'header_order_conf.html', 'test.html' ); From 60e9437f0fbb03f4ecb9ab1b9b88e72994fa9d94 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 13 Jul 2024 11:14:25 +0530 Subject: [PATCH 53/67] Fixed: Select 1 instead of Select age in the child age when age is already selected while order edit and also while creating booking in backoffice --- .../template/controllers/orders/_current_cart_details_data.tpl | 2 +- .../controllers/orders/modals/_edit_room_tab_content.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl index fb6f389c2..07f87ca73 100644 --- a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl +++ b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl @@ -92,7 +92,7 @@ {foreach $data['child_ages'] as $childAge}

- + {for $age=1 to ($max_child_age-1)} From c63768eb81a453d4ba1a91f1fe428d6269d2fe39 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 13 Jul 2024 11:41:14 +0530 Subject: [PATCH 54/67] Fixed: Unable to save the occupancy while editing booking when the room has been reallocated once. --- .../classes/HotelBookingDetail.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 9f5984083..472802aea 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -2098,6 +2098,14 @@ class HotelBookingDetail extends ObjectModel // Reinject quantity in stock $objOldOrderDetail->reinjectQuantity($objOldOrderDetail, $objOldOrderDetail->product_quantity, $deleteQty); + // retrieve and delete HotelCartBookingData row + $idHotelCartBookingData = Db::getInstance()->getValue('SELECT `id` FROM `'._DB_PREFIX_.'htl_cart_booking_data` + WHERE date_from = "'.pSQL($objOldHotelBooking->date_from).'" AND date_to = "'.pSQL($objOldHotelBooking->date_to).'" + AND id_room = '.(int) $objOldHotelBooking->id_room.' AND `id_order` = '.(int) $objOldHotelBooking->id_order + ); + $objCartBookingData = new HotelCartBookingData($idHotelCartBookingData); + $objCartBookingData->delete(); + // delete the booking detail $objOldHotelBooking = new HotelBookingDetail($idHotelBooking); $objOldHotelBooking->delete(); @@ -2107,6 +2115,19 @@ class HotelBookingDetail extends ObjectModel // =============================================================== } else { // If we are reallocating to the same room type then we need to update only the room details + // update in the cart booking data + // retrieve HotelCartBookingData row + $idHotelCartBookingData = Db::getInstance()->getValue('SELECT `id` FROM `'._DB_PREFIX_.'htl_cart_booking_data` + WHERE date_from = "'.pSQL($objOldHotelBooking->date_from).'" AND date_to = "'.pSQL($objOldHotelBooking->date_to).'" + AND id_room = '.(int) $objOldHotelBooking->id_room.' AND `id_order` = '.(int) $objOldHotelBooking->id_order + ); + $objCartBookingData = new HotelCartBookingData($idHotelCartBookingData); + $objCartBookingData->id_room = $idRoom; + // set backorder to 0 as available reallocate rooms will always be free + $objOldHotelBooking->is_back_order = 0; + $objCartBookingData->save(); + + // update in the hotel booking detail table $objOldHotelBooking->id_room = $idRoom; $objOldHotelBooking->room_num = $objHotelRoomInfo->room_num; // set backorder to 0 as available reallocate rooms will always be free From d3d3d05a6459e6e58c3b1cdb6f8e87c15a3a4ea8 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 13 Jul 2024 12:01:26 +0530 Subject: [PATCH 55/67] Fixed: Text years is wrong if child age is 1 in bookings list and overbookings list in order details page in back office --- .../default/template/controllers/orders/_overbookings.tpl | 2 +- .../default/template/controllers/orders/_product_line.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_overbookings.tpl b/admin/themes/default/template/controllers/orders/_overbookings.tpl index 154adbccf..8f0064708 100644 --- a/admin/themes/default/template/controllers/orders/_overbookings.tpl +++ b/admin/themes/default/template/controllers/orders/_overbookings.tpl @@ -54,7 +54,7 @@ {if $childAge == 0} {l s='Child %s : Under 1' sprintf=[$childAge@iteration]} {else} - {l s='Child %s : %s years' sprintf=[$childAge@iteration, $childAge]} + {l s='Child %s : %s' sprintf=[$childAge@iteration, $childAge]} {if $childAge > 1}{l s='years'}{else}{l s='year'}{/if} {/if}

{/foreach} diff --git a/admin/themes/default/template/controllers/orders/_product_line.tpl b/admin/themes/default/template/controllers/orders/_product_line.tpl index 099a0ef73..11ab4b428 100644 --- a/admin/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin/themes/default/template/controllers/orders/_product_line.tpl @@ -73,7 +73,7 @@ {if $childAge == 0} {l s='Child %s : Under 1' sprintf=[$childAge@iteration]} {else} - {l s='Child %s : %s years' sprintf=[$childAge@iteration, $childAge]} + {l s='Child %s : %s' sprintf=[$childAge@iteration, $childAge]} {if $childAge > 1}{l s='years'}{else}{l s='year'}{/if} {/if}

{/foreach} From b18f9f3612b24118b04b704c8c137c9e521691a3 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 13 Jul 2024 14:41:33 +0530 Subject: [PATCH 56/67] Updated:: Admin can edit occupancy after order from backoffice whether order is created with occupancy or with rooms selection by guest --- .../orders/modals/_edit_room_tab_content.tpl | 98 +++++++++---------- 1 file changed, 47 insertions(+), 51 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl index c8faf37de..1bb98114b 100644 --- a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl @@ -67,57 +67,55 @@
- {if $order->with_occupancy} -
-