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..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,31 +29,29 @@ {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}) - -
+ + {$customer->lastname} {$customer->firstname} ({$customer->email}) + - {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/admin/themes/default/template/controllers/login/header.tpl b/admin/themes/default/template/controllers/login/header.tpl index aff412764..d1d17ce21 100644 --- a/admin/themes/default/template/controllers/login/header.tpl +++ b/admin/themes/default/template/controllers/login/header.tpl @@ -39,7 +39,7 @@ - {$shop_name} {if $meta_title != ''}{if isset($navigationPipe)}{$navigationPipe|escape:'html':'UTF-8'}{else}>{/if} {$meta_title}{/if} (PrestaShop™) + {$shop_name} {if $meta_title != ''}{if isset($navigationPipe)}{$navigationPipe|escape:'html':'UTF-8'}{else}>{/if} {$meta_title}{/if} (QloApps™) {if isset($css_files)} {foreach from=$css_files key=css_uri item=media} diff --git a/classes/BoOrder.php b/classes/BoOrder.php new file mode 100644 index 000000000..b6046c5c8 --- /dev/null +++ b/classes/BoOrder.php @@ -0,0 +1,31 @@ + +* @copyright 2010-2022 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +class BoOrder extends PaymentModule +{ + public $active = 1; + public $name = 'bo_order'; + + public function __construct() + { + $this->displayName = $this->l('Back office order'); + $this->validateOrderAmount = false; + } +} \ No newline at end of file diff --git a/classes/Customer.php b/classes/Customer.php index a8c4c3609..a1ef3279e 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -294,21 +294,37 @@ class CustomerCore extends ObjectModel } /** - * Return customers list + * Returns a list of customers. * - * @param null|bool $only_active Returns only active customers when true - * @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) + public static function getCustomers($active = null, $deleted = null, $havingAddress = 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'; + $sqlJoin = ''; + $sqlWhere = 'WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER). + (!is_null($active) ? ' AND c.`active` = '.(int) $active: ' ' ). + (!is_null($deleted) ? ' AND c.`deleted` = '.(int) $deleted : ' '); + $sqlOrderBy = 'ORDER BY c.`id_customer` ASC'; + $sqlGroupBy = 'GROUP BY c.`id_customer`'; + + if (!is_null($havingAddress)) { + $sqlJoin .= ' LEFT JOIN `'._DB_PREFIX_.'address` a + ON a.`id_customer` = c.`id_customer` AND a.`deleted`=0'; + $sqlWhere .= (($havingAddress) ? ' AND a.`id_address` IS NOT NULL': ' AND a.`id_address` IS NULL'); + } + + $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) * @@ -951,4 +967,5 @@ class CustomerCore extends ObjectModel $sql_filter .= Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'main'); return parent::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit); } + } diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index d7e75b7d2..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() { @@ -162,7 +163,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); @@ -418,8 +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_) - && $this->name != 'wsorder' - && $this->name != 'bo_order' + && ($this->validateOrderAmount) ) { // if customer is paying full payment amount $id_order_state = Configuration::get('PS_OS_ERROR'); @@ -684,24 +684,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 +1051,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 +1092,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); @@ -1098,7 +1105,11 @@ abstract class PaymentModuleCore extends Module $order = new Order((int)$order->id); // Send an e-mail to customer (one order = one email) - if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id) { + if ($id_order_state != Configuration::get('PS_OS_ERROR') + && $id_order_state != Configuration::get('PS_OS_CANCELED') + && $this->context->customer->id + && $send_mails + ) { $invoice = new Address($order->id_address_invoice); $delivery = new Address($order->id_address_delivery); $delivery_state = $delivery->id_state ? new State($delivery->id_state) : false; @@ -1327,9 +1338,7 @@ abstract class PaymentModuleCore extends Module } } } - if ($idHotel - && Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel)) - ) { + if ($idHotel && Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))) { 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 if ($isOverBookingStatus) { diff --git a/classes/webservice/WebserviceOrder.php b/classes/webservice/WebserviceOrder.php index 4b1d337e4..860fcc0c0 100644 --- a/classes/webservice/WebserviceOrder.php +++ b/classes/webservice/WebserviceOrder.php @@ -26,5 +26,6 @@ class WebserviceOrderCore extends PaymentModule public function __construct() { $this->displayName = $this->l('Order from API'); + $this->validateOrderAmount = false; } } diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 83a646cb6..5f6bb472d 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -112,18 +112,43 @@ class AdminAddressesControllerCore extends AdminController public function renderForm() { + $customerField =array( + 'type' => 'text_customer', + 'label' => $this->l('Customer'), + 'name' => 'id_customer', + 'required' => false, + ); + 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::getCustomers(null, 0, 0)); + $customerField = array( + 'type' => 'select', + 'label' => $this->l('Customer'), + 'name' => 'id_customer', + 'required' => true, + '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, - ), + $customerField, array( 'type' => 'text', 'label' => $this->l('Identification Number'), @@ -191,9 +216,8 @@ class AdminAddressesControllerCore extends AdminController } $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 || Tools::getValue('liteDisplaying'))) ? $customer : null, + 'tokenCustomer' => isset($token_customer) ? $token_customer : null ); // Order address fields depending on country format @@ -503,7 +527,7 @@ class AdminAddressesControllerCore extends AdminController return $out; } - /** + /** * Method called when an ajax request is made * @see AdminController::postProcess() */ diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 73f3b62de..c88cf260d 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -24,17 +24,6 @@ * International Registered Trademark & Property of PrestaShop SA */ -class BoOrder extends PaymentModule -{ - public $active = 1; - public $name = 'bo_order'; - - public function __construct() - { - $this->displayName = $this->l('Back office order'); - } -} - /** * @property Order $object */ diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index e10140b77..aadb4ee44 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -707,6 +707,15 @@ 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', + 'header_order_conf.html', + 'test.html' + ); $array = array(); foreach (Language::getLanguages(false) as $language) { @@ -722,7 +731,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), diff --git a/controllers/front/CmsController.php b/controllers/front/CmsController.php index 01a4726bb..c855df6b4 100644 --- a/controllers/front/CmsController.php +++ b/controllers/front/CmsController.php @@ -79,8 +79,8 @@ 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'); + // incase the cms page in invalid i.e, url is tampered + Tools::redirect($this->context->link->getPageLink('pagenotfound')); } } @@ -134,6 +134,9 @@ 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 { + // incase the cms page is inactive + 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..224845228 100644 --- a/modules/blocknavigationmenu/blocknavigationmenu.php +++ b/modules/blocknavigationmenu/blocknavigationmenu.php @@ -103,6 +103,24 @@ class blocknavigationmenu extends Module } } + public function hookActionObjectCMSUpdateAfter($params) + { + $idCMS = $params['object']->id; + if (!$params['object']->active) { + $objCustomNavigationLink = new WkCustomNavigationLink(); + // Disabling depended Navigation link + $objCustomNavigationLink->disableNavigationLinksByIdCMS($idCMS); + } + } + + public function hookActionObjectCMSDeleteAfter($params) + { + $idCMS = $params['object']->id; + $objCustomNavigationLink = new WkCustomNavigationLink(); + // Deleting depended Navigation link + $objCustomNavigationLink->deleteNavigationLinksByIdCMS($idCMS); + } + public function install() { $objModuleDb = new WkBlockNavigationMenuDb(); @@ -125,6 +143,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..d27a037f0 100644 --- a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php +++ b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php @@ -235,6 +235,39 @@ class WkCustomNavigationLink extends ObjectModel $objCustomNavigationLink->is_custom_link = 0; $objCustomNavigationLink->link = 'contact'; $objCustomNavigationLink->save(); + return true; } + + public function getNavigationLinksByIdCMS($idCMS) + { + return Db::getInstance()->executeS(' + SELECT * FROM `'._DB_PREFIX_.'htl_custom_navigation_link` + WHERE `id_cms`='.(int) $idCMS + ); + } + + public function disableNavigationLinksByIdCMS($idCMS) + { + $objCustomNavigationLink = new WkCustomNavigationLink(); + if ($navLinks = $objCustomNavigationLink->getNavigationLinksByIdCMS($idCMS)) { + foreach ($navLinks as $navLink) { + $objCustomNavigationLink = new WkCustomNavigationLink((int) $navLink['id_navigation_link']); + $objCustomNavigationLink->active = 0; + $objCustomNavigationLink->save(); + } + } + } + + public function deleteNavigationLinksByIdCMS($idCMS) + { + $objCustomNavigationLink = new WkCustomNavigationLink(); + if ($navLinks = $objCustomNavigationLink->getNavigationLinksByIdCMS($idCMS)) { + foreach ($navLinks as $navLink) { + $objCustomNavigationLink = new WkCustomNavigationLink((int) $navLink['id_navigation_link']); + $objCustomNavigationLink->delete(); + } + } + } + } diff --git a/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php b/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php index 6e1668b84..dd1b59fb4 100644 --- a/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php +++ b/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php @@ -179,6 +179,17 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController if (Validate::isLoadedObject($objNavigationLink)) { $smartyVars['navigationLinkInfo'] = (array) $objNavigationLink; $smartyVars['edit'] = 1; + if ($objNavigationLink->id_cms + && Validate::isLoadedObject($objCMS = new CMS($objNavigationLink->id_cms)) + ) { + $smartyVars['id_cms_category'] = $objCMS->id_cms_category; + if (empty($this->errors) + && !$objCMS->active + ) { + $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.'); + } + } } // send theme's front pages $themePages = array(); @@ -196,7 +207,29 @@ 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)) { + if (!isset($smartyVars['id_cms_category'])) { + $smartyVars['id_cms_category'] = $cmsCategories[0]['id_cms_category']; + } + + foreach ($cmsCategories as $cmsCatKey => $cmsCategory) { + if (!isset($categoryWiseCmsPages[$cmsCategory['id_cms_category']])) { + unset($cmsCategories[$cmsCatKey]); + } + } + } + + $smartyVars['categoryWiseCmsPages'] = $categoryWiseCmsPages; + $smartyVars['categories'] = $cmsCategories; $this->context->smarty->assign($smartyVars); $this->fields_form = array( 'submit' => array( @@ -261,6 +294,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) { @@ -365,7 +402,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 { @@ -381,9 +418,31 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController } } + public function processStatus() + { + if (Validate::isLoadedObject($this->loadObject()) + && $this->object->id_cms + && Validate::isLoadedObject($objCMS = new CMS($this->object->id_cms)) + ) { + if (!$objCMS->active + && !$this->object->active + ) { + $this->errors[] = $this->l('Please activate the linked CMS page to enable this navigation link.'); + } + } + + if (empty($this->errors)) { + return parent::processStatus(); + } + + return $this->object; + } + public function setMedia() { parent::setMedia(); - $this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/admin/wk_navigation_link.js'); + if ($this->display == 'edit' || $this->display == 'add') { + $this->addJS($this->module->getPathUri().'views/js/admin/wk_navigation_link.js'); + } } } diff --git a/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js b/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js index db7a3ff7e..48139765e 100644 --- a/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js +++ b/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js @@ -37,6 +37,12 @@ $(document).ready(function() { $(".custom_redirect_page_div").removeClass('hidden'); } }); + + $(document).on('change', '#id_cms_category', function(){ + var id_cat = parseInt($('#id_cms_category').val()); + $('.cms_pages_table').hide(); + $('#cms_pages_table_'+id_cat).show(); + }); }); function showNavigationLinkLangField(lang_iso_code, id_lang) @@ -45,4 +51,4 @@ function showNavigationLinkLangField(lang_iso_code, id_lang) $('.navigation_link_name_all').hide(); $('#navigation_link_name_'+id_lang).show(); -} \ 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..642b6fb39 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,8 +52,26 @@
{* Feilds of cms page *}
+
+
+ +
+ +
+
+
{*Display CMS Pages*} - {if isset($cmsPages)} + {if isset($categoryWiseCmsPages)}
-
- - - - - - - - - - {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'} + +
-
+ + + {foreach $cmsPages as $cmsPage} + + + + {$cmsPage.id_cms|escape:'htmlall':'UTF-8'} + + + {/foreach} + + +
+ {/foreach}
{/if} diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 472802aea..66260263a 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -2274,10 +2274,14 @@ class HotelBookingDetail extends ObjectModel * * @return [boolean] [true if updated otherwise false] */ - public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1, $is_cancelled = 0) + public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1, $is_cancelled = null) { $table = 'htl_booking_detail'; - $data = array('is_refunded' => (int) $is_refunded, 'is_cancelled' => (int) $is_cancelled); + $data = array('is_refunded' => (int) $is_refunded); + + if (!is_null($is_cancelled)) { + $data['is_cancelled'] = (int) $is_cancelled; + } if ($id_rooms) { foreach ($id_rooms as $key_rm => $val_rm) { diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index c777cfa43..9bf4de500 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -326,10 +326,13 @@ class AdminOrderRefundRequestsController extends ModuleAdminController } else { $this->errors[] = $this->l('Invalid refund state.'); } - if (!$voucher_expiry_date = Tools::getValue('voucher_expiry_date')) { - $this->errors[] = $this->l('Voucher expiry date is required.'); - } elseif (!Validate::isDate($voucher_expiry_date)) { - $this->errors[] = $this->l('Invalid voucher expiry date.'); + + if (Tools::isSubmit('generateDiscount')) { + if (!$voucher_expiry_date = Tools::getValue('voucher_expiry_date')) { + $this->errors[] = $this->l('Voucher expiry date is required.'); + } elseif (!Validate::isDate($voucher_expiry_date)) { + $this->errors[] = $this->l('Invalid voucher expiry date.'); + } } } else { $this->errors[] = $this->l('Invalid refund information found.'); diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 065640113..e6d63c791 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -486,7 +486,8 @@ class HotelReservationSystem extends Module // Make rooms available for booking if order status is cancelled, refunded or error if (in_array($params['newOrderStatus']->id, $objHtlBkDtl->getOrderStatusToFreeBookedRoom())) { - $isCancelled = 0; + // do not change is_cancelled if room is not getting cancelled + $isCancelled = null; if ($params['newOrderStatus']->id == Configuration::get('PS_OS_CANCELED')) { $isCancelled = 1; } diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl index ad04059d2..ea4f1328a 100644 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl @@ -5,7 +5,7 @@  {l s='Order Cancellation Request Information' mod='hotelreservationsystem'}
-
+
{if isset($customer_name)}