Added: new option to save room type bed type
This commit is contained in:
@@ -27,6 +27,7 @@ class HotelReservationSystemDb
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(11) NOT NULL,
|
||||
`id_hotel` int(11) NOT NULL,
|
||||
`id_bed_types` TEXT,
|
||||
`adults` smallint(6) NOT NULL DEFAULT '2',
|
||||
`children` smallint(6) NOT NULL DEFAULT '0',
|
||||
`max_adults` smallint(6) NOT NULL DEFAULT '2',
|
||||
@@ -362,7 +363,7 @@ class HotelReservationSystemDb
|
||||
PRIMARY KEY (`id_room_type_demand`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE `"._DB_PREFIX_."htl_room_type_service_product` (
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_service_product` (
|
||||
`id_room_type_service_product` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(11) UNSIGNED NOT NULL,
|
||||
`position` smallint(2) unsigned NOT NULL DEFAULT '0',
|
||||
@@ -372,7 +373,7 @@ class HotelReservationSystemDb
|
||||
KEY `id_product` (`id_product`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE `"._DB_PREFIX_."htl_room_type_service_product_price` (
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_service_product_price` (
|
||||
`id_room_type_service_product_price` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(11) UNSIGNED NOT NULL,
|
||||
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
@@ -383,7 +384,7 @@ class HotelReservationSystemDb
|
||||
KEY `id_product` (`id_product`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE `"._DB_PREFIX_."htl_hotel_service_product_cart_detail` (
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_hotel_service_product_cart_detail` (
|
||||
`id_hotel_service_product_cart_detail` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_cart` int(11) unsigned NOT NULL,
|
||||
`id_product` int(11) UNSIGNED NOT NULL,
|
||||
@@ -393,7 +394,7 @@ class HotelReservationSystemDb
|
||||
KEY `id_product` (`id_product`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE `"._DB_PREFIX_."htl_room_type_service_product_cart_detail` (
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_service_product_cart_detail` (
|
||||
`id_room_type_service_product_cart_detail` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(11) UNSIGNED NOT NULL,
|
||||
`quantity` int(11) UNSIGNED NOT NULL,
|
||||
@@ -465,6 +466,18 @@ class HotelReservationSystemDb
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_settings_link`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_bed_type` (
|
||||
`id_bed_type` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`length` DECIMAL(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`width` DECIMAL(20,6) NOT NULL DEFAULT '0.000000',
|
||||
PRIMARY KEY (`id_bed_type`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_bed_type_lang`(
|
||||
`id_bed_type` INT(11) NOT NULL,
|
||||
`name` VARCHAR(255) DEFAULT NULL,
|
||||
`id_lang` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`id_bed_type`, `id_lang`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"INSERT INTO `"._DB_PREFIX_."htl_settings_link` (`id_settings_link`, `icon`, `link`, `new_window`, `position`, `unremovable`, `active`, `date_add`, `date_upd`) VALUES
|
||||
(1, 'icon-cogs', 'index.php?controller=AdminHotelGeneralSettings', 0, 0, 1, 1, NOW(), NOW()),
|
||||
@@ -559,6 +572,13 @@ class HotelReservationSystemDb
|
||||
`'._DB_PREFIX_.'htl_settings_link`,
|
||||
`'._DB_PREFIX_.'htl_settings_link_lang`,
|
||||
`'._DB_PREFIX_.'htl_room_type_restriction_date_range`,
|
||||
`'._DB_PREFIX_.'htl_room_type_service_product`,
|
||||
`'._DB_PREFIX_.'htl_room_type_service_product_price`,
|
||||
`'._DB_PREFIX_.'htl_hotel_service_product_cart_detail`,
|
||||
`'._DB_PREFIX_.'htl_room_type_service_product_cart_detail`,
|
||||
`'._DB_PREFIX_.'htl_room_type_service_product_order_detail`,
|
||||
`'._DB_PREFIX_.'htl_room_type_bed_type`,
|
||||
`'._DB_PREFIX_.'htl_room_type_bed_type_lang`,
|
||||
`'._DB_PREFIX_.'htl_access`'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class HotelRoomType extends ObjectModel
|
||||
public $max_adults;
|
||||
public $max_children;
|
||||
public $max_guests;
|
||||
public $id_bed_types;
|
||||
public $min_los;
|
||||
public $max_los;
|
||||
public $date_add;
|
||||
@@ -48,6 +49,7 @@ class HotelRoomType extends ObjectModel
|
||||
'max_los' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'default' => 0),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'id_bed_types' => array('type' => self::TYPE_STRING),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2020 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 <support@webkul.com>
|
||||
* @copyright 2010-2020 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
class HotelRoomTypeBedType extends ObjectModel
|
||||
{
|
||||
public $length;
|
||||
public $width;
|
||||
public $name;
|
||||
|
||||
public static $definition =array(
|
||||
'table' => 'htl_room_type_bed_type',
|
||||
'primary' => 'id_bed_type',
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'length' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
|
||||
'width' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
|
||||
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128),
|
||||
),
|
||||
);
|
||||
|
||||
public function getAllBedTypes($idLang)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$sql = 'SELECT hrtbt.*, hrtbtl.`name` FROM `'._DB_PREFIX_.$this->table.'` hrtbt
|
||||
LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` hrtbtl ON hrtbt.`id_bed_type` = hrtbtl.`id_bed_type`
|
||||
WHERE 1 AND hrtbtl.`id_lang` ='.(int) $idLang;
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class AdminHotelBedTypesController extends ModuleAdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'htl_room_type_bed_type';
|
||||
$this->className = 'HotelRoomTypeBedType';
|
||||
$this->identifier = 'id_bed_type';
|
||||
$this->context = Context::getContext();
|
||||
$this->lang = true;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->_new_list_header_design = true;
|
||||
$this->fields_list = array(
|
||||
'id_bed_type' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'align' => 'center',
|
||||
),
|
||||
'width' => array(
|
||||
'title' => $this->l('Width'),
|
||||
'align' => 'center',
|
||||
'suffix' => Configuration::get('PS_DIMENSION_UNIT')
|
||||
),
|
||||
'length' => array(
|
||||
'title' => $this->l('Lenght'),
|
||||
'align' => 'center',
|
||||
'suffix' => Configuration::get('PS_DIMENSION_UNIT')
|
||||
),
|
||||
);
|
||||
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
if (!$this->display || $this->display == 'list') {
|
||||
$this->page_header_toolbar_btn['new_product'] = array(
|
||||
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
|
||||
'desc' => $this->l('Add new', null, null, false),
|
||||
'icon' => 'process-icon-new'
|
||||
);
|
||||
}
|
||||
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!$this->loadObject(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Bed Type'),
|
||||
'icon' => 'icon-bed'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Bed Type Name'),
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'col' => 4,
|
||||
'lang' => true,
|
||||
'hint' => $this->l('Enter the name of Bed type.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Width'),
|
||||
'name' => 'width',
|
||||
'required' => true,
|
||||
'col' => 4,
|
||||
'hint' => $this->l('Enter the width of the Bed type in ').Configuration::get('PS_DIMENSION_UNIT'),
|
||||
'desc' => $this->l('Enter the width of the Bed type in ').Configuration::get('PS_DIMENSION_UNIT'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Length'),
|
||||
'name' => 'length',
|
||||
'col' => 4,
|
||||
'required' => true,
|
||||
'hint' => $this->l('Enter the length of the Bed type in ').Configuration::get('PS_DIMENSION_UNIT'),
|
||||
'desc' => $this->l('Enter the length of the Bed type in ').Configuration::get('PS_DIMENSION_UNIT'),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save')
|
||||
),
|
||||
'buttons' => array(
|
||||
'save-and-stay' => array(
|
||||
'title' => $this->l('Save and stay'),
|
||||
'name' => 'submitAdd'.$this->table.'AndStay',
|
||||
'type' => 'submit',
|
||||
'class' => 'btn btn-default pull-right',
|
||||
'icon' => 'process-icon-save',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function processSave()
|
||||
{
|
||||
if (!$this->loadObject(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!trim(Tools::getValue('width'))) {
|
||||
$this->errors[] = $this->l('Field Width is required');
|
||||
}
|
||||
|
||||
if (!trim(Tools::getValue('length'))) {
|
||||
$this->errors[] = $this->l('Field Length is required');
|
||||
}
|
||||
|
||||
return parent::processSave();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,6 +44,7 @@ require_once 'classes/HotelRoomTypeRestrictionDateRange.php';
|
||||
require_once 'classes/QloWebservice.php';
|
||||
require_once 'classes/QloRoomType.php';
|
||||
require_once 'classes/HotelRoomDisableDates.php';
|
||||
require_once 'classes/HotelRoomTypeBedType.php';
|
||||
require_once 'classes/HotelBranchRefundRules.php';
|
||||
|
||||
// linked products
|
||||
|
||||
@@ -561,18 +561,11 @@ class HotelReservationSystem extends Module
|
||||
$this->installTab('AdminAddHotel', 'Manage Hotel', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminHotelRoomsBooking', 'Book Now', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminHotelFeatures', 'Manage Hotel Features', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab(
|
||||
'AdminOrderRefundRules',
|
||||
'Manage Order Refund Rules',
|
||||
'AdminHotelReservationSystemManagement'
|
||||
);
|
||||
$this->installTab(
|
||||
'AdminOrderRefundRequests',
|
||||
'Manage Order Refund Requests',
|
||||
'AdminHotelReservationSystemManagement'
|
||||
);
|
||||
$this->installTab('AdminOrderRefundRules', 'Manage Order Refund Rules', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminOrderRefundRequests', 'Manage Order Refund Requests', 'AdminHotelReservationSystemManagement');
|
||||
|
||||
$this->installTab('AdminHotelConfigurationSetting', 'General Settings', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminHotelBedTypes', 'Manage Bed Types', 'AdminCatalog');
|
||||
// Controllers without tabs
|
||||
$this->installTab('AdminHotelGeneralSettings', 'Hotel General Configuration', 'AdminHotelConfigurationSetting', false);
|
||||
$this->installTab('AdminHotelFeaturePricesSettings', 'Advanced Price Rules', 'AdminHotelConfigurationSetting', false);
|
||||
|
||||
Reference in New Issue
Block a user