Merge branch 'origin/develop' into qlo-occupancy-update

This commit is contained in:
Shreesh Arora
2023-01-18 15:30:40 +05:30
73 changed files with 2765 additions and 1265 deletions

View File

@@ -312,7 +312,7 @@
{/if}
{* field for the current date *}
<input class="room_status_date wk-input-date" type="text" name="status_date" value="{$data['date_from']|date_format:"%d-%m-%Y"}" readonly/>
<input class="room_status_date wk-input-date" type="text" name="status_date" value="{if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']}{$data['date_to']|date_format:"%d-%m-%Y"}{else}{$data['date_from']|date_format:"%d-%m-%Y"}{/if}" readonly/>
<input type="hidden" name="date_from" value="{$data['date_from']|date_format:"%Y-%m-%d"}" />
<input type="hidden" name="date_to" value="{$data['date_to']|date_format:"%Y-%m-%d"}" />
@@ -476,12 +476,12 @@
{l s="Payment"} <span class="badge">{$order->getOrderPayments()|@count}</span>
</div>
{if count($order->getOrderPayments()) > 0}
<p class="alert alert-danger"{if round($orders_total_paid_tax_incl, 2) == round($total_paid, 2) || (isset($currentState) && $currentState->id == 6)} style="display: none;"{/if}>
<p class="alert alert-danger"{if round($order->total_paid_tax_incl, 2) == round($total_paid, 2) || (isset($currentState) && $currentState->id == 6)} style="display: none;"{/if}>
{l s='Warning'}
<strong>{displayPrice price=$total_paid currency=$currency->id}</strong>
{l s='paid instead of'}
<strong class="total_paid">{displayPrice price=$orders_total_paid_tax_incl currency=$currency->id}</strong>
{foreach $order->getBrother() as $brother_order}
<strong class="total_paid">{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}</strong>
{* {foreach $order->getBrother() as $brother_order}
{if $brother_order@first}
{if count($order->getBrother()) == 1}
<br />{l s='This warning also concerns order '}
@@ -492,7 +492,7 @@
<a href="{$current_index}&amp;vieworder&amp;id_order={$brother_order->id}&amp;token={$smarty.get.token|escape:'html':'UTF-8'}">
#{'%06d'|sprintf:$brother_order->id}
</a>
{/foreach}
{/foreach} *}
</p>
{/if}
<form id="formAddPayment" method="post" action="{$current_index}&amp;vieworder&amp;id_order={$order->id}&amp;token={$smarty.get.token|escape:'html':'UTF-8'}">
@@ -509,15 +509,15 @@
</tr>
</thead>
<tbody>
{foreach from=$order->getOrderPaymentCollection() item=payment}
{foreach from=$order_payment_detail item=payment}
<tr>
<td>{dateFormat date=$payment->date_add full=true}</td>
<td>{$payment->payment_method|escape:'html':'UTF-8'}</td>
<td>{$payment->transaction_id|escape:'html':'UTF-8'}</td>
<td>{displayPrice price=$payment->amount currency=$payment->id_currency}</td>
<td>{dateFormat date=$payment['date_add'] full=true}</td>
<td>{$payment['payment_method']|escape:'html':'UTF-8'}</td>
<td>{$payment['transaction_id']|escape:'html':'UTF-8'}</td>
<td>{displayPrice price=$payment['real_paid_amount'] currency=$payment['id_currency']}</td>
<td>
{if $invoice = $payment->getOrderInvoice($order->id)}
{$invoice->getInvoiceNumberFormatted($current_id_lang, $order->id_shop)}
{if $payment['invoice_number']}
{$payment['invoice_number']}
{else}
{/if}
</td>
@@ -532,32 +532,32 @@
<td colspan="5">
<p>
<b>{l s='Card Number'}</b>&nbsp;
{if $payment->card_number}
{$payment->card_number}
{if $payment['card_number']}
{$payment['card_number']}
{else}
<i>{l s='Not defined'}</i>
{/if}
</p>
<p>
<b>{l s='Card Brand'}</b>&nbsp;
{if $payment->card_brand}
{$payment->card_brand}
{if $payment['card_brand']}
{$payment['card_brand']}
{else}
<i>{l s='Not defined'}</i>
{/if}
</p>
<p>
<b>{l s='Card Expiration'}</b>&nbsp;
{if $payment->card_expiration}
{$payment->card_expiration}
{if $payment['card_expiration']}
{$payment['card_expiration']}
{else}
<i>{l s='Not defined'}</i>
{/if}
</p>
<p>
<b>{l s='Card Holder'}</b>&nbsp;
{if $payment->card_holder}
{$payment->card_holder}
{if $payment['card_holder']}
{$payment['card_holder']}
{else}
<i>{l s='Not defined'}</i>
{/if}
@@ -673,15 +673,27 @@
<input class="btn btn-default" type="submit" name="submitGuestToCustomer" value="{l s='Transform this guest into a customer'}" />
<p class="help-block">{l s='This feature will generate a random password and send an email to the customer.'}</p>
</form>
<dl class="panel list-detail">
<dt>{l s='Email'}</dt>
<dd><a href="mailto:{$customer->email}"><i class="icon-envelope-o"></i> {$customer->email}</a></dd>
{if $addresses.invoice->phone_mobile || $addresses.invoice->phone}
<dt>{l s='Phone'}</dt>
<dd><a href="tel:{if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}"><i class="icon-envelope-o"></i> {if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}</a></dd><br>
{/if}
</dl>
{else}
<div class="alert alert-warning">
{l s='A registered customer account has already claimed this email address'}
</div>
{/if}
{else}
<dl class="well list-detail">
<dl class="panel list-detail">
<dt>{l s='Email'}</dt>
<dd><a href="mailto:{$customer->email}"><i class="icon-envelope-o"></i> {$customer->email}</a></dd><br>
{if $addresses.invoice->phone_mobile || $addresses.invoice->phone}
<dt>{l s='Phone'}</dt>
<dd><a href="tel:{if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}"><i class="icon-envelope-o"></i> {if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}</a></dd><br>
{/if}
<dt>{l s='Account registered'}</dt>
<dd class="text-muted"><i class="icon-calendar-o"></i> {dateFormat date=$customer->date_add full=true}</dd>
<!-- <dt>{l s='Valid orders placed'}</dt>
@@ -695,6 +707,67 @@
<dd>{$customer->ape}</dd>
{/if} -->
</dl>
{if $customerGuestDetail}
<div class="panel">
<div class="panel-heading">
{l s='Traveller detail'}
</div>
<dl id="customer-guest-details">
<dt>{l s='Name'}</dt>
<dd class="guest_name">{$customerGuestDetail->gender->name} {$customerGuestDetail->firstname} {$customerGuestDetail->lastname}</dd>
<br>
<dt>{l s='Email'}</dt>
<dd class="guest_email"><a href="mailto:{$customerGuestDetail->email}"><i class="icon-envelope-o"></i> {$customerGuestDetail->email}</a></dd><br>
<dt>{l s='Phone'}</dt>
<dd class="guest_phone"><a href="tel:{$customerGuestDetail->phone}"><i class="icon-envelope-o"></i> {$customerGuestDetail->phone}</a></dd>
<div class="text-right">
<button id="edit_guest_details" class="btn btn-default">
<i class="icon-pencil"></i>
{l s='Edit'}
</button>
</div>
</dl>
<form id="customer-guest-details-form" style="display:none">
<dl>
<dt>{l s='Social title'}</dt>
<dd>
<select name="id_gender">
{foreach from=$genders key=k item=gender}
<option value="{$gender->id_gender}"{if $customerGuestDetail->id_gender == $gender->id_gender} selected="selected"{/if}>{$gender->name}</option>
{/foreach}
</select>
</dd><br>
<dt>{l s='First name'}</dt>
<dd>
<input type="text" value="{$customerGuestDetail->firstname}" name="firstname">
</dd><br>
<dt>{l s='Last name'}</dt>
<dd>
<input type="text" value="{$customerGuestDetail->lastname}" name="lastname">
</dd><br>
<dt>{l s='Email'}</dt>
<dd>
<input type="text" value="{$customerGuestDetail->email}" name="email">
</dd><br>
<dt>{l s='Phone'}</dt>
<dd>
<input type="text" value="{$customerGuestDetail->phone}" name="phone">
</dd>
</dl>
<div class="text-right">
<button id="cancle_edit_guest_details" class="btn btn-default">
<i class="icon-remove"></i>
{l s='cancel'}
</button>
<button id="submit_guest_details" class="btn btn-default">
<i class="icon-save"></i>
{l s='Save'}
</button>
</div>
</form>
</div>
{/if}
{/if}
</div>
@@ -1690,6 +1763,53 @@
/*END*/
// for updating customer guest details
$('#edit_guest_details').on('click', function(e) {
e.preventDefault();
$('#customer-guest-details-form').show();
$('#customer-guest-details').hide();
});
$('#cancle_edit_guest_details').on('click', function(e) {
e.preventDefault();
$('#customer-guest-details-form').hide();
$('#customer-guest-details').show();
});
$('#submit_guest_details').on('click', function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
headers: {
"cache-control": "no-cache"
},
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
dataType: 'JSON',
cache: false,
data: $('#customer-guest-details-form').serialize()+'&ajax=true&id_order='+id_order+'&action=updateGuestDetails',
success: function(result) {
if (result.success) {
if (result.msg) {
showSuccessMessage(result.msg);
}
if (result.data.guest_name) {
$('#customer-guest-details .guest_name').text(result.data.guest_name);
}
if (result.data.guest_email) {
$('#customer-guest-details .guest_email a').attr('href', 'mailto:'+result.data.guest_email).text(result.data.guest_email);
}
if (result.data.guest_phone) {
$('#customer-guest-details .guest_phone a').attr('href', 'tel'+result.data.guest_phone).text(result.data.guest_phone);
}
$('#customer-guest-details-form').hide();
$('#customer-guest-details').show();
} else if (result.errors) {
showErrorMessage(result.errors);
}
}
});
});
$(".textarea-autosize").autosize();
var date = new Date();

View File

@@ -0,0 +1,115 @@
{**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*}
{if isset($product->id) && $product->id}
<input type="hidden" name="submitted_tabs[]" value="AdditionalFacilities" />
<div class="panel">
<div class="panel-heading">
<i class="icon-user"></i> {l s='Room Type Additional Facilities'}
</div>
<div class="alert alert-info">
{l s='To create new Additiona facilities '} <a target="_blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')}">{l s='click here.'}</a>
</div>
{if isset($allDemands) && $allDemands}
<div class="panel-group">
{foreach $allDemands as $key => $demand}
<div class="panel panel-sm">
<input class="selected_demand" type="checkbox" name="selected_demand[]" value="{$demand['id_global_demand']|escape:'html':'UTF-8'}" {if isset($roomDemandPrices[$demand['id_global_demand']])}checked{/if} />
<a href="#" onclick="$('#panel-demands-{$key|escape:'html':'UTF-8'}').slideToggle(250); return false;">
{$demand['name']|escape:'html':'UTF-8'}
</a>
<div class="panel-body collapse" id="panel-demands-{$key|escape:'html':'UTF-8'}">
{if isset($demand['adv_option']) && count($demand['adv_option'])}
<input type="hidden" name="demand_price_{$demand['id_global_demand']|escape:'html':'UTF-8'}"
value="{if isset($roomDemandPrices[$demand['id_global_demand']]['price'])}{$roomDemandPrices[$demand['id_global_demand']]['price']|escape:'html':'UTF-8'}{elseif isset($demand['price'])}{$demand['price']|escape:'html':'UTF-8'}{/if}"/>
{else}
<div class="form-group">
<label class="col-sm-3 control-label required" >
{l s='Price'}({l s='tax excl.'})
</label>
<div class="col-sm-3">
<div class="input-group">
<span class="input-group-addon">{$defaultcurrencySign|escape:'html':'UTF-8'}</span>
<input type="text" name="demand_price_{$demand['id_global_demand']|escape:'html':'UTF-8'}"
value="{if isset($roomDemandPrices[$demand['id_global_demand']]['price'])}{$roomDemandPrices[$demand['id_global_demand']]['price']|escape:'html':'UTF-8'}{elseif isset($demand['price'])}{$demand['price']|escape:'html':'UTF-8'}{/if}"/>
</div>
</div>
</div>
{/if}
{if isset($demand['adv_option']) && $demand['adv_option']}
<div class="adv_options_dtl form-group">
<label class="col-sm-3 control-label">
{l s='Advance options'}
</label>
<div class="col-sm-9">
<div class="table-responsive-row clearfix">
<table class="table table-bordered adv_option_table">
<thead>
<tr>
<th>
<span>{l s='Option Name'}</span>
</th>
<th>
<span>{l s='Price'}</span>
</th>
</tr>
</thead>
{foreach from=$demand['adv_option'] key=key item=info}
<tr>
<td>
{$info['name']|escape:'html':'UTF-8'}
</td>
<td>
<div class="input-group">
<span class="input-group-addon">{$defaultcurrencySign|escape:'html':'UTF-8'}</span>
<input type="text" name="option_price_{$info['id']|escape:'html':'UTF-8'}" value="{if isset($roomDemandPrices[$demand['id_global_demand']]['adv_option'][$info['id']]['price'])}{$roomDemandPrices[$demand['id_global_demand']]['adv_option'][$info['id']]['price']|escape:'html':'UTF-8'}{else}{$info['price']|escape:'html':'UTF-8'}{/if}"/>
</div>
</td>
</tr>
{/foreach}
</table>
</div>
</div>
</div>
{/if}
</div>
</div>
{/foreach}
</div>
<div class="panel-footer">
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}{if isset($smarty.request.page) && $smarty.request.page > 1}&amp;submitFilterproduct={$smarty.request.page|intval}{/if}" class="btn btn-default">
<i class="process-icon-cancel"></i>
{l s='Cancel'}
</a>
<button type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled">
<i class="process-icon-loading"></i>
{l s='Save'}
</button>
<button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right" disabled="disabled">
<i class="process-icon-loading"></i>
{l s='Save and stay'}
</button>
</div>
{else}
<div class="alert alert-warning">
{l s='No additional facilities created yet. To create please visit'} <a target="_blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')}">{l s='Additional facilities'}</a> {l s='page'}.
</div>
{/if}
</div>
{/if}

View File

@@ -26,6 +26,7 @@
{if $refresh}
<div class="kpi-refresh"><button class="close refresh" type="button" onclick="refresh_kpis();"><i class="process-icon-refresh" style="font-size:1em"></i></button></div>
{/if}
{if ($kpis|count) > 0}
<div class="row">
{assign var='col' value=(int)(12 / $kpis|count)}
{foreach from=$kpis item=i name=kpi}
@@ -36,4 +37,5 @@
<div class="col-sm-6 col-lg-{$col}">{$i}</div>
{/foreach}
</div>
{/if}
</div>

View File

@@ -0,0 +1,83 @@
<?php
/**
* 2010-2022 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-2022 Webkul IN
* @license https://store.webkul.com/license.html
*/
class CartCustomerGuestDetailCore extends ObjectModel
{
public $id_customer_guest_detail;
public $id_cart;
public $id_gender;
public $firstname;
public $lastname;
public $email;
public $phone;
public $date_add;
public $date_upd;
public static $definition = array(
'table' => 'cart_customer_guest_detail',
'primary' => 'id_customer_guest_detail',
'fields' => array(
'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32),
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32),
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 128),
'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
public static function getCartCustomerGuest($id_cart)
{
return Db::getInstance()->getValue('
SELECT `id_customer_guest_detail`
FROM `'._DB_PREFIX_.'cart_customer_guest_detail`
WHERE `id_cart` = '.(int)$id_cart
);
}
public static function getCustomerGuestDetail($id_customer_guest_detail)
{
return Db::getInstance()->getRow('
SELECT `id_gender`, `firstname`, `lastname`, `email`, `phone`
FROM `'._DB_PREFIX_.'cart_customer_guest_detail`
WHERE `id_customer_guest_detail` = '.(int)$id_customer_guest_detail
);
}
public function validateGuestInfo()
{
$isValid = true;
if (!trim($this->firstname) || !Validate::isName($this->firstname)) {
$isValid = false;
}
if (!trim($this->lastname) || !Validate::isName($this->lastname)) {
$isValid = false;
}
if (!trim($this->email) || !Validate::isEmail($this->email)) {
$isValid = false;
}
if (!trim($this->phone) || !Validate::isPhoneNumber($this->phone)) {
$isValid = false;
}
return $isValid;
}
}

View File

@@ -26,6 +26,25 @@
class CookieCore
{
const SAMESITE_NONE = 'None';
const SAMESITE_LAX = 'Lax';
const SAMESITE_STRICT = 'Strict';
const SAMESITE_AVAILABLE_VALUES = array(
array(
"type" => self::SAMESITE_NONE,
"name" => self::SAMESITE_NONE
),
array(
"type" => self::SAMESITE_LAX,
"name" => self::SAMESITE_LAX
),
array(
"type" => self::SAMESITE_STRICT,
"name" => self::SAMESITE_STRICT
),
);
/** @var array Contain cookie content in a key => value format */
protected $_content;
@@ -73,6 +92,7 @@ class CookieCore
$this->_path = str_replace('%2F', '/', $this->_path);
$this->_path = str_replace('%7E', '~', $this->_path);
$this->_domain = $this->getDomain($shared_urls);
$this->_sameSite = Configuration::get('PS_COOKIE_SAMESITE');
$this->_name = 'PrestaShop-'.md5(($this->_standalone ? '' : _PS_VERSION_).$name.$this->_domain);
$this->_allow_writing = true;
$this->_salt = $this->_standalone ? str_pad('', 8, md5('ps'.__FILE__)) : _COOKIE_IV_;
@@ -342,11 +362,35 @@ class CookieCore
$content = 0;
$time = 1;
}
if (PHP_VERSION_ID <= 50200) { /* PHP version > 5.2.0 */
return setcookie($this->_name, $content, $time, $this->_path, $this->_domain, $this->_secure);
} else {
return setcookie($this->_name, $content, $time, $this->_path, $this->_domain, $this->_secure, true);
/*
* The alternative signature supporting an options array is only available since
* PHP 7.3.0, before there is no support for SameSite attribute.
*/
if (PHP_VERSION_ID < 70300) {
return setcookie(
$this->_name,
$content,
$time,
$this->_path,
$this->_domain . '; SameSite=' . $this->_sameSite,
$this->_secure,
true
);
}
return setcookie(
$this->_name,
$content,
[
'expires' => $time,
'path' => $this->_path,
'domain' => $this->_domain,
'secure' => $this->_secure,
'httponly' => true,
'samesite' => $this->_sameSite,
]
);
}
public function __destruct()

View File

@@ -371,9 +371,23 @@ abstract class PaymentModuleCore extends Module
// advance payment information
$order->is_advance_payment = $this->context->cart->is_advance_payment;
if ($order->is_advance_payment) {
$order->advance_paid_amount = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_);
$order->advance_paid_amount = (float)Tools::ps_round(
(float)$this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT, $order->product_list, $id_carrier),
_PS_PRICE_COMPUTE_PRECISION_
);
$order->amount_paid = (float)Tools::ps_round(
(($order->advance_paid_amount * $amount_paid) / $this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT, null, $id_carrier)),
_PS_PRICE_COMPUTE_PRECISION_
);
} else {
$order->advance_paid_amount = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_);
$order->advance_paid_amount = (float)Tools::ps_round(
(float)$this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier),
_PS_PRICE_COMPUTE_PRECISION_
);
$order->amount_paid = (float)Tools::ps_round(
(($order->advance_paid_amount * $amount_paid) / $this->context->cart->getOrderTotal(true, Cart::BOTH, null, $id_carrier)),
_PS_PRICE_COMPUTE_PRECISION_
);
}
// Creating order
@@ -384,11 +398,27 @@ abstract class PaymentModuleCore extends Module
throw new PrestaShopException('Can\'t save Order');
}
// save customer guest information
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
if (Validate::isLoadedObject($objCartCustomerGuestDetail = new CartCustomerGuestDetail(
$id_customer_guest_detail
))) {
$objOrderCustomerGuestDetail = new OrderCustomerGuestDetail();
$objOrderCustomerGuestDetail->id_gender = $objCartCustomerGuestDetail->id_gender;
$objOrderCustomerGuestDetail->firstname = $objCartCustomerGuestDetail->firstname;
$objOrderCustomerGuestDetail->lastname = $objCartCustomerGuestDetail->lastname;
$objOrderCustomerGuestDetail->email = $objCartCustomerGuestDetail->email;
$objOrderCustomerGuestDetail->phone = $objCartCustomerGuestDetail->phone;
$objOrderCustomerGuestDetail->id_order = (int)$order->id;
$objOrderCustomerGuestDetail->save();
}
}
// Amount paid by customer is not the right one -> Status = payment error
// We don't use the following condition to avoid the float precision issues : http://www.php.net/manual/en/language.types.float.php
// if ($order->total_paid != $order->total_paid_real)
// We use number_format in order to compare two string
if ($order_status->logable && number_format($cart_total_paid, _PS_PRICE_COMPUTE_PRECISION_) != number_format($amount_paid, _PS_PRICE_COMPUTE_PRECISION_)) {
if ($order_status->logable && number_format($cart_total_paid, _PS_PRICE_COMPUTE_PRECISION_) != number_format($amount_paid, _PS_PRICE_COMPUTE_PRECISION_) && $this->name != 'wsorder') {
// if customer is paying full payment amount
$id_order_state = Configuration::get('PS_OS_ERROR');
}
@@ -446,10 +476,19 @@ abstract class PaymentModuleCore extends Module
$transaction_id = null;
}
if (!isset($order) || !Validate::isLoadedObject($order) || !$order->addOrderPayment($amount_paid, null, $transaction_id)) {
if (!isset($order) || !Validate::isLoadedObject($order) || !$order->addOrderPayment($amount_paid, null, $transaction_id, null, null, null, false)) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Cannot save Order Payment', 3, null, 'Cart', (int)$id_cart, true);
throw new PrestaShopException('Can\'t save Order Payment');
}
// now add payment detail for order
if ($payment = OrderPayment::getByOrderReference($order->reference)) {
if ($payment = array_shift($payment)) {
foreach($order_list as $order) {
$order->addOrderPaymentDetail($payment, $order->amount_paid);
}
}
}
}
// Next !
@@ -862,14 +901,6 @@ abstract class PaymentModuleCore extends Module
// delete cart feature prices after booking creation success
HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart);
if (isset($_COOKIE['wk_id_cart'])) {
setcookie('wk_id_cart', ' ', time() - 86400, '/');
setcookie('wk_id_guest', ' ', time() - 86400, '/');
unset($_COOKIE['wk_id_cart']);
unset($_COOKIE['wk_id_guest']);
}
if (self::DEBUG_MODE) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Hook validateOrder is about to be called', 1, null, 'Cart', (int)$id_cart, true);
}
@@ -896,7 +927,11 @@ abstract class PaymentModuleCore extends Module
// Set the order status
$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
if ($order_status->logable && $order->is_advance_payment && $order->advance_paid_amount < $order->total_paid_tax_incl) {
$new_history->changeIdOrderState((int)Configuration::get('PS_OS_PARTIAL_PAYMENT'), $order, true);
} else {
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
}
$new_history->addWithemail(true, $extra_vars);
// Switch to back order if needed
@@ -1030,6 +1065,30 @@ abstract class PaymentModuleCore extends Module
null, _PS_MAIL_DIR_, false, (int)$order->id_shop
);
}
// send mail to customer guest if customer booked for someone other.
if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) {
if ($objOrderCustomerGuestDetail = new OrderCustomerGuestDetail(
$id_customer_guest_detail
)) {
if (Validate::isEmail($objOrderCustomerGuestDetail->email)) {
$data['{firstname}'] = $objOrderCustomerGuestDetail->firstname;
$data['{lastname}'] = $objOrderCustomerGuestDetail->lastname;
$data['{email}'] = $objOrderCustomerGuestDetail->email;
Mail::Send(
(int)$order->id_lang,
'order_conf',
Mail::l('Order confirmation', (int)$order->id_lang),
$data,
$objOrderCustomerGuestDetail->email,
$objOrderCustomerGuestDetail->firstname.' '.$objOrderCustomerGuestDetail->lastname,
null,
null,
$file_attachement,
null, _PS_MAIL_DIR_, false, (int)$order->id_shop
);
}
}
}
}
if (Configuration::get('PS_ORDER_CONF_MAIL_TO_SUPERADMIN')){
// send superadmin information

View File

@@ -42,9 +42,17 @@ class CheckoutCustomerDetailsStep extends AbstractCheckoutStep
}
}
} elseif (Tools::getValue('proceed_to_payment')) {
$guestInfoComplete = true;
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
$guestInfoComplete = false;
$objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail);
if ($objCustomerGuestDetail->validateGuestInfo()) {
$guestInfoComplete = true;
}
}
$this->step_is_reachable = 1;
$this->step_is_current = 1;
if ($idAddressDelivery) {
if ($idAddressDelivery && $guestInfoComplete) {
if (Validate::isLoadedObject($objAddress)) {
$this->step_is_current = 0;
$this->step_is_complete = 1;

View File

@@ -1278,8 +1278,6 @@ class OrderCore extends ObjectModel
$this->setLastInvoiceNumber($order_invoice->id, $this->id_shop);
}
// Update order_carrier
$id_order_carrier = Db::getInstance()->getValue('
SELECT `id_order_carrier`
@@ -1303,11 +1301,13 @@ class OrderCore extends ObjectModel
// Update order payment
if ($use_existing_payment) {
$id_order_payments = Db::getInstance()->executeS('
SELECT DISTINCT op.id_order_payment
SELECT DISTINCT op.id_order_payment, opd.id_order_payment_detail
FROM `'._DB_PREFIX_.'order_payment` op
INNER JOIN `'._DB_PREFIX_.'orders` o ON (o.reference = op.order_reference)
LEFT JOIN `'._DB_PREFIX_.'order_payment_detail` opd ON (op.id_order_payment = opd.id_order_payment)
LEFT JOIN `'._DB_PREFIX_.'order_invoice_payment` oip ON (oip.id_order_payment = op.id_order_payment)
WHERE (oip.id_order != '.(int)$order_invoice->id_order.' OR oip.id_order IS NULL) AND o.id_order = '.(int)$order_invoice->id_order);
WHERE (oip.id_order != '.(int)$order_invoice->id_order.' OR oip.id_order IS NULL) AND o.id_order = '.(int)$order_invoice->id_order.'
AND opd.`id_order` = '.$order_invoice->id_order);
if (count($id_order_payments)) {
foreach ($id_order_payments as $order_payment) {
@@ -1315,6 +1315,7 @@ class OrderCore extends ObjectModel
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment`
SET
`id_order_invoice` = '.(int)$order_invoice->id.',
`id_order_payment_detail` = '.(int)$order_payment['id_order_payment_detail'].',
`id_order_payment` = '.(int)$order_payment['id_order_payment'].',
`id_order` = '.(int)$order_invoice->id_order);
}
@@ -1322,7 +1323,6 @@ class OrderCore extends ObjectModel
Cache::clean('order_invoice_paid_*');
}
}
// Update order cart rule
Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'order_cart_rule`
@@ -1697,11 +1697,12 @@ class OrderCore extends ObjectModel
{
// if one of the order details use the tax computation method the display will be different
return Db::getInstance()->getValue('
SELECT od.`tax_computation_method`
FROM `'._DB_PREFIX_.'order_detail_tax` odt
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = odt.`id_order_detail`)
WHERE od.`id_order` = '.(int)$this->id.'
AND od.`tax_computation_method` = '.(int)TaxCalculator::ONE_AFTER_ANOTHER_METHOD);
SELECT od.`tax_computation_method`
FROM `'._DB_PREFIX_.'order_detail_tax` odt
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = odt.`id_order_detail`)
WHERE od.`id_order` = '.(int)$this->id.'
AND od.`tax_computation_method` = '.(int)TaxCalculator::ONE_AFTER_ANOTHER_METHOD
);
}
/**
@@ -1716,6 +1717,21 @@ class OrderCore extends ObjectModel
return $order_payments;
}
/**
* This method allows to get all Order Payment detail for the current order
* @since 1.5.0.1
* @return array of OrderPaymentDetails
*/
public function getOrderPaymentDetail()
{
return Db::getInstance()->executeS('
SELECT opd.`amount` as `real_paid_amount`, opd.*, op.*
FROM `'._DB_PREFIX_.'order_payment_detail` opd
INNER JOIN `'._DB_PREFIX_.'order_payment` op ON (opd.`id_order_payment` = op.`id_order_payment`)
WHERE `id_order` = '.$this->id
);
}
/**
*
* This method allows to add a payment to the current order
@@ -1726,9 +1742,10 @@ class OrderCore extends ObjectModel
* @param Currency $currency
* @param string $date
* @param OrderInvoice $order_invoice
* @param bool $update_payment_detail :: if false, be sure to add payment detail in payment detail table
* @return bool
*/
public function addOrderPayment($amount_paid, $payment_method = null, $payment_transaction_id = null, $currency = null, $date = null, $order_invoice = null)
public function addOrderPayment($amount_paid, $payment_method = null, $payment_transaction_id = null, $currency = null, $date = null, $order_invoice = null, $update_payment_detail = true)
{
$order_payment = new OrderPayment();
$order_payment->order_reference = $this->reference;
@@ -1746,36 +1763,53 @@ class OrderCore extends ObjectModel
$order_payment->date_add .= ' '.date('H:i:s');
}
// Update total_paid_real value for backward compatibility reasons
if ($order_payment->id_currency == $this->id_currency) {
$this->total_paid_real += $order_payment->amount;
} else {
$this->total_paid_real += Tools::ps_round(Tools::convertPrice($order_payment->amount, $order_payment->id_currency, false), 2);
}
if (!validate::isPrice($this->total_paid_real)) {
return false;
}
// We put autodate parameter of add method to true if date_add field is null
$res = $order_payment->add(is_null($order_payment->date_add)) && $this->update();
if (!$res) {
return false;
}
if (!is_null($order_invoice)) {
$res = Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment` (`id_order_invoice`, `id_order_payment`, `id_order`)
VALUES('.(int)$order_invoice->id.', '.(int)$order_payment->id.', '.(int)$this->id.')');
// Clear cache
Cache::clean('order_invoice_paid_*');
if ($res = $order_payment->add(is_null($order_payment->date_add))) {
if ($update_payment_detail) {
$res &= $this->addOrderPaymentDetail($order_payment, $amount_paid, $order_invoice);
}
}
return $res;
}
public function addOrderPaymentDetail(OrderPayment $payment, $amount = null, $order_invoice = null)
{
if (Validate::isLoadedObject($payment)) {
if (!is_null($amount)) {
$amount = $payment->amount;
}
$order_payment_detail = new OrderPaymentDetail();
$order_payment_detail->id_order = $this->id;
$order_payment_detail->id_order_payment = (int)$payment->id;
$order_payment_detail->amount = $amount;
if ($payment->id_currency == $this->id_currency) {
$this->total_paid_real += $order_payment_detail->amount;
} else {
$this->total_paid_real += Tools::ps_round(Tools::convertPrice($order_payment_detail->amount, $payment->id_currency, false), 2);
}
if (!validate::isPrice($this->total_paid_real)) {
return false;
}
if ($order_payment_detail->add() && $this->update()) {
if (!is_null($order_invoice)) {
$res = Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment` (`id_order_invoice`, `id_order_payment`, `id_order_payment_detail`, `id_order`)
VALUES('.(int)$order_invoice->id.', '.(int)(int)$payment->id.', '.(int)$order_payment_detail->id.', '.(int)$this->id.')');
// Clear cache
Cache::clean('order_invoice_paid_*');
}
return $order_payment_detail->id;
}
}
return false;
}
/**
* Returns the correct product taxes breakdown.
*
@@ -1908,14 +1942,15 @@ class OrderCore extends ObjectModel
}
$total = 0;
// Retrieve all payments
$payments = $this->getOrderPaymentCollection();
$payments = $this->getOrderPaymentDetail();
foreach ($payments as $payment) {
/** @var OrderPayment $payment */
if ($payment->id_currency == $currency->id) {
$total += $payment->amount;
if ($payment['id_currency'] == $currency->id) {
$total += $payment['real_paid_amount'];
} else {
$amount = Tools::convertPrice($payment->amount, $payment->id_currency, false);
$amount = Tools::convertPrice($payment['real_paid_amount'], $payment['id_currency'], false);
if ($currency->id == Configuration::get('PS_CURRENCY_DEFAULT', null, null, $this->id_shop)) {
$total += $amount;
} else {
@@ -2181,6 +2216,11 @@ class OrderCore extends ObjectModel
return OrderPayment::getByOrderReference($this->reference);
}
public function getOrderPaymentsDetail()
{
return OrderPaymentDetail::getByOrderId($this->id);
}
/**
* Return a unique reference like : GWJTHMZUN#2
*

View File

@@ -0,0 +1,74 @@
<?php
/**
* 2010-2022 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-2022 Webkul IN
* @license https://store.webkul.com/license.html
*/
class OrderCustomerGuestDetailCore extends ObjectModel
{
public $id_order_customer_guest_detail;
public $id_order;
public $id_gender;
public $firstname;
public $lastname;
public $email;
public $phone;
public $date_add;
public $date_upd;
public static $definition = array(
'table' => 'order_customer_guest_detail',
'primary' => 'id_order_customer_guest_detail',
'fields' => array(
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32),
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32),
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 128),
'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
public static function isCustomerGuestBooking($id_order)
{
return Db::getInstance()->getValue('
SELECT `id_order_customer_guest_detail`
FROM `'._DB_PREFIX_.'order_customer_guest_detail`
WHERE `id_order` = '.(int)$id_order
);
}
public function validateGuestInfo()
{
$isValid = true;
if (!trim($this->firstname) || !Validate::isName($this->firstname)) {
$isValid = false;
}
if (!trim($this->lastname) || !Validate::isName($this->lastname)) {
$isValid = false;
}
if (!trim($this->email) || !Validate::isEmail($this->email)) {
$isValid = false;
}
if (!trim($this->phone) || !Validate::isPhoneNumber($this->phone)) {
$isValid = false;
}
return $isValid;
}
}

View File

@@ -322,30 +322,19 @@ class OrderHistoryCore extends ObjectModel
/** @var OrderInvoice $invoice */
$rest_paid = $invoice->getRestPaid();
if ($rest_paid > 0) {
$payment = new OrderPayment();
$payment->order_reference = Tools::substr($order->reference, 0, 9);
$payment->id_currency = $order->id_currency;
$payment->amount = $rest_paid;
if ($order->total_paid != 0) {
$payment->payment_method = $payment_method->displayName;
$payment_method = $payment_method->displayName;
} else {
$payment->payment_method = null;
$payment_method = null;
}
// Update total_paid_real value for backward compatibility reasons
if ($payment->id_currency == $order->id_currency) {
$order->total_paid_real += $payment->amount;
} else {
$order->total_paid_real += Tools::ps_round(Tools::convertPrice($payment->amount, $payment->id_currency, false), 2);
}
$order->save();
$payment->conversion_rate = ($order ? $order->conversion_rate : 1);
$payment->save();
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment` (`id_order_invoice`, `id_order_payment`, `id_order`)
VALUES('.(int)$invoice->id.', '.(int)$payment->id.', '.(int)$order->id.')');
$order->addOrderPayment(
$rest_paid,
$payment_method,
null,
null,
null,
$invoice
);
}
}
}

View File

@@ -738,10 +738,10 @@ class OrderInvoiceCore extends ObjectModel
$cache_id = 'order_invoice_paid_'.(int)$this->id;
if (!Cache::isStored($cache_id)) {
$amount = 0;
$payments = OrderPayment::getByInvoiceId($this->id);
$payments = OrderPaymentDetail::getByInvoiceId($this->id);
foreach ($payments as $payment) {
/** @var OrderPayment $payment */
$amount += $payment->amount;
$amount += $payment['amount'];
}
Cache::store($cache_id, $amount);
return $amount;
@@ -880,6 +880,11 @@ class OrderInvoiceCore extends ObjectModel
return OrderPayment::getByInvoiceId($this->id);
}
public function getOrderPaymentDetail()
{
return OrderPaymentDetail::getByInvoiceId($this->id);
}
/**
* Get the formatted number of invoice
* @since 1.5.0.2

View File

@@ -0,0 +1,71 @@
<?php
/**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*/
class OrderPaymentDetailCore extends ObjectModel
{
public $id_order_payment;
public $id_order;
public $amount;
public $date_add;
public static $definition = array(
'table' => 'order_payment_detail',
'primary' => 'id_order_payment_detail',
'fields' => array(
'id_order_payment' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'required' => true),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
)
);
/**
* Get Order Payments By Order ID
*
* @param int $id_invoice Order ID
* @return array OrderPayment detail
*/
public static function getByOrderId($id_order)
{
return Db::getInstance()->executeS('
SELECT opd.*, op.`id_currency`, op.`payment_method`, op.`conversion_rate`, op.`transaction_id`, op.`card_number`, op.`card_brand`, op.`card_expiration`, op.`card_holder`
FROM `'._DB_PREFIX_.'order_payment_detail` opd
INNER JOIN `'._DB_PREFIX_.'order_payment`op ON (op.`id_order_payment` = opd.`id_order_payment`)
WHERE `id_order` = '.(int)$id_order
);
}
/**
* Get Order Payments By Invoice ID
*
* @param int $id_invoice Invoice ID
* @return array OrderPayment detail
*/
public static function getByInvoiceId($id_invoice)
{
return Db::getInstance()->executeS('
SELECT opd.`id_order_payment_detail`, opd.`id_order_payment`, opd.`id_order`, opd.`date_add`, op.*, opd.`amount` as `amount`
FROM `'._DB_PREFIX_.'order_payment_detail` opd
INNER JOIN `'._DB_PREFIX_.'order_payment` op ON (opd.`id_order_payment` = op.`id_order_payment`)
INNER JOIN `'._DB_PREFIX_.'order_invoice_payment` oip ON (oip.`id_order_payment_detail` = opd.`id_order_payment_detail`)
WHERE oip.`id_order_invoice` = '.(int)$id_invoice
);
}
}

View File

@@ -40,7 +40,7 @@ class WebserviceOutputJSON implements WebserviceOutputInterface
/**
* Current association
*/
protected $currentAssociatedEntity;
protected $currentAssociatedEntity = array();
/**
* Json content

View File

@@ -161,10 +161,10 @@ if ($cookie_lifetime > 0) {
$cookie_lifetime = time() + (max($cookie_lifetime, 1) * 3600);
}
$force_ssl = Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE');
if (defined('_PS_ADMIN_DIR_')) {
$cookie = new Cookie('psAdmin', '', $cookie_lifetime);
$cookie = new Cookie('psAdmin', '', $cookie_lifetime, null, false, $force_ssl);
} else {
$force_ssl = Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE');
if ($context->shop->getGroup()->share_order) {
$cookie = new Cookie('ps-sg'.$context->shop->getGroup()->id, '', $cookie_lifetime, $context->shop->getUrlsSharedCart(), false, $force_ssl);
} else {

View File

@@ -65,7 +65,6 @@
<hooks>
<hook module="hotelreservationsystem" hook="actionValidateOrder" position="1"/>
<hook module="hotelreservationsystem" hook="Header" position="1"/>
<hook module="hotelreservationsystem" hook="actionProductUpdate" position="1"/>
<hook module="hotelreservationsystem" hook="displayTop" position="1"/>
<hook module="hotelreservationsystem" hook="displayFooter" position="1"/>
<hook module="hotelreservationsystem" hook="actionOrderStatusPostUpdate" position="1"/>
@@ -77,8 +76,6 @@
<hook module="hotelreservationsystem" hook="displayAfterDefautlFooterHook" position="1"/>
<hook module="hotelreservationsystem" hook="addWebserviceResources" position="1"/>
<hook module="hotelreservationsystem" hook="actionObjectLanguageAddAfter" position="1"/>
<hook module="hotelreservationsystem" hook="actionAdminControllerSetMedia" position="1"/>
<hook module="hotelreservationsystem" hook="displayAdminProductsExtra" position="1"/>
<hook module="hotelreservationsystem" hook="actionObjectProfileAddAfter" position="1"/>
<hook module="hotelreservationsystem" hook="actionObjectProfileDeleteBefore" position="1"/>
<hook module="hotelreservationsystem" hook="actionObjectGroupDeleteBefore" position="1"/>

View File

@@ -85,6 +85,16 @@ class AdminAdminPreferencesControllerCore extends AdminController
'default' => '480',
'visibility' => Shop::CONTEXT_ALL
),
'PS_COOKIE_SAMESITE' => array(
'title' => $this->l('Same site cookie'),
'hint' => $this->l('Allows you to declare if your cookie should be restricted to a first-party or same-site context.'),
'validation' => 'isGenericName',
'type' => 'select',
'cast' => 'strval',
'identifier' => 'type',
'list' => CookieCore::SAMESITE_AVAILABLE_VALUES,
'visibility' => Shop::CONTEXT_ALL
),
),
'submit' => array('title' => $this->l('Save'))
),
@@ -159,6 +169,12 @@ class AdminAdminPreferencesControllerCore extends AdminController
$upload_max_size = (int)str_replace('M', '', ini_get('upload_max_filesize'));
$post_max_size = (int)str_replace('M', '', ini_get('post_max_size'));
$max_size = $upload_max_size < $post_max_size ? $upload_max_size : $post_max_size;
$forceSsl = Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE');
if (!$forceSsl && Tools::getValue('PS_COOKIE_SAMESITE') === Cookie::SAMESITE_NONE) {
$this->errors[] = Tools::displayError('The SameSite=None is only available in secure mode.');
return;
}
if (Tools::getValue('PS_LIMIT_UPLOAD_FILE_VALUE') > $max_size || Tools::getValue('PS_LIMIT_UPLOAD_IMAGE_VALUE') > $max_size) {
$this->errors[] = Tools::displayError('The limit chosen is larger than the server\'s maximum upload limit. Please increase the limits of your server.');

View File

@@ -592,7 +592,7 @@ class AdminCartsControllerCore extends AdminController
$id_cart = Tools::getValue('id_cart');//get cart id from url
$cart_detail_data = array();
$cart_detail_data_obj = new HotelCartBookingData();
$update_htl_cart_currency = $cart_detail_data_obj->updateIdCurrencyByIdCart($id_cart, $currency->id);
$cart_detail_data_obj->updateIdCurrencyByIdCart($id_cart, $currency->id);
$cart_detail_data = $cart_detail_data_obj->getCartFormatedBookinInfoByIdCart((int) $id_cart);
$this->context->smarty->assign(array(
'cart_detail_data' => $cart_detail_data,

View File

@@ -881,13 +881,14 @@ class AdminOrdersControllerCore extends AdminController
false,
$cart->secure_key
);
/*
setcookie('wk_id_cart', ' ', time() - 86400, '/');
setcookie('wk_id_guest', ' ', time() - 86400, '/');
unset($_COOKIE['wk_id_cart']);
unset($_COOKIE['wk_id_guest']);
*/
if (isset($this->context->cookie->id_cart)) {
unset($this->context->cookie->id_cart);
}
if (isset($this->context->cookie->id_guest)) {
unset($this->context->cookie->id_guest);
}
if ($payment_module->currentOrder) {
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$payment_module->currentOrder.'&vieworder'.'&token='.$this->token.'&conf=3');
}
@@ -1351,6 +1352,13 @@ class AdminOrdersControllerCore extends AdminController
$this->toolbar_title .= ' - '.sprintf($this->l('Shop: %s'), $shop->name);
}
// get details if booking is done for some other guest
$customerGuestDetail = false;
if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) {
$customerGuestDetail = new OrderCustomerGuestDetail($id_customer_guest_detail);
$customerGuestDetail->gender = new Gender($customerGuestDetail->id_gender, $this->context->language->id);
}
// gets warehouses to ship products, if and only if advanced stock management is activated
$warehouse_list = null;
@@ -1431,6 +1439,16 @@ class AdminOrdersControllerCore extends AdminController
foreach ($history as &$order_state) {
$order_state['text-color'] = Tools::getBrightness($order_state['color']) < 128 ? 'white' : 'black';
}
$order_payment_detail = $order->getOrderPaymentDetail();
foreach ($order_payment_detail as &$payment_detail) {
$payment = new OrderPayment($payment_detail['id_order_payment']);
if ($invoice = $payment->getOrderInvoice($order->id)) {
$payment_detail['invoice_number'] = $invoice->getInvoiceNumberFormatted($this->context->language->id, $order->id_shop);
}
}
//by webkul to get data to show hotel rooms order data on order detail page
$cart_id = Cart::getCartIdByOrderId(Tools::getValue('id_order'));
@@ -1537,6 +1555,8 @@ class AdminOrdersControllerCore extends AdminController
'cart' => new Cart($order->id_cart),
'customer' => $customer,
'gender' => $gender,
'customerGuestDetail' => $customerGuestDetail,
'genders' => Gender::getGenders(),
'customer_addresses' => $customer->getAddresses($this->context->language->id),
'addresses' => array(
'delivery' => $addressDelivery,
@@ -1547,13 +1567,13 @@ class AdminOrdersControllerCore extends AdminController
'customerStats' => $customer->getStats(),
'products' => $products,
'discounts' => $order->getCartRules(),
'orders_total_paid_tax_incl' => $order->getOrdersTotalPaid(), // Get the sum of total_paid_tax_incl of the order with similar reference
'total_paid' => $order->getTotalPaid(),
'customer_thread_message' => CustomerThread::getCustomerMessages($order->id_customer, null, $order->id),
'orderMessages' => OrderMessage::getOrderMessages($order->id_lang),
'messages' => Message::getMessagesByOrderId($order->id, true),
'carrier' => new Carrier($order->id_carrier),
'history' => $history,
'order_payment_detail' => $order_payment_detail,
'states' => OrderState::getOrderStates($this->context->language->id),
'warehouse_list' => $warehouse_list,
'sources' => ConnectionsSource::getOrderSources($order->id),
@@ -1606,6 +1626,49 @@ class AdminOrdersControllerCore extends AdminController
return parent::renderView();
}
public function ajaxProcessUpdateGuestDetails()
{
$response = array(
'success' => false
);
if (Validate::isLoadedObject($order = new Order(Tools::getValue('id_order')))) {
if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) {
if (Validate::isLoadedObject($objCustomerGuestDetail = new OrderCustomerGuestDetail($id_customer_guest_detail))) {
$id_gender = Tools::getValue('id_gender');
$firstname = Tools::getValue('firstname');
$lastname = Tools::getValue('lastname');
$email = Tools::getValue('email');
$phone = Tools::getValue('phone');
$objCustomerGuestDetail->id_gender = $id_gender;
$objCustomerGuestDetail->firstname = $firstname;
$objCustomerGuestDetail->lastname = $lastname;
$objCustomerGuestDetail->email = $email;
$objCustomerGuestDetail->phone = $phone;
if ($objCustomerGuestDetail->validateGuestInfo()) {
if ($objCustomerGuestDetail->save()) {
$response['success'] = true;
$gender = new Gender($objCustomerGuestDetail->id_gender, $this->context->language->id);
$response['data']['guest_name'] = $gender->name.' '.$objCustomerGuestDetail->firstname.' '.$objCustomerGuestDetail->lastname ;
$response['data']['guest_email'] = $objCustomerGuestDetail->email;
$response['data']['guest_phone'] = $objCustomerGuestDetail->phone;
$response['msg'] = $this->l('Guest details are updated.');
} else {
$response['errors'][] = $this->l('Unable to save guest details.');
}
} else {
$response['errors'][] = $this->l('Invalid guest details, please check and try again.');
}
} else {
$response['errors'][] = $this->l('Guest details not found.');
}
} else {
$response['errors'][] = $this->l('Guest details not found.');
}
}
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessSearchProducts()
{
Context::getContext()->customer = new Customer((int)Tools::getValue('id_customer'));

View File

@@ -382,6 +382,29 @@ class AdminPPreferencesControllerCore extends AdminController
// 'bottom' => '<script type="text/javascript">stockManagementActivationAuthorization();advancedStockManagementActivationAuthorization();</script>',
// 'submit' => array('title' => $this->l('Save'))
// ),
'fo_search_filters' => array(
'title' => $this->l('Search Results Page Filters'),
'icon' => 'icon-search',
'fields' => array(
'SHOW_AMENITIES_FILTER' => array(
'title' => $this->l('Show Amenities filter'),
'hint' => $this->l('Enable to display Amenities filter.'),
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
'type' => 'bool',
),
'SHOW_PRICE_FILTER' => array(
'title' => $this->l('Show Price filter'),
'hint' => $this->l('Enable to display Price filter.'),
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
'type' => 'bool',
),
),
'submit' => array('title' => $this->l('Save'))
),
);
}

View File

@@ -113,6 +113,7 @@ class AdminProductsControllerCore extends AdminController
'Configuration' => $this->l('Configuration'),
'Occupancy' => $this->l('Occupancy'),
'LengthOfStay' => $this->l('Length of Stay'),
'AdditionalFacilities' => $this->l('Additional Facilities'),
);
$this->available_tabs = array('Warehouses' => 14);
@@ -134,6 +135,7 @@ class AdminProductsControllerCore extends AdminController
'Configuration' => 14,
'Occupancy' => 15,
'LengthOfStay' => 16,
'AdditionalFacilities' => 17,
));
}
@@ -2228,6 +2230,9 @@ class AdminProductsControllerCore extends AdminController
if ($this->isTabSubmitted('Configuration')) {
$this->processConfiguration();
}
if ($this->isTabSubmitted('AdditionalFacilities')) {
$this->processAdditionalFacilities();
}
$this->updatePackItems($object);
// Disallow avanced stock management if the product become a pack
@@ -3784,6 +3789,122 @@ class AdminProductsControllerCore extends AdminController
die('0');
}
public function initFormAdditionalFacilities($obj)
{
$data = $this->createTemplate($this->tpl_form);
if ($obj->id) {
$objGlobalDemand = new HotelRoomTypeGlobalDemand();
$allDemands = $objGlobalDemand->getAllDemands();
$objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
// get room type additional facilities
$objRoomDemand = new HotelRoomTypeDemand();
$roomDemandPrices = $objRoomDemand->getRoomTypeDemands($obj->id, 0, 0);
$data->assign(array(
'product' => $obj,
'roomDemandPrices' => $roomDemandPrices,
'allDemands' => $allDemands,
'defaultcurrencySign' => $objCurrency->sign,
));
} else {
$this->displayWarning($this->l('You must save this room type before managing additional facilities.'));
}
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function processAdditionalFacilities()
{
if ($idProduct = Tools::getValue('id_product')) {
$objRoomTypeDemand = new HotelRoomTypeDemand();
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
// first delete all the previously saved prices and demands of this room type
$objRoomTypeDemand->deleteRoomTypeDemands($idProduct);
$objRoomTypeDemandPrice->deleteRoomTypeDemandPrices($idProduct);
if ($selectedDemands = Tools::getValue('selected_demand')) {
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
foreach ($selectedDemands as $idGlobalDemand) {
if (Validate::isLoadedObject($objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand))) {
// save selected demands for this room type
$objRoomTypeDemand = new HotelRoomTypeDemand();
$objRoomTypeDemand->id_product = $idProduct;
$objRoomTypeDemand->id_global_demand = $idGlobalDemand;
$objRoomTypeDemand->save();
// save selected demands prices for this room type
$demandPrice = Tools::getValue('demand_price_'.$idGlobalDemand);
if (Validate::isPrice($demandPrice)) {
if ($objGlobalDemand->price != $demandPrice) {
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
$objRoomTypeDemandPrice->id_product = $idProduct;
$objRoomTypeDemandPrice->id_global_demand = $idGlobalDemand;
$objRoomTypeDemandPrice->id_option = 0;
$objRoomTypeDemandPrice->price = $demandPrice;
$objRoomTypeDemandPrice->save();
}
} else {
$this->errors[] = Tools::displayError('Invalid demand price of facility.').
' : '.$objGlobalDemand->name[$this->context->language->id];
}
if ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($idGlobalDemand)) {
foreach ($advOptions as $option) {
if (Validate::isLoadedObject($objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($option['id']))) {
$optionPrice = Tools::getValue('option_price_'.$option['id']);
if (Validate::isPrice($optionPrice)) {
if ($optionPrice != $objAdvOption->price) {
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
$objRoomTypeDemandPrice->id_product = $idProduct;
$objRoomTypeDemandPrice->id_global_demand = $idGlobalDemand;
$objRoomTypeDemandPrice->id_option = $option['id'];
$objRoomTypeDemandPrice->price = $optionPrice;
$objRoomTypeDemandPrice->save();
}
} else {
$this->errors[] = Tools::displayError('Invalid price of advanced option: ').$objAdvOption->name[$this->context->language->id];
}
}
}
}
}
}
if (count($this->errors)) {
$this->warnings[] = Tools::displayError('Invalid price values are not saved. Please correct them and save again.');
}
$objCartBookingData = new HotelCartBookingData();
if ($cartExtraDemands = $objCartBookingData->getCartExtraDemands(0, $idProduct)) {
// delete the demands from cart if not available in cart
$objRoomDemand = new HotelRoomTypeDemand();
$roomTypeDemandIds = array();
if ($roomTypeDemands = $objRoomDemand->getRoomTypeDemands($idProduct)) {
$roomTypeDemandIds = array_keys($roomTypeDemands);
}
foreach ($cartExtraDemands as &$demandInfo) {
if (isset($demandInfo['extra_demands']) && $demandInfo['extra_demands']) {
$cartChanged = 0;
foreach ($demandInfo['extra_demands'] as $key => $demand) {
if (!in_array($demand['id_global_demand'], $roomTypeDemandIds)) {
$cartChanged = 1;
unset($demandInfo['extra_demands'][$key]);
}
}
if ($cartChanged) {
if (Validate::isLoadedObject(
$objCartBooking = new HotelCartBookingData($demandInfo['id'])
)) {
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
$objCartBooking->save();
}
}
}
}
}
}
}
}
/**
* @param Product $obj
*

View File

@@ -144,7 +144,7 @@ class AdminThemesControllerCore extends AdminController
'fields' => array(
'PS_LOGO' => array(
'title' => $this->l('Header logo'),
'hint' => $this->l('Will appear on main page. Recommended height: 52px. Maximum height on default theme: 65px.'),
'hint' => $this->l('Will appear on header of website. Maximum height on default theme: 60px.'),
'type' => 'file',
'name' => 'PS_LOGO',
'tab' => 'logo',
@@ -153,7 +153,7 @@ class AdminThemesControllerCore extends AdminController
'PS_LOGO_MOBILE' => array(
'title' => $this->l('Header logo for mobile'),
'desc' => ((Configuration::get('PS_LOGO_MOBILE') === false) ? '<span class="light-warning">'.$this->l('Warning: No mobile logo has been defined. The header logo will be used instead.').'</span><br />' : ''),
'hint' => $this->l('Will appear on the main page of your mobile template. If left undefined, the header logo will be used.'),
'hint' => $this->l('Will appear on the header of your mobile template. If left undefined, the header logo will be used.'),
'type' => 'file',
'name' => 'PS_LOGO_MOBILE',
'tab' => 'mobile',

View File

@@ -98,6 +98,18 @@ class CategoryControllerCore extends FrontController
$this->errors[] = Tools::displayError('Missing category ID');
}
// validate dates if available
$dateFrom = Tools::getValue('date_from');
$dateTo = Tools::getValue('date_to');
if ($dateFrom != '' && !Validate::isDate($dateFrom)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
if ($dateTo != '' && !Validate::isDate($dateTo)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
// Instantiate category
$this->category = new Category($id_category, $this->context->language->id);

View File

@@ -275,6 +275,12 @@ class OrderDetailControllerCore extends FrontController
$customer = new Customer($order->id_customer);
$customerGuestDetail = false;
if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) {
$customerGuestDetail = new OrderCustomerGuestDetail($id_customer_guest_detail);
}
//by webkul to show order details properly on order history page
if (Module::isInstalled('hotelreservationsystem')) {
@@ -459,6 +465,7 @@ class OrderDetailControllerCore extends FrontController
'shop_name' => strval(Configuration::get('PS_SHOP_NAME')),
'order' => $order,
'guestInformations' => (array)new Customer($order->id_customer),
'customerGuestDetail' => $customerGuestDetail,
'currency' => new Currency($order->id_currency),
'order_state' => (int) $id_order_state,
'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'),

View File

@@ -345,6 +345,10 @@ class OrderOpcControllerCore extends ParentOrderController
$this->ajaxDie($this->changeRoomDemands());
exit;
break;
case 'submitCustomerGuestDetail':
$this->ajaxDie($this->submitCustomerGuestDetail());
exit;
break;
default:
throw new PrestaShopException('Unknown method "'.Tools::getValue('method').'"');
}
@@ -505,6 +509,15 @@ class OrderOpcControllerCore extends ParentOrderController
$this->_assignCarrier();
// PAYMENT
$this->_assignPayment();
// GUEST BOOKING
if ($this->isLogged) {
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
$this->context->smarty->assign(
'customer_guest_detail', CartCustomerGuestDetail::getCustomerGuestDetail($id_customer_guest_detail)
);
}
$this->context->smarty->assign('id_customer_guest_detail', $id_customer_guest_detail);
}
Tools::safePostVars();
$newsletter = Configuration::get('PS_CUSTOMER_NWSL') || (Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active);
@@ -993,6 +1006,50 @@ class OrderOpcControllerCore extends ParentOrderController
die('0');
}
public function submitCustomerGuestDetail()
{
$customerGuestDetail = Tools::getValue('customer_guest_detail');
$this->context->cookie->__set('customer_details_proceeded', 0);
$this->context->cookie->checkedTOS = false;
if ($customerGuestDetail) {
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
$objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail);
} else {
$objCustomerGuestDetail = new CartCustomerGuestDetail();
}
$customerGuestDetailGender = Tools::getValue('customer_guest_detail_gender');
$customerGuestDetailFirstname = Tools::getValue('customer_guest_detail_firstname');
$customerGuestDetailLastname = Tools::getValue('customer_guest_detail_lastname');
$customerGuestDetailEmail = Tools::getValue('customer_guest_detail_email');
$customerGuestDetailPhone = Tools::getValue('customer_guest_detail_phone');
if (trim($customerGuestDetailGender) && Validate::isUnsignedInt($customerGuestDetailGender)) {
$objCustomerGuestDetail->id_gender = $customerGuestDetailGender;
}
if (trim($customerGuestDetailFirstname) && Validate::isName($customerGuestDetailFirstname)) {
$objCustomerGuestDetail->firstname = $customerGuestDetailFirstname;
}
if (trim($customerGuestDetailLastname) && Validate::isName($customerGuestDetailLastname)) {
$objCustomerGuestDetail->lastname = $customerGuestDetailLastname;
}
if (trim($customerGuestDetailEmail) && Validate::isEmail($customerGuestDetailEmail)) {
$objCustomerGuestDetail->email = $customerGuestDetailEmail;
}
if (trim($customerGuestDetailPhone) && Validate::isPhoneNumber($customerGuestDetailPhone)) {
$objCustomerGuestDetail->phone = $customerGuestDetailPhone;
}
$objCustomerGuestDetail->id_cart = $this->context->cart->id;
$objCustomerGuestDetail->save();
} else {
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
if (Validate::isLoadedObject($objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail))) {
$objCustomerGuestDetail->delete();
}
}
}
$this->context->cart->save();
}
public function updateContext(Customer $customer)
{
$this->context->cookie->id_customer = (int)$customer->id;

View File

@@ -91,6 +91,18 @@ class ProductControllerCore extends FrontController
*/
public function init()
{
// validate dates if available
$dateFrom = Tools::getValue('date_from');
$dateTo = Tools::getValue('date_to');
if ($dateFrom != '' && !Validate::isDate($dateFrom)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
if ($dateTo != '' && !Validate::isDate($dateTo)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
parent::init();
if ($id_product = (int) Tools::getValue('id_product')) {

View File

@@ -673,6 +673,32 @@ CREATE TABLE `PREFIX_customer_thread` (
KEY `id_product` (`id_product`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
CREATE TABLE `PREFIX_order_customer_guest_detail` (
`id_order_customer_guest_detail` int(10) unsigned NOT NULL auto_increment,
`id_order` int(10) unsigned NOT NULL,
`id_gender` int(10) unsigned NOT NULL,
`firstname` varchar(32) NOT NULL,
`lastname` varchar(32) NOT NULL,
`email` varchar(128) NOT NULL,
`phone` varchar(32) DEFAULT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_order_customer_guest_detail`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
CREATE TABLE `PREFIX_cart_customer_guest_detail` (
`id_customer_guest_detail` int(10) unsigned NOT NULL auto_increment,
`id_cart` int(10) unsigned NOT NULL,
`id_gender` int(10) unsigned NOT NULL,
`firstname` varchar(32) NOT NULL,
`lastname` varchar(32) NOT NULL,
`email` varchar(128) NOT NULL,
`phone` varchar(32) DEFAULT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_customer_guest_detail`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
CREATE TABLE `PREFIX_customization` (
`id_customization` int(10) unsigned NOT NULL auto_increment,
`id_product_attribute` int(10) unsigned NOT NULL DEFAULT '0',
@@ -1458,6 +1484,15 @@ CREATE TABLE `PREFIX_order_payment` (
KEY `order_reference`(`order_reference`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
CREATE TABLE `PREFIX_order_payment_detail` (
`id_order_payment_detail` INT(10) unsigned NOT NULL auto_increment,
`id_order_payment` INT(10) unsigned NOT NULL,
`id_order` INT(10) unsigned NOT NULL,
`amount` DECIMAL(10,2) NOT NULL,
`date_add` DATETIME NOT NULL,
PRIMARY KEY (`id_order_payment_detail`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
CREATE TABLE `PREFIX_product` (
`id_product` int(10) unsigned NOT NULL auto_increment,
`id_supplier` int(10) unsigned DEFAULT NULL,
@@ -2598,7 +2633,7 @@ CREATE TABLE `PREFIX_tab_module_preference` (
UNIQUE KEY `employee_module` (`id_employee`, `id_tab`, `module`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
CREATE TABLE `PREFIX_carrier_tax_rules_group_shop` (
CREATE TABLE `PREFIX_carrier_tax_rules_group_shop` (
`id_carrier` int( 11 ) unsigned NOT NULL,
`id_tax_rules_group` int(11) unsigned NOT NULL,
`id_shop` int(11) unsigned NOT NULL,
@@ -2608,6 +2643,7 @@ CREATE TABLE `PREFIX_tab_module_preference` (
CREATE TABLE `PREFIX_order_invoice_payment` (
`id_order_invoice` int(11) unsigned NOT NULL,
`id_order_payment` int(11) unsigned NOT NULL,
`id_order_payment_detail` int(11) unsigned NOT NULL,
`id_order` int(11) unsigned NOT NULL,
PRIMARY KEY (`id_order_invoice`,`id_order_payment`),
KEY `order_payment` (`id_order_payment`),

View File

@@ -3,6 +3,8 @@ SET NAMES 'utf8';
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'PS_CONDITIONS';
UPDATE `PREFIX_configuration` SET value = '12' WHERE name = 'PS_PRODUCTS_PER_PAGE';
UPDATE `PREFIX_configuration` SET value = '9' WHERE name = 'PS_HOTEL_IMAGES_PER_PAGE';
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'SHOW_AMENITIES_FILTER';
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'SHOW_PRICE_FILTER';
UPDATE `PREFIX_configuration` SET value = '0' WHERE name = 'PS_PRODUCTS_ORDER_WAY';
UPDATE `PREFIX_configuration` SET value = '4' WHERE name = 'PS_PRODUCTS_ORDER_BY';
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'PS_DISPLAY_QTIES';

View File

@@ -62,6 +62,12 @@
<configuration id="PS_HOTEL_IMAGES_PER_PAGE" name="PS_HOTEL_IMAGES_PER_PAGE">
<value>9</value>
</configuration>
<configuration id="SHOW_AMENITIES_FILTER" name="SHOW_AMENITIES_FILTER">
<value>1</value>
</configuration>
<configuration id="SHOW_PRICE_FILTER" name="SHOW_PRICE_FILTER">
<value>1</value>
</configuration>
<configuration id="PS_PURCHASE_MINIMUM" name="PS_PURCHASE_MINIMUM">
<value>0</value>
</configuration>
@@ -440,6 +446,9 @@
<configuration id="PS_COOKIE_LIFETIME_BO" name="PS_COOKIE_LIFETIME_BO">
<value>480</value>
</configuration>
<configuration id="PS_COOKIE_SAMESITE" name="PS_COOKIE_SAMESITE">
<value>Lax</value>
</configuration>
<configuration id="PS_RESTRICT_DELIVERED_COUNTRIES" name="PS_RESTRICT_DELIVERED_COUNTRIES">
<value>0</value>
</configuration>

View File

@@ -190,12 +190,16 @@ function validate_field(that)
}
else if($(that).attr('data-validate'))
var result = window['validate_' + $(that).attr('data-validate')]($(that).val());
if (result)
if (result) {
$(that).parent().removeClass('form-error').addClass('form-ok');
else
return true;
} else {
$(that).parent().addClass('form-error').removeClass('form-ok');
return false;
}
}
return true;
}
$(document).on('focusout', 'input.validate, textarea.validate', function() {

View File

@@ -129,7 +129,7 @@ class Blockcart extends Module
$wrappingCost = (float) ($params['cart']->getOrderTotal($useTax, Cart::ONLY_WRAPPING));
$totalToPay = $params['cart']->getOrderTotal($useTax);
$tax_cost = 0;
if ($showTax) {
if ($useTax && $showTax) {
$totalToPayWithoutTaxes = $params['cart']->getOrderTotal(false);
$tax_cost = Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency);
}
@@ -252,6 +252,7 @@ class Blockcart extends Module
'shipping_cost_float' => $shipping_cost_float,
'show_wrapping' => $wrappingCost > 0 ? true : false,
'show_tax' => $showTax,
'use_tax' => $useTax,
'tax_cost' => $tax_cost,
'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency),
'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_PRODUCTS), $currency),

View File

@@ -206,7 +206,7 @@
</span>
</div>
{/if} --><!-- commented by webkul unnecessary data -->
{if $show_tax && isset($tax_cost)}
{if $show_tax && $use_tax}
<div class="cart-prices-line">
<span class="price cart_block_tax_cost ajax_cart_tax_cost">{$tax_cost}</span>
<span>{l s='Tax' mod='blockcart'}</span>

View File

@@ -59,13 +59,6 @@ class DashOccupancy extends Module
public function hookDashboardZoneOne()
{
$this->context->smarty->assign(array(
'count_total' => sprintf('%02d', $occupancyData['count_total']),
'count_occupied' => sprintf('%02d', $occupancyData['count_occupied']),
'count_available' => sprintf('%02d', $occupancyData['count_available']),
'count_unavailable' => sprintf('%02d', $occupancyData['count_unavailable']),
));
return $this->display(__FILE__, 'dashboard_zone_one.tpl');
}

View File

@@ -1408,45 +1408,39 @@ class HotelBookingDetail extends ObjectModel
* @return [Boolean] [Returns true if successfully updated else returns false]
*/
public function updateBookingOrderStatusByOrderId(
$order_id,
$new_status,
$id_room,
$date_from,
$date_to,
$status_date = ''
$idOrder,
$newStatus,
$idRoom,
$dateFrom,
$dateTo,
$statusDate = ''
) {
if ($status_date) {
$status_date = date('Y-m-d H:i:s', strtotime($status_date));
} else {
$status_date = date('Y-m-d H:i:s');
$roomBookingData = $this->getRoomBookingData($idRoom, $idOrder, $dateFrom, $dateTo);
$objHotelBookingDetail = new self($roomBookingData['id']);
if (Validate::isLoadedObject($objHotelBookingDetail)) {
if ($statusDate) {
$statusDate = date('Y-m-d H:i:s', strtotime($statusDate));
} else {
$statusDate = date('Y-m-d H:i:s');
}
if ($newStatus == self::STATUS_CHECKED_IN) {
$objHotelBookingDetail->id_status = $newStatus;
$objHotelBookingDetail->check_in = ($statusDate > $dateTo ? $dateTo : $statusDate);
} elseif ($newStatus == self::STATUS_CHECKED_OUT) {
$objHotelBookingDetail->id_status = $newStatus;
$objHotelBookingDetail->check_out = ($statusDate > $dateTo ? $dateTo : $statusDate);
} else {
$objHotelBookingDetail->id_status = $newStatus;
$objHotelBookingDetail->check_in = '';
$objHotelBookingDetail->check_out = '';
}
return $objHotelBookingDetail->save();
}
$table = 'htl_booking_detail';
// create date to update in the table
if ($new_status == self::STATUS_CHECKED_IN) {
$data = array(
'id_status' => $new_status,
'check_in' => ($status_date > $date_to ? $date_to : $status_date)
);
} elseif ($new_status == self::STATUS_CHECKED_OUT) {
$data = array(
'id_status' => $new_status,
'check_out' => ($status_date > $date_to ? $date_to : $status_date)
);
} else {
$data = array(
'id_status' => $new_status,
'check_in' => '',
'check_out' => ''
);
}
// where conditions
$where = 'id_order = '.(int)$order_id.' AND id_room = '.(int)$id_room.
' AND `date_from` = \''.pSQL($date_from).'\' AND `date_to` = \''.pSQL($date_to).'\'';
return Db::getInstance()->update($table, $data, $where);
return false;
}
/**
@@ -1602,8 +1596,9 @@ class HotelBookingDetail extends ObjectModel
*/
public function getAvailableRoomsForReallocation($date_from, $date_to, $id_room_type, $hotel_id)
{
if (isset($_COOKIE['wk_id_cart'])) {
$current_admin_cart_id = $_COOKIE['wk_id_cart'];
$context = Context::getContext();
if (isset($context->cookie->id_cart)) {
$current_admin_cart_id = $context->cookie->id_cart;
}
$exclude_ids = 'SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail`
WHERE `date_from` < \''.pSQL($date_to).'\' AND `date_to` > \''.pSQL($date_from).'\'
@@ -1672,36 +1667,48 @@ class HotelBookingDetail extends ObjectModel
*
* @return [boolean] [true if rooms successfully reallocated else returns false]
*/
public function reallocateRoomWithAvailableSameRoomType($current_room_id, $date_from, $date_to, $swapped_room_id)
public function reallocateRoomWithAvailableSameRoomType($currentRoomId, $dateFrom, $dateTo, $swappedRoomId)
{
$date_from = date('Y-m-d H:i:s', strtotime($date_from));
$date_to = date('Y-m-d H:i:s', strtotime($date_to));
$table = 'htl_cart_booking_data';
$table2 = 'htl_booking_detail';
$data = array('id_room' => $swapped_room_id);
$where = 'date_from=\''.pSQL($date_from).'\' AND date_to=\''.pSQL($date_to).'\' AND id_room='.
(int)$current_room_id;
$dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom));
$dateTo = date('Y-m-d H:i:s', strtotime($dateTo));
if ($result = Db::getInstance()->update($table, $data, $where)) {
if($room_num = Db::getInstance()->getValue(
'SELECT `room_num` FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id` = '.$swapped_room_id
)) {
$data['room_num'] = $room_num;
$idHotelCartBookingData = Db::getInstance()->getValue(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE date_from = "'.pSQL($dateFrom).'" AND date_to = "'.pSQL($dateTo).'"
AND id_room = '.(int) $currentRoomId
);
if ($idHotelCartBookingData) {
$objHotelCartBookingData = new HotelCartBookingData($idHotelCartBookingData);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$objHotelCartBookingData->id_room = $swappedRoomId;
if ($objHotelCartBookingData->save()) {
$objHotelRoomInformation = new HotelRoomInformation($swappedRoomId);
$roomBookingData = $this->getRoomBookingData($currentRoomId, $objHotelCartBookingData->id_order, $dateFrom, $dateTo);
$objHotelBookingDetail = new self($roomBookingData['id']);
if (Validate::isLoadedObject($objHotelBookingDetail)) {
$objHotelBookingDetail->id_room = $swappedRoomId;
$objHotelBookingDetail->room_num = $objHotelRoomInformation->room_num;
if ($objHotelBookingDetail->save()) {
Hook::exec(
'actionRoomReAllocateAfter',
array(
'room_id' => $currentRoomId,
'realloc_room_id' => $swappedRoomId,
'date_from' => $dateFrom,
'date_to' => $dateTo,
)
);
return true;
}
}
}
}
if ($result2 = Db::getInstance()->update($table2, $data, $where)) {
Hook::exec(
'actionRoomReAllocateAfter',
array(
'room_id' => $current_room_id,
'realloc_room_id' => $swapped_room_id,
'date_from' => $date_from,
'date_to' => $date_to,
)
);
return true;
}
return false;
}
return false;
}
@@ -1714,58 +1721,69 @@ class HotelBookingDetail extends ObjectModel
*
* @return [boolean] [true if rooms successfully swapped else returns false]
*/
public function swapRoomWithAvailableSameRoomType($current_room_id, $date_from, $date_to, $swapped_room_id)
public function swapRoomWithAvailableSameRoomType($currentRoomId, $dateFrom, $dateTo, $swappedRoomId)
{
$date_from = date('Y-m-d H:i:s', strtotime($date_from));
$date_to = date('Y-m-d H:i:s', strtotime($date_to));
$dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom));
$dateTo = date('Y-m-d H:i:s', strtotime($dateTo));
$idcrt1 = Db::getInstance()->getValue(
$idHotelCartBookingData1 = Db::getInstance()->getValue(
'SELECT `id` FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `is_refunded` = 0
AND `date_from`=\''.pSQL($date_from).'\' AND `date_to`=\''.pSQL($date_to).'\'
AND `id_room`='.(int)$swapped_room_id
AND `date_from`=\''.pSQL($dateFrom).'\' AND `date_to`=\''.pSQL($dateTo).'\'
AND `id_room`='.(int)$swappedRoomId
);
$idcrt2 = Db::getInstance()->getValue(
$idHotelCartBookingData2 = Db::getInstance()->getValue(
'SELECT `id` FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `is_refunded` = 0
AND `date_from`=\''.pSQL($date_from).'\' AND `date_to`=\''.pSQL($date_to).'\'
AND `id_room`='.(int)$current_room_id
AND `date_from`=\''.pSQL($dateFrom).'\' AND `date_to`=\''.pSQL($dateTo).'\'
AND `id_room`='.(int)$currentRoomId
);
$swap_room = Db::getInstance()->getRow(
'SELECT `id`, `room_num` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `is_refunded` = 0
AND `date_from`=\''.pSQL($date_from).'\' AND `date_to`=\''.pSQL($date_to).'\'
AND `id_room`='.(int)$swapped_room_id
$idHotelBookingDetail1 = Db::getInstance()->getValue(
'SELECT `id` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `is_refunded` = 0
AND `date_from`=\''.pSQL($dateFrom).'\' AND `date_to`=\''.pSQL($dateTo).'\'
AND `id_room`='.(int)$swappedRoomId
);
$curr_room = Db::getInstance()->getRow(
'SELECT `id`, `room_num` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `is_refunded` = 0
AND `date_from`=\''.pSQL($date_from).'\' AND `date_to`=\''.pSQL($date_to).'\'
AND `id_room`='.(int)$current_room_id
$idHotelBookingDetail2 = Db::getInstance()->getValue(
'SELECT `id` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `is_refunded` = 0
AND `date_from`=\''.pSQL($dateFrom).'\' AND `date_to`=\''.pSQL($dateTo).'\'
AND `id_room`='.(int)$currentRoomId
);
$sql = 'UPDATE `'._DB_PREFIX_.'htl_cart_booking_data` SET `id_room`=IF(`id`='.(int)$idcrt1.','.
(int)$current_room_id.','.(int)$swapped_room_id.') WHERE `id` IN('.(int)$idcrt1.','.(int)$idcrt2.')';
$sql1 = 'UPDATE `'._DB_PREFIX_.'htl_booking_detail`
SET `id_room`=IF(`id`='.(int)$swap_room['id'].','.(int)$current_room_id.','.(int)$swapped_room_id.'),
`room_num`=IF(
`id`='.(int)$swap_room['id'].',\''.pSQL($curr_room['room_num']).'\',\''.pSQL($swap_room['room_num']).'\'
)
WHERE `id` IN('.(int)$swap_room['id'].','.(int)$curr_room['id'].')';
$objHotelCartBookingData1 = new HotelCartBookingData($idHotelCartBookingData1);
$objHotelCartBookingData2 = new HotelCartBookingData($idHotelCartBookingData2);
if ($result = Db::getInstance()->execute($sql)) {
$result2 = Db::getInstance()->execute($sql1);
if ($result2) {
Hook::exec(
'actionRoomSwapAfter',
array(
'room_id' => $current_room_id,
'swapped_room_id' => $swapped_room_id,
'date_from' => $date_from,
'date_to' => $date_to,
)
);
return true;
}
return false;
$temp = $objHotelCartBookingData1->id_room;
$objHotelCartBookingData1->id_room = $objHotelCartBookingData2->id_room;
$objHotelCartBookingData2->id_room = $temp;
$objHotelBookingDetail1 = new HotelBookingDetail($idHotelBookingDetail1);
$objHotelBookingDetail2 = new HotelBookingDetail($idHotelBookingDetail2);
$temp = $objHotelBookingDetail1->id_room;
$objHotelBookingDetail1->id_room = $objHotelBookingDetail2->id_room;
$objHotelBookingDetail2->id_room = $temp;
$temp = $objHotelBookingDetail1->room_num;
$objHotelBookingDetail1->room_num = $objHotelBookingDetail2->room_num;
$objHotelBookingDetail2->room_num = $temp;
if ($objHotelCartBookingData1->save()
&& $objHotelCartBookingData2->save()
&& $objHotelBookingDetail1->save()
&& $objHotelBookingDetail2->save()
) {
Hook::exec(
'actionRoomSwapAfter',
array(
'room_id' => $currentRoomId,
'swapped_room_id' => $swappedRoomId,
'date_from' => $dateFrom,
'date_to' => $dateTo,
)
);
return true;
}
return false;
}
@@ -1834,15 +1852,16 @@ class HotelBookingDetail extends ObjectModel
*
* @return [Boolean] [True if deleted else false]
*/
public function deleteOrderedRoomFromOrder($id_order, $id_hotel, $id_room, $date_from, $date_to)
public function deleteOrderedRoomFromOrder($idOrder, $idHotel, $idRoom, $dateFrom, $dateTo)
{
return Db::getInstance()->delete(
'htl_booking_detail',
'`id_order`='.(int) $id_order.' AND `id_hotel`='.(int) $id_hotel.' AND `id_room`='.(int) $id_room.
' AND `date_from`=\''.pSQL($date_from).'\' AND `date_to`=\''.pSQL($date_to).'\''
);
$roomBookingData = $this->getRoomBookingData($idRoom, $idOrder, $dateFrom, $dateTo);
$objHotelBookingDetail = new self($roomBookingData['id']);
return $delete;
if (Validate::isLoadedObject($objHotelBookingDetail)) {
return $objHotelBookingDetail->delete();
}
return false;
}
public function getRoomBookinInformationForDateRangeByOrder(
@@ -1861,86 +1880,92 @@ class HotelBookingDetail extends ObjectModel
}
public function UpdateHotelCartHotelOrderOnOrderEdit(
$id_order,
$id_room,
$old_date_from,
$old_date_to,
$new_date_from,
$new_date_to,
$idOrder,
$idRoom,
$oldDateFrom,
$oldDateTo,
$newDateFrom,
$newDateTo,
$occupancy,
$new_total_price = null
$newTotalPrice = null
) {
$rowByIdOrderIdRoom = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `id_room`='.(int)$id_room.' AND `id_order`='.(int)$id_order);
$newTotalPriceTE = '';
$newTotalPriceTI = '';
$newNumDays = $this->getNumberOfDays($new_date_from, $new_date_to);
if ($new_total_price) {
$newTotalPriceTE = $new_total_price['tax_excl'];
$newTotalPriceTI = $new_total_price['tax_incl'];
} else {
$oldNumDays = $this->getNumberOfDays($old_date_from, $old_date_to);
$unitRoomPriceTE = $rowByIdOrderIdRoom['total_price_tax_excl'] / $oldNumDays;
$unitRoomPriceTI = $rowByIdOrderIdRoom['total_price_tax_incl'] / $oldNumDays;
$newTotalPriceTE = $unitRoomPriceTE * $newNumDays;
$newTotalPriceTI = $unitRoomPriceTI * $newNumDays;
}
// retrieve HotelBookingDetail row
$roomBookingData = $this->getRoomBookingData($idRoom, $idOrder, $oldDateFrom, $oldDateTo);
$objHotelBookingDetail = new self($roomBookingData['id']);
if (Validate::isLoadedObject($objHotelBookingDetail)) {
// retrieve HotelCartBookingData row
$idHotelCartBookingData = Db::getInstance()->getValue(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE date_from = "'.pSQL($oldDateFrom).'" AND date_to = "'.pSQL($oldDateTo).'"
AND id_room = '.(int) $idRoom.' AND `id_order` = '.(int) $idOrder
);
// update `total_paid_amount` on database
$totalPaidAmount = 0;
$isAdvancePayment = Db::getInstance()->getValue(
'SELECT o.`is_advance_payment`
FROM `'._DB_PREFIX_.'orders` o
WHERE o.`id_order` = '.(int) $id_order
);
$objHotelCartBookingData = new HotelCartBookingData($idHotelCartBookingData);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
// calculate new prices
$newTotalPriceTE = '';
$newTotalPriceTI = '';
$newNumDays = $this->getNumberOfDays($newDateFrom, $newDateTo);
if ($newTotalPrice) {
$newTotalPriceTE = $newTotalPrice['tax_excl'];
$newTotalPriceTI = $newTotalPrice['tax_incl'];
} else {
$oldNumDays = $this->getNumberOfDays($oldDateFrom, $oldDateTo);
$unitRoomPriceTE = $objHotelBookingDetail->total_price_tax_excl / $oldNumDays;
$unitRoomPriceTI = $objHotelBookingDetail->total_price_tax_incl / $oldNumDays;
$newTotalPriceTE = $unitRoomPriceTE * $newNumDays;
$newTotalPriceTI = $unitRoomPriceTI * $newNumDays;
}
if ($isAdvancePayment) {
$objHotelAdvancedPayment = new HotelAdvancedPayment();
$productAdvancePayment = $objHotelAdvancedPayment->getIdAdvPaymentByIdProduct($rowByIdOrderIdRoom['id_product']);
if (!$productAdvancePayment || (isset($productAdvancePayment['payment_type']) && $productAdvancePayment['payment_type'])) {
$totalPaidAmount = $objHotelAdvancedPayment->getRoomMinAdvPaymentAmount(
$rowByIdOrderIdRoom['id_product'],
$new_date_from,
$new_date_to
// calculate `total_paid_amount`
$totalPaidAmount = 0;
$isAdvancePayment = Db::getInstance()->getValue(
'SELECT o.`is_advance_payment`
FROM `'._DB_PREFIX_.'orders` o
WHERE o.`id_order` = '.(int) $idOrder
);
if ($isAdvancePayment) {
$objHotelAdvancedPayment = new HotelAdvancedPayment();
$productAdvancePayment = $objHotelAdvancedPayment->getIdAdvPaymentByIdProduct($objHotelBookingDetail->id_product);
if (!$productAdvancePayment || (isset($productAdvancePayment['payment_type']) && $productAdvancePayment['payment_type'])) {
$totalPaidAmount = $objHotelAdvancedPayment->getRoomMinAdvPaymentAmount(
$objHotelBookingDetail->id_product,
$newDateFrom,
$newDateTo
);
}
} else {
$totalPaidAmount = $newTotalPriceTI;
}
// update $objHotelCartBookingData
$objHotelCartBookingData->date_from = $newDateFrom;
$objHotelCartBookingData->date_to = $newDateTo;
$objHotelCartBookingData->quantity = $newNumDays;
$objHotelCartBookingData->adults = $occupancy['adults'];
$objHotelCartBookingData->children = $occupancy['children'];
$objHotelCartBookingData->child_ages = json_encode($occupancy['child_ages']);
// update $objHotelBookingDetail
$objHotelBookingDetail->date_from = $newDateFrom;
$objHotelBookingDetail->date_to = $newDateTo;
$objHotelBookingDetail->total_price_tax_excl = Tools::ps_round($newTotalPriceTE, 6);
$objHotelBookingDetail->total_price_tax_incl = Tools::ps_round($newTotalPriceTI, 6);
$objHotelBookingDetail->total_paid_amount = Tools::ps_round($totalPaidAmount, 6);
$objHotelBookingDetail->adults = $occupancy['adults'];
$objHotelBookingDetail->children = $occupancy['children'];
$objHotelBookingDetail->child_ages = json_encode($occupancy['child_ages']);
if ($objHotelCartBookingData->save() && $objHotelBookingDetail->save()) {
return true;
}
}
} else {
$totalPaidAmount = $newTotalPriceTI;
}
$cart_booking = array(
'table' => 'htl_cart_booking_data',
'data' => array(
'date_from' => $new_date_from,
'date_to' => $new_date_to,
'quantity' => $newNumDays,
'adults' => $occupancy['adults'],
'children' => $occupancy['children'],
'child_ages' => json_encode($occupancy['child_ages']),
),
);
$booking_detail = array(
'table' => 'htl_booking_detail',
'data' => array(
'date_from' => $new_date_from,
'date_to' => $new_date_to,
'total_price_tax_excl' => $newTotalPriceTE,
'total_price_tax_incl' => $newTotalPriceTI,
'total_paid_amount' => $totalPaidAmount,
'adults' => $occupancy['adults'],
'children' => $occupancy['children'],
'child_ages' => json_encode($occupancy['child_ages']),
),
);
$where = 'id_order = '.(int)$id_order.' AND id_room = '.(int)$id_room.' AND date_from= \''.pSQL($old_date_from).
'\' AND date_to = \''.pSQL($old_date_to).'\' AND `is_refunded`=0 AND `is_back_order`=0';
$result = Db::getInstance()->update($cart_booking['table'], $cart_booking['data'], $where);
$result &= Db::getInstance()->update($booking_detail['table'], $booking_detail['data'], $where);
return $result;
return false;
}
/**
@@ -2358,37 +2383,105 @@ class HotelBookingDetail extends ObjectModel
}
}
public function deleteHotelOrderInfo($id_order)
public function deleteHotelOrderInfo($idOrder)
{
$cartTable = 'htl_cart_booking_data';
$orderTable = 'htl_booking_detail';
$condition = 'id_order = '.(int)$id_order;
if (Db::getInstance()->delete($orderTable, $condition)) {
return Db::getInstance()->delete($cartTable, $condition);
$result = true;
$objHotelCartBookingData = new HotelCartBookingData();
$bookingsCartData = $objHotelCartBookingData->getCartCurrentDataByOrderId($idOrder);
if (is_array($bookingsCartData) && count($bookingsCartData)) {
foreach ($bookingsData as $bookingCartData) {
$objHotelCartBookingData = new HotelCartBookingData($bookingCartData['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$result &= $objHotelCartBookingData->delete();
}
}
}
return false;
$bookingsData = $this->getBookingDataByOrderId($idOrder);
if (is_array($bookingsData) && count($bookingsData)) {
foreach ($bookingsData as $bookingData) {
$objHotelBookingDetail = new self($bookingData['id']);
if (Validate::isLoadedObject($objHotelBookingDetail)) {
$result &= $objHotelBookingDetail->delete();
}
}
}
return $result;
}
public function deleteHotelOrderRoomInfo($id_order, $id_product, $id_room)
public function deleteHotelOrderRoomInfo($idOrder, $idProduct, $idRoom)
{
$cartTable = 'htl_cart_booking_data';
$orderTable = 'htl_booking_detail';
$condition = 'id_order = '.(int)$id_order.' AND id_product = '.(int)$id_product.' AND id_room = '.(int)$id_room;
if (Db::getInstance()->delete($orderTable, $condition)) {
return Db::getInstance()->delete($cartTable, $condition);
$result = Db::getInstance()->executeS(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE `id_order` = '.(int) $idOrder.' AND `id_product` = '.(int) $idProduct.'
AND `id_room` = '.(int) $idRoom
);
$return = true;
if (is_array($result) && count($result)) {
foreach ($result as $row) {
$objHotelCartBookingData = new HotelCartBookingData($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$return &= $objHotelCartBookingData->delete();
}
}
}
return false;
$result = Db::getInstance()->executeS(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_booking_detail`
WHERE `id_order` = '.(int) $idOrder.' AND `id_product` = '.(int) $idProduct.'
AND `id_room` = '.(int) $idRoom
);
if (is_array($result) && count($result)) {
foreach ($result as $row) {
$objHotelBookingDetail = new self($row['id']);
if (Validate::isLoadedObject($objHotelBookingDetail)) {
$return &= $objHotelBookingDetail->delete();
}
}
}
return $return;
}
public function deleteHotelOrderRoomTypeInfo($id_order, $id_product)
public function deleteHotelOrderRoomTypeInfo($idOrder, $idProduct)
{
$cartTable = 'htl_cart_booking_data';
$orderTable = 'htl_booking_detail';
$condition = 'id_order = '.(int)$id_order.' AND id_product = '.(int)$id_product;
if (Db::getInstance()->delete($orderTable, $condition)) {
return Db::getInstance()->delete($cartTable, $condition);
$result = Db::getInstance()->executeS(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE `id_order` = '.(int) $idOrder.' AND `id_product` = '.(int) $idProduct
);
$return = true;
if (is_array($result) && count($result)) {
foreach ($result as $row) {
$objHotelCartBookingData = new HotelCartBookingData($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$return &= $objHotelCartBookingData->delete();
}
}
}
return false;
$result = Db::getInstance()->executeS(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_booking_detail`
WHERE `id_order` = '.(int) $idOrder.' AND `id_product` = '.(int) $idProduct
);
if (is_array($result) && count($result)) {
foreach ($result as $row) {
$objHotelBookingDetail = new self($row['id']);
if (Validate::isLoadedObject($objHotelBookingDetail)) {
$return &= $objHotelBookingDetail->delete();
}
}
}
return $return;
}
public function enterHotelOrderBookingFormCartBookingData($id_cart)
@@ -2440,6 +2533,8 @@ class HotelBookingDetail extends ObjectModel
public function updateHotelOrderRoomDurationInfo($id_order, $id_product, $id_room, $update_params)
{
Tools::displayAsDeprecated();
$cartTable = 'htl_cart_booking_data';
$orderTable = 'htl_booking_detail';
$condition = '`id_order` = '.(int)$id_order.' AND `id_product` = '.(int)$id_product.
@@ -2484,11 +2579,19 @@ class HotelBookingDetail extends ObjectModel
// Add new entry to the table
if ($orderDetail->save()) {
return Db::getInstance()->update(
'htl_booking_detail',
array('id_order_detail' => $orderDetail->id_order_detail),
'`id_order` = '.(int)$id_order.' AND `id_product` = '.(int)$id_product
);
$bookingsData = self::getOrderInfoIdOrderIdProduct($id_order, $id_product);
if (is_array($bookingsData) && count($bookingsData)) {
$result = true;
foreach ($bookingsData as $bookingData) {
$objHotelBookingDetail = new self($bookingData['id']);
if (Validate::isLoadedObject($objHotelBookingDetail)) {
$objHotelBookingDetail->id_order_detail = $orderDetail->id_order_detail;
$result &= $objHotelBookingDetail->save();
}
}
return $result;
}
}
}
return false;
@@ -2513,7 +2616,7 @@ class HotelBookingDetail extends ObjectModel
public function getRoomBookingData($idRoom, $idOrder, $date_from, $date_to)
{
$sql = 'SELECT `id_product`, `id_order_detail`, `id_hotel`, `id_customer`, `booking_type`, `id_status`, `check_in`, `check_out`
$sql = 'SELECT `id`, `id_product`, `id_order_detail`, `id_hotel`, `id_customer`, `booking_type`, `id_status`, `check_in`, `check_out`
FROM `'._DB_PREFIX_.'htl_booking_detail`
WHERE `id_order`='.(int)$idOrder.' AND `id_room`='.(int)$idRoom.'
AND `date_from`=\''.pSQL($date_from).'\' AND `date_to`= \''.pSQL($date_to).'\'';

View File

@@ -230,9 +230,13 @@ class HotelCartBookingData extends ObjectModel
*/
public function deleteRowById($id)
{
$delete = Db::getInstance()->delete('htl_cart_booking_data', '`id`='.(int) $id);
$objHotelCartBookingData = new self($id);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$objHotelCartBookingData->delete();
return true;
}
return $delete;
return false;
}
/**
@@ -314,28 +318,15 @@ class HotelCartBookingData extends ObjectModel
*
* @return [boolean] [If cart updated with quantity successfully returns true else returns false]
*/
public function changeProductDataByRoomId($roomid, $id_product, $days_diff, $cart_id)
public function changeProductDataByRoomId($idRoom, $idProduct, $daysDiff, $idCart)
{
$deleted = Db::getInstance()->delete('htl_cart_booking_data', '`id_room` = '.(int) $roomid.' AND `id_cart` = '.(int) $cart_id);
$cartProductQuantity = Db::getInstance()->getValue('SELECT `quantity` FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart`='.$idCart.' AND `id_product`='.$idProduct);
$newQuantity = $cartProductQuantity - $daysDiff;
$cart_product_quantity = Db::getInstance()->getValue('SELECT `quantity` FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart`='.$cart_id.' AND `id_product`='.$id_product);
$new_quantity = $cart_product_quantity - $days_diff;
if ($new_quantity > 0) {
$update_quantity = Db::getInstance()->update('cart_product', array('quantity' => $new_quantity), '`id_cart`='.$cart_id.' AND `id_product`='.$id_product);
if ($update_quantity) {
return true;
}
return false;
if ($newQuantity > 0) {
return Db::getInstance()->update('cart_product', array('quantity' => $newQuantity), '`id_cart`='.$idCart.' AND `id_product`='.$idProduct);
} else {
$delete_product = Db::getInstance()->delete('cart_product', '`id_cart`='.$cart_id.' AND `id_product`='.$id_product);
if ($delete_product) {
return true;
}
return false;
return Db::getInstance()->delete('cart_product', '`id_cart`='.$idCart.' AND `id_product`='.$idProduct);
}
}
@@ -427,13 +418,18 @@ class HotelCartBookingData extends ObjectModel
}
}
}
// delete rows from table
if (!Db::getInstance()->delete('htl_cart_booking_data', $where)) {
return false;
foreach ($cartBookingInfo as $row) {
$objHotelCartBookingData = new HotelCartBookingData($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$objHotelCartBookingData->delete();
}
}
}
// return number of rooms deleted
return true;
return $numRooms;
}
public function addCartBookingData(
@@ -612,11 +608,19 @@ class HotelCartBookingData extends ObjectModel
*
* @return [boolean] [Returns true if deleted successfully else returns false]
*/
public function deleteCartDataByIdProductIdCart($id_cart, $id_product, $date_from, $date_to)
public function deleteCartDataByIdProductIdCart($idCart, $idProduct, $dateFrom, $dateTo)
{
$result = Db::getInstance()->delete('htl_cart_booking_data', '`id_cart`='.$id_cart.' AND `id_product`='.$id_product." AND `date_from` = '$date_from' AND `date_to` = '$date_to'");
if ($result) {
return true;
$result = $this->getHotelCartRoomsInfoByRoomType($idCart, $idProduct, $dateFrom, $dateTo);
if (is_array($result) && count($result)) {
$return = true;
foreach ($result as $row) {
$objHotelCartBookingData = new self($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$return &= $objHotelCartBookingData->delete();
}
}
return $return;
}
return false;
@@ -647,15 +651,20 @@ class HotelCartBookingData extends ObjectModel
$this->context = Context::getContext();
$update_quantity = $this->context->cart->updateQty($qty, $id_product, null, false, 'down');
$delete_rooms = Db::getInstance()->delete('htl_cart_booking_data', '`id_cart`='.$id_cart.' AND `id_guest`='.$id_guest.' AND `id_product`='.$id_product." AND `date_from`= '$date_from' AND `date_to`= '$date_to'");
if ($delete_rooms) {
return true;
if (is_array($result) && count($result)) {
$return = true;
foreach ($result as $row) {
$objHotelCartBookingData = new self($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$return &= $objHotelCartBookingData->delete();
}
}
}
return false;
} else {
return false;
return $return;
}
return false;
}
/**
@@ -667,34 +676,22 @@ class HotelCartBookingData extends ObjectModel
*/
public function deleteBookingCartDataNotOrderedByProductId($id_product)
{
return Db::getInstance()->delete(
'htl_cart_booking_data',
'`id_product`='.(int) $id_product.' AND `id_order`= 0'
$result = Db::getInstance()->executeS(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE `id_product`='.(int) $id_product.' AND `id_order`= 0'
);
}
/**
* [updateOrderRefundStatus :: To update the refund status of a room booked in the Cart(htl_cart_booking_data) if amount refunded by the admin].
*
* @param [int] $id_cart [Id of the Cart]
* @param [date] $date_from [start date of the bookin of the room]
* @param [date] $date_to [end date of the bookin of the room]
* @param [int] $id_room [id of the room for which refund is done]
*
* @return [boolean] [true if updated otherwise false]
*/
public function updateOrderRefundStatus($id_cart, $date_from, $date_to, $id_rooms)
{
$table = 'htl_cart_booking_data';
$data = array('is_refunded' => 1);
if (is_array($result) && count($result)) {
$return = true;
foreach ($result as $row) {
$objHotelCartBookingData = new self($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$return &= $objHotelCartBookingData->delete();
}
}
foreach ($id_rooms as $key_rm => $val_rm) {
$where = '`id_cart` = '.$id_cart.' AND `id_room` = '.$val_rm['id_room']." AND `date_from` = '$date_from' AND `date_to` = '$date_to'";
$result = Db::getInstance()->update($table, $data, $where);
}
if ($result) {
return $result;
return $return;
}
return false;
@@ -733,7 +730,7 @@ class HotelCartBookingData extends ObjectModel
return false;
}
$dltdata = false;
$dltdata = '';
$stringArr = array('date_from', 'date_to');
@@ -748,9 +745,26 @@ class HotelCartBookingData extends ObjectModel
$dltdata .= $c_key.' = '.$c_val;
}
}
$delete = Db::getInstance()->delete('htl_cart_booking_data', $dltdata);
return $delete;
$result = Db::getInstance()->executeS(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE '.$dltdata
);
if (is_array($result) && count($result)) {
$return = true;
foreach ($result as $row) {
$objHotelCartBookingData = new self($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$return &= $objHotelCartBookingData->delete();
}
}
return $return;
}
return false;
}
/**
@@ -767,7 +781,7 @@ class HotelCartBookingData extends ObjectModel
return false;
}
$where = false;
$where = '';
$stringArr = array('date_from', 'date_to');
foreach ($updBy as $u_key => $u_val) {
if ($where) {
@@ -780,9 +794,30 @@ class HotelCartBookingData extends ObjectModel
$where .= $u_key.' = '.$u_val;
}
}
$update = Db::getInstance()->update('htl_cart_booking_data', $updData, $where);
// $update = Db::getInstance()->update('htl_cart_booking_data', $updData, $where);
$result = Db::getInstance()->executeS(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE '.$where
);
return $update;
if (is_array($result) && count($result)) {
$return = true;
foreach ($result as $row) {
$objHotelCartBookingData = new self($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
foreach ($updData as $key => $value) {
$objHotelCartBookingData->$key = $value;
}
$return &= $objHotelCartBookingData->save();
}
}
return $return;
}
return true;
}
/**
@@ -896,12 +931,26 @@ class HotelCartBookingData extends ObjectModel
*/
public function updateIdCurrencyByIdCart($id_cart, $id_currency)
{
$update_currency = Db::getInstance()->update('htl_cart_booking_data', array('id_currency' => $id_currency), '`id_cart`='.$id_cart);
if ($update_currency) {
return true;
$result = Db::getInstance()->executeS(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE `id_cart` = '.(int) $idCart
);
if (is_array($result) && count($result)) {
$return = true;
foreach ($result as $row) {
$objHotelCartBookingData = new HotelCartBookingData($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$objHotelCartBookingData->id_currency = $id_currency;
$return &= $objHotelCartBookingData->save();
}
}
return $return;
}
return false;
return true;
}
/**
@@ -916,9 +965,25 @@ class HotelCartBookingData extends ObjectModel
*/
public function deleteOrderedRoomFromCart($id_order, $id_hotel, $id_room, $date_from, $date_to)
{
$delete = Db::getInstance()->delete('htl_cart_booking_data', '`id_order`='.(int) $id_order.' AND `id_hotel`='.(int) $id_hotel.' AND `id_room`='.(int) $id_room." AND `date_from`='$date_from' AND `date_to`='$date_to'");
$result = Db::getInstance()->executeS(
'SELECT `id`
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE '.'`id_order`='.(int) $id_order.' AND `id_hotel`='.(int) $id_hotel.' AND `id_room`='.(int) $id_room." AND `date_from`='$date_from' AND `date_to`='$date_to'"
);
return $delete;
if (is_array($result) && count($result)) {
$return = true;
foreach ($result as $row) {
$objHotelCartBookingData = new HotelCartBookingData($row['id']);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
$return &= $objHotelCartBookingData->delete();
}
}
return $return;
}
return true;
}
/**

View File

@@ -381,6 +381,65 @@ class HotelReservationSystemDb
`access` int(11) NOT NULL,
PRIMARY KEY (`id_profile`, `id_hotel`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_settings_link` (
`id_settings_link` int(11) NOT NULL AUTO_INCREMENT,
`icon` varchar(32) character set utf8 NOT NULL,
`link` text NOT NULL,
`new_window` tinyint(1) NOT NULL DEFAULT '0',
`position` int(11) unsigned NOT NULL DEFAULT '0',
`unremovable` tinyint(1) NOT NULL DEFAULT '0',
`active` tinyint(1) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_settings_link`)
) 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()),
(2, 'icon-list-alt', 'index.php?controller=AdminOrderRestrictSettings', 0, 1, 1, 1, NOW(), NOW()),
(3, 'icon-dollar', 'index.php?controller=AdminHotelFeaturePricesSettings', 0, 2, 1, 1, NOW(), NOW()),
(4, 'icon-plus-square', 'index.php?controller=AdminRoomTypeGlobalDemand', 0, 3, 1, 1, NOW(), NOW()),
(5, 'icon-file-text', 'index.php?controller=AdminAboutHotelBlockSetting', 0, 4, 0, 1, NOW(), NOW()),
(6, 'icon-th-list', 'index.php?controller=AdminFeaturesModuleSetting', 0, 5, 0, 1, NOW(), NOW());",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_settings_link_lang` (
`id_settings_link` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(255) character set utf8 NOT NULL,
`hint` varchar(255) character set utf8 NOT NULL,
PRIMARY KEY (`id_settings_link`, `id_lang`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
SELECT 1, `id_lang`, 'General Settings', 'Configure Your hotel general gettings using this option.'
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
SELECT 2, `id_lang`, 'Order Restrict', 'Configure if you want to restrict orders till a specific date for your hotels.'
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
SELECT 3, `id_lang`, 'Advanced Price Rules', 'Here set Advanced price rules for specific dates.'
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
SELECT 4, `id_lang`, 'Additional Facilities', 'Here create Additional facilities and their prices for room types.'
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
SELECT 5, `id_lang`, 'Hotel Interior Block', 'Configure Hotel Interior block. You can display hotel interior images using this block. This block will be displayed on home page.'
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
SELECT 6, `id_lang`, 'Hotel Amenities Block', 'Configure Hotels Amenities settings. You can display hotel amenities images using this block. This block will be displayed on home page.'
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",
);
}
@@ -431,6 +490,8 @@ class HotelReservationSystemDb
`'._DB_PREFIX_.'htl_room_type_demand_price`,
`'._DB_PREFIX_.'htl_room_type_demand`,
`'._DB_PREFIX_.'htl_room_disable_dates`,
`'._DB_PREFIX_.'htl_settings_link`,
`'._DB_PREFIX_.'htl_settings_link_lang`,
`'._DB_PREFIX_.'htl_room_type_restriction_date_range`,
`'._DB_PREFIX_.'htl_access`'
);

View File

@@ -0,0 +1,148 @@
<?php
/**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*/
class HotelSettingsLink extends ObjectModel
{
public $id_settings_link;
public $name;
public $hint;
public $icon;
public $link;
public $new_window;
public $position;
public $unremovable;
public $active;
public $date_add;
public $date_upd;
public static $definition = array(
'table' => 'htl_settings_link',
'primary' => 'id_settings_link',
'multilang' => true,
'fields' => array(
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'lang' => true, 'required' => true),
'hint' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'lang' => true, 'required' => true),
'icon' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true),
'link' => array('type' => self::TYPE_STRING, 'validate' => 'isUrl', 'required' => true),
'new_window' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'unremovable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
),
);
public function getAllSettingsLinks($active = true)
{
return Db::getInstance()->executeS(
'SELECT * FROM `'._DB_PREFIX_.'htl_settings_link` hsl
LEFT JOIN `'._DB_PREFIX_.'htl_settings_link_lang` hsll
ON (hsll.`id_settings_link` = hsl.`id_settings_link` AND hsll.`id_lang` = '.(int) Context::getContext()->language->id.')
WHERE hsl.`active` = '.(int) $active.'
ORDER BY hsl.`position`'
);
}
public function generateLink($link = null, $id_employee = null)
{
if ($link) {
$this->link = $link;
}
$context = Context::getContext();
if ($this->link == '../') {
return $context->shop->getBaseURL();
} else {
preg_match('/controller=(.+)(&.+)?$/', $this->link, $adminTab);
if (isset($adminTab[1])) {
if (strpos($adminTab[1], '&')) {
$adminTab[1] = substr($adminTab[1], 0, strpos($adminTab[1], '&'));
}
$token = Tools::getAdminToken($adminTab[1].(int) Tab::getIdFromClassName($adminTab[1]).(int) ($id_employee ? $id_employee : $context->employee->id));
return $link.'&token='.$token;
}
}
return $link;
}
public function getUnremovableLinks()
{
return Db::getInstance()->executeS(
'SELECT *
FROM `'._DB_PREFIX_.'htl_settings_link` hsl
WHERE hsl.`unremovable` = 1'
);
}
public function getHigherPosition()
{
$position = Db::getInstance()->getValue(
'SELECT MAX(`position`) FROM `'._DB_PREFIX_.'htl_settings_link`'
);
$result = (is_numeric($position)) ? $position : -1;
return $result + 1;
}
public function updatePosition($way, $position)
{
if (!$result = Db::getInstance()->executeS(
'SELECT hsl.`id_settings_link`, hsl.`position`
FROM `'._DB_PREFIX_.'htl_settings_link` hsl
WHERE hsl.`id_settings_link` = '.(int) $this->id.' ORDER BY `position` ASC')
) {
return false;
}
$movedBlock = false;
foreach ($result as $block) {
if ((int)$block['id_settings_link'] == (int) $this->id) {
$movedBlock = $block;
}
}
if ($movedBlock === false) {
return false;
}
return (Db::getInstance()->execute(
'UPDATE `'._DB_PREFIX_.'htl_settings_link` SET `position`= `position` '.($way ? '- 1' : '+ 1').
' WHERE `position`'.($way ? '> '.
(int) $movedBlock['position'].' AND `position` <= '.(int) $position : '< '
.(int) $movedBlock['position'].' AND `position` >= '.(int) $position)
) && Db::getInstance()->execute(
'UPDATE `'._DB_PREFIX_.'htl_settings_link`
SET `position` = '.(int) $position.'
WHERE `id_settings_link`='.(int) $movedBlock['id_settings_link']
));
}
public function cleanPositions()
{
Db::getInstance()->execute('SET @i = -1', false);
$sql = 'UPDATE `'._DB_PREFIX_.'htl_settings_link` SET `position` = @i:=@i+1 ORDER BY `position` ASC';
return Db::getInstance()->execute($sql);
}
}

View File

@@ -2,36 +2,339 @@
class AdminHotelConfigurationSettingController extends ModuleAdminController
{
protected $position_identifier = 'id_settings_link';
public function __construct()
{
$this->table = 'configuration';
$this->className = 'Configuration';
$this->table = 'htl_settings_link';
$this->identifier = 'id_settings_link';
$this->className = 'HotelSettingsLink';
$this->_defaultOrderBy = 'position';
$this->lang = true;
$this->bootstrap = true;
if (!($obj = $this->loadObject(true))) {
return;
}
$this->toolbar_title = $this->l('Manage Hotel Settings');
$this->list_no_link = true;
parent::__construct();
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->bulk_actions = array(
'enableSelection' => array(
'text' => $this->l('Enable selection'),
'icon' => 'icon-power-off text-success'
),
'disableSelection' => array(
'text' => $this->l('Disable selection'),
'icon' => 'icon-power-off text-danger'
),
'divider' => array(
'text' => 'divider'
),
'delete' => array(
'text' => $this->l('Delete selected'),
'confirm' => $this->l('Delete selected items?'),
'icon' => 'icon-trash'
)
);
$this->fields_list = array(
'id_settings_link' => array(
'title' => $this->l('ID'),
'hint' => $this->l('ID of the settings link.'),
'align' => 'center',
'class' => 'fixed-width-xs',
),
'name' => array(
'title' => $this->l('Name'),
'hint' => $this->l('Name of the settings link.'),
'align' => 'left',
'class' => 'fixed-width-xxl',
),
'link' => array(
'title' => $this->l('Link'),
'hint' => $this->l('Link of the page where admin is redirected.'),
'align' => 'left',
'callback' => 'displayColumnLink',
),
'icon' => array(
'title' => $this->l('Icon'),
'hint' => $this->l('Icon of the settings link.'),
'align' => 'center',
'callback' => 'displayColumnIcon',
),
'new_window' => array(
'title' => $this->l('New Window'),
'hint' => $this->l('Active if link is opened in a new window.'),
'align' => 'center',
'active' => 'new_window',
'ajax' => true,
'orderby' => false,
'type' => 'bool',
'class' => 'fixed-width-sm',
),
'position' => array(
'title' => $this->l('Position'),
'filter_key' => 'a!position',
'position' => 'position',
'align' => 'center',
'class' => 'fixed-width-md',
),
'active' => array(
'title' => $this->l('Status'),
'hint' => $this->l('Current status of the settings link.'),
'type' => 'bool',
'active' => 'status',
'align' => 'center',
'class' => 'fixed-width-lg',
'filter_key' => 'a!active',
),
);
}
public function displayColumnIcon($icon)
{
$tpl = $this->context->smarty->createTemplate(
$this->module->getLocalPath().'views/templates/admin/'.$this->tpl_folder.'helpers/list/link-icon.tpl'
);
$tpl->assign('icon', $icon);
return $tpl->fetch();
}
public function displayColumnLink($link)
{
$this->loadObject(true);
$tpl = $this->context->smarty->createTemplate(
$this->module->getLocalPath().'views/templates/admin/'.$this->tpl_folder.'helpers/list/link-page.tpl'
);
$tpl->assign(array(
'saved_link' => $link,
'generated_link' => $this->object->generateLink($link),
));
return $tpl->fetch();
}
public function initToolbar()
{
parent::initToolbar();
if ($this->display == 'view') {
$this->toolbar_title = $this->l('Hotel Settings');
$this->page_header_toolbar_btn['manage_links'] = array(
'icon' => 'process-icon-cogs',
'href' => self::$currentIndex.'&display=list&token='.$this->token,
'desc' => $this->l('Manage links'),
);
} elseif ($this->display == 'list') {
$this->page_header_toolbar_title = $this->l('Settings Links');
$this->page_header_toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
'desc' => $this->l('Add new link'),
);
}
}
public function initContent()
{
$this->show_toolbar = false;
$this->display = 'view';
if (!$this->ajax) {
if (Tools::getValue('display') == 'list') {
$this->display = 'list';
} elseif (empty($this->display)
&& !Tools::isSubmit('submitFilter'.$this->table)
) {
$this->display = 'view';
}
}
parent::initContent();
}
public function renderList()
{
$this->context->smarty->assign('icon', 'icon-list');
$this->toolbar_title = $this->l('Settings Links');
$this->loadObject(true);
$unremovableLinks = $this->object->getUnremovableLinks();
if (is_array($unremovableLinks) && count($unremovableLinks)) {
$ids = array();
foreach ($unremovableLinks as $unremovableLink) {
$ids[] = $unremovableLink['id_settings_link'];
}
$this->addRowActionSkipList('delete', $ids);
}
return parent::renderList();
}
public function renderForm()
{
$smartyVars = array();
$idSettingsLink = (int) Tools::getValue($this->identifier);
$objHotelSettingsLink = $this->loadObject(true);
$smartyVars['id_hotel_settings_link'] = $idSettingsLink;
$smartyVars['currentTab'] = $this;
$smartyVars['currentObject'] = $objHotelSettingsLink;
$this->fields_form = $this->getFieldsForm();
$this->context->smarty->assign($smartyVars);
return parent::renderForm();
}
public function getFieldsForm()
{
$fields_form = array();
$fields_form[] = array(
'form' => array(
'submit' => array(
'title' => $this->l('Save'),
'name' => 'submitHotelSettingsLink',
'class' => 'btn btn-default pull-right',
),
),
);
return $fields_form;
}
public function renderView()
{
$settingsLinks = $this->object->getAllSettingsLinks();
foreach ($settingsLinks as $index => &$settingsLink) {
$settingsLink['generated_link'] = $this->object->generateLink($settingsLink['link']);
}
$this->tpl_view_vars = array(
'feature_price_setting_link' => $this->context->link->getAdminLink('AdminHotelFeaturePricesSettings'),
'general_setting_link' => $this->context->link->getAdminLink('AdminHotelGeneralSettings'),
'additional_demand_setting_link' => $this->context->link->getAdminLink('AdminRoomTypeGlobalDemand'),
'settings_links' => $settingsLinks,
);
return parent::renderView();
}
public function postProcess()
{
if (Tools::isSubmit('submitHotelSettingsLink') || Tools::isSubmit('submitHotelSettingsLinkAndStay')) {
$idHotelSettingsLink = Tools::getValue($this->identifier);
$this->validateRules();
if (is_array($this->errors) && !count($this->errors)) {
$objHotelSettingsLink = new HotelSettingsLink($idHotelSettingsLink);
$this->copyFromPost($objHotelSettingsLink, $this->table);
if (!$idHotelSettingsLink) {
$objHotelSettingsLink->position = $objHotelSettingsLink->getHigherPosition();
}
if ($objHotelSettingsLink->save()) {
$newId = $objHotelSettingsLink->id;
if (is_array($this->errors) && !count($this->errors)) {
if (Tools::isSubmit('submitHotelSettingsLinkAndStay')) {
if ($idHotelSettingsLink) {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token.
'&update'.$this->table.'&'.$this->identifier.'='.$newId);
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token.
'&update'.$this->table.'&'.$this->identifier.'='.$newId);
}
} else {
self::$currentIndex .= '&display=list';
if ($idHotelSettingsLink) {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token);
}
}
}
}
}
}
parent::postProcess();
}
public function processStatus()
{
self::$currentIndex .= '&display=list';
return parent::processStatus();
}
public function processDelete()
{
self::$currentIndex .= '&display=list';
return parent::processDelete();
}
public function processBulkDelete()
{
self::$currentIndex .= '&display=list';
return parent::processBulkDelete();
}
public function ajaxProcessNewWindowHtlSettingsLink()
{
$response = array(
'success' => 0,
'text' => $this->l('An error occurred while updating object.')
);
$idSettingsLink = Tools::getValue('id_settings_link');
$objHotelSettingsLink = new HotelSettingsLink($idSettingsLink);
if (Validate::isLoadedObject($objHotelSettingsLink)) {
$objHotelSettingsLink->new_window = (int) !$objHotelSettingsLink->new_window;
if ($objHotelSettingsLink->save()) {
$response['success'] = 1;
$response['text'] = $this->l('The object has been updated successfully.');
}
}
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessUpdatePositions()
{
$way = (int) Tools::getValue('way');
$idSettingsLink = (int) Tools::getValue('id');
$positions = Tools::getValue('settings_link');
foreach ($positions as $position => $value) {
$pos = explode('_', $value);
if (isset($pos[2]) && (int) $pos[2] === $idSettingsLink) {
if ($objHotelSettingsLink = new HotelSettingsLink((int) $pos[2])) {
if (isset($position) && $objHotelSettingsLink->updatePosition($way, $position, $idSettingsLink)) {
$this->ajaxDie(json_encode(true));
} else {
$this->ajaxDie(json_encode(array(
'hasError' => true,
'errors' => sprintf(
$this->l('Can not update position for object ID: %d to position %d'),
(int) $idSettingsLink,
$position
),
)));
}
} else {
$this->ajaxDie(json_encode(array(
'hasError' => true,
'errors' => sprintf(
$this->l('The object with ID: %d can not be loaded.'),
(int) $idSettingsLink
),
)));
}
break;
}
}
}
public function setMedia()
{
parent::setMedia();

View File

@@ -30,65 +30,51 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
parent::__construct();
$this->setPhpCookieData();
$this->initCart();
}
public function setPhpCookieData()
public function initCart()
{
if (!isset($_COOKIE['wk_id_guest']) || !$_COOKIE['wk_id_guest']) {
if (!isset($this->context->cookie->id_guest)) {
Guest::setNewGuest($this->context->cookie);
}
setcookie('wk_id_guest', $this->context->cookie->id_guest, time() + 86400, "/");
} else {
$this->context->cookie->id_guest = $_COOKIE['wk_id_guest'];
setcookie('wk_id_guest', $this->context->cookie->id_guest, time() + 86400, "/");
}
$guest = new Guest($this->context->cookie->id_guest);
if (!isset($_COOKIE['wk_id_cart']) && !isset($this->context->cart->id)) {
$cart = new Cart();
$cart->recyclable = 0;
$cart->gift = 0;
$cart->id_shop = (int)$this->context->shop->id;
$cart->id_lang = (($id_lang = (int)Tools::getValue('id_lang')) ? $id_lang : Configuration::get('PS_LANG_DEFAULT'));
$cart->id_currency = (($id_currency = (int)Tools::getValue('id_currency')) ? $id_currency : Configuration::get('PS_CURRENCY_DEFAULT'));
$cart->id_address_delivery = 0;
$cart->id_address_invoice = 0;
$cart->id_currency = Configuration::get('PS_CURRENCY_DEFAULT');
$cart->id_guest = (int)$this->context->cookie->id_guest;
$cart->setNoMultishipping();
$cart->save();
$this->context->cart = $cart;
$this->context->cookie->id_cart = $cart->id;
setcookie('wk_id_cart', $cart->id, time() + 86400, "/");
} else {
$cart = new Cart((int)$_COOKIE['wk_id_cart']);
$this->context->cart = $cart;
$this->context->cookie->id_cart = $cart->id;
setcookie('wk_id_cart', $cart->id, time() + 86400, "/");
if (!isset($this->context->cookie->id_guest)) {
Guest::setNewGuest($this->context->cookie);
}
$customer = new Customer();
$customer->id_gender = 0;
$customer->id_default_group = 1;
$customer->outstanding_allow_amount = 0;
$customer->show_public_prices = 0;
$customer->max_payment_days = 0;
$customer->active = 1;
$customer->is_guest = 0;
$customer->deleted = 0;
$customer->logged = 0;
$customer->id_guest = $this->context->cookie->id_guest;
if (!isset($this->context->cookie->id_cart)) {
// create a new cart
$objCart = new Cart();
$objCart->recyclable = 0;
$objCart->gift = 0;
$objCart->id_shop = (int) $this->context->shop->id;
$objCart->id_lang = (($id_lang = (int) Tools::getValue('id_lang')) ? $id_lang : (int) Configuration::get('PS_LANG_DEFAULT'));
$objCart->id_currency = (($id_currency = (int) Tools::getValue('id_currency')) ? $id_currency : (int) Configuration::get('PS_CURRENCY_DEFAULT'));
$objCart->id_address_delivery = 0;
$objCart->id_address_invoice = 0;
$objCart->id_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT');
$objCart->id_guest = (int) $this->context->cookie->id_guest;
$objCart->setNoMultishipping();
$this->context->customer = $customer;
$this->context->cart = $objCart;
$this->context->cart->save();
return true;
$this->context->cookie->id_cart = (int) $objCart->id;
} else {
// use previous cart
$this->context->cart = new Cart($this->context->cookie->id_cart);
}
$objCustomer = new Customer();
$objCustomer->id_gender = 0;
$objCustomer->id_default_group = 1;
$objCustomer->outstanding_allow_amount = 0;
$objCustomer->show_public_prices = 0;
$objCustomer->max_payment_days = 0;
$objCustomer->active = 1;
$objCustomer->is_guest = 0;
$objCustomer->deleted = 0;
$objCustomer->logged = 0;
$objCustomer->id_guest = (int) $this->context->cookie->id_guest;
$this->context->customer = $objCustomer;
}
public function postProcess()

View File

@@ -46,5 +46,7 @@ require_once 'classes/QloRoomType.php';
require_once 'classes/HotelRoomDisableDates.php';
require_once 'classes/HotelBranchRefundRules.php';
require_once 'classes/HotelSettingsLink.php';
// Web services classes
require_once 'classes/WebserviceSpecificManagementQlo.php';

View File

@@ -253,123 +253,6 @@ class HotelReservationSystem extends Module
}
}
public function hookDisplayAdminProductsExtra($params)
{
if ($idProduct = Tools::getValue('id_product')) {
$objGlobalDemand = new HotelRoomTypeGlobalDemand();
$allDemands = $objGlobalDemand->getAllDemands();
$objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
// get room type additional services
$objRoomDemand = new HotelRoomTypeDemand();
$roomDemandPrices = $objRoomDemand->getRoomTypeDemands($idProduct, 0, 0);
$this->context->smarty->assign(
array(
'idProduct' => $idProduct,
'roomDemandPrices' => $roomDemandPrices,
'allDemands' => $allDemands,
'defaultcurrencySign' => $objCurrency->sign,
)
);
}
return $this->display(__FILE__, 'roomTypeDemands.tpl');
}
public function moduleProductsExtraTabName()
{
return $this->l('Additional Facilities');
}
public function hookActionProductUpdate($params)
{
if ($idProduct = $params['id_product']) {
$objRoomTypeDemand = new HotelRoomTypeDemand();
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
// first delete all the previously saved prices and demands of this room type
$objRoomTypeDemand->deleteRoomTypeDemands($idProduct);
$objRoomTypeDemandPrice->deleteRoomTypeDemandPrices($idProduct);
if ($selectedDemands = Tools::getValue('selected_demand')) {
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
foreach ($selectedDemands as $idGlobalDemand) {
if (Validate::isLoadedObject($objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand))) {
// save selected demands for this room type
$objRoomTypeDemand = new HotelRoomTypeDemand();
$objRoomTypeDemand->id_product = $idProduct;
$objRoomTypeDemand->id_global_demand = $idGlobalDemand;
$objRoomTypeDemand->save();
// save selected demands prices for this room type
$demandPrice = Tools::getValue('demand_price_'.$idGlobalDemand);
if (Validate::isPrice($demandPrice)) {
if ($objGlobalDemand->price != $demandPrice) {
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
$objRoomTypeDemandPrice->id_product = $idProduct;
$objRoomTypeDemandPrice->id_global_demand = $idGlobalDemand;
$objRoomTypeDemandPrice->id_option = 0;
$objRoomTypeDemandPrice->price = $demandPrice;
$objRoomTypeDemandPrice->save();
}
} else {
$this->context->controller->errors[] = $this->l('Invalid demand price of facility').
' : '.$objGlobalDemand->name[$this->context->language->id];
}
if ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($idGlobalDemand)) {
foreach ($advOptions as $option) {
if (Validate::isLoadedObject($objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($option['id']))) {
$optionPrice = Tools::getValue('option_price_'.$option['id']);
if (Validate::isPrice($optionPrice)) {
if ($optionPrice != $objAdvOption->price) {
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
$objRoomTypeDemandPrice->id_product = $idProduct;
$objRoomTypeDemandPrice->id_global_demand = $idGlobalDemand;
$objRoomTypeDemandPrice->id_option = $option['id'];
$objRoomTypeDemandPrice->price = $optionPrice;
$objRoomTypeDemandPrice->save();
}
} else {
$this->context->controller->errors[] = $this->l('Invalid price of advance option').
' : '.$objAdvOption->name[$this->context->language->id];
}
}
}
}
}
}
if (count($this->context->controller->errors)) {
$this->context->controller->warnings[] = $this->l('Invalid price values are not saved. Please correct them and save again');
}
$objCartBookingData = new HotelCartBookingData();
if ($cartExtraDemands = $objCartBookingData->getCartExtraDemands(0, $idProduct)) {
// delete the demands from cart if not available in cart
$objRoomDemand = new HotelRoomTypeDemand();
$roomTypeDemandIds = array();
if ($roomTypeDemands = $objRoomDemand->getRoomTypeDemands($idProduct)) {
$roomTypeDemandIds = array_keys($roomTypeDemands);
}
foreach ($cartExtraDemands as &$demandInfo) {
if (isset($demandInfo['extra_demands']) && $demandInfo['extra_demands']) {
$cartChanged = 0;
foreach ($demandInfo['extra_demands'] as $key => $demand) {
if (!in_array($demand['id_global_demand'], $roomTypeDemandIds)) {
$cartChanged = 1;
unset($demandInfo['extra_demands'][$key]);
}
}
if ($cartChanged) {
if (Validate::isLoadedObject(
$objCartBooking = new HotelCartBookingData($demandInfo['id'])
)) {
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
$objCartBooking->save();
}
}
}
}
}
}
}
}
public function hookActionProductSave($params)
{
$isToggling = Tools::getValue('statusproduct');
@@ -419,14 +302,6 @@ class HotelReservationSystem extends Module
}
}
public function hookActionAdminControllerSetMedia()
{
if ('AdminProducts' == Tools::getValue('controller')) {
$this->context->controller->addJs($this->_path.'views/js/roomTypeDemand.js');
$this->context->controller->addCSS($this->_path.'views/css/roomTypeDemand.css');
}
}
public function hookDisplayBackOfficeHeader()
{
$this->context->controller->addCSS($this->_path.'views/css/admin/css/hotel_admin_tab_logo.css');
@@ -567,9 +442,6 @@ class HotelReservationSystem extends Module
'actionProductSave',
'addWebserviceResources',
'actionObjectLanguageAddAfter',
'actionAdminControllerSetMedia',
'displayAdminProductsExtra',
'actionProductUpdate',
'actionObjectProfileAddAfter',
'actionObjectProfileDeleteBefore',
'actionObjectGroupDeleteBefore',

View File

@@ -1,42 +0,0 @@
/**
* 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
*/
/*----- Accordion -----*/
.accordion, .accordion * {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
.accordion {
overflow:hidden;
border-bottom: 1px solid #CCCCCC;
}
.accordion-section-title {
width:100%;
padding:15px;
display:inline-block;
transition:all linear 0.15s;
color:#252525 !important;
text-decoration:none !important;
}
.accordion-section-content {
display:none;
border-top: 1px solid #eee;
padding-top: 15px;
}

View File

@@ -1,49 +0,0 @@
/**
* 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
*/
$(document).ready(function() {
function close_accordion_section() {
$('.accordion .accordion-section-title').removeClass('active');
$('.accordion .accordion-section-content').slideUp(300).removeClass('open');
}
$(document).on('click', '.accordion-section-title', function(e) {
// Grab current anchor value
var currentAttrValue = $(this).attr('href');
if ($(e.target).is('.active')) {
close_accordion_section();
$(this).find('i').removeClass('icon-angle-down');
$(this).find('i').addClass('icon-angle-left');
} else {
close_accordion_section();
// Add active class to section title
$(this).addClass('active');
$(this).find('i').removeClass('icon-angle-left');
$(this).find('i').addClass('icon-angle-down');
// Open up the hidden content panel
$('.accordion ' + currentAttrValue).slideDown(300).addClass('open');
}
e.preventDefault();
});
$(document).on('click', '.selected_demand', function(e) {
e.stopPropagation();
});
});

View File

@@ -0,0 +1,181 @@
{**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*}
{extends file='helpers/form/form.tpl'}
{block name='fieldset'}
<div class="panel" id="general">
<div class="panel-heading">
<i class="icon-info-circle"></i>
{l s='Link Information' mod='hotelreservationsystem'}
</div>
<div class="form-wrapper" id="fields-meta-tags-rule">
<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Enable to show this link.' mod='hotelreservationsystem'}">
{l s='Enabled' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="active" id="active_on" value="1"
{if $currentTab->getFieldValue($currentObject, 'active')|intval}checked="checked"{/if}>
<label for="active_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input type="radio" name="active" id="active_off" value="0"
{if !$currentTab->getFieldValue($currentObject, 'active')|intval}checked="checked"{/if}>
<label for="active_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3 required">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Enter a memorable name for this link.' mod='hotelreservationsystem'}">
{l s='Name' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-lg-9">
{if $languages|count > 0}
{foreach $languages as $language}
{assign var='value_text' value=$currentTab->getFieldValue($currentObject, 'name', $language.id_lang)}
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
<div class="col-lg-6">
<input type="text" name="name_{$language.id_lang}" class="form-control" value="{$value_text|escape:'html':'UTF-8'}">
</div>
{if $languages|count > 1}
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
{$language.iso_code}
<i class="icon-caret-down"></i>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=language}
<li><a href="javascript:hideOtherLanguage({$language.id_lang});" tabindex="-1">{$language.name}</a></li>
{/foreach}
</ul>
</div>
{/if}
</div>
{/foreach}
{/if}
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3 required">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Enter a hint for this link.' mod='hotelreservationsystem'}">
{l s='Hint' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-lg-9">
{if $languages|count > 0}
{foreach $languages as $language}
{assign var='value_text' value=$currentTab->getFieldValue($currentObject, 'hint', $language.id_lang)}
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
<div class="col-lg-6">
<input type="text" name="hint_{$language.id_lang}" class="form-control" value="{$value_text|escape:'html':'UTF-8'}">
</div>
{if $languages|count > 1}
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
{$language.iso_code}
<i class="icon-caret-down"></i>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=language}
<li><a href="javascript:hideOtherLanguage({$language.id_lang});" tabindex="-1">{$language.name}</a></li>
{/foreach}
</ul>
</div>
{/if}
</div>
{/foreach}
{/if}
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3 required">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Set icon class for this link.' mod='hotelreservationsystem'}">
{l s='Icon' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-lg-5">
<input name="icon" class="form-control" placeholder="{l s='Eg. icon-user' mod='hotelreservationsystem'}" value="{$currentTab->getFieldValue($currentObject, 'icon')|escape}">
</div>
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block">
{l s='Refer to the following link for available icons.' mod='hotelreservationsystem'}
<a href="https://fontawesome.com/v4/cheatsheet" target="_blank">
https://fontawesome.com/v4/cheatsheet <i class="icon icon-external-link"></i>
</a>
{l s=' Note: Replace fa- with icon- in icon name.' mod='hotelreservationsystem'}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3 required">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Set URL of the desired page. If it is a Back office URL please remove the token from it.' mod='hotelreservationsystem'}">
{l s='URL' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-lg-5">
<input name="link" class="form-control" value="{$currentTab->getFieldValue($currentObject, 'link')|escape}">
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Enable to open the link in a new window.' mod='hotelreservationsystem'}">
{l s='Open in new window' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="new_window" id="new_window_on" value="1"
{if $currentTab->getFieldValue($currentObject, 'new_window')|intval}checked="checked"{/if}>
<label for="new_window_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input type="radio" name="new_window" id="new_window_off" value="0"
{if !$currentTab->getFieldValue($currentObject, 'new_window')|intval}checked="checked"{/if}>
<label for="new_window_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
</div>
<div class="panel-footer">
<button type="submit" value="1" name="submitHotelSettingsLink" class="btn btn-default pull-right">
<i class="process-icon-save"></i>
{l s='Save' mod='hotelreservationsystem'}
</button>
<button type="submit" value="1" name="submitHotelSettingsLinkAndStay" class="btn btn-default pull-right">
<i class="process-icon-save"></i>
{l s='Save and stay' mod='hotelreservationsystem'}
</button>
<a href="{$link->getAdminLink('AdminHotelConfigurationSetting')}&display=list" class="btn btn-default" onclick="window.history.back();">
<i class="process-icon-back"></i>
{l s='Back to list' mod='hotelreservationsystem'}
</a>
</div>
</div>
{/block}

View File

@@ -0,0 +1,29 @@
<?php
/**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../');
exit;

View File

@@ -0,0 +1,29 @@
<?php
/**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../');
exit;

View File

@@ -0,0 +1,20 @@
{**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*}
<i class="icon {$icon}"></i>

View File

@@ -0,0 +1,20 @@
{**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*}
<a href="{$generated_link}" target="_blank">{$saved_link}</a>

View File

@@ -1,35 +1,36 @@
{**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*}
<div class="panel htl_conf_panel">
<h3 class="tab"> <i class="icon-cogs"></i>&nbsp;&nbsp; {l s='Hotel Configuration' mod='hotelreservationsystem'}</h3>
<div class="panel-body">
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$general_setting_link}" class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="icon-cogs"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{l s='General Settings' mod='hotelreservationsystem'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{l s='Hotel General Settings' mod='hotelreservationsystem'}" data-content="{l s='Configure Your Hotel general Settings using this option.' mod='hotelreservationsystem'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>
<!-- Setting to set prices for date range -->
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$feature_price_setting_link}" class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="icon-cog"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{l s='Advanced Price Rules' mod='hotelreservationsystem'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{l s='Advanced Price Rule Settings' mod='hotelreservationsystem'}" data-content="{l s='Here set advanced price rules for specific dates.' mod='hotelreservationsystem'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>
<!-- Setting to set addition demands for the room type -->
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$additional_demand_setting_link}" class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="icon-cog"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{l s='Additional Facilities' mod='hotelreservationsystem'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{l s='Additional Facilities Settings' mod='hotelreservationsystem'}" data-content="{l s='Here create additional facilities and their prices for room types.' mod='hotelreservationsystem'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>
{foreach from=$settings_links item=settings_link}
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$settings_link.generated_link|escape:'html':'UTF-8'}" {if $settings_link.new_window}target="_blank"{/if} class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="{$settings_link.icon}"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{$settings_link.name|escape:'html':'UTF-8'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{$settings_link.name|escape:'html':'UTF-8'}" data-content="{$settings_link.hint|escape:'html':'UTF-8'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>
{/foreach}
{hook h='displayAddModuleSettingLink'}
</div>

View File

@@ -111,90 +111,84 @@
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box">{l s='Duration' mod='hotelreservationsystem'}</span></th>
<th><span class="title_box">{l s='Duration' mod='hotelreservationsystem'}</span></th>
<th><span class="title_box">{l s='Room No.' mod='hotelreservationsystem'}</span></th>
<th class="text-left"><span class="title_box">{l s='Allotment Type' mod='hotelreservationsystem'}</span></th>
<th><span class="title_box">{l s='Allotment Type' mod='hotelreservationsystem'}</span></th>
{if $occupancy_required_for_booking}
<th class="fixed-width-xxl"><span class="title_box">{l s='Guests' mod='hotelreservationsystem'}</span></th>
{/if}
<th class="text-center"><span class="title_box">{l s='Action' mod='hotelreservationsystem'}</span></th>
<th><span class="title_box">{l s='Action' mod='hotelreservationsystem'}</span></th>
</tr>
</thead>
<tbody>
{foreach from=$book_v['data']['partially_available'] key=part_k item=part_v}
<tr>
<td class="text-center">
<p>{dateFormat date=date('Y-m-d', strtotime($part_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($part_v['date_to']))}</p>
</td>
<td colspan="4">
<table class="table">
{foreach from=$part_v['rooms'] key=sub_part_k item=sub_part_v}
<tr>
<td class="text-center">
<p>{$sub_part_v['room_num']}</p>
</td>
<td class="text-left">
{foreach $allotment_types as $allotment_type}
<label class="control-label">
<input type="radio" value="{$allotment_type.id_allotment|intval}" class="par_bk_type" name="bk_type_{$sub_part_v['id_room']|escape:'htmlall':'UTF-8'}_{$sub_part_k|escape:'htmlall':'UTF-8'}" data-id-room="{$sub_part_v['id_room']|escape:'htmlall':'UTF-8'}" data-sub-key="{$sub_part_k|escape:'htmlall':'UTF-8'}" {if $allotment_type@first}checked="checked"{/if}>
<span>{$allotment_type.name|escape:'htmlall':'UTF-8'}</span>
</label>
{/foreach}
<input type="text" id="comment_{$sub_part_v['id_room']|escape:'htmlall':'UTF-8'}_{$sub_part_k|escape:'htmlall':'UTF-8'}" class="form-control par_comment" placeholder="{l s='Allotment message' mod='hotelreservationsystem'}">
</td>
{if $occupancy_required_for_booking}
<td class="booking_occupancy">
<div class="dropdown">
<button class="btn btn-default btn-left btn-block booking_guest_occupancy input-occupancy" type="button">
<span>{l s='Select occupancy'}</span>
</button>
<div class="dropdown-menu booking_occupancy_wrapper well well-sm">
<input type="hidden" class="max_adults" value="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_children" value="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_guests" value="{if isset($book_v)}{$book_v['max_guests']|escape:'html':'UTF-8'}{/if}">
<div class="booking_occupancy_inner row">
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1'}</label></div>
<div class="col-sm-12">
<div class="row">
<div class="form-group col-xs-6 occupancy_count_block">
<label>{l s='Adults'}</label>
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" max="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
</div>
<div class="form-group col-xs-6 occupancy_count_block">
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
</div>
</div>
<div class="row children_age_info_block" style="display:none">
<div class="form-group col-sm-12">
<label class="">{l s='All Children'}</label>
<div class="">
<div class="row children_ages">
</div>
</div>
</div>
</div>
</div>
{* <hr class="occupancy-info-separator"> *}
{foreach from=$part_v['rooms'] key=sub_part_k item=sub_part_v}
<tr>
{if $sub_part_v@first}
<td rowspan="{$part_v['rooms']|count}">
<p>{dateFormat date=date('Y-m-d', strtotime($part_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($part_v['date_to']))}</p>
</td>
{/if}
<td >{$sub_part_v['room_num']|escape:'htmlall':'UTF-8'}</td>
<td>
{foreach $allotment_types as $allotment_type}
<label class="control-label">
<input type="radio" value="{$allotment_type.id_allotment|intval}" class="par_bk_type" name="bk_type_{$sub_part_v['id_room']|escape:'htmlall':'UTF-8'}_{$sub_part_k|escape:'htmlall':'UTF-8'}" data-id-room="{$sub_part_v['id_room']|escape:'htmlall':'UTF-8'}" data-sub-key="{$sub_part_k|escape:'htmlall':'UTF-8'}" {if $allotment_type@first}checked="checked"{/if}>
<span>{$allotment_type.name|escape:'htmlall':'UTF-8'}</span>
</label>
{/foreach}
<input type="text" id="comment_{$sub_part_v['id_room']|escape:'htmlall':'UTF-8'}_{$sub_part_k|escape:'htmlall':'UTF-8'}" class="form-control par_comment" placeholder="{l s='Allotment message' mod='hotelreservationsystem'}">
</td>
{if $occupancy_required_for_booking}
<td class="booking_occupancy">
<div class="dropdown">
<button class="btn btn-default btn-left btn-block booking_guest_occupancy input-occupancy" type="button">
<span>{l s='Select occupancy'}</span>
</button>
<div class="dropdown-menu booking_occupancy_wrapper well well-sm">
<input type="hidden" class="max_adults" value="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_children" value="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_guests" value="{if isset($book_v)}{$book_v['max_guests']|escape:'html':'UTF-8'}{/if}">
<div class="booking_occupancy_inner row">
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1'}</label></div>
<div class="col-sm-12">
<div class="row">
<div class="form-group col-xs-6 occupancy_count_block">
<label>{l s='Adults'}</label>
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" max="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
</div>
<div class="form-group col-xs-6 occupancy_count_block">
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
</div>
</div>
<div class="row children_age_info_block" style="display:none">
<div class="form-group col-sm-12">
<label class="">{l s='All Children'}</label>
<div class="">
<div class="row children_ages">
</div>
</div>
</div>
</div>
{* <div class="add_occupancy_block">
<a class="add_new_occupancy_btn" href="#"><i class="icon-plus"></i> <span>{l s='Add Room'}</span></a>
</div> *}
</div>
{* <hr class="occupancy-info-separator"> *}
</div>
</td>
{/if}
<td class="text-center">
<button type="button" data-id-cart="" data-id-cart-book-data="" data-id-product="{$sub_part_v['id_product']|escape:'htmlall':'UTF-8'}" data-id-room="{$sub_part_v['id_room']|escape:'htmlall':'UTF-8'}" data-id-hotel="{$sub_part_v['id_hotel']|escape:'htmlall':'UTF-8'}" data-date-from="{$part_v['date_from']|escape:'htmlall':'UTF-8'|date_format:'%Y-%m-%d'}" data-date-to ="{$part_v['date_to']|escape:'htmlall':'UTF-8'|date_format:'%Y-%m-%d'}" data-sub-key="{$part_k|escape:'htmlall':'UTF-8'}" class="btn btn-primary par_add_cart">{l s='Add To Cart' mod='hotelreservationsystem'}</button>
</td>
</tr>
{/foreach}
</table>
</td>
</tr>
</div>
{* <div class="add_occupancy_block">
<a class="add_new_occupancy_btn" href="#"><i class="icon-plus"></i> <span>{l s='Add Room'}</span></a>
</div> *}
</div>
</div>
</td>
{/if}
<td>
<button type="button" data-id-cart="" data-id-cart-book-data="" data-id-product="{$sub_part_v['id_product']|escape:'htmlall':'UTF-8'}" data-id-room="{$sub_part_v['id_room']|escape:'htmlall':'UTF-8'}" data-id-hotel="{$sub_part_v['id_hotel']|escape:'htmlall':'UTF-8'}" data-date-from="{$part_v['date_from']|escape:'htmlall':'UTF-8'|date_format:'%Y-%m-%d'}" data-date-to ="{$part_v['date_to']|escape:'htmlall':'UTF-8'|date_format:'%Y-%m-%d'}" data-sub-key="{$sub_part_k|escape:'htmlall':'UTF-8'}" class="btn btn-primary par_add_cart">{l s='Add To Cart' mod='hotelreservationsystem'}</button>
</td>
</tr>
{/foreach}
{/foreach}
</tbody>
</table>
@@ -206,39 +200,35 @@
<thead>
<tr>
<th><span class="title_box">{l s='Room No.' mod='hotelreservationsystem'}</span></th>
<th class="text-center"><span class="title_box">{l s='Duration' mod='hotelreservationsystem'}</span></th>
<th class="text-center"><span class="title_box">{l s='Message' mod='hotelreservationsystem'}</span></th>
<th class="text-center"><span class="title_box">{l s='Allotment Type' mod='hotelreservationsystem'}</span></th>
<th><span class="title_box">{l s='Duration' mod='hotelreservationsystem'}</span></th>
<th><span class="title_box">{l s='Message' mod='hotelreservationsystem'}</span></th>
<th><span class="title_box">{l s='Allotment Type' mod='hotelreservationsystem'}</span></th>
<th><span class="title_box">{l s='Reallocate' mod='hotelreservationsystem'}</span></th>
</tr>
</thead>
<tbody>
{foreach from=$book_v['data']['booked'] key=booked_k item=booked_v}
<tr>
<td>{$booked_v['room_num']|escape:'htmlall':'UTF-8'}</td>
<td colspan="4">
<table class="table">
{foreach from=$booked_v['detail'] key=rm_dtl_k item=rm_dtl_v}
<tr>
<td class="col-xs-3">{dateFormat date=date('Y-m-d', strtotime($rm_dtl_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($rm_dtl_v['date_to']))}</td>
<td class="col-xs-3">{$rm_dtl_v['comment']|escape:'htmlall':'UTF-8'}</td>
<td class="col-xs-3">
{if $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_AUTO}{l s='Auto Allotment' mod='hotelreservationsystem'}{elseif $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL}{l s='Manual Allotment' mod='hotelreservationsystem'}{/if}
</td>
<td>
{if $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_AUTO}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mySwappigModal" data-room_num={$booked_v['room_num']|escape:'htmlall':'UTF-8'} data-date_from={$rm_dtl_v['date_from']|escape:'htmlall':'UTF-8'} data-date_to={$rm_dtl_v['date_to']|escape:'htmlall':'UTF-8'} data-id_room={$booked_v['id_room']|escape:'htmlall':'UTF-8'} data-cust_name="{$rm_dtl_v['alloted_cust_name']|escape:'htmlall':'UTF-8'}" data-cust_email="{$rm_dtl_v['alloted_cust_email']|escape:'htmlall':'UTF-8'}" data-avail_rm_realloc={$rm_dtl_v['avail_rooms_to_realloc']|@json_encode} data-avail_rm_swap={$rm_dtl_v['avail_rooms_to_swap']|@json_encode}>
{l s='Reallocate Room' mod='hotelreservationsystem'}
</button>
{else}
--
{/if}
</td>
</tr>
{/foreach}
</table>
</td>
</tr>
{foreach from=$booked_v['detail'] key=rm_dtl_k item=rm_dtl_v}
<tr>
{if $rm_dtl_v@first}
<td rowspan="{$booked_v['detail']|count}">{$booked_v['room_num']|escape:'htmlall':'UTF-8'}</td>
{/if}
<td>{dateFormat date=date('Y-m-d', strtotime($rm_dtl_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($rm_dtl_v['date_to']))}</td>
<td>{$rm_dtl_v['comment']|escape:'htmlall':'UTF-8'}</td>
<td>
{if $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_AUTO}{l s='Auto Allotment' mod='hotelreservationsystem'}{elseif $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL}{l s='Manual Allotment' mod='hotelreservationsystem'}{/if}
</td>
<td>
{if $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_AUTO}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mySwappigModal" data-room_num={$booked_v['room_num']|escape:'htmlall':'UTF-8'} data-date_from={$rm_dtl_v['date_from']|escape:'htmlall':'UTF-8'} data-date_to={$rm_dtl_v['date_to']|escape:'htmlall':'UTF-8'} data-id_room={$booked_v['id_room']|escape:'htmlall':'UTF-8'} data-cust_name="{$rm_dtl_v['alloted_cust_name']|escape:'htmlall':'UTF-8'}" data-cust_email="{$rm_dtl_v['alloted_cust_email']|escape:'htmlall':'UTF-8'}" data-avail_rm_realloc={$rm_dtl_v['avail_rooms_to_realloc']|@json_encode} data-avail_rm_swap={$rm_dtl_v['avail_rooms_to_swap']|@json_encode}>
{l s='Reallocate Room' mod='hotelreservationsystem'}
</button>
{else}
--
{/if}
</td>
</tr>
{/foreach}
{/foreach}
</tbody>
</table>

View File

@@ -187,6 +187,97 @@
<div class="modal fade" id="cartModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
{include file="./_partials/booking-cart.tpl"}
</div>
<!-- Modal for reallocation of rooms -->
<div class="modal fade" id="mySwappigModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#reallocate_room_tab" aria-controls="reallocate" role="tab" data-toggle="tab">{l s='Room Reallocation' mod='hotelreservationsystem'}</a></li>
<li role="presentation"><a href="#swap_room_tab" aria-controls="swap" role="tab" data-toggle="tab">{l s='Swap Room' mod='hotelreservationsystem'}</a></li>
</ul>
<div class="tab-content panel active">
<div role="tabpanel" class="tab-pane active" id="reallocate_room_tab">
<form method="post" action="{$formAction|escape:'htmlall':'UTF-8'}">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="realloc_myModalLabel">{l s='Reallocate Rooms'}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="curr_room_num" class="control-label">{l s='Current Room Number:' mod='hotelreservationsystem'}</label>
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
<input type="hidden" class="form-control modal_date_from" name="modal_date_from">
<input type="hidden" class="form-control modal_date_to" name="modal_date_to">
<input type="hidden" class="form-control modal_id_room" name="modal_id_room">
</div>
<div class="form-group">
<label for="realloc_avail_rooms" class="control-label">{l s='Available Rooms To Reallocate:' mod='hotelreservationsystem'}</label>
<div style="width: 195px;">
<select class="form-control" name="realloc_avail_rooms" id="realloc_avail_rooms">
<option value="0" selected="selected">{l s='Select Rooms' mod='hotelreservationsystem'}</option>
</select>
<p class="error_text" id="realloc_sel_rm_err_p"></p>
</div>
</div>
<div class="form-group">
<label style="text-decoration:underline;margin-top:5px;" for="message-text" class="col-sm-12 control-label"><i class="icon-info-circle"></i>&nbsp;{l s='Currently Alloted Customer Information:' mod='hotelreservationsystem'}</label>
<dl class="well list-detail">
<dt>{l s='Name' mod='hotelreservationsystem'}</dt>
<dd class="cust_name"></dd><br>
<dt>{l s='Email' mod='hotelreservationsystem'}</dt>
<dd class="cust_email"></dd><br>
</dl>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{l s="Close" mod="hotelreservationsyatem"}</button>
<input type="submit" id="realloc_allocated_rooms" name="realloc_allocated_rooms" class="btn btn-primary" value="Reallocate">
</div>
</form>
</div>
<div role="tabpanel" class="tab-pane" id="swap_room_tab">
<form method="post" action="">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="swap_myModalLabel">{l s='Swap Rooms' mod='hotelreservationsystem'}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="swap_curr_room_num" class="control-label">{l s='Current Room Number:' mod='hotelreservationsystem'}</label>
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
<input type="hidden" class="form-control modal_date_from" name="modal_date_from">
<input type="hidden" class="form-control modal_date_to" name="modal_date_to">
<input type="hidden" class="form-control modal_id_room" name="modal_id_room">
</div>
<div class="form-group">
<label for="swap_avail_rooms" class="control-label">{l s='Available Rooms To Swap:' mod='hotelreservationsystem'}</label>
<div style="width: 195px;">
<select class="form-control" name="swap_avail_rooms" id="swap_avail_rooms">
<option value="0" selected="selected">{l s='Select Rooms' mod='hotelreservationsystem'}</option>
</select>
<p class="error_text" id="swap_sel_rm_err_p"></p>
</div>
</div>
<div class="form-group">
<label style="text-decoration:underline;margin-top:5px;" for="message-text" class="col-sm-12 control-label"><i class="icon-info-circle"></i>&nbsp;{l s='Currently Alloted Customer Information:' mod='hotelreservationsystem'}</label>
<dl class="well list-detail">
<dt>{l s='Name' mod='hotelreservationsystem'}</dt>
<dd class="cust_name"></dd><br>
<dt>{l s='Email' mod='hotelreservationsystem'}</dt>
<dd class="cust_email"></dd><br>
</dl>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{l s="Close" mod="hotelreservationsyatem"}</button>
<input type="submit" id="swap_allocated_rooms" name="swap_allocated_rooms" class="btn btn-primary" value="Swap">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div id="date-stats-tooltop" style="display:none">
<div class="tooltip_cont">
<div class="tip_header">

View File

@@ -1,127 +0,0 @@
{*
* 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
*}
{if isset($idProduct) && $idProduct}
<form method="post" action="{$current|escape:'htmlall':'UTF-8'}&{if !empty($submit_action)}{$submit_action|escape:'htmlall':'UTF-8'}{/if}&token={$token|escape:'htmlall':'UTF-8'}" class="defaultForm form-horizontal" enctype="multipart/form-data">
<div class="panel">
<div class="panel-heading">
<i class="icon-user"></i> {l s='Room Type Additional Facilities' mod='hotelreservationsystem'}
</div>
<div class="alert alert-info">
{l s='To create new please visit' mod='hotelreservationsystem'} <a target="_blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')}">{l s='Additional facilities' mod='hotelreservationsystem'}</a> {l s='page' mod='hotelreservationsystem'}.
</div>
{if isset($allDemands) && $allDemands}
<div id="service_accordian">
{foreach $allDemands as $key => $demand}
<div class="accordion">
<div class="accordion-section">
<a class="accordion-section-title" href="#accordion_{$key|escape:'html':'UTF-8'}">
<input class="selected_demand" type="checkbox" name="selected_demand[]" value="{$demand['id_global_demand']|escape:'html':'UTF-8'}" {if isset($roomDemandPrices[$demand['id_global_demand']])}checked{/if} /> &nbsp;&nbsp;<span>{$demand['name']|escape:'html':'UTF-8'}<span class="pull-right"> <i class="icon-angle-left"></i>
</a>
<div id="accordion_{$key|escape:'html':'UTF-8'}" class="accordion-section-content">
{if isset($demand['adv_option']) && count($demand['adv_option'])}
<input type="hidden" name="demand_price_{$demand['id_global_demand']|escape:'html':'UTF-8'}"
value="{if isset($roomDemandPrices[$demand['id_global_demand']]['price'])}{$roomDemandPrices[$demand['id_global_demand']]['price']|escape:'html':'UTF-8'}{elseif isset($demand['price'])}{$demand['price']|escape:'html':'UTF-8'}{/if}"/>
{else}
<div class="form-group">
<label class="col-sm-3 control-label required" >
{l s='Price' mod='hotelreservationsystem'}({l s='tax excl.' mod='hotelreservationsystem'})
</label>
<div class="col-sm-3">
<div class="input-group">
<span class="input-group-addon">{$defaultcurrencySign|escape:'html':'UTF-8'}</span>
<input type="text" name="demand_price_{$demand['id_global_demand']|escape:'html':'UTF-8'}"
value="{if isset($roomDemandPrices[$demand['id_global_demand']]['price'])}{$roomDemandPrices[$demand['id_global_demand']]['price']|escape:'html':'UTF-8'}{elseif isset($demand['price'])}{$demand['price']|escape:'html':'UTF-8'}{/if}"/>
</div>
</div>
</div>
{/if}
{if isset($demand['adv_option']) && $demand['adv_option']}
<div class="adv_options_dtl form-group">
<label class="col-sm-3 control-label">
{l s='Advance options' mod='hotelreservationsystem'}
</label>
<div class="col-sm-9">
<div class="table-responsive-row clearfix">
<table class="table table-bordered adv_option_table">
<thead>
<tr>
<th>
<span>{l s='Option Name' mod='hotelreservationsystem'}</span>
</th>
<th>
<span>{l s='Price' mod='hotelreservationsystem'}</span>
</th>
</tr>
</thead>
{foreach from=$demand['adv_option'] key=key item=info}
<tr>
<td>
{$info['name']|escape:'html':'UTF-8'}
</td>
<td>
<div class="input-group">
<span class="input-group-addon">{$defaultcurrencySign|escape:'html':'UTF-8'}</span>
<input type="text" name="option_price_{$info['id']|escape:'html':'UTF-8'}" value="{if isset($roomDemandPrices[$demand['id_global_demand']]['adv_option'][$info['id']]['price'])}{$roomDemandPrices[$demand['id_global_demand']]['adv_option'][$info['id']]['price']|escape:'html':'UTF-8'}{else}{$info['price']|escape:'html':'UTF-8'}{/if}"/>
</div>
</td>
</tr>
{/foreach}
</table>
</div>
</div>
</div>
{/if}
</div>
</div>
</div>
{/foreach}
</div>
<div class="panel-footer">
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}{if isset($smarty.request.page) && $smarty.request.page > 1}&amp;submitFilterproduct={$smarty.request.page|intval}{/if}" class="btn btn-default">
<i class="process-icon-cancel"></i>
{l s='Cancel' mod='hotelreservationsystem'}
</a>
<button type="submit" name="submitAddproduct" class="btn btn-default pull-right checkConfigurationClick" disabled="disabled">
<i class="process-icon-loading"></i>
{l s='Save' mod='hotelreservationsystem'}
</button>
<button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right checkConfigurationClick" disabled="disabled">
<i class="process-icon-loading"></i>
{l s='Save and stay' mod='hotelreservationsystem'}
</button>
</div>
{else}
<div class="alert alert-warning">
{l s='No additional facilities created yet. To create please visit' mod='hotelreservationsystem'} <a target="_blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')}">{l s='Additional facilities' mod='hotelreservationsystem'}</a> {l s='page' mod='hotelreservationsystem'}.
</div>
{/if}
</div>
</form>
{else}
<div class="product-tab-content">
<div class="alert alert-warning">
<button data-dismiss="alert" class="close" type="button">×</button>
{l s='There is 1 warning.' mod='hotelreservationsystem'}
<ul id="seeMore" style="display:block;">
<li>{l s='You must save this product before selecting room type addttional facilities.' mod='hotelreservationsystem'}</li>
</ul>
</div>
</div>
{/if}

View File

@@ -820,6 +820,7 @@ class QloCleaner extends Module
'order_message',
'order_message_lang',
'order_payment',
'order_payment_detail',
'order_return',
'order_return_detail',
'order_slip',

View File

@@ -244,6 +244,15 @@ class QhrHotelReview extends ObjectModel
);
}
public function getTotalUseful()
{
return (int) Db::getInstance()->getValue(
'SELECT COUNT(*)
FROM `'._DB_PREFIX_.'qhr_review_usefulness` ru
WHERE ru.`id_hotel_review` = '.(int) $this->id_hotel_review
);
}
public function getTotalReports()
{
$sql = new DbQuery();

View File

@@ -139,6 +139,8 @@ class QloHotelReviewDefaultModuleFrontController extends ModuleFrontController
if (QhrHotelReview::markHelpful($idHotelReview, $this->context->cookie->id_customer)) {
$response['status'] = true;
$objHotelReview = new QhrHotelReview($idHotelReview);
$response['count_useful'] = $objHotelReview->getTotalUseful();
$this->ajaxDie(json_encode($response));
}
}

View File

@@ -36,9 +36,10 @@ var QhrReview = {
headers: { 'cache-control': 'no-cache' },
success: function(response) {
if (response.status == true) {
$(btnHelpful).closest('.review').find('.helpful-count span').html(response.count_useful);
$(btnHelpful).fadeOut('slow', function() {
$(btnHelpful).remove();
})
});
}
}
});

View File

@@ -124,7 +124,11 @@
<label class="control-label col-lg-3">{l s='Total Reports' mod='qlohotelreview'}</label>
<div class="col-lg-9">
<p class="form-control-static">
<span class="badge badge-danger">{$total_reports|escape:'html':'UTF-8'}</span>
{if $total_reports|intval > 0}
<span class="badge badge-danger">{$total_reports|escape:'html':'UTF-8'}</span>
{else}
--
{/if}
</p>
{if $total_reports|intval > 0}
<p>

View File

@@ -51,7 +51,7 @@
<i class="icon icon-thumbs-o-up text-primary"></i>
</a>
{/if}
<p class="helpful-count">{l s='%1$d people found it helpful.' sprintf=[$review.total_useful] mod='qlohotelreview'}</p>
<p class="helpful-count"><span>{$review.total_useful|escape:'html':'UTF-8'}</span>{l s=' people found it helpful.' mod='qlohotelreview'}</p>
</div>
{if $logged && !$review.response_report}
<div class="col-sm-6 text-right">

View File

@@ -1,28 +0,0 @@
{*
* 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
*}
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$link->getAdminLink('AdminAboutHotelBlockSetting')|escape:'html':'UTF-8'}" class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="icon-file-text"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{l s='Hotel Interior Block' mod='wkabouthotelblock'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{l s='About Hotel Setting' mod='wkabouthotelblock'}" data-content="{l s='Configure Hotel Interior block. You can display hotel interior images using this block. This block will be displayed in home page' mod='wkabouthotelblock'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>

View File

@@ -67,11 +67,6 @@ class WkAboutHotelBlock extends Module
return $this->display(__FILE__, 'hotelInteriorBlock.tpl');
}
public function hookDisplayAddModuleSettingLink()
{
return $this->display(__FILE__, 'aboutHotelBlockModuleSetting.tpl');
}
/**
* If admin add any language then an entry will add in defined $lang_tables array's lang table same as prestashop
* @param array $params
@@ -102,13 +97,17 @@ class WkAboutHotelBlock extends Module
return true;
}
public function getContent()
{
Tools::redirectAdmin($this->context->link->getAdminLink('AdminAboutHotelBlockSetting'));
}
public function registerModuleHooks()
{
return $this->registerHook(
array(
'displayHome',
'displayFooterExploreSectionHook',
'displayAddModuleSettingLink',
'actionObjectLanguageAddAfter'
)
);

View File

@@ -1,28 +0,0 @@
{*
* 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
*}
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$features_setting_link|escape:'htmlall':'UTF-8'}" class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="icon-th-list"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{l s='Hotel Amenities Block' mod='wkhotelfeaturesblock'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{l s='Features Module Setting' mod='wkhotelfeaturesblock'}" data-content="{l s='Configure Hotels Amenities settings. You can display hotel Amenities images using this block. This block will be displayed in home page.' mod='wkhotelfeaturesblock'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>

View File

@@ -63,13 +63,6 @@ class WkHotelFeaturesBlock extends Module
return $this->display(__FILE__, 'hotelfeaturescontent.tpl');
}
public function hookDisplayAddModuleSettingLink()
{
$hrefFeaturesConf = $this->context->link->getAdminLink('AdminFeaturesModuleSetting');
$this->context->smarty->assign('features_setting_link', $hrefFeaturesConf);
return $this->display(__FILE__, 'hotelFeatureSettingLink.tpl');
}
/**
* If admin add any language then an entry will add in defined $lang_tables array's lang table same as prestashop
* @param array $params
@@ -140,12 +133,16 @@ class WkHotelFeaturesBlock extends Module
array (
'displayHome',
'displayFooterExploreSectionHook',
'displayAddModuleSettingLink',
'actionObjectLanguageAddAfter'
)
);
}
public function getContent()
{
Tools::redirectAdmin($this->context->link->getAdminLink('AdminFeaturesModuleSetting'));
}
public function uninstall()
{
$objHotelFeaturesBlockDb = new WkHotelFeaturesBlockDb();

View File

@@ -42,108 +42,6 @@ class wkhotelfilterblock extends Module
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
}
public function getContent()
{
$this->html = '';
if (Tools::isSubmit('btnConfigSubmit')) {
$this->postProcess();
} else {
$this->html .= '<br />';
}
$this->html .= $this->renderForm();
return $this->html;
}
public function renderForm()
{
$fields_form = array();
$fields_form['form'] = array(
'legend' => array(
'icon' => 'icon-cog',
'title' => $this->l('Search Results Filter Configuration'),
),
'input' => array(
array(
'type' => 'switch',
'label' => $this->l('Show Amenities Filter'),
'name' => 'SHOW_AMENITIES_FILTER',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
),
array(
'id' => 'active_off',
'value' => 0,
),
),
'hint' => $this->l('If yes, it will display Amenities Filter.'),
),
array(
'type' => 'switch',
'label' => $this->l('Show Price Filter'),
'name' => 'SHOW_PRICE_FILTER',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
),
array(
'id' => 'active_off',
'value' => 0,
),
),
'hint' => $this->l('If yes, it will display price Filter.'),
),
),
'submit' => array(
'title' => $this->l('Save'),
'name' => 'submit_conf_filter',
),
);
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = $lang->id;
$this->fields_form = array();
$helper->identifier = $this->identifier;
$helper->submit_action = 'btnConfigSubmit';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).
'&configure='.$this->name.'&module_name='.$this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = array(
'fields_value' => $this->getConfigFieldsValues(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id,
);
return $helper->generateForm(array($fields_form));
}
public function postProcess()
{
if (Tools::isSubmit('btnConfigSubmit')) {
Configuration::updateValue(
'SHOW_AMENITIES_FILTER',
Tools::getValue('SHOW_AMENITIES_FILTER')
);
Configuration::updateValue('SHOW_PRICE_FILTER', Tools::getValue('SHOW_PRICE_FILTER'));
// redirect after saving the configuration
Tools::redirectAdmin(
$this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&tab_module='.$this->tab.
'&module_name='.$this->name.'&conf=4'
);
}
}
public function install()
{
if (!parent::install()
@@ -153,10 +51,6 @@ class wkhotelfilterblock extends Module
return false;
}
//set default config variable`
Configuration::updateValue('SHOW_AMENITIES_FILTER', 1);
Configuration::updateValue('SHOW_PRICE_FILTER', 1);
return true;
}
@@ -165,15 +59,6 @@ class wkhotelfilterblock extends Module
$this->context->controller->addJQueryUI('ui.slider');
}
public function uninstall($keep = true)
{
if (!parent::uninstall() || !$this->deleteConfigKeys()) {
return false;
}
return true;
}
public function hookDisplayLeftColumn()
{
if ($this->context->controller->php_self == 'category') {
@@ -258,24 +143,9 @@ class wkhotelfilterblock extends Module
public function getConfigFieldsValues()
{
$config_vars = array(
'SHOW_AMENITIES_FILTER' => Tools::getValue('SHOW_AMENITIES_FILTER', Configuration::get('SHOW_AMENITIES_FILTER')),
'SHOW_PRICE_FILTER' => Tools::getValue('SHOW_PRICE_FILTER', Configuration::get('SHOW_PRICE_FILTER')),
return array(
'SHOW_AMENITIES_FILTER' => Configuration::get('SHOW_AMENITIES_FILTER'),
'SHOW_PRICE_FILTER' => Configuration::get('SHOW_PRICE_FILTER'),
);
return $config_vars;
}
public function deleteConfigKeys()
{
$var = array('SHOW_AMENITIES_FILTER', 'SHOW_PRICE_FILTER');
foreach ($var as $key) {
if (!Configuration::deleteByName($key)) {
return false;
}
}
return true;
}
}

View File

@@ -1,28 +0,0 @@
{*
* 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
*}
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$htlRoomBlockConfigLink|escape:'htmlall':'UTF-8'}" class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="icon-key"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{l s='Hotel Rooms Block' mod='wkhotelroom'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{l s='Hotel Rooms Setting' mod='wkhotelroom'}" data-content="{l s='Configure Hotel Rooms settings. Using this module you can display your hotel rooms in home page.' mod='wkhotelroom'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>

View File

@@ -126,14 +126,6 @@ class WkHotelRoom extends Module
}
}
public function hookDisplayAddModuleSettingLink()
{
$htlRoomBlockConfigLink = $this->context->link->getAdminLink('AdminHotelRoomModuleSetting');
$this->context->smarty->assign('htlRoomBlockConfigLink', $htlRoomBlockConfigLink);
return $this->display(__FILE__, 'hotelRoomSettingLink.tpl');
}
/**
* If admin add any language then an entry will add in defined $lang_tables array's lang table same as prestashop
* @param array $params
@@ -204,7 +196,6 @@ class WkHotelRoom extends Module
array (
'displayHome',
'actionProductDelete',
'displayAddModuleSettingLink',
'displayFooterExploreSectionHook',
'actionProductSave',
'actionObjectLanguageAddAfter'
@@ -212,6 +203,11 @@ class WkHotelRoom extends Module
);
}
public function getContent()
{
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomModuleSetting'));
}
public function uninstall()
{
$objHotelRoomDb = new WkHotelRoomDb();

View File

@@ -1,28 +0,0 @@
{*
* 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
*}
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$testimonials_setting_link|escape:'htmlall':'UTF-8'}" class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="icon-quote-left"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{l s='Hotel Testimonial' mod='wktestimonialblock'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{l s='Hotel Testimonials Setting' mod='wktestimonialblock'}" data-content="{l s='Configure Hotel Testimonials settings using this link.' mod='wktestimonialblock'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>

View File

@@ -44,13 +44,6 @@ class WkTestimonialBlock extends Module
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
}
public function hookDisplayAddModuleSettingLink()
{
$hrefTestimonialsConf = $this->context->link->getAdminLink('AdminTestimonialsModuleSetting');
$this->context->smarty->assign('testimonials_setting_link', $hrefTestimonialsConf);
return $this->display(__FILE__, 'hotelTestimonialSettingLink.tpl');
}
public function hookDisplayHome()
{
$this->context->controller->addCSS(_PS_JS_DIR_.'/owl-carousel/assets/owl.carousel.min.css');
@@ -132,12 +125,16 @@ class WkTestimonialBlock extends Module
array (
'displayHome',
'displayFooterExploreSectionHook',
'displayAddModuleSettingLink',
'actionObjectLanguageAddAfter'
)
);
}
public function getContent()
{
Tools::redirectAdmin($this->context->link->getAdminLink('AdminTestimonialsModuleSetting'));
}
public function callInstallTab()
{
//Controllers which are to be used in this modules but we have not to create tab for those controllers...

View File

@@ -27,10 +27,10 @@
<td class="payment center small grey bold" width="44%">{l s='Payment Method' pdf='true'}</td>
<td class="payment left white" width="56%">
<table width="100%" border="0">
{foreach from=$order_invoice->getOrderPaymentCollection() item=payment}
{foreach from=$order_invoice->getOrderPaymentDetail() item=payment}
<tr>
<td class="right small">{$payment->payment_method}</td>
<td class="right small">{displayPrice currency=$payment->id_currency price=$payment->amount}</td>
<td class="right small">{$payment['payment_method']}</td>
<td class="right small">{displayPrice currency=$payment['id_currency'] price=$payment['amount']}</td>
</tr>
{/foreach}
</table>

View File

@@ -5818,8 +5818,7 @@ header {
header .row #header_logo {
padding: 10px 0; }
header .row #header_logo img {
max-width: 120px;
max-height: 120px; }
max-height: 60px; }
header .header-top > div > div > div .header-top-menu {
display: flex;
flex-direction: row-reverse;

View File

@@ -105,7 +105,7 @@
<div class="col-xs-12">
<div id="header_logo">
<a href="{if isset($force_ssl) && $force_ssl}{$base_dir_ssl}{else}{$base_dir}{/if}" title="{$shop_name|escape:'html':'UTF-8'}">
<img class="logo img-responsive" src="{$logo_url}" alt="{$shop_name|escape:'html':'UTF-8'}"{if isset($logo_image_width) && $logo_image_width} width="{$logo_image_width}"{/if}{if isset($logo_image_height) && $logo_image_height} height="{$logo_image_height}"{/if}/>
<img class="logo img-responsive" src="{$logo_url}" alt="{$shop_name|escape:'html':'UTF-8'}"/>
</a>
</div>
<div class="header-top-menu">

View File

@@ -50,6 +50,44 @@ $(document).ready(function()
$("#partial_data").slideDown();
});
// customer guest booking
function initGuestbookingcontainer() {
if ($("#customer_guest_detail:checked").val() == 1) {
$('#checkout-guest-info-block').hide('slow');
$('#customer-guest-detail-container').show('slow');
} else {
$('#customer-guest-detail-container').hide('slow');
$('#checkout-guest-info-block').show('slow');
}
}
function validateCustomerGuestDetailForm() {
$('#customer_guest_detail_form input.validate').each(function (index, element) {
if (!validate_field(element)) {
if ($('#cgv').prop('checked') == 1) {
$('#cgv').trigger('click');
}
}
});
}
initGuestbookingcontainer();
$("#customer_guest_detail").on('change',function() {
initGuestbookingcontainer();
});
if ($("#customer_guest_detail:checked").val() == 1) {
validateCustomerGuestDetailForm();
}
$('#customer_guest_detail_form').on('change', function(e) {
$.ajax({
type: 'POST',
url: orderOpcUrl,
async: false,
cache: false,
dataType : "json",
data: $(this).serialize()+'&method=submitCustomerGuestDetail&ajax=true&token=' + static_token
});
});
// GUEST CHECKOUT / NEW ACCOUNT MANAGEMENT
if ((typeof isLogged == 'undefined' || !isLogged) || (typeof isGuest !== 'undefined' && isGuest))
{

View File

@@ -206,7 +206,7 @@
</span>
</div>
{/if} --><!-- commented by webkul unnecessary data -->
{if $show_tax && isset($tax_cost)}
{if $show_tax && $use_tax}
<div class="cart-prices-line">
<span class="price cart_block_tax_cost ajax_cart_tax_cost">{$tax_cost}</span>
<span>{l s='Tax' mod='blockcart'}</span>

View File

@@ -93,23 +93,36 @@
<div class="row">
<div class="col-xs-12 col-sm-12">
<ul class="address item {if $order->isVirtual()}full_width{/if} box">
<li><h3 class="page-subheading">{l s='Customer Details'}</h3></li>
{if isset($address_invoice->firstname) && $address_invoice->firstname}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Name'}</div><div class="col-sm-9 col-xs-6">{$address_invoice->firstname|escape:'html':'UTF-8'} {$address_invoice->lastname|escape:'html':'UTF-8'}</div></li>
{/if}
{if isset($guestInformations['email']) && $guestInformations['email']}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Email'}</div><div class="col-sm-9 col-xs-6">{$guestInformations['email']|escape:'html':'UTF-8'}</div></li>
{/if}
{if isset($address_invoice->phone_mobile) && $address_invoice->phone_mobile}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Mobile Number'}</div><div class="col-sm-9 col-xs-6">{$address_invoice->phone_mobile|escape:'html':'UTF-8'}</div></li>
{/if}
{if isset($address_invoice->phone) && $address_invoice->phone}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Phone Number'}</div><div class="col-sm-9 col-xs-6">{$address_invoice->phone|escape:'html':'UTF-8'}</div></li>
<li><h3 class="page-subheading">{l s='Guest Details'}</h3></li>
{if $customerGuestDetail}
{if isset($customerGuestDetail->firstname) && $customerGuestDetail->firstname}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Name'}</div><div class="col-sm-9 col-xs-6">{$customerGuestDetail->firstname|escape:'html':'UTF-8'} {$customerGuestDetail->lastname|escape:'html':'UTF-8'}</div></li>
{/if}
{if isset($customerGuestDetail->email) && $customerGuestDetail->email}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Email'}</div><div class="col-sm-9 col-xs-6">{$customerGuestDetail->email|escape:'html':'UTF-8'}</div></li>
{/if}
{if isset($customerGuestDetail->phone) && $customerGuestDetail->phone}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Mobile Number'}</div><div class="col-sm-9 col-xs-6">{$customerGuestDetail->phone|escape:'html':'UTF-8'}</div></li>
{/if}
{else}
{if isset($address_invoice->firstname) && $address_invoice->firstname}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Name'}</div><div class="col-sm-9 col-xs-6">{$address_invoice->firstname|escape:'html':'UTF-8'} {$address_invoice->lastname|escape:'html':'UTF-8'}</div></li>
{/if}
{if isset($guestInformations['email']) && $guestInformations['email']}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Email'}</div><div class="col-sm-9 col-xs-6">{$guestInformations['email']|escape:'html':'UTF-8'}</div></li>
{/if}
{if isset($address_invoice->phone_mobile) && $address_invoice->phone_mobile}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Mobile Number'}</div><div class="col-sm-9 col-xs-6">{$address_invoice->phone_mobile|escape:'html':'UTF-8'}</div></li>
{/if}
{if isset($address_invoice->phone) && $address_invoice->phone}
<li class="row"><div class="col-sm-3 col-md-2 col-xs-6">{l s='Phone Number'}</div><div class="col-sm-9 col-xs-6">{$address_invoice->phone|escape:'html':'UTF-8'}</div></li>
{/if}
{/if}
</ul>
</div>
</div>
</div>
{$HOOK_ORDERDETAILDISPLAYED}
{if !$is_guest}<form action="{$link->getPageLink('order-follow', true)|escape:'html':'UTF-8'}" method="post">{/if}

View File

@@ -78,7 +78,47 @@
<div id="collapse-guest-info" class="opc-collapse {if !$step->step_is_current}collapse{/if}" aria-labelledby="guest-info-head" data-parent="#oprder-opc-accordion">
<div class="card-body">
{if $is_logged || $isGuest}
<div class="checkout-guest-info-block">
{if $is_logged}
<form id="customer_guest_detail_form">
<p class="checkbox">
<input type="checkbox" name="customer_guest_detail" id="customer_guest_detail" value="1" {if $id_customer_guest_detail}checked="checked"{/if}/>
<label for="customer_guest_detail" id="customer_guest_detail_txt">{l s='Booking for someone else?'}</label>
</p>
<div id="customer-guest-detail-container" {if !$id_customer_guest_detail}style="display: none;"{/if}>
<div class="row">
<div class="required clearfix gender-line col-sm-2">
<label>{l s='Social title'}</label>
<select name="customer_guest_detail_gender" id="customer_guest_detail_gender">
{foreach from=$genders key=k item=gender}
<option value="{$gender->id_gender}"{if isset($smarty.post.customer_guest_detail_gender) && $smarty.post.customer_guest_detail_gender == $gender->id_gender || (isset($customer_guest_detail) && $customer_guest_detail.id_gender == $gender->id_gender)} selected="selected"{/if}>{$gender->name}</option>
{/foreach}
</select>
</div>
<div class="required form-group col-sm-5">
<label for="firstname">{l s='First name'} <sup>*</sup></label>
<input type="text" class="text form-control validate is_required" id="customer_guest_detail_firstname" name="customer_guest_detail_firstname" data-validate="isName"{if isset($smarty.post.customer_guest_detail_firstname) && $smarty.post.customer_guest_detail_firstname} value="{$smarty.post.customer_guest_detail_firstname}"{elseif isset($customer_guest_detail) && $customer_guest_detail.firstname} value="{$customer_guest_detail.firstname}"{/if}/>
</div>
<div class="required form-group col-sm-5">
<label for="lastname">{l s='Last name'} <sup>*</sup></label>
<input type="text" class="form-control validate is_required" id="customer_guest_detail_lastname" name="customer_guest_detail_lastname" data-validate="isName"{if isset($smarty.post.customer_guest_detail_lastname) && $smarty.post.customer_guest_detail_lastname} value="{$smarty.post.customer_guest_detail_lastname}"{elseif isset($customer_guest_detail) && $customer_guest_detail.lastname} value="{$customer_guest_detail.lastname}"{/if}/>
</div>
</div>
<div class="row">
<div class="required text form-group col-sm-6">
<label for="email">{l s='Email'} <sup>*</sup></label>
<input type="email" class="text form-control validate is_required" id="customer_guest_detail_email" name="customer_guest_detail_email" data-validate="isEmail"{if isset($smarty.post.customer_guest_detail_email) && $smarty.post.customer_guest_detail_email} value="{$smarty.post.customer_guest_detail_email}"{elseif isset($customer_guest_detail) && $customer_guest_detail.email} value="{$customer_guest_detail.email}"{/if}/>
</div>
</div>
<div class="row">
<div class="{if isset($one_phone_at_least) && $one_phone_at_least}required {/if}form-group col-sm-6">
<label for="phone_mobile">{l s='Mobile phone'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>**</sup>{/if}</label>
<input type="text" class="text form-control validate is_required" name="customer_guest_detail_phone" id="customer_guest_detail_phone" data-validate="isPhoneNumber"{if isset($smarty.post.customer_guest_detail_phone) && $smarty.post.customer_guest_detail_phone} value="{$smarty.post.customer_guest_detail_phone}"{elseif isset($customer_guest_detail) && $customer_guest_detail.phone} value="{$customer_guest_detail.phone}"{/if}/>
</div>
</div>
</div>
</form>
{/if}
<div id="checkout-guest-info-block" {if $id_customer_guest_detail}style="display: none;"{/if}>
<div class="row margin-btm-10">
<div class="col-sm-3 col-xs-5 info-head">{l s='Name'}</div>
<div class="col-sm-9 col-xs-7 info-value">
@@ -111,28 +151,28 @@
</div>
</div>
{/if}
</div>
{* proceed only if no order restrict errors are there *}
{if !$orderRestrictErr}
<hr>
<div class="row">
<div class="col-sm-12 proceed_btn_block">
<a class="btn btn-default button button-medium pull-right" href="{$link->getPageLink('order-opc', null, null, ['proceed_to_payment' => 1])}" title="Proceed to Payment" rel="nofollow">
{* proceed only if no order restrict errors are there *}
{if !$orderRestrictErr}
<hr>
<div class="row">
<div class="col-sm-12 proceed_btn_block">
<a class="btn btn-default button button-medium pull-right" href="{$link->getPageLink('order-opc', null, null, ['proceed_to_payment' => 1])}" title="Proceed to Payment" rel="nofollow">
<span>
{l s='Proceed'}
</span>
</a>
{if $isGuest}
<a class="btn btn-default btn-edit-guest-info pull-right" href="#" rel="nofollow">
<span>
{l s='Proceed'}
{l s='Edit'}
</span>
</a>
{if $isGuest}
<a class="btn btn-default btn-edit-guest-info pull-right" href="#" rel="nofollow">
<span>
{l s='Edit'}
</span>
</a>
{/if}
</div>
{/if}
</div>
{/if}
</div>
</div>
{/if}
{else}
<!-- Create account / Guest account / Login block -->
{include file="$tpl_dir./order-opc-new-account.tpl"}