diff --git a/admin/themes/default/template/controllers/normal_products/helpers/tree/tree.tpl b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree.tpl deleted file mode 100644 index ce2479919..000000000 --- a/admin/themes/default/template/controllers/normal_products/helpers/tree/tree.tpl +++ /dev/null @@ -1,39 +0,0 @@ -{* -* 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 -*} -{extends file="helpers/tree/tree.tpl"} - \ No newline at end of file diff --git a/admin/themes/default/template/helpers/tree/tree.tpl b/admin/themes/default/template/helpers/tree/tree.tpl index c4ecff65f..30c4283c6 100644 --- a/admin/themes/default/template/helpers/tree/tree.tpl +++ b/admin/themes/default/template/helpers/tree/tree.tpl @@ -84,6 +84,22 @@ }); {/if} + {if isset($auto_select_children) && $auto_select_children == true} + $('#{$id|escape:'html':'UTF-8'}').find(':input[type=checkbox]').on('click', function(){ + if ($(this).is(":checked")) { + $(this).closest('.tree-folder').find(':input[type=checkbox]').each(function(){ + $(this).prop('checked', true); + $(this).parent().addClass('tree-selected'); + }); + } else { + $(this).closest('.tree-folder').find(':input[type=checkbox]').each(function(){ + $(this).prop('checked', false); + $(this).parent().removeClass('tree-selected'); + }); + } + }); + {/if} + $(document).ready(function () { var tree = $("#{$id|escape:'html':'UTF-8'}").tree('collapseAll'); diff --git a/classes/Address.php b/classes/Address.php index 5a0bd2498..a9360be5a 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -149,13 +149,16 @@ class AddressCore extends ObjectModel protected $webserviceParameters = array( 'objectsNodeName' => 'addresses', 'fields' => array( - 'id_customer' => array('xlink_resource'=> 'customers'), + 'id_customer' => array('xlink_resource'=> 'customers', 'required' => true), 'id_manufacturer' => array('xlink_resource'=> 'manufacturers'), 'id_supplier' => array('xlink_resource'=> 'suppliers'), 'id_warehouse' => array('xlink_resource'=> 'warehouse'), 'id_country' => array('xlink_resource'=> 'countries'), 'id_state' => array('xlink_resource'=> 'states'), ), + 'hidden_fields' => array( + 'id_hotel' + ), ); /** @@ -551,4 +554,37 @@ class AddressCore extends ObjectModel ) '); } + + public function validateFields($die = true, $error_return = false) + { + if (isset($this->webservice_validation) && $this->webservice_validation) { + if (!$this->id_customer || !Validate::isLoadedObject(new Customer((int) $this->id_customer))) { + $message = Tools::displayError('Invalid Id customer.'); + } elseif (Customer::getCustomerIdAddress($this->id_customer, false) && !$this->id) { + $message = Tools::displayError('A single customer cannot have multiple addresses.'); + } elseif (!$this->id_country || !Validate::isLoadedObject($objCountry = new Country($this->id_country))) { + $message = Tools::displayError('Invalid Id country'); + } elseif ($objCountry->contains_states + && (!$this->id_state || !Validate::isLoadedObject($objState = new State((int) $this->id_state))) + ) { + $message = Tools::displayError('Invalid Id state'); + } elseif (isset($objState) && ($objCountry->id != $objState->id_country)) { + $message = Tools::displayError('The given provided Id state does not belongs to the provided Id country'); + } elseif ($objCountry->zip_code_format && !$objCountry->checkZipCode($this->postcode)) { + $message = Tools::displayError('Your Zip/postal code is incorrect'); + } elseif (empty($this->postcode) && $objCountry->need_zip_code) { + $message = Tools::displayError('A Zip/postal code is required.'); + } elseif ($this->postcode && !Validate::isPostCode($this->postcode)) { + $message = Tools::displayError('The Zip/postal code is invalid.'); + } + + if (isset($message)) { + if ($die) { + throw new PrestaShopException($message); + } + return $error_return ? $message : false; + } + } + return parent::validateFields($die, $error_return); + } } diff --git a/classes/Cart.php b/classes/Cart.php index 1c844c9db..edc9cee2f 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -4698,7 +4698,7 @@ class CartCore extends ObjectModel public function getWsCartBookings() { return Db::getInstance()->executeS(' - SELECT `id` + SELECT `id`, `date_from`, `date_to`, `id_hotel`, `id_product` FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE id_cart = '.(int)$this->id.' ORDER BY `id` ASC' ); diff --git a/classes/CustomerMessage.php b/classes/CustomerMessage.php index 33792addf..99522fa0d 100644 --- a/classes/CustomerMessage.php +++ b/classes/CustomerMessage.php @@ -141,4 +141,12 @@ class CustomerMessageCore extends ObjectModel '); } + public function validateFields($die = true, $error_return = false) + { + if (isset($this->webservice_validation) && $this->webservice_validation) { + $this->message = trim($this->message); + } + + return parent::validateFields($die, $error_return); + } } diff --git a/classes/Guest.php b/classes/Guest.php index 15a71165c..fd41846d2 100644 --- a/classes/Guest.php +++ b/classes/Guest.php @@ -173,9 +173,18 @@ class GuestCore extends ObjectModel public function mergeWithCustomer($idGuest, $idCustomer) { // Since the guests are merged, the guest id in the connections table must be changed too - Db::getInstance()->update('connections', [ - 'id_guest' => (int) $idGuest, - ], 'id_guest = ' . (int) $this->id); + // If guest entry is already there in the connection within 30 mins then delete the visitor entry else update it with guest id of the customer + + $sql = 'SELECT SQL_NO_CACHE `id_guest` FROM `'._DB_PREFIX_.'connections` + WHERE `id_guest` = '.(int)$idGuest.' AND `date_add` > \''.pSQL(date('Y-m-d H:i:00', time() - 1800)).'\''. + Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).' ORDER BY `date_add` DESC'; + if (Db::getInstance()->getRow($sql, false)) { + Db::getInstance()->delete('connections', 'id_guest = ' . (int) $this->id); + } else { + Db::getInstance()->update('connections', [ + 'id_guest' => (int) $idGuest, + ], 'id_guest = ' . (int) $this->id); + } // Since the guests are merged, the guest id in the cart table must be changed too Db::getInstance()->update('cart', [ @@ -198,4 +207,21 @@ class GuestCore extends ObjectModel $guest->save(); $cookie->id_guest = (int)($guest->id); } + + public function validateFields($die = true, $error_return = false) + { + if (isset($this->webservice_validation) && $this->webservice_validation) { + if ((int) $this->id_customer && !Validate::isLoadedObject(new Customer((int) $this->id_customer))) { + $message = Tools::displayError('Invalid Id customer.'); + } + + if (isset($message)) { + if ($die) { + throw new PrestaShopException($message); + } + return $error_return ? $message : false; + } + } + return parent::validateFields($die, $error_return); + } } diff --git a/classes/Product.php b/classes/Product.php index c47bb1f04..862dd457d 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -373,36 +373,22 @@ class ProductCore extends ObjectModel protected $webserviceParameters = array( 'objectMethods' => array( - 'add' => 'addWs', - 'update' => 'updateWs', + 'add' => 'addWsRoomType', + 'update' => 'updateWsRoomType', 'delete' => 'deleteWs' ), - 'objectsNodeName' => 'room_types', 'objectNodeName' => 'room_type', + 'retrieveData' => array( + 'retrieveMethod' => 'getRoomTypesObjectList' + ), 'fields' => array( - 'id_hotel' => array( - 'getter' => 'getWsHotel', - 'setter' => 'setWsHotel', - 'xlink_resource' => 'hotels' - ), - 'adults' => array( - 'getter' => 'getWsAdults', - 'setter' => 'setWsAdults', - ), - 'children' => array( - 'getter' => 'getWsChildren', - 'setter' => 'setWsChildren', - ), - 'id_manufacturer' => array( - 'xlink_resource' => 'manufacturers' - ), - 'id_supplier' => array( - 'xlink_resource' => 'suppliers' - ), - 'id_category_default' => array( - 'xlink_resource' => 'categories' - ), + 'id_hotel' => array('getter' => 'getWsHotel','setter' => 'setWsHotel', 'xlink_resource' => 'hotels'), + 'adults' => array('getter' => 'getWsAdults','setter' => 'setWsAdults'), + 'children' => array('getter' => 'getWsChildren','setter' => 'setWsChildren'), + 'id_manufacturer' => array('xlink_resource' => 'manufacturers'), + 'id_supplier' => array('xlink_resource' => 'suppliers'), + 'id_category_default' => array('xlink_resource' => 'categories'), 'new' => array(), 'cache_default_attribute' => array(), 'id_default_image' => array( @@ -420,36 +406,28 @@ class ProductCore extends ObjectModel // 'resourceName' => 'combinations' // ) // ), - 'id_tax_rules_group' => array( - 'xlink_resource' => array( - 'resourceName' => 'tax_rule_groups' - ) - ), - 'position_in_category' => array( - 'getter' => 'getWsPositionInCategory', - 'setter' => 'setWsPositionInCategory' - ), + 'id_tax_rules_group' => array('xlink_resource' => array('resourceName' => 'tax_rule_groups')), + 'position_in_category' => array('getter' => 'getWsPositionInCategory', 'setter' => 'setWsPositionInCategory'), // 'manufacturer_name' => array( // 'getter' => 'getWsManufacturerName', // 'setter' => false // ), - 'quantity' => array( - 'getter' => false, - 'setter' => false - ), - 'type' => array( - 'getter' => 'getWsType', - 'setter' => 'setWsType', - ), - 'id_advance_paypent' => array( - 'xlink_resource' => array( - 'resourceName' => 'advance_payments' - ), - 'getter' => 'getWsRoomTypeAdvancePayment', - 'setter' => false - ), + 'type' => array('getter' => 'getWsType', 'setter' => 'setWsType'), ), 'associations' => array( + 'advance_payments' => array( + 'resource' => 'advance_payment', + 'getter' => 'getWsAdvancePayments', + 'setter' => 'setWsAdvancePayments', + 'fields' => array( + 'id' => array(), + 'payment_type' => array(), + 'tax_include' => array(), + 'value' => array(), + 'active' => array(), + 'calculate_from' => array(), + ), + ), 'categories' => array( 'resource' => 'category', 'fields' => array( @@ -466,7 +444,8 @@ class ProductCore extends ObjectModel 'id' => array('required' => true), ) ), - 'tags' => array('resource' => 'tag', + 'tags' => array( + 'resource' => 'tag', 'fields' => array( 'id' => array('required' => true), ) @@ -484,13 +463,78 @@ class ProductCore extends ObjectModel ) ), 'extra_demands' => array( - 'setter' => false, 'resource' => 'extra_demand', + 'fields' => array( + 'id' => array('required' => true), + 'id_option' => array(), + 'price' => array(), + ) + ), + 'services' => array( + 'resource' => 'service', + 'fields' => array( + 'id' => array('validate' => 'isUnsignedId', 'required' => true), + 'price' => array('validate' => 'isPrice', 'required' => true), + 'id_tax_rules_group' => array('validate' => 'isUnsignedId') + ) + ), + ), + 'hidden_fields' => array( + 'booking_product', + 'service_product_type' + ), + ); + + protected $webserviceServicesParameters = array( + 'objectMethods' => array( + 'add' => 'addWsServices', + 'update' => 'updateWsServices', + 'delete' => 'deleteWs' + ), + 'objectsNodeName' => 'services', + 'objectNodeName' => 'service', + 'retrieveData' => array( + 'retrieveMethod' => 'getServicesObjectList' + ), + 'fields' => array( + 'id_manufacturer' => array('xlink_resource' => 'manufacturers'), + 'id_supplier' => array('xlink_resource' => 'suppliers'), + 'id_category_default' => array('xlink_resource' => 'categories'), + 'new' => array(), + 'cache_default_attribute' => array(), + 'id_default_image' => array( + 'getter' => 'getCoverWs', + 'setter' => 'setCoverWs', + 'xlink_resource' => array( + 'resourceName' => 'images', + 'subResourceName' => 'room_types' + ) + ), + 'id_tax_rules_group' => array('xlink_resource' => array('resourceName' => 'tax_rule_groups')), + 'position_in_category' => array('getter' => 'getWsPositionInCategory', 'setter' => 'setWsPositionInCategory'), + // 'manufacturer_name' => array( + // 'getter' => 'getWsManufacturerName', + // 'setter' => false + // ), + 'quantity' => array('getter' => false, 'setter' => false), + 'type' => array('getter' => 'getWsType', 'setter' => 'setWsType'), + ), + 'associations' => array( + 'categories' => array( + 'resource' => 'category', + 'fields' => array('id' => array('required' => true)) + ), + 'images' => array('resource' => 'image', 'fields' => array('id' => array())), + 'feature_prices' => array( + 'setter' => false, 'resource' => 'feature_price', 'fields' => array( 'id' => array('required' => true), ) ), ), + 'hidden_fields' => array( + 'booking_product', + ), ); const CUSTOMIZE_FILE = 0; @@ -5695,8 +5739,11 @@ class ProductCore extends ObjectModel */ public function getCoverWs() { - $result = $this->getCover($this->id); - return $result['id_image']; + if ($result = $this->getCover($this->id)) { + return $result['id_image']; + } + + return false; } /** @@ -5985,8 +6032,9 @@ class ProductCore extends ObjectModel return true; } - public function addWs($autodate = true, $null_values = false) + public function addWsRoomType($autodate = true, $null_values = false) { + $this->booking_product = 1; if ($success = $this->add($autodate, $null_values)) { if (Configuration::get('PS_SEARCH_INDEXATION')) { Search::indexation(false, $this->id); @@ -5998,19 +6046,56 @@ class ProductCore extends ObjectModel return $success; } - public function updateWs($null_values = false) + public function updateWsRoomType($null_values = false) { - $success = parent::update($null_values); - if ($success && Configuration::get('PS_SEARCH_INDEXATION')) { - Search::indexation(false, $this->id); + if (self::isBookingProduct($this->id)) { + $this->booking_product = 1; // Since there is nothing set from the API, it might get set as false + $success = parent::update($null_values); + if ($success && Configuration::get('PS_SEARCH_INDEXATION')) { + Search::indexation(false, $this->id); + } + + $this->setWsRoomTypeInfo(); + + Hook::exec('updateProduct', array('id_product' => (int)$this->id)); + return $success; } - $this->setWsRoomTypeInfo(); + WebserviceRequest::getInstance()->setError(500, Tools::displayError('Room type not found.'), 134); + + return false; + } + + public function addWsServices() + { + $this->booking_product = 0; + if ($success = $this->add()) { + if (Configuration::get('PS_SEARCH_INDEXATION')) { + Search::indexation(false, $this->id); + } + } - Hook::exec('updateProduct', array('id_product' => (int)$this->id)); return $success; } + public function updateWsServices($null_values = false) + { + if (!self::isBookingProduct($this->id)) { + $this->booking_product = 0; // Since there is nothing set from the API. + $success = parent::update($null_values); + if ($success && Configuration::get('PS_SEARCH_INDEXATION')) { + Search::indexation(false, $this->id); + } + + Hook::exec('updateProduct', array('id_product' => (int)$this->id)); + return $success; + } + + WebserviceRequest::getInstance()->setError(500, Tools::displayError('Service not found.'), 134); + + return false; + } + /** * For a given product, returns its real quantity * @@ -6370,6 +6455,20 @@ class ProductCore extends ObjectModel return $cache_id; } + public function getRoomTypesObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit) + { + $sql_filter .= ' AND main.`booking_product` = 1'; + + return parent::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit); + } + + public function getServicesObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit) + { + $sql_filter .= ' AND main.`booking_product` = 0'; + + return parent::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit); + } + public static function setPackStockType($id_product, $pack_stock_type) { return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product p @@ -6394,10 +6493,55 @@ class ProductCore extends ObjectModel public function getWsAdvancePayments() { return Db::getInstance()->executeS( - 'SELECT `id` FROM `'._DB_PREFIX_.'htl_advance_payment` WHERE `id_product` = '.(int)$this->id.' ORDER BY `id` ASC' + 'SELECT * FROM `'._DB_PREFIX_.'htl_advance_payment` WHERE `id_product` = '.(int)$this->id.' ORDER BY `id` ASC' ); } + public function setWsAdvancePayments($adv_payment) + { + $obj_adv_pmt = new HotelAdvancedPayment(); + if (!$adv_payment) { + if ($adv_pmt_info = $obj_adv_pmt->getIdAdvPaymentByIdProduct($this->id)) { + $obj_adv_pmt = new HotelAdvancedPayment((int) $adv_pmt_info['id']); + } + + $obj_adv_pmt->payment_type = ''; + $obj_adv_pmt->id_product = $this->id; + $obj_adv_pmt->value = ''; + $obj_adv_pmt->id_currency = ''; + $obj_adv_pmt->tax_include = ''; + $obj_adv_pmt->calculate_from = 0; + $obj_adv_pmt->active = 0; + + return $obj_adv_pmt->save(); + } else if (is_array($adv_payment) && count($adv_payment) == 1) { + $fields = array_shift($adv_payment); + if (!Validate::isLoadedObject($obj_adv_pmt = new HotelAdvancedPayment($fields['id']))) { + if ($adv_pmt_info = $obj_adv_pmt->getIdAdvPaymentByIdProduct($this->id)) { + $obj_adv_pmt = new HotelAdvancedPayment((int) $adv_pmt_info['id']); + } + } + + $obj_adv_pmt->id_product = $this->id; + $obj_adv_pmt->active = 1; + $obj_adv_pmt->payment_type = $fields['payment_type']; + $obj_adv_pmt->value = $fields['value']; + + if ($fields['payment_type'] == 2) { + $obj_adv_pmt->id_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT'); + } else { + $obj_adv_pmt->id_currency = ''; + } + + $obj_adv_pmt->tax_include = $fields['tax_include']; + $obj_adv_pmt->calculate_from = $fields['calculate_from']; + + return $obj_adv_pmt->save(); + } + + return false; + } + public function getWsHotel() { return Db::getInstance()->getValue( @@ -6421,8 +6565,41 @@ class ProductCore extends ObjectModel public function getWsExtraDemands() { - return Db::getInstance()->getValue( - 'SELECT `id_global_demand` as `id` FROM `'._DB_PREFIX_.'htl_room_type_demand` WHERE `id_product` = '.(int)$this->id + $objHotelRoomTypeDemand = new HotelRoomTypeDemand(); + $selectedDemands = Db::getInstance()->executeS( + 'SELECT `id_global_demand` as `id` FROM `'._DB_PREFIX_.'htl_room_type_demand` + WHERE `id_product` = '.(int)$this->id + ); + $res = array(); + $demands = $objHotelRoomTypeDemand->getRoomTypeDemands($this->id); + if ($selectedDemands) { + foreach ($selectedDemands as $id_demand => $demand) { + $option['id'] = $demand['id']; + if (isset($demands[$demand['id']]['adv_option']) && count($demands[$demand['id']]['adv_option'])) { + foreach ($demands[$demand['id']]['adv_option'] as $id_option => $adv_option) { + $option['id_option'] = $id_option; + $option['price'] = $adv_option['price_tax_excl']; + $res[] = $option; + } + } else { + $option['id_option'] = false; + $option['price'] = $demand['price_tax_excl']; + $res[] = $option; + } + } + } + + return $res; + } + + public function getWsServices() + { + return Db::getInstance()->executeS( + 'SELECT spp.`price`, spp.`id_tax_rules_group`, sp.`id_product` AS id + FROM `'._DB_PREFIX_.'htl_room_type_service_product` sp + LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_price` spp + ON (spp.`id_product` = sp.`id_product` AND spp.`id_element` = sp.`id_element` AND spp.`element_type` = sp.`element_type`) + WHERE sp.`id_element` = '.(int)$this->id ); } @@ -6476,4 +6653,106 @@ class ProductCore extends ObjectModel { return $this->delete(); } + + public function setWsExtraDemands($demands) + { + Db::getInstance()->execute(' + DELETE FROM `'._DB_PREFIX_.'htl_room_type_demand` + WHERE `id_product` = '.(int)$this->id + ); + Db::getInstance()->execute(' + DELETE FROM `'._DB_PREFIX_.'htl_room_type_demand_price` + WHERE `id_product` = '.(int)$this->id + ); + $objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption(); + $savedDemands = array(); + foreach ($demands as $globalDemand) { + if (Validate::isLoadedObject($objGlobalDemand = new HotelRoomTypeGlobalDemand($globalDemand['id']))) { + if (!isset($savedDemands[$globalDemand['id']])) { + $objRoomTypeDemand = new HotelRoomTypeDemand(); + $objRoomTypeDemand->id_product = $this->id; + $objRoomTypeDemand->id_global_demand = $objGlobalDemand->id; + $objRoomTypeDemand->save(); + $savedDemands[$globalDemand['id']] = $objRoomTypeDemand->id; + } + + if (isset($globalDemand['price'])) { + if ($objAdvOption->getGlobalDemandAdvanceOptions($objGlobalDemand->id) + && isset($globalDemand['id_option']) + && Validate::isLoadedObject($objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($globalDemand['id_option'])) + ) { + if ($globalDemand['price'] != $objAdvOption->price) { + $objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice(); + $objRoomTypeDemandPrice->id_product = $this->id; + $objRoomTypeDemandPrice->id_global_demand = $objGlobalDemand->id; + $objRoomTypeDemandPrice->id_option = $objAdvOption->id; + $objRoomTypeDemandPrice->price = $globalDemand['price']; + $objRoomTypeDemandPrice->save(); + } + } else { + // save selected demands prices for this room type + if ($objGlobalDemand->price != $globalDemand['price']) { + $objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice(); + $objRoomTypeDemandPrice->id_product = $this->id; + $objRoomTypeDemandPrice->id_global_demand = $objGlobalDemand->id; + $objRoomTypeDemandPrice->id_option = 0; + $objRoomTypeDemandPrice->price = $globalDemand['price']; + $objRoomTypeDemandPrice->save(); + } + } + } + } + } + + return true; + } + + public function setWsServices($services) + { + Db::getInstance()->execute(' + DELETE FROM `'._DB_PREFIX_.'htl_room_type_service_product` + WHERE `id_element` = '.(int)$this->id + ); + Db::getInstance()->execute(' + DELETE FROM `'._DB_PREFIX_.'htl_room_type_service_product_price` + WHERE `id_element` = '.(int)$this->id + ); + if ($this->booking_product) { + if ($allServiceProducts = $this->getServiceProducts()) { + $formttedServiceProducts = array(); + foreach ($allServiceProducts as $product) { + $formttedServiceProducts[$product['id_product']] = $product; + } + + $allServiceProducts = $formttedServiceProducts; + + foreach ($services as $service) { + if (isset($service['id']) + && Validate::isLoadedObject($objServiceProduct = new Product($service['id'])) + && !$objServiceProduct->booking_product + && isset($allServiceProducts[$objServiceProduct->id]) + ) { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $objRoomTypeServiceProduct->addRoomProductLink( + $objServiceProduct->id, + $this->id, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + ); + + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $objRoomTypeServiceProductPrice->id_product = $objServiceProduct->id; + $objRoomTypeServiceProductPrice->id_element = $this->id; + $objRoomTypeServiceProductPrice->element_type = RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE; + $objRoomTypeServiceProductPrice->price = isset($service['price']) ? $service['price'] : $allServiceProducts[$objServiceProduct->id]['price']; + $objRoomTypeServiceProductPrice->id_tax_rules_group = isset($service['id_tax_rules_group']) ? $service['id_tax_rules_group'] : $allServiceProducts[$objServiceProduct->id]['id_tax_rules_group']; + $objRoomTypeServiceProductPrice->save(); + } + } + } + } else { + return false; + } + + return true; + } } diff --git a/classes/TranslatedConfiguration.php b/classes/TranslatedConfiguration.php index 43ba573c1..1e1d68358 100644 --- a/classes/TranslatedConfiguration.php +++ b/classes/TranslatedConfiguration.php @@ -46,7 +46,7 @@ class TranslatedConfigurationCore extends Configuration 'id_shop' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'), 'value' => array('type' => self::TYPE_STRING, 'lang' => true), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), - 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), + 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'lang' => true), ), ); diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 74150d376..d30d831c1 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -1216,6 +1216,7 @@ class FrontControllerCore extends Controller */ if ($this->context->language->is_rtl) { $this->addCSS(_THEME_CSS_DIR_.'rtl.css'); + $this->addCSS(_THEME_CSS_DIR_.'rtl_grid.css'); $this->addCSS(_THEME_CSS_DIR_.$this->context->language->iso_code.'.css'); } } diff --git a/classes/helper/HelperTree.php b/classes/helper/HelperTree.php index 0a3824205..d79bea095 100644 --- a/classes/helper/HelperTree.php +++ b/classes/helper/HelperTree.php @@ -29,6 +29,7 @@ class HelperTreeCore extends TreeCore private $_use_bulk_actions; private $_use_checkbox; private $_show_collapse_expand_button = true; + private $_auto_select_children = false; private $_max_height = 350; @@ -43,6 +44,18 @@ class HelperTreeCore extends TreeCore return (isset($this->_use_search) && $this->_use_search); } + public function setAutoSelectChildren($value) + { + $this->_auto_select_children = (bool)$value; + return $this; + } + + public function autoSelectChildren() + { + return (isset($this->_auto_select_children) && $this->_auto_select_children); + } + + public function setUseBulkActions($value) { $this->_use_bulk_actions = (bool)$value; @@ -119,6 +132,7 @@ class HelperTreeCore extends TreeCore ); $this->setAttribute('use_search', $this->useSearch()); } + $this->setAttribute('auto_select_children', $this->autoSelectChildren()); if ($this->showCollapseExpandButton()) { $collapse_all = new TreeToolbarLink( diff --git a/classes/webservice/WebserviceOutputBuilder.php b/classes/webservice/WebserviceOutputBuilder.php index e8e793f0a..cdba833eb 100644 --- a/classes/webservice/WebserviceOutputBuilder.php +++ b/classes/webservice/WebserviceOutputBuilder.php @@ -632,6 +632,7 @@ class WebserviceOutputBuilderCore $value = $object_assoc; } if (empty($fields_assoc)) { + $value['id'] = isset($value['id']) ? $value['id'] : ''; $fields_assoc = array(array('id' => $value['id'])); } $output_details .= $this->renderFlatAssociation($object, $depth, $assoc_name, $association['resource'], $fields_assoc, $value, $parent_details); @@ -680,7 +681,7 @@ class WebserviceOutputBuilderCore $field['sqlId'] = 'id'; $field['value'] = isset($object_assoc['id']) ? $object_assoc['id'] : null; } elseif (!isset($field['sqlId'])) { - $field['sqlId'] = $field_name; + $field['sqlId'] = $field_name ? $field_name : 'id'; $field['value'] = isset($object_assoc[$field_name]) ? $object_assoc[$field_name] : null; } @@ -829,4 +830,10 @@ class WebserviceOutputBuilderCore { $this->fieldsToDisplay = $fields; } + + public function setWsParameters($class, $parameters) + { + WebserviceOutputBuilder::$_cache_ws_parameters[$class] = $parameters; + } + } diff --git a/classes/webservice/WebserviceOutputXML.php b/classes/webservice/WebserviceOutputXML.php index effbd6ee2..476d9e60d 100644 --- a/classes/webservice/WebserviceOutputXML.php +++ b/classes/webservice/WebserviceOutputXML.php @@ -199,7 +199,7 @@ class WebserviceOutputXMLCore implements WebserviceOutputInterface if (array_key_exists('setter', $params['associations'][$assoc_name]) && !$params['associations'][$assoc_name]['setter']) { $more .= ' readOnly="true"'; } - $more .= ' nodeType="'.$params['associations'][$assoc_name]['resource'].'"'; + $more .= (isset($params['associations'][$assoc_name]['resource'])? ' nodeType="'.$params['associations'][$assoc_name]['resource'].'"' : ' '); if (isset($params['associations'][$assoc_name]['virtual_entity']) && $params['associations'][$assoc_name]['virtual_entity']) { $more .= ' virtualEntity="true"'; } else { diff --git a/classes/webservice/WebserviceRequest.php b/classes/webservice/WebserviceRequest.php index 2d35c03a2..dd8383074 100644 --- a/classes/webservice/WebserviceRequest.php +++ b/classes/webservice/WebserviceRequest.php @@ -290,6 +290,7 @@ class WebserviceRequestCore 'room_type_options' => array('description' => 'The product options','class' => 'AttributeGroup'), 'room_type_option_values' => array('description' => 'The product options value','class' => 'Attribute'), 'room_types' => array('description' => 'The room types','class' => 'Product'), + 'services' => array('description' => 'Services', 'class' => 'Product', 'parameters_attribute' => 'webserviceServicesParameters'), 'states' => array('description' => 'The available states of countries','class' => 'State'), 'stores' => array('description' => 'The stores', 'class' => 'Store'), 'suppliers' => array('description' => 'The product suppliers','class' => 'Supplier'), @@ -512,6 +513,8 @@ class WebserviceRequestCore $object = new $url_resource['class'](); if (isset($this->resourceList[$this->urlSegment[0]]['parameters_attribute'])) { $this->resourceConfiguration = $object->getWebserviceParameters($this->resourceList[$this->urlSegment[0]]['parameters_attribute']); + // Setting the parameters for the output builder in cache for the resources having parameters_attribute. + $this->objOutput->setWsParameters($url_resource['class'], $this->resourceConfiguration); } else { $this->resourceConfiguration = $object->getWebserviceParameters(); } diff --git a/classes/webservice/WebserviceSpecificManagementImages.php b/classes/webservice/WebserviceSpecificManagementImages.php index a72e615ec..f22592428 100644 --- a/classes/webservice/WebserviceSpecificManagementImages.php +++ b/classes/webservice/WebserviceSpecificManagementImages.php @@ -51,6 +51,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage 'room_types' => array(), 'hotels' => array(), 'categories' => array(), + 'extra_service' => array(), // 'manufacturers' => array(), // 'suppliers' => array(), // 'stores' => array(), @@ -286,7 +287,9 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage $this->imageType = $this->wsObject->urlSegment[1]; // if image type requested is room_types then process products images - if ($this->imageType == 'room_types') { + if ($this->imageType == 'room_types' + || $this->imageType == 'extra_services' + ) { $this->imageType = 'products'; } diff --git a/controllers/admin/AdminDashboardController.php b/controllers/admin/AdminDashboardController.php index 11ffe69e6..1fc4a45ae 100644 --- a/controllers/admin/AdminDashboardController.php +++ b/controllers/admin/AdminDashboardController.php @@ -295,9 +295,12 @@ class AdminDashboardControllerCore extends AdminController public function postProcess() { if (Tools::isSubmit('submitDateRange')) { - if (!Validate::isDate(Tools::getValue('date_from')) - || !Validate::isDate(Tools::getValue('date_to'))) { + if (!Validate::isDate(Tools::getValue('date_from')) && !Validate::isDate(Tools::getValue('date_to'))) { $this->errors[] = Tools::displayError('The selected date range is not valid.'); + } elseif (!Validate::isDate(Tools::getValue('date_from'))) { + $this->errors[] = Tools::displayError('Date from in not selected. Please select a date range from the calendar.'); + } elseif (!Validate::isDate(Tools::getValue('date_to'))) { + $this->errors[] = Tools::displayError('Date to in not selected. Please select a date range from the calendar.'); } if (Tools::getValue('datepicker_compare')) { diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index 0e52ca53f..c584a46b6 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -3507,6 +3507,7 @@ class AdminNormalProductsControllerCore extends AdminController 'selectedElements' => $selectedElements ])) ->setUseCheckBox(true) + ->setAutoSelectChildren(true) ->setUseBulkActions(true) ->setUseSearch(true); $data->assign('hotel_tree', $tree->render()); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 16db5f22e..cfa0d9b10 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -91,6 +91,12 @@ class AdminOrdersControllerCore extends AdminController } elseif (Tools::getValue('orders_stay_over')) { $this->_where .= ' AND hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0 AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.' AND hbd.`date_to` > \''.pSQL(date('Y-m-d')).' 00:00:00\''; + } elseif (Tools::getValue('orders_not_paid')) { + $this->_where .= ' AND os.`paid` = 0 AND a.`current_state` NOT IN ('.implode(',', array( + Configuration::get('PS_OS_CANCELED'), + Configuration::get('PS_OS_REFUND'), + Configuration::get('PS_OS_ERROR') + )).')'; } $this->_orderBy = 'id_order'; diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 2a4e6666e..94f56168f 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -516,6 +516,46 @@ class AdminStatsControllerCore extends AdminStatsTabController } } + public static function getRefunds($date_from, $date_to, $granularity = false, $id_hotel = 0) + { + if ($granularity == 'day') { + $refunds = array(); + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' + SELECT + LEFT(`invoice_date`, 10) as date, + SUM(orr.`refunded_amount`) as total_refund_amount, + ( + SELECT hbd.`id_hotel` + FROM`'._DB_PREFIX_.'htl_booking_detail` hbd + WHERE hbd.`id_order` = o.`id_order` LIMIT 1 + ) AS id_hotel + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_return` orr ON (o.id_order = orr.id_order) + LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state) + WHERE orr.`payment_mode` != "" AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1'.' + GROUP BY LEFT(`invoice_date`, 10) HAVING 1 '.HotelBranchInformation::addHotelRestriction($id_hotel)); + + foreach ($result as $row) { + $refunds[strtotime($row['date'])] = $row['total_refund_amount']; + } + + return $refunds; + } else { + return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue( + 'SELECT SUM(orr.`refunded_amount`), + ( + SELECT hbd.`id_hotel` + FROM`'._DB_PREFIX_.'htl_booking_detail` hbd + WHERE hbd.`id_order` = o.`id_order` LIMIT 1 + ) AS id_hotel + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_return` orr ON (o.id_order = orr.id_order) + LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state) + WHERE orr.`payment_mode` != "" AND orr.`id_transaction` != "" AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 HAVING 1 '.HotelBranchInformation::addHotelRestriction($id_hotel) + ); + } + } + public static function getExpenses($date_from, $date_to, $granularity = false, $id_hotel = 0) { $expenses = ($granularity == 'day' ? array() : 0); @@ -1165,7 +1205,7 @@ class AdminStatsControllerCore extends AdminStatsTabController ON (p.`id_product` = hri.`id_product`) WHERE p.`active` = 1 AND hbd.`is_refunded` = 0 - AND hbd.`date_from` < "'.pSQL($dateTo).' 00:00:00" AND hbd.`date_to` > "'.pSQL($dateFrom).' 00:00:00"'. + AND IF(hbd.`id_status` = '. HotelBookingDetail::STATUS_CHECKED_OUT .', hbd.`date_from` < DATE_FORMAT(hbd.`check_out`, "%Y-%m-%d") AND hbd.`date_from` < \''.pSQL($dateTo).'\' AND DATE_FORMAT(hbd.`check_out`, "%Y-%m-%d") > \''.pSQL($dateFrom).'\', hbd.`date_from` < \''.pSQL($dateTo).'\' AND hbd.`date_to` > \''.pSQL($dateFrom).'\')'. HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd') ); @@ -1257,7 +1297,7 @@ class AdminStatsControllerCore extends AdminStatsTabController return $averageDailyRates; } - // Average Daily Rate is the average income per paid occupied room in a given time period + // Average Daily Rate is the average income per occupied room in a given time period public static function getAverageDailyRate($dateFrom, $dateTo, $idHotel = null) { $roomsRevenueByDates = self::getRoomsRevenueForDiscreteDates($dateFrom, $dateTo, $idHotel); @@ -1552,7 +1592,8 @@ class AdminStatsControllerCore extends AdminStatsTabController return $result; } - public static function getTotalRevenueForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) + // Calculate total services revenue (services and demands) + public static function getServicesRevenueForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) { $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; @@ -1570,41 +1611,55 @@ class AdminStatsControllerCore extends AdminStatsTabController $result = array(); foreach ($discreteDates as $discreteDate) { - $cacheKey = 'AdminStats::getTotalRevenueForDiscreteDates'.'_'.(int) $discreteDate['timestamp_from'].'_'. - (!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel)); - if (!Cache::isStored($cacheKey) || !$useCache) { - $sql = 'SELECT SUM((current_parts / total_parts) * total_paid_tax_excl) AS total_revenue - FROM ( - SELECT o.`id_order`, - o.`total_paid_tax_excl` / o.`conversion_rate` AS total_paid_tax_excl, - ( - SELECT SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)) - FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) - WHERE hbd.`id_order` = o.`id_order` - AND p.`active` = 1 AND hbd.`is_refunded` = 0 AND o.`valid` = 1'. - (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').' - ) AS total_parts, - ( - SELECT COUNT(*) - FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) - WHERE hbd.`id_order` = o.`id_order` - AND hbd.`date_from` <= "'.pSQL($discreteDate['date_from']).' 00:00:00" AND hbd.`date_to` >= "'.pSQL($discreteDate['date_to']).' 00:00:00" - AND p.`active` = 1 AND hbd.`is_refunded` = 0 AND o.`valid` = 1'. - (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').' - ) AS current_parts - FROM `'._DB_PREFIX_.'orders` o - HAVING total_parts IS NOT NULL AND current_parts > 0 - ORDER BY o.`id_order` - ) AS t'; + $totalServicesRevenue = 0; + // Calculate services revenue + $servicesRevenueSql = 'SELECT SUM((rtspod.`total_price_tax_excl` / o.`conversion_rate`) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) + FROM `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rtspod + LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd + ON (rtspod.`id_htl_booking_detail` = hbd.`id`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) + WHERE p.`active` = 1 + AND o.`valid` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); - $value = Db::getInstance()->getValue($sql); - $value = !$value ? 0: (float) $value; - Cache::store($cacheKey, $value); + if ($servicesRevenue = Db::getInstance()->getValue($servicesRevenueSql)) { + $totalServicesRevenue += $servicesRevenue; } - $result[$discreteDate['timestamp_from']] = Cache::retrieve($cacheKey); + // Calculate demands revenue + $demandsRevenueSql = 'SELECT SUM((hdmd.`total_price_tax_excl` / o.`conversion_rate`) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) + FROM `'._DB_PREFIX_.'htl_booking_demands` hdmd + LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd + ON (hdmd.`id_htl_booking` = hbd.`id`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) + WHERE p.`active` = 1 + AND o.`valid` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); + + if ($demandsRevenue = Db::getInstance()->getValue($demandsRevenueSql)) { + $totalServicesRevenue += $demandsRevenue; + } + + $result[$discreteDate['timestamp_from']] = $totalServicesRevenue; + } + + return $result; + } + + public static function getTotalRevenueForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) + { + $result = array(); + $servicesRevenueByDates = self::getServicesRevenueForDiscreteDates($dateFrom, $dateTo, $idHotel); + if ($roomsRevenueByDates = self::getRoomsRevenueForDiscreteDates($dateFrom, $dateTo, $idHotel)) { + foreach ($roomsRevenueByDates as $key => $value) { + $result[$key] = (isset($servicesRevenueByDates[$key]) ? $servicesRevenueByDates[$key] : 0) + $value; + } } return $result; @@ -2020,18 +2075,18 @@ class AdminStatsControllerCore extends AdminStatsTabController $roomsSql = 'SELECT IFNULL(SUM( CASE - WHEN od.`original_wholesale_price` <> "0.000000" - THEN od.`original_wholesale_price` - WHEN p.`wholesale_price` <> "0.000000" - THEN p.`wholesale_price` + WHEN od.`purchase_supplier_price` <> "0.000000" + THEN od.`purchase_supplier_price` + WHEN od.`purchase_supplier_price` = "0.000000" + THEN (od.`original_product_price` / o.`conversion_rate`) * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100 END ), 0) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - LEFT JOIN `'._DB_PREFIX_.'product` p - ON (p.`id_product` = hbd.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'order_detail` od - ON (od.`id_order_detail` = hbd.`id_order_detail`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = hbd.`id_order_detail`) + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (od.`id_order` = o.`id_order`) WHERE p.`active` = 1 + AND o.`valid` = 1 AND hbd.`is_refunded` = 0 AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); @@ -2044,20 +2099,20 @@ class AdminStatsControllerCore extends AdminStatsTabController $servicesSql = 'SELECT IFNULL(SUM( CASE - WHEN od.`original_wholesale_price` <> "0.000000" - THEN od.`original_wholesale_price` - WHEN p.`wholesale_price` <> "0.000000" - THEN p.`wholesale_price` + WHEN od.`purchase_supplier_price` <> "0.000000" + THEN (od.`purchase_supplier_price` / (IF (od.`product_price_calculation_method` = '.Product::PRICE_CALCULATION_METHOD_PER_BOOKING.', DATEDIFF(hbd.`date_to`, hbd.`date_from`), 1))) + WHEN od.`purchase_supplier_price` = "0.000000" + THEN ((od.`original_product_price` / o.`conversion_rate`) * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100) / (IF (od.`product_price_calculation_method` = '.Product::PRICE_CALCULATION_METHOD_PER_BOOKING.', DATEDIFF(hbd.`date_to`, hbd.`date_from`), 1)) END ), 0) FROM `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rtspod LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (rtspod.`id_htl_booking_detail` = hbd.`id`) - LEFT JOIN `'._DB_PREFIX_.'product` p - ON (p.`id_product` = hbd.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'order_detail` od - ON (od.`id_order_detail` = rtspod.`id_order_detail`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rtspod.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = rtspod.`id_order_detail`) + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (od.`id_order` = o.`id_order`) WHERE p.`active` = 1 + AND o.`valid` = 1 AND hbd.`is_refunded` = 0 AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); diff --git a/controllers/front/OrderConfirmationController.php b/controllers/front/OrderConfirmationController.php index a60326859..2b5709135 100644 --- a/controllers/front/OrderConfirmationController.php +++ b/controllers/front/OrderConfirmationController.php @@ -469,8 +469,6 @@ class OrderConfirmationControllerCore extends FrontController { if (Tools::getValue('ajax') != 'true') { parent::setMedia(); - $this->addCSS(_THEME_CSS_DIR_.'history.css'); - $this->addJS(_THEME_JS_DIR_.'history.js'); $this->addJS(_THEME_JS_DIR_.'order-confirmation.js'); $this->addCSS(_THEME_CSS_DIR_.'order-confirmation.css'); $this->addJqueryPlugin(array('fancybox')); //fancybox not found for some client theme diff --git a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl index 5ed29c94c..b705d8be9 100644 --- a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl +++ b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl @@ -80,7 +80,7 @@