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 2f5c37c16..2184085c9 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -458,7 +458,7 @@ {dateFormat date=$payment['date_add'] full=true} {$payment['payment_method']|escape:'html':'UTF-8'} - {$payment_types[$payment['payment_type']]['name']|escape:'html':'UTF-8'} + {$payment_types[$payment['payment_type']]['name']|escape:'UTF-8'} {$payment['transaction_id']|escape:'html':'UTF-8'} {displayPrice price=$payment['real_paid_amount'] currency=$payment['id_currency']} {if isset($payment['invoice_number'])}{$payment['invoice_number']}{else}--{/if} diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index 21e63328b..db65db934 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -101,8 +101,8 @@ {if isset($room_info['id'])} - {if $room_info['booked_dates']} - + {if isset($room_info['booked_dates']) && $room_info['booked_dates']} + {/if} diff --git a/admin/themes/default/template/controllers/products/prices.tpl b/admin/themes/default/template/controllers/products/prices.tpl index b45c43e69..32fe8a418 100644 --- a/admin/themes/default/template/controllers/products/prices.tpl +++ b/admin/themes/default/template/controllers/products/prices.tpl @@ -413,13 +413,6 @@ $(document).ready(function () { {$featurePlan['feature_price_name']} - - {if $featurePlan['impact_type'] == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE} - {l s='Percentage'} - {else} - {l s='Fixed Amount'} - {/if} - {if $featurePlan['impact_way'] == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE} {l s='Decrease'} @@ -427,6 +420,13 @@ $(document).ready(function () { {l s='Increase'} {/if} + + {if $featurePlan['impact_type'] == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE} + {l s='Percentage'} + {else} + {l s='Fixed Amount'} + {/if} + {if $featurePlan['impact_type'] == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE} {$featurePlan['impact_value']|round:2}% diff --git a/admin/themes/default/template/page_header_toolbar.tpl b/admin/themes/default/template/page_header_toolbar.tpl index 0bf095f1a..7e47cd02d 100644 --- a/admin/themes/default/template/page_header_toolbar.tpl +++ b/admin/themes/default/template/page_header_toolbar.tpl @@ -83,7 +83,7 @@
  • - {$btn.desc|escape} + {$btn.desc}
  • {/if} diff --git a/classes/Customer.php b/classes/Customer.php index 310e9270e..2e8c3bba5 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -149,8 +149,7 @@ class CustomerCore extends ObjectModel 'last_passwd_gen' => array('setter' => null), 'secure_key' => array('setter' => null), 'deleted' => array(), - 'passwd' => array('setter' => 'setWsPasswd'), - 'phone' => array() + 'passwd' => array('setter' => 'setWsPasswd') ), 'associations' => array( 'groups' => array('resource' => 'group'), @@ -180,6 +179,7 @@ class CustomerCore extends ObjectModel 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'siret' => array('type' => self::TYPE_STRING, 'validate' => 'isSiret'), 'ape' => array('type' => self::TYPE_STRING, 'validate' => 'isApe'), + 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'outstanding_allow_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'copy_post' => false), 'show_public_prices' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'id_risk' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false), @@ -206,12 +206,8 @@ class CustomerCore extends ObjectModel $this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP'); parent::__construct($id); - if ($this->email) { - $this->phone = CustomerGuestDetail::getCustomerPhone($this->email, false); - } - if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { - $this->webserviceParameters['fields']['phone']['required'] = true; + self::$definition['fields']['phone']['required'] = true; } } @@ -264,7 +260,7 @@ class CustomerCore extends ObjectModel } $success = parent::add($autodate, $null_values); $this->updateGroup($this->groupBox); - $this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($this->email, false)); + return $success; } @@ -289,22 +285,9 @@ class CustomerCore extends ObjectModel $objOldCustomer = new Customer($this->id); $success = parent::update(true); - $this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($objOldCustomer->email, false)); return $success; } - public function updateCustomerAdditionalDetails($idCustomerGuest) - { - $objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuest); - $objCustomerGuestDetail->id_customer = 0; - $objCustomerGuestDetail->id_gender = $this->id_gender; - $objCustomerGuestDetail->firstname = $this->firstname; - $objCustomerGuestDetail->lastname = $this->lastname; - $objCustomerGuestDetail->email = $this->email; - $objCustomerGuestDetail->phone = $this->phone; - return $objCustomerGuestDetail->save(); - } - public function delete() { if (!count(Order::getCustomerOrders((int)$this->id))) { @@ -344,8 +327,6 @@ class CustomerCore extends ObjectModel CartRule::deleteByIdCustomer((int)$this->id); // delete customer data from customerGuest table - $objCustomerGuestDetail = new CustomerGuestDetail(CustomerGuestDetail::getIdCustomerGuest($this->email, false)); - $objCustomerGuestDetail->delete(); return parent::delete(); } diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 7b4dcb80c..187facb07 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -1384,7 +1384,7 @@ abstract class PaymentModuleCore extends Module } // End foreach $order_detail_list // delete cart feature prices after booking creation success - HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($id_cart); if (count($cart_rules)) { foreach ($cart_rules as $idCartRule => $cartRule) { diff --git a/classes/Product.php b/classes/Product.php index f62901fe9..3c34bd1c3 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -3043,7 +3043,7 @@ class ProductCore extends ObjectModel public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null, $id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null, - $use_customer_price = true, $id_product_roomtype = false) + $use_customer_price = true, $id_product_roomtype = false, $id_group = null) { if (!$context) { $context = Context::getContext(); @@ -3060,14 +3060,16 @@ class ProductCore extends ObjectModel } // Initializations - $id_group = null; - if ($id_customer) { - $id_group = Customer::getDefaultGroupId((int)$id_customer); - } + if (!$id_group) { - $id_group = (int)Group::getCurrent()->id; + if ($id_customer) { + $id_group = Customer::getDefaultGroupId((int)$id_customer); + } } + if (!$id_group || !Validate::isLoadedObject(new Group((int) $id_group))) { + $id_group = (int)Group::getCurrent()->id; + } // If there is cart in context or if the specified id_cart is different from the context cart id if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart && $cur_cart->id != $id_cart)) { /* diff --git a/classes/Translate.php b/classes/Translate.php index c2c8ccd08..190be1515 100644 --- a/classes/Translate.php +++ b/classes/Translate.php @@ -30,6 +30,8 @@ class TranslateCore { public static $ignore_folder = array('.', '..', '.svn', '.git', '.htaccess', 'index.php'); + public static $adminTranslations = array(); + public static $moduleTranslations = array(); /** * Get a translation for an admin controller @@ -43,21 +45,19 @@ class TranslateCore public static function getAdminTranslation($string, $class = 'AdminTab', $addslashes = false, $htmlentities = true, $sprintf = null) { static $modules_tabs = null; - - // @todo remove global keyword in translations files and use static - global $_LANGADM; - if ($modules_tabs === null) { $modules_tabs = Tab::getModuleTabList(); } - if ($_LANGADM == null) { - $iso = Context::getContext()->language->iso_code; - if (empty($iso)) { - $iso = Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')); - } + $iso = Context::getContext()->language->iso_code; + if (empty($iso)) { + $iso = Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')); + } + + if (!isset(self::$adminTranslations[$iso])) { if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php')) { include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); + self::$adminTranslations[$iso] = $GLOBALS['_LANGADM']; } } @@ -71,10 +71,10 @@ class TranslateCore $string = preg_replace("/\\\*'/", "\'", $string); $key = md5($string); - if (isset($_LANGADM[$class.$key])) { - $str = $_LANGADM[$class.$key]; + if (isset(self::$adminTranslations[$iso][$class.$key])) { + $str = self::$adminTranslations[$iso][$class.$key]; } else { - $str = Translate::getGenericAdminTranslation($string, $key, $_LANGADM); + $str = Translate::getGenericAdminTranslation($string, $key, self::$adminTranslations[$iso]); } if ($htmlentities) { @@ -128,7 +128,7 @@ class TranslateCore */ public static function getModuleTranslation($module, $string, $source, $sprintf = null, $addslashes = false, $language = null) { - global $_MODULES, $_MODULE, $_LANGADM; + global $_MODULE; static $lang_cache = array(); // $_MODULES is a cache of translations for all module. @@ -146,15 +146,19 @@ class TranslateCore $force_refresh = true; } - if ((!isset($translations_merged[$name]) && isset(Context::getContext()->language)) || $force_refresh) { + $iso = $language->iso_code; + if (!isset(self::$moduleTranslations[$iso])) { + self::$moduleTranslations[$iso] = array(); + } + if ((isset(Context::getContext()->language) && !isset($translations_merged[$name])) || $force_refresh) { $files_by_priority = array( // Translations in theme - _PS_THEME_DIR_.'modules/'.$name.'/translations/'.$language->iso_code.'.php', - _PS_THEME_DIR_.'modules/'.$name.'/'.$language->iso_code.'.php', + _PS_THEME_DIR_.'modules/'.$name.'/translations/'.$iso.'.php', + _PS_THEME_DIR_.'modules/'.$name.'/'.$iso.'.php', // PrestaShop 1.5 translations - _PS_MODULE_DIR_.$name.'/translations/'.$language->iso_code.'.php', + _PS_MODULE_DIR_.$name.'/translations/'.$iso.'.php', // PrestaShop 1.4 translations - _PS_MODULE_DIR_.$name.'/'.$language->iso_code.'.php' + _PS_MODULE_DIR_.$name.'/'.$iso.'.php' ); // if force_refresh is set reverse the list because array_merge will overrite the previous file with new file if ($force_refresh) { @@ -163,8 +167,8 @@ class TranslateCore foreach ($files_by_priority as $file) { if (file_exists($file)) { include_once($file); - $_MODULES = !empty($_MODULES) ? ($force_refresh ? array_merge($_MODULES, $_MODULE) : $_MODULES + $_MODULE) : $_MODULE; //we use "+" instead of array_merge() when force_refresh is false because array merge erase existing values. - $translations_merged[$name] = true; + self::$moduleTranslations[$iso] = !empty(self::$moduleTranslations[$iso]) ? ($force_refresh ? array_merge(self::$moduleTranslations[$iso], $_MODULE) : self::$moduleTranslations[$iso] + $_MODULE) : $_MODULE; //we use "+" instead of array_merge() when force_refresh is false because array merge erase existing values. + $translations_merged[$language->iso_code][$name] = true; } } } @@ -174,7 +178,7 @@ class TranslateCore $cache_key = $name.'|'.$string.'|'.$source.'|'.(int)$addslashes; if (!isset($lang_cache[$cache_key])) { - if ($_MODULES == null) { + if (self::$moduleTranslations[$iso] == null) { if ($sprintf !== null) { $string = Translate::checkAndReplaceArgs($string, $sprintf); } @@ -190,18 +194,18 @@ class TranslateCore $default_key_file = strtolower('<{'.$name.'}prestashop>'.$file).'_'.$key; } - if (isset($current_key_file) && !empty($_MODULES[$current_key_file])) { - $ret = stripslashes($_MODULES[$current_key_file]); - } elseif (isset($default_key_file) && !empty($_MODULES[$default_key_file])) { - $ret = stripslashes($_MODULES[$default_key_file]); - } elseif (!empty($_MODULES[$current_key])) { - $ret = stripslashes($_MODULES[$current_key]); - } elseif (!empty($_MODULES[$default_key])) { - $ret = stripslashes($_MODULES[$default_key]); + if (isset($current_key_file) && !empty(self::$moduleTranslations[$iso][$current_key_file])) { + $ret = stripslashes(self::$moduleTranslations[$iso][$current_key_file]); + } elseif (isset($default_key_file) && !empty(self::$moduleTranslations[$iso][$default_key_file])) { + $ret = stripslashes(self::$moduleTranslations[$iso][$default_key_file]); + } elseif (!empty(self::$moduleTranslations[$iso][$current_key])) { + $ret = stripslashes(self::$moduleTranslations[$iso][$current_key]); + } elseif (!empty(self::$moduleTranslations[$iso][$default_key])) { + $ret = stripslashes(self::$moduleTranslations[$iso][$default_key]); } // if translation was not found in module, look for it in AdminController or Helpers - elseif (!empty($_LANGADM)) { - $ret = stripslashes(Translate::getGenericAdminTranslation($string, $key, $_LANGADM)); + elseif (isset(self::$adminTranslations[$iso]) && !empty(self::$adminTranslations[$iso])) { + $ret = stripslashes(Translate::getGenericAdminTranslation($string, $key, self::$adminTranslations[$iso])); } else { $ret = stripslashes($string); } diff --git a/classes/cache/Cache.php b/classes/cache/Cache.php index 96b0fed3f..408fdf1bf 100644 --- a/classes/cache/Cache.php +++ b/classes/cache/Cache.php @@ -90,6 +90,7 @@ abstract class CacheCore 'page_viewed', 'employee', 'log', + 'htl_cart_booking_data', ); /** diff --git a/classes/webservice/WebserviceSpecificManagementBookings.php b/classes/webservice/WebserviceSpecificManagementBookings.php index 8d3580781..f0e6c5289 100644 --- a/classes/webservice/WebserviceSpecificManagementBookings.php +++ b/classes/webservice/WebserviceSpecificManagementBookings.php @@ -1269,7 +1269,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $this->bookingCustomer = $objCustomer; } else { $objCustomer = new Customer(); - $this->bookingCustomer = $objCustomer->getByEmail($guestDetails['email']); + $this->bookingCustomer = $objCustomer->getByEmail($guestDetails['email'], null, false); } if (isset($this->bookingCustomer->id) @@ -1710,7 +1710,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We 'id_cart' => (int) $this->context->cart->id, 'id_guest' => (int) $this->context->cart->id_guest, 'date_from' => date('Y-m-d', strtotime($dateFrom)), - 'date_to' => date('Y-m-d', strtotime($dateTo)), + 'date_to' => date('Y-m-d', strtotime($dateTo) - _TIME_1_DAY_), 'id_room' => $objCartBookingData->id_room, 'price' => $room['unit_price_without_tax'] ) @@ -2331,7 +2331,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We } $this->deleteWsFeaturePrices(); - HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($this->context->cart->id); } /** @@ -2878,8 +2878,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $objRoomTypeFeaturePricing->id_room = (int) $params['id_room']; $objRoomTypeFeaturePricing->feature_price_name = $feature_price_name; $objRoomTypeFeaturePricing->date_selection_type = HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE; - $objRoomTypeFeaturePricing->date_from = date('Y-m-d', strtotime($params['date_from'])); - $objRoomTypeFeaturePricing->date_to = date('Y-m-d', strtotime($params['date_to'])); + $objRoomTypeFeaturePricing->date_from = $params['date_from']; + $objRoomTypeFeaturePricing->date_to = $params['date_to']; $objRoomTypeFeaturePricing->is_special_days_exists = 0; $objRoomTypeFeaturePricing->special_days = json_encode(false); $objRoomTypeFeaturePricing->impact_way = HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE; @@ -2970,7 +2970,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We 'id_cart' => (int) $objCart->id, 'id_guest' => (int) $objCart->id_guest, 'date_from' => date('Y-m-d', strtotime($objHotelBookingDetail->date_from)), - 'date_to' => date('Y-m-d', strtotime($objHotelBookingDetail->date_to)), + 'date_to' => date('Y-m-d', strtotime($objHotelBookingDetail->date_to) - _TIME_1_DAY_), 'id_room' => $objHotelBookingDetail->id_room, 'price' => $room['unit_price_without_tax'] ) @@ -3006,7 +3006,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $objOrder->total_products_wt += $objHotelBookingDetail->total_price_tax_incl; $objOrder->update(); - HotelRoomTypeFeaturePricing::deleteByIdCart($objCart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($objCart->id); $this->deleteWsFeaturePrices(); } } diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 99299e9ce..8f26b9294 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -952,7 +952,7 @@ class AdminCartsControllerCore extends AdminController $this->context->cart = new Cart($id_cart); $date_from = date('Y-m-d H:i:s', strtotime($date_from)); - $date_to = date('Y-m-d H:i:s', strtotime($date_to)); + $date_to = date('Y-m-d H:i:s', strtotime($date_to) - _TIME_1_DAY_); if ($this->context->cart->id_currency != (int)Configuration::get('PS_CURRENCY_DEFAULT')) { $currency = Currency::getCurrencyInstance($this->context->cart->id_currency); @@ -960,7 +960,7 @@ class AdminCartsControllerCore extends AdminController } if ($this->tabAccess['edit'] === '1') { - HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart, $id_product, $id_room, $date_from, $date_to); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($id_cart, $id_product, $id_room, $date_from, $date_to); $feature_price_name = array(); foreach (Language::getIDs(true) as $id_lang) { $feature_price_name[$id_lang] = 'Auto-generated'; diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index b9523a9bc..3a0af4c64 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -141,6 +141,11 @@ class AdminCustomersControllerCore extends AdminController 'align' => 'text-right', 'badge_success' => true ), + 'phone' => array( + 'title' => $this->l('Phone'), + 'optional' => true, + 'visible_default' => false, + ), 'active' => array( 'title' => $this->l('Enabled'), 'align' => 'text-center', diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index e833b711d..bb32323e3 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -1680,6 +1680,8 @@ class AdminOrdersControllerCore extends AdminController $this->context->cart = $objCart; $this->context->currency = new Currency((int)$objCart->id_currency); + // Setting the customer in context to get the order total with the group discount. + $this->context->customer = new Customer($objCart->id_customer); $this->errors = HotelCartBookingData::validateCartBookings(); $orderTotal = $objCart->getOrderTotal(true, Cart::BOTH); if ($objCart->is_advance_payment) { @@ -4684,7 +4686,7 @@ class AdminOrdersControllerCore extends AdminController } // delete cart feature prices after room addition success - HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($this->context->cart->id); die(json_encode(array( 'result' => true, @@ -4845,7 +4847,7 @@ class AdminOrdersControllerCore extends AdminController } // delete cart feature prices after booking update success - HotelRoomTypeFeaturePricing::deleteByIdCart($cart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($cart->id); // Calculate differences of price (Before / After) $diff_price_tax_incl = $totalRoomPriceAfterTI - $totalRoomPriceBeforeTI; @@ -6148,7 +6150,6 @@ class AdminOrdersControllerCore extends AdminController $obj_hotel_cart_detail = new HotelCartBookingData(); $deleted = $obj_hotel_cart_detail->deleteCartBookingData($cart_id, $id_product, $room_id, $dt_frm, $dt_to); if ($deleted) { - HotelRoomTypeFeaturePricing::deleteByIdCart($cart_id, $id_product, $room_id, $dt_frm, $dt_to ); $obj_product_process = new HotelCartBookingData(); $num_cart_rooms = 0; if ($rooms = $obj_hotel_cart_detail->getCartCurrentDataByCartId($cart_id)) { @@ -6156,6 +6157,8 @@ class AdminOrdersControllerCore extends AdminController } $numDays = HotelHelper::getNumberOfDays($dt_frm, $dt_to); + $dt_to = date('Y-m-d H:i:s', strtotime($dt_to) - _TIME_1_DAY_); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($cart_id, $id_product, $room_id, $dt_frm, $dt_to); $changed = $obj_product_process->changeProductDataByRoomId($room_id, $id_product, $numDays, $cart_id); if ($changed) { $result['status'] = 'deleted'; diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 3dc7ccdda..7e6d5908f 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2966,7 +2966,7 @@ class AdminProductsControllerCore extends AdminController $bookedDate['date_from_formatted'] = Tools::displayDate($bookedDate['date_from']); $bookedDate['date_to_formatted'] = Tools::displayDate($bookedDate['date_to']); } - $room['booked_dates'] = $bookedDates; + $room['booked_dates'] = json_encode($bookedDates); if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) { $disableDates = $objRoomDisableDates->getRoomDisableDates($room['id']); diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index ab0c0b31e..4e08a593e 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -606,6 +606,7 @@ CREATE TABLE `PREFIX_customer` ( `max_payment_days` int(10) unsigned NOT NULL DEFAULT '60', `secure_key` varchar(32) NOT NULL DEFAULT '-1', `note` text, + `phone` varchar(32) DEFAULT NULL, `active` tinyint(1) unsigned NOT NULL DEFAULT '0', `is_guest` tinyint(1) NOT NULL DEFAULT '0', `deleted` tinyint(1) NOT NULL DEFAULT '0', diff --git a/install/upgrade/php/add_order_detail_meta_page_161.php b/install/upgrade/php/add_order_detail_meta_page_161.php new file mode 100644 index 000000000..c07b903cf --- /dev/null +++ b/install/upgrade/php/add_order_detail_meta_page_161.php @@ -0,0 +1,105 @@ +getValue(' + SELECT id_meta + FROM `'._DB_PREFIX_.'meta` m + WHERE m.`page` = "order-detail"') + ) { + // meta + Db::getInstance()->insert( + 'meta', + array( + 'page' => 'order-detail', + 'configurable' => 1, + ) + ); + if ($last_id = Db::getInstance()->Insert_ID()) { + // meta lang + $pageDetail = array( + 'en' => array( + 'title' => 'Booking details', + 'url_rewrite' => 'order-detail' + ), + 'fr' => array( + 'title' => 'Détails de réservation', + 'url_rewrite' => 'details-de-reservation' + ) + ); + if ($languages = Db::getInstance()->executeS('SELECT id_lang, iso_code FROM `'._DB_PREFIX_.'lang`')) { + $row = array(); + foreach ($languages as $lang) { + if (in_array(strtolower($lang['iso_code']), array_keys($pageDetail))) { + $row[] = array( + 'id_meta' => (int)$last_id, + 'id_shop' => 1, + 'id_lang' => (int)$lang['id_lang'], + 'title' => $pageDetail[strtolower($lang['iso_code'])]['title'], + 'description' => '', + 'keywords' => '', + 'url_rewrite' => $pageDetail[strtolower($lang['iso_code'])]['url_rewrite'] + ); + } else { + $row[] = array( + 'id_meta' => (int)$last_id, + 'id_shop' => 1, + 'id_lang' => (int)$lang['id_lang'], + 'title' => $pageDetail['en']['title'], + 'description' => '', + 'keywords' => '', + 'url_rewrite' => $pageDetail['en']['url_rewrite'] + ); + } + } + Db::getInstance()->insert( + 'meta_lang', + $row + ); + } + + // meta themes + $row = array(); + if ($themes = Db::getInstance()->executeS('SELECT id_theme FROM `'._DB_PREFIX_.'theme`')) { + foreach ($themes as $theme) { + $row[] = array( + 'id_theme' => (int)$theme, + 'id_meta' => (int)$last_id, + 'left_column' => 0, + 'right_column' => 0 + ); + } + Db::getInstance()->insert( + 'theme_meta', + $row + ); + } + + return true; + } else { + return false; + } + } +} diff --git a/install/upgrade/php/clean_product_description_161.php b/install/upgrade/php/clean_product_description_161.php new file mode 100644 index 000000000..4bc0c9ce6 --- /dev/null +++ b/install/upgrade/php/clean_product_description_161.php @@ -0,0 +1,39 @@ +executeS( + 'SELECT `id_product`, `id_lang`, `description_short` FROM `'._DB_PREFIX_.'product_lang`' + )) { + $sql = 'UPDATE `'._DB_PREFIX_.'product_lang` + SET description_short = CASE'; + foreach ($descriptions as $description) { + $sql .= ' WHEN id_product = '.(int)$description['id_product'].' AND id_lang = '.(int)$description['id_lang'].' + THEN "'.pSQL(Tools::getDescriptionClean($description['description_short'])).'"'; + } + $sql .= ' END'; + Db::getInstance()->execute($sql); + } + +} \ No newline at end of file diff --git a/install/upgrade/php/update_order_payment_type_160.php b/install/upgrade/php/update_order_payment_type_160.php new file mode 100644 index 000000000..102546a00 --- /dev/null +++ b/install/upgrade/php/update_order_payment_type_160.php @@ -0,0 +1,51 @@ +executeS( + 'SELECT `id_order`, `module` FROM `'._DB_PREFIX_.'orders`' + )) { + $sql = 'UPDATE `'._DB_PREFIX_.'orders` + SET payment_type = CASE'; + $modulePaymentType = array(); + foreach ($orders as &$order) { + if (!isset($modulePaymentType[$order['module']])) { + $module = Module::getInstanceByName($order['module']); + if ($module instanceof Module && $module->payment_type) { + $modulePaymentType[$order['module']] = $module->payment_type; + } else { + $modulePaymentType[$order['module']] = 1; + } + } + $sql .= ' WHEN id_order = '.(int)$order['id_order'].' THEN '.(int)$modulePaymentType[$order['module']]; + } + $sql .= ' END WHERE id_order IN ('.pSQL(implode(', ', array_column($orders, 'id_order'))).')'; + Db::getInstance()->execute($sql); + } + Db::getInstance()->execute( + 'UPDATE `'._DB_PREFIX_.'order_payment` op + INNER JOIN `'._DB_PREFIX_.'orders` o ON (op.`order_reference` = o.`reference`) + SET op.`payment_type` = o.`payment_type`' + ); +} \ No newline at end of file diff --git a/install/upgrade/php/update_order_states_161.php b/install/upgrade/php/update_order_states_161.php new file mode 100644 index 000000000..97667c26f --- /dev/null +++ b/install/upgrade/php/update_order_states_161.php @@ -0,0 +1,67 @@ + 0, + 'send_email' => 0, + 'color' => '#FF69B4', + 'unremovable' => 1, + 'hidden' => 0, + 'logable' => 0, + 'delivery' => 0, + 'shipped' => 0, + 'paid' => 0, + 'pdf_delivery' => 0, + 'pdf_invoice' => 0, + 'deleted' => 0 + ); + Db::getInstance()->insert('order_state', $data); + if ($last_id = Db::getInstance()->Insert_ID()) { + if ($languages = Db::getInstance()->executeS('SELECT id_lang, iso_code FROM `'._DB_PREFIX_.'lang`')) { + $row = array(); + foreach ($languages as $lang) { + $row[] = array( + 'id_order_state' => (int)$last_id, + 'id_lang' => (int)$lang['id_lang'], + 'name' => 'Overbooking (Partial payment)', + 'template' => '', + ); + } + Db::getInstance()->insert( + 'order_state_lang', + $row + ); + } + if (file_exists(dirname(__FILE__).'/../../data/img/os/Overbooking_partial_paid.gif')) { + copy(dirname(__FILE__).'/../../data/img/os/Overbooking_partial_paid.gif', _PS_ROOT_DIR_.'/img/os/'.$last_id.'.gif'); + } + Db::getInstance()->insert('configuration',[ + 'name' => 'PS_OS_OVERBOOKING_PARTIAL_PAID', + 'value' => $last_id, + 'date_add' => date('Y-m-d H:i:s'), + 'date_upd' => date('Y-m-d H:i:s') + ]); + } +} \ No newline at end of file diff --git a/install/upgrade/php/update_tabs_161.php b/install/upgrade/php/update_tabs_161.php new file mode 100644 index 000000000..0fbd7331c --- /dev/null +++ b/install/upgrade/php/update_tabs_161.php @@ -0,0 +1,58 @@ +delete('tab', 'id_tab IN ('.implode(', ', $ids).')'); + Db::getInstance()->delete('tab_lang', 'id_tab IN ('.implode(', ', $ids).')'); + } + + // remove id parent of stats tab + $idAdminStats = get_tab_id('AdminStats'); + $position = Db::getInstance()->getValue('SELECT MAX(`position`) FROM `'._DB_PREFIX_.'tab` WHERE `id_parent` = 0'); + Db::getInstance()->update('tab', array('id_parent' => 0, 'position' => ($position + 1)), '`id_tab` = '.$idAdminStats); +} + +function get_tab_id($class_name) +{ + static $cache = array(); + + if (!isset($cache[$class_name])) { + $cache[$class_name] = Db::getInstance()->getValue('SELECT id_tab FROM '._DB_PREFIX_.'tab WHERE class_name = \''.pSQL($class_name).'\''); + } + return $cache[$class_name]; +} \ No newline at end of file diff --git a/install/upgrade/sql/1.6.1.0.sql b/install/upgrade/sql/1.6.1.0.sql new file mode 100644 index 000000000..9d3cf32d9 --- /dev/null +++ b/install/upgrade/sql/1.6.1.0.sql @@ -0,0 +1,65 @@ +SET NAMES 'utf8'; + +INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES + ('PS_ALLOW_EMP', '0', NOW(), NOW()), + ('PS_ALLOW_EMP_MAX_ATTEMPTS', '0', NOW(), NOW()), + ('PS_KPI_BEST_SELLING_ROOM_TYPE_NB_DAYS', '30', NOW(), NOW()), + ('PS_ORDER_LIST_PRICE_DISPLAY_CURRENCY', '1', NOW(), NOW()), + ('PS_OVERBOOKING_ORDER_ACTION', '1', NOW(), NOW()), + ('PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY', '2', NOW(), NOW()), + + ('PS_CUSTOMER_BIRTHDATE', '1', NOW(), NOW()), + + ('PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS', '5', NOW(), NOW()), + ('PS_KPI_REVPAC_NB_DAYS', '30', NOW(), NOW()), + ('PS_KPI_CONVERSION_RATE_NB_DAYS', '30', NOW(), NOW()), + ('PS_ORDER_KPI_AVG_ORDER_VALUE_NB_DAYS', '30', NOW(), NOW()), + ('PS_ORDER_KPI_PER_VISITOR_PROFIT_NB_DAYS', '30', NOW(), NOW()), + ('PS_KPI_NEW_CUSTOMERS_NB_DAYS', '30', NOW(), NOW()), + + ('PS_BACKDATE_ORDER_SUPERADMIN', '1', NOW(), NOW()), + ('PS_BACKDATE_ORDER_EMPLOYEES', '0', NOW(), NOW()); + +UPDATE `PREFIX_configuration` +set `value` = 1 +WHERE `name` = 'PS_TAX_DISPLAY'; + +UPDATE `PREFIX_configuration` +set `value` = 'id_address_invoice' +WHERE `name` = 'PS_TAX_ADDRESS_TYPE'; + + +UPDATE `PREFIX_configuration` +set `value` = STR_TO_DATE(`value`, '%d-%m-%Y') +WHERE `name` = 'MAX_GLOBAL_BOOKING_DATE'; + +UPDATE `PREFIX_product` +set `show_at_front` = 1 +WHERE `booking_product` = 1; +UPDATE `PREFIX_product_shop` ps +INNER JOIN `PREFIX_product` p on(ps.`id_product` = p.`id_product`) +set ps.`show_at_front` = 1 +WHERE p.`booking_product` = 1; + +INSERT INTO `PREFIX_cart_customer_guest_detail` +(`phone`, `id_gender`, `firstname`, `lastname`, `email`, `id_cart`, `date_add`, `date_upd`) +SELECT + IF(a.phone_mobile IS NOT NULL AND a.phone_mobile != '', a.phone_mobile, a.phone) AS phone, + c.id_gender, c.firstname, c.lastname, c.email, 0 AS id_cart, + NOW() AS date_add, NOW() AS date_upd +FROM + `PREFIX_address` a +INNER JOIN + `PREFIX_customer` c ON a.`id_customer` = c.`id_customer` +WHERE + a.`auto_generated` = 0 +GROUP BY + c.`id_customer`; + + + +/* PHP:add_order_detail_meta_page_161(); */; +/* PHP:clean_product_description_161(); */; +/* PHP:update_tabs_161(); */; +/* PHP:update_order_states_161(); */; + diff --git a/modules/blocknavigationmenu/upgrade/upgrade-1.1.3.php b/modules/blocknavigationmenu/upgrade/upgrade-1.1.3.php new file mode 100644 index 000000000..8d227a83e --- /dev/null +++ b/modules/blocknavigationmenu/upgrade/upgrade-1.1.3.php @@ -0,0 +1,46 @@ +initUpgrade(); +} + +class upgradeBlockNavigationMenu113 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function initUpgrade() + { + return ($this->module->registerHook('actionObjectCMSUpdateAfter') + && $this->module->registerHook('actionObjectCMSDeleteAfter')); + + } +} diff --git a/modules/blocknewsletter/upgrade/index.php b/modules/blocknewsletter/upgrade/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/blocknewsletter/upgrade/index.php @@ -0,0 +1,32 @@ +registerHooks() + || !$objUpgrade->callInstallTab() + ) { + return false; + } + + return true; +} + +class upgradeBlocknewsletter230 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function registerHooks() + { + if (!$this->module->registerHook('actionObjectCustomerUpdateBefore') + || !$this->module->registerHook('actionCustomerCartRulesModifier') + || !$this->module->registerHook('actionValidateCartRule') + || !$this->module->registerHook('actionObjectCustomerDeleteAfter') + ) { + return false; + } + + return true; + } + + public function callInstallTab() + { + $result = $this->installTab('AdminParentNewsletter', 'Newsletter', false, true); + $result &= $this->installTab('AdminNewsletter', 'Configuration', 'AdminParentNewsletter', true); + + return $result; + } + + public function installTab($className, $tabName, $tabParentName = false, $hidden = false) + { + $tab = new Tab(); + $tab->active = 1; + $tab->class_name = $className; + $tab->name = array(); + foreach (Language::getLanguages(false) as $lang) { + $tab->name[$lang['id_lang']] = $tabName; + } + if ($tabParentName) { + $tab->id_parent = (int) Tab::getIdFromClassName($tabParentName); + } elseif ($hidden) { + $tab->id_parent = -1; + } else { + $tab->id_parent = 0; + } + $tab->module = $this->module->name; + + return $tab->add(); + } +} diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 3aab098e2..f63d25a46 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -62,6 +62,7 @@ class HotelBookingDetail extends ObjectModel public $adults; public $children; public $child_ages; + public $planned_check_out; public $date_add; public $date_upd; @@ -124,6 +125,7 @@ class HotelBookingDetail extends ObjectModel 'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 255, 'required' => true), 'check_in_time' => array('type' => self::TYPE_STRING, 'required' => true), 'check_out_time' => array('type' => self::TYPE_STRING, 'required' => true), + 'planned_check_out' => array('type' => self::TYPE_STRING, 'required' => true), 'adults' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'children' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'child_ages' => array('type' => self::TYPE_STRING), @@ -2136,7 +2138,7 @@ class HotelBookingDetail extends ObjectModel } // delete cart feature prices after room addition success - HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($this->context->cart->id); // =============================================================== // END: Add Process of the old booking @@ -3665,4 +3667,18 @@ class HotelBookingDetail extends ObjectModel return $result; } + + public function add($auto_date = true, $null_values = false) + { + if (!$this->planned_check_out) { + $objHotelBranchInfo = new HotelBranchInformation((int) $this->id_hotel); + $dateTo = new DateTime($this->date_to); + $timeParts = explode(':', $objHotelBranchInfo->check_out); + $dateTo->setTime($timeParts[0], $timeParts[1]); + + $this->planned_check_out = $dateTo->format('Y-m-d H:i:s'); + } + + return parent::add($auto_date, $null_values); + } } diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 7f8a3e151..7ad74427a 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1357,10 +1357,11 @@ class HotelCartBookingData extends ObjectModel $id_room = 0 ) { if ($id_cart && $id_room) { - if ($featurePrice = Db::getInstance()->getRow( - 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp + if ($featurePrice = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp WHERE fp.`id_product` = '.(int) $id_product.' AND fp.`id_cart` = '.(int) $id_cart.' - AND fp.`id_guest` = '.(int) $id_guest.' AND fp.`id_room` = '.(int) $id_room.' AND fp.`active` = 1') + AND fp.`id_guest` = '.(int) $id_guest.' AND fp.`id_room` = '.(int) $id_room.' + AND fp.`active` = 1 AND fp.`date_from` <= \''.pSQL($date).'\' + AND fp.`date_to` >= \''.pSQL($date).'\'') ) { return $featurePrice; } diff --git a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php index 484311892..56b672313 100644 --- a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php +++ b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php @@ -153,6 +153,7 @@ class HotelReservationSystemDb `comment` text NOT NULL, `check_in` datetime NOT NULL, `check_out` datetime NOT NULL, + `planned_check_out` datetime NOT NULL, `date_from` datetime NOT NULL, `date_to` datetime NOT NULL, `total_price_tax_excl` decimal(20,6) NOT NULL, diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index fd1ef9d93..b63d922cf 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -363,7 +363,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $params['roomTypeId'] = $id_product; $params['featurePriceName'] = 'Webservice Feature Price'; $params['dateFrom'] = $dateFrom; - $params['dateTo'] = $dateTo; + $featurePriceDateTo = date('Y-m-d', (strtotime($dateTo) - _TIME_1_DAY_)); + $params['dateTo'] = $featurePriceDateTo; $params['priceImpactWay'] = $priceImpactWay; $params['isSpecialDaysExists'] = 0; $params['jsonSpecialDays'] = null; @@ -376,7 +377,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( $id_product, $dateFrom, - $dateTo, + $featurePriceDateTo, 'specific_date' ); if ($featurePriceExists) { @@ -393,12 +394,12 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( $id_product, $dateFrom, - $dateTo, + $featurePriceDateTo, 'date_range' ); if ($featurePriceExists) { if ($featurePriceExists['date_from'] == $dateFrom - && $featurePriceExists['date_to'] == $dateTo + && $featurePriceExists['date_to'] == $featurePriceDateTo ) { if (!$this->saveFeaturePricePlan( $featurePriceExists['id'], @@ -409,8 +410,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel } } else { for($date = $dateFrom; $date < $dateTo; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { - $currentDate = date('Y-m-d', $date); - $nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate))); + // Creating feature prices day wise, for single days. + $nextDayDate = $currentDate = date('Y-m-d', $date); $params['dateFrom'] = $currentDate; $params['dateTo'] = $nextDayDate; $params['dateSelectionType'] = self::DATE_SELECTION_TYPE_SPECIFIC; @@ -608,20 +609,17 @@ class HotelRoomTypeFeaturePricing extends ObjectModel foreach ($languages as $language) { $roomTypeFeaturePricing->feature_price_name[$language['id_lang']] = $params['featurePriceName']; } + $roomTypeFeaturePricing->date_selection_type = $params['dateSelectionType']; - if ($dateSelectionType == self::DATE_SELECTION_TYPE_RANGE) { - $roomTypeFeaturePricing->date_from = $params['dateFrom']; - $roomTypeFeaturePricing->date_to = $params['dateTo']; - } else { - $roomTypeFeaturePricing->date_from = $params['dateFrom']; - $roomTypeFeaturePricing->date_to = $params['dateTo']; - } + $roomTypeFeaturePricing->date_from = $params['dateFrom']; + $roomTypeFeaturePricing->date_to = $params['dateTo']; $roomTypeFeaturePricing->impact_way = $params['priceImpactWay']; $roomTypeFeaturePricing->is_special_days_exists = $params['isSpecialDaysExists']; $roomTypeFeaturePricing->special_days = $params['jsonSpecialDays']; $roomTypeFeaturePricing->impact_type = $params['priceImpactType']; $roomTypeFeaturePricing->impact_value = $params['impactValue']; $roomTypeFeaturePricing->active = $params['enableFeaturePrice']; + return $roomTypeFeaturePricing->save(); } @@ -651,8 +649,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $totalPrice['total_price_tax_excl'] = 0; $featureImpactPriceTE = 0; $featureImpactPriceTI = 0; - $productPriceTI = Product::getPriceStatic((int) $id_product, true, false, 6, null, false, $use_reduc); - $productPriceTE = Product::getPriceStatic((int) $id_product, false, false, 6, null, false, $use_reduc); + $productPriceTI = Product::getPriceStatic((int) $id_product, 1, 0, 6, null, 0, $use_reduc, 1, 0, null, null, null, $nothing, 1, 1, null, 1, 0, $id_group); + $productPriceTE = Product::getPriceStatic((int) $id_product, 0, 0, 6, null, 0, $use_reduc, 1, 0, null, null, null, $nothing, 1, 1, null, 1, 0, $id_group); if ($productPriceTE) { $taxRate = (($productPriceTI-$productPriceTE)/$productPriceTE)*100; } else { diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php index 8feb56940..ffb137c2f 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php @@ -110,7 +110,8 @@ class RoomTypeServiceProductPrice extends ObjectModel $useTax = null, $id_cart = false, $id_address = null, - $use_reduc= 1 + $use_reduc= 1, + $idGroup = null ) { if ($useTax === null) $useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true; @@ -135,7 +136,8 @@ class RoomTypeServiceProductPrice extends ObjectModel true, null, true, - (int)$idProductRoomType + (int)$idProductRoomType, + $idGroup ); Hook::exec('actionServicePriceModifier', diff --git a/modules/hotelreservationsystem/upgrade/upgrade-1.6.0.php b/modules/hotelreservationsystem/upgrade/upgrade-1.6.0.php new file mode 100644 index 000000000..ab51aec40 --- /dev/null +++ b/modules/hotelreservationsystem/upgrade/upgrade-1.6.0.php @@ -0,0 +1,78 @@ +initUpgrade(); +} + +class UpgradeHotelreservationSystem160 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function initUpgrade() + { + if (!$this->updateTabs() + || !$this->updateDefaultConfiguration() + || !$this->updateHooks() + + ) { + return false; + } + return true; + } + + public function updateHooks() + { + if (!$this->module->registerHook('actionFrontControllerSetMedia') + || !$this->module->registerHook('displayNav') + || !$this->module->registerHook('displayExternalNavigationHook') + ) { + return false; + } + + return true; + } + + public function updateTabs() + { + $id_tab = Tab::getIdFromClassName('AdminAssignHotelFeatures'); + $objTab = new Tab($id_tab); + return $objTab->delete(); + } + + public function updateDefaultConfiguration() + { + Configuration::updateValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER', Configuration::get('WK_HOTEL_GLOBAL_CONTACT_NUMBER')); + Configuration::updateValue('WK_CUSTOMER_SUPPORT_EMAIL', Configuration::get('WK_HOTEL_GLOBAL_CONTACT_EMAIL')); + + return true; + } +} diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index 1e3bc80b5..c813d7f97 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -680,7 +680,7 @@ $(document).ready(function() { }, onSelect: function(selectedDate) { let objDateToMin = $.datepicker.parseDate('dd-mm-yy', selectedDate); - objDateToMin.setDate(objDateToMin.getDate() + 1); + objDateToMin.setDate(objDateToMin.getDate()); $('#feature_plan_date_to').datepicker('option', 'minDate', objDateToMin); }, @@ -705,7 +705,7 @@ $(document).ready(function() { objDateToMin = new Date(); } - objDateToMin.setDate(objDateToMin.getDate() + 1); + objDateToMin.setDate(objDateToMin.getDate()); $('#feature_plan_date_to').datepicker('option', 'minDate', objDateToMin); }, //for calender Css diff --git a/modules/qlocleaner/qlocleaner.php b/modules/qlocleaner/qlocleaner.php index 1bc99a55e..a475b0c55 100644 --- a/modules/qlocleaner/qlocleaner.php +++ b/modules/qlocleaner/qlocleaner.php @@ -85,6 +85,7 @@ class QloCleaner extends Module } Hook::exec('actionCleanData', array('method' => 'checkAndFix')); $html .= $this->displayConfirmation($conf); + Cache::getInstance()->flush(); } elseif (Tools::isSubmit('submitCleanAndOptimize')) { $logs = self::cleanAndOptimize(); if (count($logs)) { @@ -95,14 +96,17 @@ class QloCleaner extends Module } Hook::exec('actionCleanData', array('method' => 'cleanAndOptimize')); $html .= $this->displayConfirmation($conf); + Cache::getInstance()->flush(); } elseif (Tools::getValue('submitTruncateCatalog') && Tools::getValue('checkTruncateCatalog')) { self::truncate('catalog'); Hook::exec('actionCleanData', array('method' => 'catalog')); $html .= $this->displayConfirmation($this->l('Catalog truncated successfuly, please run functional Integrity constraints to clean the database.')); + Cache::getInstance()->flush(); } elseif (Tools::getValue('submitTruncateSales') && Tools::getValue('checkTruncateSales')) { self::truncate('sales'); Hook::exec('actionCleanData', array('method' => 'sales')); $html .= $this->displayConfirmation($this->l('Orders and customers truncated successfuly, please run functional Integrity constraints to clean the database')); + Cache::getInstance()->flush(); } $html .= $this->context->smarty->fetch(_PS_MODULE_DIR_.$this->name.'/views/templates/admin/qlocleaner_script.tpl'); @@ -665,7 +669,8 @@ class QloCleaner extends Module array('warehouse_carrier', 'id_carrier', 'carrier', 'id_carrier'), array('warehouse_product_location', 'id_product', 'product', 'id_product'), array('warehouse_product_location', 'id_warehouse', 'warehouse', 'id_warehouse'), - array('specific_price', 'id_product', 'customer', 'id_customer'), + array('specific_price', 'id_product', 'product', 'id_product'), + array('specific_price', 'id_customer', 'customer', 'id_customer'), array('specific_price', 'id_group', 'group', 'id_group'), array('htl_features_block_data_lang', 'id_features_block', 'htl_features_block_data', 'id_features_block'), array('cart_rule', 'id_customer', 'customer', 'id_customer'), @@ -699,13 +704,18 @@ class QloCleaner extends Module array('profile_lang', 'id_lang', 'lang', 'id_lang'), array('htl_access', 'id_profile', 'profile', 'id_profile'), array('htl_access', 'id_hotel', 'htl_branch_info', 'id'), - array('htl_room_disable_dates', 'id_room_type', 'htl_room_type', 'id'), + array('htl_room_disable_dates', 'id_room_type', 'htl_room_type', 'id_product'), array('htl_room_type_feature_pricing_lang', 'id_feature_price', 'htl_room_type_feature_pricing', 'id_feature_price'), array('htl_room_type_feature_pricing_lang', 'id_lang', 'lang', 'id_lang'), array('htl_order_restrict_date', 'id_hotel', 'htl_branch_info', 'id'), array('htl_branch_refund_rules', 'id_hotel', 'htl_branch_info', 'id'), array('htl_order_refund_rules_lang', 'id_refund_rule', 'htl_branch_refund_rules', 'id_refund_rule'), array('htl_advance_payment', 'id_product', 'product', 'id_product'), + array('htl_order_refund_rules_lang', 'id_lang', 'lang', 'id_lang'), + array('htl_room_type_service_product', 'id_product', 'product', 'id_product'), + array('htl_room_type_service_product', 'id_element', 'product', 'id_product'), + array('htl_room_type_service_product_price', 'id_product', 'product', 'id_product'), + array('htl_room_type_service_product_price', 'id_element', 'product', 'id_product'), ) ); } @@ -802,7 +812,9 @@ class QloCleaner extends Module 'htl_room_block_data', 'htl_features_block_data', 'htl_testimonials_block_data', - 'htl_room_type_global_demand' + 'htl_room_type_global_demand', + 'htl_room_type_service_product', + 'htl_room_type_service_product_price', ) ); } @@ -854,8 +866,6 @@ class QloCleaner extends Module 'htl_room_type_service_product_order_detail', 'htl_room_type_service_product_cart_detail', 'htl_hotel_service_product_cart_detail', - 'htl_order_refund_rules', - 'htl_order_refund_rules_lang', ); } } diff --git a/modules/qlohotelreview/upgrade/index.php b/modules/qlohotelreview/upgrade/index.php new file mode 100644 index 000000000..409280877 --- /dev/null +++ b/modules/qlohotelreview/upgrade/index.php @@ -0,0 +1,32 @@ +initUpgrade(); +} + +class UpgradeQloHotelReview101 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function initUpgrade() + { + return $this->module->registerHook('actionCleanData'); + } +} diff --git a/modules/wkhotelroom/upgrade/upgrade-1.1.9.php b/modules/wkhotelroom/upgrade/upgrade-1.1.9.php new file mode 100644 index 000000000..f259c5e85 --- /dev/null +++ b/modules/wkhotelroom/upgrade/upgrade-1.1.9.php @@ -0,0 +1,44 @@ +initUpgrade(); +} + +class UpgradeWkHotelRoom119 +{ + public function __construct($module) + { + $this->module = $module; + } + + public function initUpgrade() + { + return $this->module->registerHook('actionCleanData'); + } +} diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl index 9ac445d81..561d8a5a5 100644 --- a/themes/hotel-reservation-theme/order-detail.tpl +++ b/themes/hotel-reservation-theme/order-detail.tpl @@ -406,20 +406,6 @@ {$guestInformations['phone']|escape:'html':'UTF-8'} {/if} - - {if isset($address_invoice->phone_mobile) && $address_invoice->phone_mobile} - - {l s='Mobile'} - {$address_invoice->phone_mobile|escape:'html':'UTF-8'} - - {/if} - - {if isset($address_invoice->phone) && $address_invoice->phone} - - {l s='Phone'} - {$address_invoice->phone|escape:'html':'UTF-8'} - - {/if} {/if} {block name='displayOrderDetailGuestDetailsRow'} @@ -798,19 +784,6 @@ {$guestInformations['phone']|escape:'html':'UTF-8'} {/if} - {if isset($address_invoice->phone_mobile) && $address_invoice->phone_mobile} - - {l s='Mobile'} - {$address_invoice->phone_mobile|escape:'html':'UTF-8'} - - {/if} - - {if isset($address_invoice->phone) && $address_invoice->phone} - - {l s='Phone'} - {$address_invoice->phone|escape:'html':'UTF-8'} - - {/if} {/if} {block name='displayOrderDetailGuestDetailsRow'}