Merge 'origin/develop' into gli-1274
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
{else}
|
||||
<h2>{l s='No order was created from this cart.'}</h2>
|
||||
{if $customer->id}
|
||||
<a class="btn btn-default" href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&id_cart={$cart->id|intval}&addorder"><i class="icon-shopping-cart"></i> {l s='Create an order from this cart.'}</a>
|
||||
<a class="btn btn-default" href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&cart_id={$cart->id|intval}&addorder"><i class="icon-shopping-cart"></i> {l s='Create an order from this cart.'}</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -129,15 +129,15 @@
|
||||
<h3><i class="icon-link"></i> {l s="Help Center"}</h3>
|
||||
<dl>
|
||||
<dt><a href="https://qloapps.com/qlo-reservation-system/" class="_blank">{l s="Official Documentation"}</a></dt>
|
||||
<dd>{l s="Qloapps User Guide"}</dd>
|
||||
<dd>{l s="QloApps User Guide"}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><a href="https://forums.qloapps.com/" class="_blank">{l s="Qloapps Forum"}</a></dt>
|
||||
<dd>{l s="Connect with the Qloapps community"}</dd>
|
||||
<dt><a href="https://forums.qloapps.com/" class="_blank">{l s="QloApps Forum"}</a></dt>
|
||||
<dd>{l s="Connect with the QloApps community"}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><a href="https://qloapps.com/addons/" class="_blank">{l s="Qloapps Addons"}</a></dt>
|
||||
<dd>{l s="Enhance your store Qloapps modules"}</dd>
|
||||
<dt><a href="https://qloapps.com/addons/" class="_blank">{l s="QloApps Addons"}</a></dt>
|
||||
<dd>{l s="Enhance your store QloApps modules"}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><a href="https://qloapps.com/contact/" class="_blank">{l s="Contact Us!"}</a></dt>
|
||||
@@ -148,4 +148,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,7 +85,7 @@
|
||||
</div>
|
||||
<div class="col-xs-6 occupancy_count_block">
|
||||
<div class="col-sm-12">
|
||||
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
|
||||
<label>{l s='Children'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="{$data['children']}" min="0" max="{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}">
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
|
||||
</div>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<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>
|
||||
{l s='To create new Additional facilities'} <a target="_blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')}">{l s='click here.'}</a>
|
||||
</div>
|
||||
{if isset($allDemands) && $allDemands}
|
||||
<div class="panel-group">
|
||||
@@ -112,4 +112,4 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -54,7 +54,9 @@
|
||||
<hr>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{l s='Below, enter the maximum of adults or children which can be accommodated in a room of this room type. Also, enter maximum number of guests for this room type.'}
|
||||
{l s='Below, enter the maximum number of adults and children which can be accommodated in a room of this room type.'}
|
||||
<br>
|
||||
{l s='For maximum room occupancy, the total number of guests which can be accommodated in a room of this room type.'}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{* <div class="form-group">
|
||||
<label for="id_manufacturer" class="control-label col-lg-3">{l s='Manufacturer'}</label>
|
||||
<div class="col-lg-9">
|
||||
<div class="col-lg-8">
|
||||
@@ -68,8 +68,8 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
</div> *}
|
||||
{* <div class="form-group">
|
||||
<label for="id_supplier" class="control-label col-lg-3">{l s='Supplier'}</label>
|
||||
<div class="col-lg-9">
|
||||
<div class="col-lg-8">
|
||||
@@ -85,8 +85,8 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
</div> *}
|
||||
{* <div class="form-group">
|
||||
<label for="id_attribute_group" class="control-label col-lg-3">{l s='Attributes'}</label>
|
||||
<div class="col-lg-9">
|
||||
<div class="col-lg-4">
|
||||
@@ -111,7 +111,7 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> *}
|
||||
<div class="form-group">
|
||||
<label for="id_feature" class="control-label col-lg-3">{l s='Features'}</label>
|
||||
<div class="col-lg-9">
|
||||
|
||||
@@ -75,7 +75,7 @@ class PageCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'page`
|
||||
WHERE `id_page_type` = '.(int)$page_type_id.$where;
|
||||
$result = Db::getInstance()->getRow($sql);
|
||||
if ($result['id_page']) {
|
||||
if (isset($result['id_page']) && $result['id_page']) {
|
||||
return $result['id_page'];
|
||||
}
|
||||
|
||||
|
||||
@@ -379,19 +379,23 @@ abstract class PaymentModuleCore extends Module
|
||||
(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_
|
||||
);
|
||||
if ($totalOrder = $this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT, null, $id_carrier)) {
|
||||
$order->amount_paid = (float)Tools::ps_round(
|
||||
(($order->advance_paid_amount * $amount_paid) / $totalOrder),
|
||||
_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->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_
|
||||
);
|
||||
if ($orderTotal = $this->context->cart->getOrderTotal(true, Cart::BOTH, null, $id_carrier)) {
|
||||
$order->amount_paid = (float)Tools::ps_round(
|
||||
(($order->advance_paid_amount * $amount_paid) / $orderTotal),
|
||||
_PS_PRICE_COMPUTE_PRECISION_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Creating order
|
||||
|
||||
@@ -219,13 +219,13 @@ class OrderReturnCore extends ObjectModel
|
||||
0
|
||||
);
|
||||
$bookingRow['additional_services_tax_excl'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
|
||||
$id_order,
|
||||
$bookingRow['id_order'],
|
||||
0,
|
||||
0,
|
||||
$type_value['product_id'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
$data_v['id_room'],
|
||||
$bookingRow['id_product'],
|
||||
$bookingRow['date_from'],
|
||||
$bookingRow['date_to'],
|
||||
$bookingRow['id_room'],
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
@@ -369,49 +369,49 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function renderKpis()
|
||||
{
|
||||
$time = time();
|
||||
$kpis = array();
|
||||
// public function renderKpis()
|
||||
// {
|
||||
// $time = time();
|
||||
// $kpis = array();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-disabled-categories';
|
||||
$helper->icon = 'icon-off';
|
||||
$helper->color = 'color1';
|
||||
$helper->title = $this->l('Disabled Categories', null, null, false);
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_categories';
|
||||
$kpis[] = $helper->generate();
|
||||
// $helper = new HelperKpi();
|
||||
// $helper->id = 'box-disabled-categories';
|
||||
// $helper->icon = 'icon-off';
|
||||
// $helper->color = 'color1';
|
||||
// $helper->title = $this->l('Disabled Categories', null, null, false);
|
||||
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_categories';
|
||||
// $kpis[] = $helper->generate();
|
||||
|
||||
// $helper = new HelperKpi();
|
||||
// $helper->id = 'box-empty-categories';
|
||||
// $helper->icon = 'icon-bookmark-empty';
|
||||
// $helper->color = 'color2';
|
||||
// $helper->href = $this->context->link->getAdminLink('AdminTracking');
|
||||
// $helper->title = $this->l('Empty Categories', null, null, false);
|
||||
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=empty_categories';
|
||||
// $kpis[] = $helper->generate();
|
||||
// // $helper = new HelperKpi();
|
||||
// // $helper->id = 'box-empty-categories';
|
||||
// // $helper->icon = 'icon-bookmark-empty';
|
||||
// // $helper->color = 'color2';
|
||||
// // $helper->href = $this->context->link->getAdminLink('AdminTracking');
|
||||
// // $helper->title = $this->l('Empty Categories', null, null, false);
|
||||
// // $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=empty_categories';
|
||||
// // $kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-top-category';
|
||||
$helper->icon = 'icon-money';
|
||||
$helper->color = 'color3';
|
||||
$helper->title = $this->l('Top Category', null, null, false);
|
||||
$helper->subtitle = $this->l('30 days', null, null, false);
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=top_category';
|
||||
$kpis[] = $helper->generate();
|
||||
// $helper = new HelperKpi();
|
||||
// $helper->id = 'box-top-category';
|
||||
// $helper->icon = 'icon-money';
|
||||
// $helper->color = 'color3';
|
||||
// $helper->title = $this->l('Top Category', null, null, false);
|
||||
// $helper->subtitle = $this->l('30 days', null, null, false);
|
||||
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=top_category';
|
||||
// $kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-products-per-category';
|
||||
$helper->icon = 'icon-search';
|
||||
$helper->color = 'color4';
|
||||
$helper->title = $this->l('Average number of products per category', null, null, false);
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=products_per_category';
|
||||
$kpis[] = $helper->generate();
|
||||
// $helper = new HelperKpi();
|
||||
// $helper->id = 'box-products-per-category';
|
||||
// $helper->icon = 'icon-search';
|
||||
// $helper->color = 'color4';
|
||||
// $helper->title = $this->l('Average number of products per category', null, null, false);
|
||||
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=products_per_category';
|
||||
// $kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpiRow();
|
||||
$helper->kpis = $kpis;
|
||||
return $helper->generate();
|
||||
}
|
||||
// $helper = new HelperKpiRow();
|
||||
// $helper->kpis = $kpis;
|
||||
// return $helper->generate();
|
||||
// }
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
|
||||
@@ -175,8 +175,6 @@ class AdminEmployeesControllerCore extends AdminController
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
parent::initPageHeaderToolbar();
|
||||
|
||||
if (empty($this->display)) {
|
||||
$this->page_header_toolbar_btn['new_employee'] = array(
|
||||
'href' => self::$currentIndex.'&addemployee&token='.$this->token,
|
||||
@@ -195,6 +193,8 @@ class AdminEmployeesControllerCore extends AdminController
|
||||
$this->toolbar_title);
|
||||
}
|
||||
}
|
||||
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
|
||||
@@ -139,9 +139,9 @@ class AdminGeolocationControllerCore extends AdminController
|
||||
{
|
||||
$this->display = 'options';
|
||||
if (!$this->isGeoLiteCityAvailable()) {
|
||||
$this->displayWarning($this->l('In order to use Geolocation, please download').'
|
||||
<a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz">'.$this->l('this file').'</a> '.
|
||||
$this->l('and extract it (using Winrar or Gzip) into the /tools/geoip/ directory.'));
|
||||
$this->displayWarning($this->l('In order to use Geolocation, please download the file').'
|
||||
<a href="https://github.com/mbcc2006/GeoLiteCity-data/blob/master/GeoLiteCity.dat" target="_blank">GeoLiteCity.dat</a> '.
|
||||
$this->l('from GitHub and copy into the /tools/geoip/ directory.'));
|
||||
Configuration::updateValue('PS_GEOLOCATION_ENABLED', 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class AdminOrderPreferencesControllerCore extends AdminController
|
||||
),
|
||||
'GLOBAL_PREPARATION_TIME' => array(
|
||||
'title' => $this->l('Preparation time'),
|
||||
'hint' => $this->l('Number of days required to prepare a room for stay.'),
|
||||
'hint' => $this->l('Number of days required to prepare a room for a guest\'s stay. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'),
|
||||
'desc' => $this->l('Set to 0 to disable this feature.'),
|
||||
'type' => 'text',
|
||||
'class' => 'fixed-width-xl',
|
||||
|
||||
@@ -2695,10 +2695,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->context->cart = $cart;
|
||||
$this->context->customer = new Customer($order->id_customer);
|
||||
|
||||
if ($order->with_occupancy) {
|
||||
$objRoomType = new HotelRoomType();
|
||||
$roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($id_product);
|
||||
}
|
||||
/*By Webkul to make entries in HotelCartBookingData */
|
||||
$hotel_room_info_arr = $hotel_room_data['rm_data'][$idProduct]['data']['available'];
|
||||
$chkQty = 0;
|
||||
@@ -2724,8 +2720,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$objCartBookingData->children = $room_occupancy['children'];
|
||||
$objCartBookingData->child_ages = $room_occupancy['children'] ? json_encode($room_occupancy['child_ages']) : json_encode(array());
|
||||
} else {
|
||||
$objCartBookingData->adults = $roomTypeInfo['adults'];
|
||||
$objCartBookingData->children = $roomTypeInfo['children'];
|
||||
$objCartBookingData->adults = $room_info_by_id_product['adults'];
|
||||
$objCartBookingData->children = $room_info_by_id_product['children'];
|
||||
$objCartBookingData->child_ages = json_encode(array());
|
||||
}
|
||||
$objCartBookingData->save();
|
||||
@@ -3247,10 +3243,12 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$product_quantity = (int) $obj_booking_detail->getNumberOfDays($new_date_from, $new_date_to);
|
||||
$old_product_quantity = (int) $obj_booking_detail->getNumberOfDays($old_date_from, $old_date_to);
|
||||
$qty_diff = $product_quantity - $old_product_quantity;
|
||||
$occupancy = array_shift(Tools::getValue('occupancy'));
|
||||
$adults = $occupancy['adults'];
|
||||
$children = $occupancy['children'];
|
||||
$child_ages = $occupancy['child_ages'];
|
||||
if ($order->with_occupancy) {
|
||||
$occupancy = array_shift(Tools::getValue('occupancy'));
|
||||
$adults = $occupancy['adults'];
|
||||
$children = $occupancy['children'];
|
||||
$child_ages = $occupancy['child_ages'];
|
||||
}
|
||||
|
||||
/*By webkul to validate fields before deleting the cart and order data form the tables*/
|
||||
if ($id_hotel == '') {
|
||||
@@ -3308,30 +3306,36 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity.'),
|
||||
)));
|
||||
} elseif (!isset($adults) || !$adults || !Validate::isUnsignedInt($adults)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid number of adults.'),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($children)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid number of children.'),
|
||||
)));
|
||||
}
|
||||
if ($children > 0) {
|
||||
if (!isset($child_ages) || ($children != count($child_ages))) {
|
||||
|
||||
// validations if order is with occupancy
|
||||
if ($order->with_occupancy) {
|
||||
if (!isset($adults) || !$adults || !Validate::isUnsignedInt($adults)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please provide all children age.'),
|
||||
'error' => Tools::displayError('Invalid number of adults.'),
|
||||
)));
|
||||
} else {
|
||||
foreach($child_ages as $childAge) {
|
||||
if (!Validate::isUnsignedInt($childAge)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid children age.'),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($children)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid number of children.'),
|
||||
)));
|
||||
}
|
||||
|
||||
if ($children > 0) {
|
||||
if (!isset($child_ages) || ($children != count($child_ages))) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please provide all children age.'),
|
||||
)));
|
||||
} else {
|
||||
foreach($child_ages as $childAge) {
|
||||
if (!Validate::isUnsignedInt($childAge)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid children age.'),
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
if (!$distinct_products) {
|
||||
return '0%';
|
||||
}
|
||||
return round(100 * $distinct_products / AdminStatsController::getTotalProducts()).'%';
|
||||
return round(100 * $distinct_products / AdminStatsController::getTotalRoomTypes()).'%';
|
||||
}
|
||||
|
||||
public static function getOrders($date_from, $date_to, $granularity = false, $id_hotel = false)
|
||||
@@ -354,7 +354,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
public static function getCustomerMainGender()
|
||||
{
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT SUM(IF(g.id_gender IS NOT NULL, 1, 0)) as total, SUM(IF(type = 0, 1, 0)) as male, SUM(IF(type = 1, 1, 0)) as female, SUM(IF(type = 2, 1, 0)) as neutral
|
||||
SELECT SUM(IF(c.id_gender IS NOT NULL, 1, 0)) as total, SUM(IF(type = 0, 1, 0)) as male, SUM(IF(type = 1, 1, 0)) as female, SUM(IF(type = 2, 1, 0)) as neutral
|
||||
FROM `'._DB_PREFIX_.'customer` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'gender` g ON c.id_gender = g.id_gender
|
||||
WHERE c.active = 1 '.Shop::addSqlRestriction());
|
||||
@@ -1176,9 +1176,10 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
|
||||
public static function getArrivalsInfoByDate($date, $idHotel = null)
|
||||
{
|
||||
$sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
$sql = 'SELECT hbd.*, o.`with_occupancy`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
WHERE hbd.`is_refunded` = 0 AND hbd.`date_from` = "'.pSQL($date).' 00:00:00"
|
||||
AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_IN.'
|
||||
@@ -1191,9 +1192,10 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
|
||||
public static function getDeparturesInfoByDate($date, $idHotel = null)
|
||||
{
|
||||
$sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
$sql = 'SELECT hbd.*, o.`with_occupancy`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
WHERE hbd.`is_refunded` = 0 AND hbd.`date_to` = "'.pSQL($date).' 00:00:00"
|
||||
AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.
|
||||
@@ -1205,9 +1207,10 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
|
||||
public static function getInHousesInfo($idHotel = null)
|
||||
{
|
||||
$sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
$sql = 'SELECT hbd.*, o.`with_occupancy`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
WHERE hbd.`is_refunded` = 0 AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
|
||||
@@ -1220,7 +1223,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
{
|
||||
$sql = 'SELECT hbd.`id_customer`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
COUNT(hbd.`id`) AS total_rooms, SUM(hbd.`adults` + hbd.`children`) AS total_guests,
|
||||
hbd.`id_hotel`, hbd.`hotel_name`, hbd.`id_order`, o.`total_paid_tax_excl`, o.`id_currency`, osl.`name` AS `state_name`
|
||||
hbd.`id_hotel`, hbd.`hotel_name`, hbd.`id_order`, o.`with_occupancy`, o.`total_paid_tax_excl`, o.`id_currency`, osl.`name` AS `state_name`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl
|
||||
@@ -1237,8 +1240,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
public static function getCancellationsInfoByDate($date, $idHotel = null)
|
||||
{
|
||||
$sql = 'SELECT orr.`id_order_return`, orr.`id_customer`, hbd.`room_num`, hbd.`id_product`, hbd.`room_type_name`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
hbd.`id_hotel`, hbd.`hotel_name`, SUM(hbd.`adults` + hbd.`children`) AS total_guests,
|
||||
o.`with_occupancy`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, hbd.`id_hotel`,
|
||||
hbd.`hotel_name`, SUM(hbd.`adults` + hbd.`children`) AS total_guests,
|
||||
hbd.`date_from`, hbd.`date_to`, orr.`id_order`
|
||||
FROM `'._DB_PREFIX_.'order_return` orr
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (ord.`id_order_return` = orr.`id_order_return`)
|
||||
@@ -1665,9 +1668,10 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
$dateTo = date('Y-m-d', strtotime('+1 day', strtotime($dateTo)));
|
||||
}
|
||||
|
||||
$sql = 'SELECT SUM(total_paid_tax_excl)
|
||||
$sql = 'SELECT SUM(total_paid_tax_excl - refunded_amount)
|
||||
FROM (
|
||||
SELECT o.`id_order`, o.`total_paid_tax_excl` / o.`conversion_rate` AS total_paid_tax_excl,
|
||||
IFNULL(orr.`refunded_amount`, 0) AS refunded_amount,
|
||||
(SELECT hbd.`id_hotel`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`id_order` = o.`id_order` LIMIT 1
|
||||
@@ -1677,6 +1681,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
ON (hbd.`id_order` = o.`id_order`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_branch_info` hbi
|
||||
ON (hbi.`id` = hbd.`id_hotel`)
|
||||
LEFT JOIN `' ._DB_PREFIX_.'order_return` orr
|
||||
ON (orr.`id_order` = o.`id_order`)
|
||||
WHERE o.`valid` = 1 AND hbi.`active` = 1 AND hbd.`is_refunded` = 0
|
||||
AND o.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"
|
||||
AND o.`source` = "'.pSQL(Configuration::get('PS_SHOP_DOMAIN')).'"'.
|
||||
|
||||
@@ -716,8 +716,6 @@ class AdminThemesControllerCore extends AdminController
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
parent::initPageHeaderToolbar();
|
||||
|
||||
if (empty($this->display)) {
|
||||
$this->page_header_toolbar_btn['import_theme'] = array(
|
||||
'href' => self::$currentIndex.'&action=importtheme&token='.$this->token,
|
||||
@@ -746,6 +744,8 @@ class AdminThemesControllerCore extends AdminController
|
||||
|
||||
$title = implode(' '.Configuration::get('PS_NAVIGATION_PIPE').' ', $this->toolbar_title);
|
||||
$this->page_header_toolbar_title = $title;
|
||||
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
private function checkParentClass($name)
|
||||
|
||||
@@ -170,6 +170,8 @@ class AuthControllerCore extends FrontController
|
||||
'informations' => $this->informations,
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors,
|
||||
'hasAjaxExtraData' => !empty($this->ajaxExtraData),
|
||||
'ajaxExtraData' => $this->ajaxExtraData,
|
||||
'page' => $this->context->smarty->fetch($this->template),
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
@@ -416,309 +418,314 @@ class AuthControllerCore extends FrontController
|
||||
if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email)) {
|
||||
if (Customer::customerExists($email)) {
|
||||
$this->errors[] = Tools::displayError('An account using this email address has already been registered.', false);
|
||||
} elseif (Customer::customerExists($email, false, false)) {
|
||||
$this->errors[] = Tools::displayError('You are already registered as a guest with this email address.').' <button type="submit" class="btn btn-link alert-link btn-transform" name="submitTransformAccount">'.Tools::displayError('Click here').'</button>'.Tools::displayError('').' to generate a password for your account.';
|
||||
}
|
||||
}
|
||||
// Preparing customer
|
||||
$customer = new Customer();
|
||||
$lastnameAddress = Tools::getValue('lastname');
|
||||
$firstnameAddress = Tools::getValue('firstname');
|
||||
$_POST['lastname'] = Tools::getValue('customer_lastname', $lastnameAddress);
|
||||
$_POST['firstname'] = Tools::getValue('customer_firstname', $firstnameAddress);
|
||||
$addresses_types = array('address');
|
||||
|
||||
if (!Configuration::get('PS_ORDER_PROCESS_TYPE') && Configuration::get('PS_GUEST_CHECKOUT_ENABLED') && Tools::getValue('invoice_address')) {
|
||||
$addresses_types[] = 'address_invoice';
|
||||
}
|
||||
|
||||
$error_phone = false;
|
||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) {
|
||||
if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) {
|
||||
if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) {
|
||||
$error_phone = true;
|
||||
}
|
||||
} elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE'))
|
||||
|| (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create'))
|
||||
|| (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Tools::getValue('email_create')))
|
||||
&& (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) {
|
||||
$error_phone = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error_phone) {
|
||||
$this->errors[] = Tools::displayError('You must register at least one phone number.');
|
||||
}
|
||||
|
||||
// if PS_CUSTOMER_ADDRESS_CREATION is disabled And customer has no addresses then create customer address
|
||||
// with the details of first hotel which rooms he has in cart
|
||||
if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION')
|
||||
&& isset($this->context->cart->id)
|
||||
&& $this->context->cart->id
|
||||
) {
|
||||
if (Module::isInstalled('hotelreservationsystem')) {
|
||||
include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
|
||||
$objHtlCart = new HotelCartBookingData();
|
||||
if ($htlCartInfo = $objHtlCart->getCartCurrentDataByCartId($this->context->cart->id)) {
|
||||
if (isset($htlCartInfo[0]['id_hotel']) && ($idHotel = $htlCartInfo[0]['id_hotel'])) {
|
||||
if ($address_info = HotelBranchInformation::getAddress($idHotel)) {
|
||||
$_POST['lastname'] = Tools::getValue('customer_lastname');
|
||||
$_POST['firstname'] = Tools::getValue('customer_firstname');
|
||||
$_POST['address1'] = $address_info['address1'];
|
||||
$_POST['city'] = $address_info['city'];
|
||||
$_POST['postcode'] = $address_info['postcode'];
|
||||
$_POST['alias'] = 'My address';
|
||||
$_POST['id_country'] = $address_info['id_country'];
|
||||
$_POST['id_state'] = $address_info['id_state'];
|
||||
$_POST['auto_generated'] = true;
|
||||
// if form is shorter then address name will be customer name
|
||||
$lastnameAddress = $_POST['lastname'];
|
||||
$firstnameAddress = $_POST['firstname'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// End
|
||||
$this->errors = array_unique(array_merge($this->errors, $customer->validateController()));
|
||||
|
||||
// Check the requires fields which are settings in the BO
|
||||
$this->errors = $this->errors + $customer->validateFieldsRequiredDatabase();
|
||||
|
||||
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) {
|
||||
if (!count($this->errors)) {
|
||||
|
||||
$this->processCustomerNewsletter($customer);
|
||||
|
||||
$customer->firstname = Tools::ucwords($customer->firstname);
|
||||
$customer->birthday = (empty($_POST['years']) ? '' : (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days'));
|
||||
if (!Validate::isBirthDate($customer->birthday)) {
|
||||
$this->errors[] = Tools::displayError('Invalid date of birth.');
|
||||
}
|
||||
|
||||
// New Guest customer
|
||||
$customer->is_guest = (Tools::isSubmit('is_new_customer') ? !Tools::getValue('is_new_customer', 1) : 0);
|
||||
$customer->active = 1;
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if ($customer->add()) {
|
||||
if (!$customer->is_guest) {
|
||||
if (!$this->sendConfirmationMail($customer)) {
|
||||
$this->errors[] = Tools::displayError('The email cannot be sent.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->updateContext($customer);
|
||||
|
||||
$this->context->cart->update();
|
||||
Hook::exec('actionCustomerAccountAdd', array(
|
||||
'_POST' => $_POST,
|
||||
'newCustomer' => $customer
|
||||
));
|
||||
if ($this->ajax) {
|
||||
$return = array(
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors,
|
||||
'isSaved' => true,
|
||||
'id_customer' => (int)$this->context->cookie->id_customer,
|
||||
'id_address_delivery' => $this->context->cart->id_address_delivery,
|
||||
'id_address_invoice' => $this->context->cart->id_address_invoice,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
|
||||
if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) {
|
||||
Tools::redirect(html_entity_decode($back));
|
||||
}
|
||||
|
||||
// redirection: if cart is not empty : redirection to the cart
|
||||
if (count($this->context->cart->getProducts(true)) > 0) {
|
||||
$multi = (int)Tools::getValue('multi-shipping');
|
||||
Tools::redirect('index.php?controller=order'.($multi ? '&multi-shipping='.$multi : ''));
|
||||
}
|
||||
// else : redirection to the account
|
||||
else {
|
||||
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if registration type is in one step, we save the address
|
||||
|
||||
$_POST['lastname'] = $lastnameAddress;
|
||||
$_POST['firstname'] = $firstnameAddress;
|
||||
$post_back = $_POST;
|
||||
// Preparing addresses
|
||||
foreach ($addresses_types as $addresses_type) {
|
||||
$$addresses_type = new Address();
|
||||
$$addresses_type->id_customer = 1;
|
||||
|
||||
if ($addresses_type == 'address_invoice') {
|
||||
foreach ($_POST as $key => &$post) {
|
||||
if ($tmp = Tools::getValue($key.'_invoice')) {
|
||||
$post = $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController()));
|
||||
if ($addresses_type == 'address_invoice') {
|
||||
$_POST = $post_back;
|
||||
}
|
||||
|
||||
if (!($country = new Country($$addresses_type->id_country)) || !Validate::isLoadedObject($country)) {
|
||||
$this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country');
|
||||
}
|
||||
|
||||
if (!$country->active) {
|
||||
$this->errors[] = Tools::displayError('This country is not active.');
|
||||
}
|
||||
|
||||
$postcode = $$addresses_type->postcode;
|
||||
/* Check zip code format */
|
||||
if ($country->zip_code_format && !$country->checkZipCode($postcode)) {
|
||||
$this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format))));
|
||||
} elseif (empty($postcode) && $country->need_zip_code) {
|
||||
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
|
||||
} elseif ($postcode && !Validate::isPostCode($postcode)) {
|
||||
$this->errors[] = Tools::displayError('The Zip / Postal code is invalid.');
|
||||
}
|
||||
|
||||
if ($country->need_identification_number) {
|
||||
if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION')) {
|
||||
$$addresses_type->dni = null;
|
||||
} elseif (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))) {
|
||||
$this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.');
|
||||
}
|
||||
} elseif (!$country->need_identification_number) {
|
||||
$$addresses_type->dni = null;
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) {
|
||||
if (!($country = new Country($$addresses_type->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country)) {
|
||||
$this->errors[] = Tools::displayError('Country is invalid');
|
||||
}
|
||||
}
|
||||
$contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0;
|
||||
$id_state = isset($$addresses_type) && is_object($$addresses_type) ? (int)$$addresses_type->id_state: 0;
|
||||
if ((Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) && $contains_state && !$id_state) {
|
||||
$this->errors[] = Tools::displayError('This country requires you to choose a State.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
|
||||
$this->errors[] = Tools::displayError('Invalid date of birth');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if (Customer::customerExists(Tools::getValue('email'))) {
|
||||
$this->errors[] = Tools::displayError('An account using this email address has already been registered. Please enter a valid password or request a new one. ', false);
|
||||
// Preparing customer
|
||||
$customer = new Customer();
|
||||
$lastnameAddress = Tools::getValue('lastname');
|
||||
$firstnameAddress = Tools::getValue('firstname');
|
||||
$_POST['lastname'] = Tools::getValue('customer_lastname', $lastnameAddress);
|
||||
$_POST['firstname'] = Tools::getValue('customer_firstname', $firstnameAddress);
|
||||
$addresses_types = array('address');
|
||||
|
||||
if (!Configuration::get('PS_ORDER_PROCESS_TYPE') && Configuration::get('PS_GUEST_CHECKOUT_ENABLED') && Tools::getValue('invoice_address')) {
|
||||
$addresses_types[] = 'address_invoice';
|
||||
}
|
||||
|
||||
$this->processCustomerNewsletter($customer);
|
||||
$error_phone = false;
|
||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) {
|
||||
if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) {
|
||||
if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) {
|
||||
$error_phone = true;
|
||||
}
|
||||
} elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE'))
|
||||
|| (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create'))
|
||||
|| (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Tools::getValue('email_create')))
|
||||
&& (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) {
|
||||
$error_phone = true;
|
||||
}
|
||||
}
|
||||
|
||||
$customer->birthday = (empty($_POST['years']) ? '' : (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days'));
|
||||
if (!Validate::isBirthDate($customer->birthday)) {
|
||||
if ($error_phone) {
|
||||
$this->errors[] = Tools::displayError('You must register at least one phone number.');
|
||||
}
|
||||
|
||||
// if PS_CUSTOMER_ADDRESS_CREATION is disabled And customer has no addresses then create customer address
|
||||
// with the details of first hotel which rooms he has in cart
|
||||
if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION')
|
||||
&& isset($this->context->cart->id)
|
||||
&& $this->context->cart->id
|
||||
) {
|
||||
if (Module::isInstalled('hotelreservationsystem')) {
|
||||
include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
|
||||
$objHtlCart = new HotelCartBookingData();
|
||||
if ($htlCartInfo = $objHtlCart->getCartCurrentDataByCartId($this->context->cart->id)) {
|
||||
if (isset($htlCartInfo[0]['id_hotel']) && ($idHotel = $htlCartInfo[0]['id_hotel'])) {
|
||||
if ($address_info = HotelBranchInformation::getAddress($idHotel)) {
|
||||
$_POST['lastname'] = Tools::getValue('customer_lastname');
|
||||
$_POST['firstname'] = Tools::getValue('customer_firstname');
|
||||
$_POST['address1'] = $address_info['address1'];
|
||||
$_POST['city'] = $address_info['city'];
|
||||
$_POST['postcode'] = $address_info['postcode'];
|
||||
$_POST['alias'] = 'My address';
|
||||
$_POST['id_country'] = $address_info['id_country'];
|
||||
$_POST['id_state'] = $address_info['id_state'];
|
||||
$_POST['auto_generated'] = true;
|
||||
// if form is shorter then address name will be customer name
|
||||
$lastnameAddress = $_POST['lastname'];
|
||||
$firstnameAddress = $_POST['firstname'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// End
|
||||
$this->errors = array_unique(array_merge($this->errors, $customer->validateController()));
|
||||
|
||||
// Check the requires fields which are settings in the BO
|
||||
$this->errors = $this->errors + $customer->validateFieldsRequiredDatabase();
|
||||
|
||||
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) {
|
||||
if (!count($this->errors)) {
|
||||
|
||||
$this->processCustomerNewsletter($customer);
|
||||
|
||||
$customer->firstname = Tools::ucwords($customer->firstname);
|
||||
$customer->birthday = (empty($_POST['years']) ? '' : (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days'));
|
||||
if (!Validate::isBirthDate($customer->birthday)) {
|
||||
$this->errors[] = Tools::displayError('Invalid date of birth.');
|
||||
}
|
||||
|
||||
// New Guest customer
|
||||
$customer->is_guest = (Tools::isSubmit('is_new_customer') ? !Tools::getValue('is_new_customer', 1) : 0);
|
||||
$customer->active = 1;
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if ($customer->add()) {
|
||||
if (!$customer->is_guest) {
|
||||
if (!$this->sendConfirmationMail($customer)) {
|
||||
$this->errors[] = Tools::displayError('The email cannot be sent.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->updateContext($customer);
|
||||
|
||||
$this->context->cart->update();
|
||||
Hook::exec('actionCustomerAccountAdd', array(
|
||||
'_POST' => $_POST,
|
||||
'newCustomer' => $customer
|
||||
));
|
||||
if ($this->ajax) {
|
||||
$return = array(
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors,
|
||||
'isSaved' => true,
|
||||
'id_customer' => (int)$this->context->cookie->id_customer,
|
||||
'id_address_delivery' => $this->context->cart->id_address_delivery,
|
||||
'id_address_invoice' => $this->context->cart->id_address_invoice,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
|
||||
if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) {
|
||||
Tools::redirect(html_entity_decode($back));
|
||||
}
|
||||
|
||||
// redirection: if cart is not empty : redirection to the cart
|
||||
if (count($this->context->cart->getProducts(true)) > 0) {
|
||||
$multi = (int)Tools::getValue('multi-shipping');
|
||||
Tools::redirect('index.php?controller=order'.($multi ? '&multi-shipping='.$multi : ''));
|
||||
}
|
||||
// else : redirection to the account
|
||||
else {
|
||||
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if registration type is in one step, we save the address
|
||||
|
||||
$_POST['lastname'] = $lastnameAddress;
|
||||
$_POST['firstname'] = $firstnameAddress;
|
||||
$post_back = $_POST;
|
||||
// Preparing addresses
|
||||
foreach ($addresses_types as $addresses_type) {
|
||||
$$addresses_type = new Address();
|
||||
$$addresses_type->id_customer = 1;
|
||||
|
||||
if ($addresses_type == 'address_invoice') {
|
||||
foreach ($_POST as $key => &$post) {
|
||||
if ($tmp = Tools::getValue($key.'_invoice')) {
|
||||
$post = $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController()));
|
||||
if ($addresses_type == 'address_invoice') {
|
||||
$_POST = $post_back;
|
||||
}
|
||||
|
||||
if (!($country = new Country($$addresses_type->id_country)) || !Validate::isLoadedObject($country)) {
|
||||
$this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country');
|
||||
}
|
||||
|
||||
if (!$country->active) {
|
||||
$this->errors[] = Tools::displayError('This country is not active.');
|
||||
}
|
||||
|
||||
$postcode = $$addresses_type->postcode;
|
||||
/* Check zip code format */
|
||||
if ($country->zip_code_format && !$country->checkZipCode($postcode)) {
|
||||
$this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format))));
|
||||
} elseif (empty($postcode) && $country->need_zip_code) {
|
||||
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
|
||||
} elseif ($postcode && !Validate::isPostCode($postcode)) {
|
||||
$this->errors[] = Tools::displayError('The Zip / Postal code is invalid.');
|
||||
}
|
||||
|
||||
if ($country->need_identification_number) {
|
||||
if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION')) {
|
||||
$$addresses_type->dni = null;
|
||||
} elseif (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))) {
|
||||
$this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.');
|
||||
}
|
||||
} elseif (!$country->need_identification_number) {
|
||||
$$addresses_type->dni = null;
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) {
|
||||
if (!($country = new Country($$addresses_type->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country)) {
|
||||
$this->errors[] = Tools::displayError('Country is invalid');
|
||||
}
|
||||
}
|
||||
$contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0;
|
||||
$id_state = isset($$addresses_type) && is_object($$addresses_type) ? (int)$$addresses_type->id_state: 0;
|
||||
if ((Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) && $contains_state && !$id_state) {
|
||||
$this->errors[] = Tools::displayError('This country requires you to choose a State.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
|
||||
$this->errors[] = Tools::displayError('Invalid date of birth');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$customer->active = 1;
|
||||
// New Guest customer
|
||||
if (Tools::isSubmit('is_new_customer')) {
|
||||
$customer->is_guest = !Tools::getValue('is_new_customer', 1);
|
||||
} else {
|
||||
$customer->is_guest = 0;
|
||||
if (Customer::customerExists(Tools::getValue('email'))) {
|
||||
$this->errors[] = Tools::displayError('An account using this email address has already been registered. Please enter a valid password or request a new one. ', false);
|
||||
}
|
||||
if (!$customer->add()) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
|
||||
} else {
|
||||
foreach ($addresses_types as $addresses_type) {
|
||||
$$addresses_type->id_customer = (int)$customer->id;
|
||||
if ($addresses_type == 'address_invoice') {
|
||||
foreach ($_POST as $key => &$post) {
|
||||
if ($tmp = Tools::getValue($key.'_invoice')) {
|
||||
$post = $tmp;
|
||||
|
||||
$this->processCustomerNewsletter($customer);
|
||||
|
||||
$customer->birthday = (empty($_POST['years']) ? '' : (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days'));
|
||||
if (!Validate::isBirthDate($customer->birthday)) {
|
||||
$this->errors[] = Tools::displayError('Invalid date of birth');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$customer->active = 1;
|
||||
// New Guest customer
|
||||
if (Tools::isSubmit('is_new_customer')) {
|
||||
$customer->is_guest = !Tools::getValue('is_new_customer', 1);
|
||||
} else {
|
||||
$customer->is_guest = 0;
|
||||
}
|
||||
if (!$customer->add()) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
|
||||
} else {
|
||||
foreach ($addresses_types as $addresses_type) {
|
||||
$$addresses_type->id_customer = (int)$customer->id;
|
||||
if ($addresses_type == 'address_invoice') {
|
||||
foreach ($_POST as $key => &$post) {
|
||||
if ($tmp = Tools::getValue($key.'_invoice')) {
|
||||
$post = $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController()));
|
||||
if ($addresses_type == 'address_invoice') {
|
||||
$_POST = $post_back;
|
||||
}
|
||||
if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$$addresses_type->add()) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your address.');
|
||||
}
|
||||
}
|
||||
if (!count($this->errors)) {
|
||||
if (!$customer->is_guest) {
|
||||
$this->context->customer = $customer;
|
||||
$customer->cleanGroups();
|
||||
// we add the guest customer in the default customer group
|
||||
$customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP')));
|
||||
if (!$this->sendConfirmationMail($customer)) {
|
||||
// webkul - we will not stop process on email delivery fails
|
||||
//$this->errors[] = Tools::displayError('The email cannot be sent.');
|
||||
$this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController()));
|
||||
if ($addresses_type == 'address_invoice') {
|
||||
$_POST = $post_back;
|
||||
}
|
||||
if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$$addresses_type->add()) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your address.');
|
||||
}
|
||||
} else {
|
||||
$customer->cleanGroups();
|
||||
// we add the guest customer in the guest customer group
|
||||
$customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP')));
|
||||
}
|
||||
$this->updateContext($customer);
|
||||
$this->context->cart->id_address_delivery = (int)Address::getFirstCustomerAddressId((int)$customer->id);
|
||||
$this->context->cart->id_address_invoice = (int)Address::getFirstCustomerAddressId((int)$customer->id);
|
||||
if (isset($address_invoice) && Validate::isLoadedObject($address_invoice)) {
|
||||
$this->context->cart->id_address_invoice = (int)$address_invoice->id;
|
||||
}
|
||||
if (!count($this->errors)) {
|
||||
if (!$customer->is_guest) {
|
||||
$this->context->customer = $customer;
|
||||
$customer->cleanGroups();
|
||||
// we add the guest customer in the default customer group
|
||||
$customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP')));
|
||||
if (!$this->sendConfirmationMail($customer)) {
|
||||
// webkul - we will not stop process on email delivery fails
|
||||
//$this->errors[] = Tools::displayError('The email cannot be sent.');
|
||||
}
|
||||
} else {
|
||||
$customer->cleanGroups();
|
||||
// we add the guest customer in the guest customer group
|
||||
$customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP')));
|
||||
}
|
||||
$this->updateContext($customer);
|
||||
$this->context->cart->id_address_delivery = (int)Address::getFirstCustomerAddressId((int)$customer->id);
|
||||
$this->context->cart->id_address_invoice = (int)Address::getFirstCustomerAddressId((int)$customer->id);
|
||||
if (isset($address_invoice) && Validate::isLoadedObject($address_invoice)) {
|
||||
$this->context->cart->id_address_invoice = (int)$address_invoice->id;
|
||||
}
|
||||
|
||||
if ($this->ajax && Configuration::get('PS_ORDER_PROCESS_TYPE')) {
|
||||
$delivery_option = array((int)$this->context->cart->id_address_delivery => (int)$this->context->cart->id_carrier.',');
|
||||
$this->context->cart->setDeliveryOption($delivery_option);
|
||||
}
|
||||
if ($this->ajax && Configuration::get('PS_ORDER_PROCESS_TYPE')) {
|
||||
$delivery_option = array((int)$this->context->cart->id_address_delivery => (int)$this->context->cart->id_carrier.',');
|
||||
$this->context->cart->setDeliveryOption($delivery_option);
|
||||
}
|
||||
|
||||
// If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated
|
||||
$this->context->cart->update();
|
||||
// If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated
|
||||
$this->context->cart->update();
|
||||
|
||||
// Avoid articles without delivery address on the cart
|
||||
$this->context->cart->autosetProductAddress();
|
||||
// Avoid articles without delivery address on the cart
|
||||
$this->context->cart->autosetProductAddress();
|
||||
|
||||
Hook::exec('actionCustomerAccountAdd', array(
|
||||
'_POST' => $_POST,
|
||||
'newCustomer' => $customer
|
||||
));
|
||||
if ($this->ajax) {
|
||||
$return = array(
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors,
|
||||
'isSaved' => true,
|
||||
'id_customer' => (int)$this->context->cookie->id_customer,
|
||||
'id_address_delivery' => $this->context->cart->id_address_delivery,
|
||||
'id_address_invoice' => $this->context->cart->id_address_invoice,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
// if registration type is in two steps, we redirect to register address
|
||||
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) {
|
||||
Tools::redirect('index.php?controller=address');
|
||||
}
|
||||
Hook::exec('actionCustomerAccountAdd', array(
|
||||
'_POST' => $_POST,
|
||||
'newCustomer' => $customer
|
||||
));
|
||||
if ($this->ajax) {
|
||||
$return = array(
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors,
|
||||
'isSaved' => true,
|
||||
'id_customer' => (int)$this->context->cookie->id_customer,
|
||||
'id_address_delivery' => $this->context->cart->id_address_delivery,
|
||||
'id_address_invoice' => $this->context->cart->id_address_invoice,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
// if registration type is in two steps, we redirect to register address
|
||||
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) {
|
||||
Tools::redirect('index.php?controller=address');
|
||||
}
|
||||
|
||||
if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) {
|
||||
Tools::redirect(html_entity_decode($back));
|
||||
}
|
||||
if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) {
|
||||
Tools::redirect(html_entity_decode($back));
|
||||
}
|
||||
|
||||
// redirection: if cart is not empty : redirection to the cart
|
||||
if (count($this->context->cart->getProducts(true)) > 0) {
|
||||
Tools::redirect('index.php?controller=order'.($multi = (int)Tools::getValue('multi-shipping') ? '&multi-shipping='.$multi : ''));
|
||||
}
|
||||
// else : redirection to the account
|
||||
else {
|
||||
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
|
||||
// redirection: if cart is not empty : redirection to the cart
|
||||
if (count($this->context->cart->getProducts(true)) > 0) {
|
||||
Tools::redirect('index.php?controller=order'.($multi = (int)Tools::getValue('multi-shipping') ? '&multi-shipping='.$multi : ''));
|
||||
}
|
||||
// else : redirection to the account
|
||||
else {
|
||||
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -772,12 +779,21 @@ class AuthControllerCore extends FrontController
|
||||
*/
|
||||
protected function processTransformAccount()
|
||||
{
|
||||
if (!Validate::isEmail($email = trim(Tools::getValue('email_create'))) || empty($email)) {
|
||||
if (!Validate::isEmail($email = trim(Tools::getValue('email_create', Tools::getValue('email')))) || empty($email)) {
|
||||
$this->errors[] = Tools::displayError('Invalid email address.');
|
||||
} elseif ($id_customer = Customer::customerExists($email, true, false)) {
|
||||
$customer = new Customer($id_customer);
|
||||
if ($customer->transformToCustomer($this->context->language->id)) {
|
||||
$this->confirmations[] = 'TRANSFORM_OK';
|
||||
|
||||
$back = '';
|
||||
if ($back == Tools::secureReferrer(Tools::getValue('back'))) {
|
||||
$back = html_entity_decode($back);
|
||||
} else {
|
||||
$back = Tools::safeOutput($back);
|
||||
}
|
||||
$this->ajaxExtraData['redirect_link'] = $this->context->link->getPageLink('authentication').
|
||||
($back ? '?back='.$back.'&' : '?').'guest_transform_success=1';
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Your guest account could not be transformed to a customer account.');
|
||||
}
|
||||
|
||||
@@ -163,110 +163,117 @@ class OrderDetailControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('Order ID required');
|
||||
} else {
|
||||
$order = new Order($id_order);
|
||||
// Here handle request from the ajax on order details page i.e refund, additional qty etc
|
||||
$method = Tools::getValue('method');
|
||||
// extra demands popup ajax
|
||||
if ($method == 'getRoomTypeBookingDemands') {
|
||||
$response = array('reload' => false);
|
||||
if (($idProduct = Tools::getValue('id_product'))
|
||||
&& ($idOrder = Tools::getValue('id_order'))
|
||||
&& ($dateFrom = Tools::getValue('date_from'))
|
||||
&& ($dateTo = Tools::getValue('date_to'))
|
||||
) {
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$useTax = 0;
|
||||
$customer = Context::getContext()->customer;
|
||||
if (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC) {
|
||||
$useTax = 1;
|
||||
}
|
||||
if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$idProduct,
|
||||
0,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
1,
|
||||
0,
|
||||
$useTax
|
||||
)) {
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) {
|
||||
// Here handle request from the ajax on order details page i.e refund, additional qty etc
|
||||
$method = Tools::getValue('method');
|
||||
// extra demands popup ajax
|
||||
if ($method == 'getRoomTypeBookingDemands') {
|
||||
$response = array('reload' => false);
|
||||
if (($idProduct = Tools::getValue('id_product'))
|
||||
&& ($idOrder = Tools::getValue('id_order'))
|
||||
&& ($dateFrom = Tools::getValue('date_from'))
|
||||
&& ($dateTo = Tools::getValue('date_to'))
|
||||
) {
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$useTax = 0;
|
||||
$customer = Context::getContext()->customer;
|
||||
if (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC) {
|
||||
$useTax = 1;
|
||||
}
|
||||
if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$idProduct,
|
||||
0,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
1,
|
||||
0,
|
||||
$useTax
|
||||
)) {
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'useTax' => $useTax,
|
||||
'extraDemands' => $extraDemands,
|
||||
)
|
||||
);
|
||||
}
|
||||
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
|
||||
if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
|
||||
$idOrder,
|
||||
0,
|
||||
0,
|
||||
$idProduct,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
0,
|
||||
0,
|
||||
$useTax
|
||||
)) {
|
||||
$this->context->smarty->assign(array(
|
||||
'useTax' => $useTax,
|
||||
'extraDemands' => $extraDemands,
|
||||
)
|
||||
);
|
||||
'additionalServices' => $additionalServices,
|
||||
));
|
||||
}
|
||||
$response['extra_demands'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order_booking_demands.tpl');
|
||||
}
|
||||
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
|
||||
if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
|
||||
$idOrder,
|
||||
0,
|
||||
0,
|
||||
$idProduct,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
0,
|
||||
0,
|
||||
$useTax
|
||||
)) {
|
||||
$this->context->smarty->assign(array(
|
||||
'useTax' => $useTax,
|
||||
'additionalServices' => $additionalServices,
|
||||
));
|
||||
}
|
||||
$response['extra_demands'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order_booking_demands.tpl');
|
||||
}
|
||||
|
||||
die(json_encode($response));
|
||||
} elseif ($method == 'submitRefundRequest') { // room cancellation ajax
|
||||
$hasError = 0;
|
||||
if (!$refundReason = Tools::getValue('cancellation_reason')) {
|
||||
$hasError = 1;
|
||||
} elseif (!Validate::isCleanHtml($refundReason)) {
|
||||
$hasError = 1;
|
||||
}
|
||||
if ($bookingRefunds = Tools::getValue('bookings_to_refund')) {
|
||||
if (!count($bookingRefunds = json_decode($bookingRefunds, true))) {
|
||||
die(json_encode($response));
|
||||
} elseif ($method == 'submitRefundRequest') { // room cancellation ajax
|
||||
$hasError = 0;
|
||||
if (!$refundReason = Tools::getValue('cancellation_reason')) {
|
||||
$hasError = 1;
|
||||
} else {
|
||||
foreach ($bookingRefunds as $idHtlBooking) {
|
||||
if (OrderReturn::getOrdersReturnDetail($order->id, 0, $idHtlBooking)) {
|
||||
$hasError = 1;
|
||||
break;
|
||||
} elseif (!Validate::isCleanHtml($refundReason)) {
|
||||
$hasError = 1;
|
||||
}
|
||||
if ($bookingRefunds = Tools::getValue('bookings_to_refund')) {
|
||||
if (!count($bookingRefunds = json_decode($bookingRefunds, true))) {
|
||||
$hasError = 1;
|
||||
} else {
|
||||
foreach ($bookingRefunds as $idHtlBooking) {
|
||||
$objHotelBookingDetail = new HotelBookingDetail($idHtlBooking);
|
||||
if ($objHotelBookingDetail->id_customer == $order->id_customer
|
||||
|| OrderReturn::getOrdersReturnDetail($order->id, 0, $idHtlBooking)
|
||||
) {
|
||||
$hasError = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$hasError = 1;
|
||||
}
|
||||
} else {
|
||||
$hasError = 1;
|
||||
}
|
||||
if (!$hasError) {
|
||||
$objOrderReturn = new OrderReturn();
|
||||
$objOrderReturn->id_customer = $order->id_customer;
|
||||
$objOrderReturn->id_order = $order->id;
|
||||
$objOrderReturn->state = 0;
|
||||
$objOrderReturn->by_admin = 0;
|
||||
$objOrderReturn->question = $refundReason;
|
||||
$objOrderReturn->save();
|
||||
if ($objOrderReturn->id) {
|
||||
foreach ($bookingRefunds as $idHtlBooking) {
|
||||
$objHtlBooking = new HotelBookingDetail($idHtlBooking);
|
||||
$numDays = $objHtlBooking->getNumberOfDays(
|
||||
$objHtlBooking->date_from,
|
||||
$objHtlBooking->date_to
|
||||
);
|
||||
if (!$hasError) {
|
||||
$objOrderReturn = new OrderReturn();
|
||||
$objOrderReturn->id_customer = $order->id_customer;
|
||||
$objOrderReturn->id_order = $order->id;
|
||||
$objOrderReturn->state = 0;
|
||||
$objOrderReturn->by_admin = 0;
|
||||
$objOrderReturn->question = $refundReason;
|
||||
$objOrderReturn->save();
|
||||
if ($objOrderReturn->id) {
|
||||
foreach ($bookingRefunds as $idHtlBooking) {
|
||||
$objHtlBooking = new HotelBookingDetail($idHtlBooking);
|
||||
$numDays = $objHtlBooking->getNumberOfDays(
|
||||
$objHtlBooking->date_from,
|
||||
$objHtlBooking->date_to
|
||||
);
|
||||
|
||||
$objOrderReturnDetail = new OrderReturnDetail();
|
||||
$objOrderReturnDetail->id_order_return = $objOrderReturn->id;
|
||||
$objOrderReturnDetail->id_order_detail = $objHtlBooking->id_order_detail;
|
||||
$objOrderReturnDetail->product_quantity = $numDays;
|
||||
$objOrderReturnDetail->id_htl_booking = $idHtlBooking;
|
||||
$objOrderReturnDetail->save();
|
||||
$objOrderReturnDetail = new OrderReturnDetail();
|
||||
$objOrderReturnDetail->id_order_return = $objOrderReturn->id;
|
||||
$objOrderReturnDetail->id_order_detail = $objHtlBooking->id_order_detail;
|
||||
$objOrderReturnDetail->product_quantity = $numDays;
|
||||
$objOrderReturnDetail->id_htl_booking = $idHtlBooking;
|
||||
$objOrderReturnDetail->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Emails to customer, admin on refund request state change
|
||||
$objOrderReturn->changeIdOrderReturnState(Configuration::get('PS_ORS_PENDING'));
|
||||
// Emails to customer, admin on refund request state change
|
||||
$objOrderReturn->changeIdOrderReturnState(Configuration::get('PS_ORS_PENDING'));
|
||||
|
||||
die(json_encode(array('status' => 1)));
|
||||
die(json_encode(array('status' => 1)));
|
||||
}
|
||||
die(json_encode(array('status' => 0)));
|
||||
}
|
||||
} else {
|
||||
die(json_encode(array('status' => 0)));
|
||||
}
|
||||
// END ajax request handle
|
||||
|
||||
@@ -114,6 +114,10 @@ class ProductControllerCore extends FrontController
|
||||
$this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
|
||||
}
|
||||
|
||||
if (!$this->product->booking_product) {
|
||||
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($this->product)) {
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
header('Status: 404 Not Found');
|
||||
@@ -192,12 +196,6 @@ class ProductControllerCore extends FrontController
|
||||
$this->context->cookie->last_visited_category = (int)$this->category->id_category;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->product->booking_product) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
header('Status: 403 Forbidden');
|
||||
$this->errors[] = Tools::displayError('You do not have access to this Product.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,11 +355,12 @@ class ProductControllerCore extends FrontController
|
||||
// booking preparation time
|
||||
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id);
|
||||
|
||||
$objHotelImage = new HotelImage();
|
||||
$hotelImageLink = null;
|
||||
if ($coverImage = HotelImage::getCover($hotel_id)) {
|
||||
$hotelImagesBaseDir = _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_img/';
|
||||
$hotelImageLink = $this->context->link->getMediaLink(
|
||||
$hotelImagesBaseDir.$coverImage['hotel_image_id'].'.jpg'
|
||||
$objHotelImage->getImageLink($coverImage['id'], ImageType::getFormatedName('large'))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -603,6 +602,7 @@ class ProductControllerCore extends FrontController
|
||||
$quantity = 1;
|
||||
}
|
||||
|
||||
$totalAvailableRooms = 0;
|
||||
if ($hotelRoomData = $objBookingDetail->DataForFrontSearch($bookingParams)) {
|
||||
$totalAvailableRooms = $hotelRoomData['stats']['num_avail'];
|
||||
$quantity = ($quantity > $totalAvailableRooms) ? $totalAvailableRooms : $quantity;
|
||||
@@ -1244,7 +1244,8 @@ class ProductControllerCore extends FrontController
|
||||
$hotelImagesBaseDir = _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_img/';
|
||||
foreach ($hotelImages as &$hotelImage) {
|
||||
$hotelImage['link'] = $this->context->link->getMediaLink(
|
||||
$hotelImagesBaseDir.$hotelImage['hotel_image_id'].'.jpg'
|
||||
$objHotelImage->getImageLink($hotelImage['id'],
|
||||
ImageType::getFormatedName('large'))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1318,12 +1319,13 @@ class ProductControllerCore extends FrontController
|
||||
public function displayAjaxCheckServiceProductWithRoomType()
|
||||
{
|
||||
$response = array(
|
||||
'status' => false
|
||||
'success' => false
|
||||
);
|
||||
|
||||
if ($this->isTokenValid()) {
|
||||
$idProduct = Tools::getValue('id_product');
|
||||
$idServiceProduct = Tools::getValue('service_product');
|
||||
$addedServiceProduct = Tools::getValue('added_service_product');
|
||||
if (Validate::isLoadedObject($objProduct = new Product($idProduct))) {
|
||||
if (!Product::isBookingProduct($idProduct)) {
|
||||
$response['error'] = Tools::displayError('Room Type info not Found');
|
||||
@@ -1334,7 +1336,22 @@ class ProductControllerCore extends FrontController
|
||||
if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($idProduct, $idServiceProduct)) {
|
||||
$response['error'] = Tools::displayError('Selected product is not available with current room type');
|
||||
} else {
|
||||
$response['status'] = true;
|
||||
if (Validate::isLoadedObject($objServiceProduct = new Product($idServiceProduct))) {
|
||||
$response['success'] = true;
|
||||
if (!$objServiceProduct->allow_multiple_quantity && !empty($addedServiceProduct)) {
|
||||
if (!in_array($idServiceProduct, array_column($addedServiceProduct, 'id_product'))) {
|
||||
$response['add'] = true;
|
||||
$response['msg'] = 'Service is added to cart.';
|
||||
} else {
|
||||
$response['msg'] = 'Service already added.';
|
||||
}
|
||||
} else {
|
||||
$response['add'] = true;
|
||||
$response['msg'] = 'Service is added to cart.';
|
||||
}
|
||||
} else {
|
||||
$response['error'] = Tools::displayError('Service not Found');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$response['error'] = Tools::displayError('Room Type not Found');
|
||||
|
||||
@@ -686,6 +686,24 @@
|
||||
<configuration id="ROOM_TYPE_CHECKUP_TOTAL_ROOMS_GT" name="ROOM_TYPE_CHECKUP_TOTAL_ROOMS_GT">
|
||||
<value>3</value>
|
||||
</configuration>
|
||||
<configuration id="SERVICE_CHECKUP_DESCRIPTIONS_SHORT_LT" name="SERVICE_CHECKUP_DESCRIPTIONS_SHORT_LT">
|
||||
<value>50</value>
|
||||
</configuration>
|
||||
<configuration id="SERVICE_CHECKUP_DESCRIPTIONS_SHORT_GT" name="SERVICE_CHECKUP_DESCRIPTIONS_GT">
|
||||
<value>150</value>
|
||||
</configuration>
|
||||
<configuration id="SERVICE_CHECKUP_IMAGES_LT" name="SERVICE_CHECKUP_IMAGES_LT">
|
||||
<value>1</value>
|
||||
</configuration>
|
||||
<configuration id="SERVICE_CHECKUP_IMAGES_GT" name="SERVICE_CHECKUP_IMAGES_GT">
|
||||
<value>2</value>
|
||||
</configuration>
|
||||
<configuration id="SERVICE_CHECKUP_ORDERS_LT" name="SERVICE_CHECKUP_ORDERS_LT">
|
||||
<value>1</value>
|
||||
</configuration>
|
||||
<configuration id="SERVICE_CHECKUP_ORDERS_GT" name="SERVICE_CHECKUP_ORDERS_GT">
|
||||
<value>2</value>
|
||||
</configuration>
|
||||
<configuration id="FOOTER_CMS" name="FOOTER_CMS">
|
||||
<value>0_3|0_4</value>
|
||||
</configuration>
|
||||
|
||||
2
js/daterangepicker/moment.min.js
vendored
2
js/daterangepicker/moment.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -9501,7 +9501,6 @@ var FullCalendar = (function (exports) {
|
||||
});
|
||||
return (createElement(ContentHook, { hookProps: hookProps, content: options.dayCellContent, defaultContent: props.defaultContent }, props.children));
|
||||
};
|
||||
console.log(DayCellContent);
|
||||
return DayCellContent;
|
||||
}(BaseComponent));
|
||||
function refineDayCellHookProps(raw) {
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
<td class="linkbelow" style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<span>
|
||||
You can review this credit slip and download your invoice from the <a href="{history_url}" style="color:#337ff1">"My credit slips"</a> section of your account by clicking <a href="{my_account_url}" style="color:#337ff1">"My account"</a> on our shop. </span>
|
||||
You can review this credit slip and download your invoice from the <a href="{credit_slip_url}" style="color:#337ff1">"My credit slips"</a> section of your account by clicking <a href="{my_account_url}" style="color:#337ff1">"My account"</a> on our shop. </span>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -7,7 +7,7 @@ We have generated a credit slip in your name for order with the
|
||||
reference {order_name}.
|
||||
|
||||
You can review this credit slip and download your invoice from the
|
||||
"My credit slips" [/{history_url}] section of your account by clicking
|
||||
"My credit slips" [/{credit_slip_url}] section of your account by clicking
|
||||
"My account" [/{my_account_url}] on our shop.
|
||||
|
||||
{shop_name} [/{shop_url}] powered by Webkul(tm)
|
||||
|
||||
@@ -26,6 +26,7 @@ function line_chart_availability(widget_name, chart_details) {
|
||||
.useInteractiveGuideline(true)
|
||||
.x(function(d) { return (d !== undefined ? d[0] : 0); })
|
||||
.y(function(d) { return (d !== undefined ? parseInt(d[1]) : 0); })
|
||||
.forceY(0)
|
||||
.margin({
|
||||
left: 30,
|
||||
right: 30,
|
||||
|
||||
@@ -170,7 +170,7 @@ class DashGuestCycle extends Module
|
||||
}
|
||||
|
||||
$tr[] = array(
|
||||
'value' => $arrivalInfo['adult'] + $arrivalInfo['children'],
|
||||
'value' => $arrivalInfo['with_occupancy'] ? ($arrivalInfo['adults'] + $arrivalInfo['children']) : '--',
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
@@ -230,7 +230,7 @@ class DashGuestCycle extends Module
|
||||
}
|
||||
|
||||
$tr[] = array(
|
||||
'value' => $departureInfo['adult'] + $departureInfo['children'],
|
||||
'value' => $departureInfo['with_occupancy'] ? ($departureInfo['adults'] + $departureInfo['children']) : '--',
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
@@ -291,7 +291,7 @@ class DashGuestCycle extends Module
|
||||
}
|
||||
|
||||
$tr[] = array(
|
||||
'value' => $inHouseInfo['adult'] + $inHouseInfo['children'],
|
||||
'value' => $inHouseInfo['with_occupancy'] ? ($inHouseInfo['adults'] + $inHouseInfo['children']) : '--',
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
@@ -357,7 +357,7 @@ class DashGuestCycle extends Module
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
'value' => $newBookingInfo['total_guests'],
|
||||
'value' => $newBookingInfo['with_occupancy'] ? $newBookingInfo['total_guests'] : '--',
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
@@ -425,7 +425,7 @@ class DashGuestCycle extends Module
|
||||
}
|
||||
|
||||
$tr[] = array(
|
||||
'value' => $cancellationInfo['total_guests'],
|
||||
'value' => $cancellationInfo['with_occupancy'] ? $cancellationInfo['total_guests'] : '--',
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-lg-3">
|
||||
<div class="stat-box label-tooltip" data-toggle="tooltip" data-original-title="{l s='Total Revenue Per Available Room (TrevPAR) measures the total revenue being generated per available room including additional facilities.' mod='dashperformance'}" data-placement="top" style="background-color: #B6FFB6;">
|
||||
<div class="stat-box label-tooltip" data-toggle="tooltip" data-original-title="{l s='Total Revenue Per Available Room (TrevPAR) measures the total revenue being generated per available room including additional facilities and service products.' mod='dashperformance'}" data-placement="top" style="background-color: #B6FFB6;">
|
||||
<div class="title-wrapper">
|
||||
<p>{l s='Total Revenue Per Available Room' mod='dashperformance'}</p>
|
||||
</div>
|
||||
|
||||
@@ -561,7 +561,7 @@ class DashProducts extends Module
|
||||
LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON pv.`id_date_range` = dr.`id_date_range`
|
||||
LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page`
|
||||
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type`
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON hrt.`id_product` = p.`id_object`
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON hrt.`id_product` = p.`id_object`
|
||||
WHERE pt.`name` = \'product\'
|
||||
'.Shop::addSqlRestriction(false, 'pv').'
|
||||
AND dr.`time_start` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"
|
||||
|
||||
@@ -471,11 +471,10 @@ class HotelReservationSystemDb
|
||||
|
||||
"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());",
|
||||
(2, 'icon-dollar', 'index.php?controller=AdminHotelFeaturePricesSettings', 0, 2, 1, 1, NOW(), NOW()),
|
||||
(3, 'icon-plus-square', 'index.php?controller=AdminRoomTypeGlobalDemand', 0, 3, 1, 1, NOW(), NOW()),
|
||||
(4, 'icon-file-text', 'index.php?controller=AdminAboutHotelBlockSetting', 0, 4, 0, 1, NOW(), NOW()),
|
||||
(5, '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,
|
||||
@@ -491,27 +490,22 @@ class HotelReservationSystemDb
|
||||
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.'
|
||||
SELECT 2, `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 3, `id_lang`, 'Advanced Price Rules', 'Here set Advanced price rules for specific dates.'
|
||||
SELECT 3, `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 4, `id_lang`, 'Additional Facilities', 'Here create Additional facilities and their prices for room types.'
|
||||
SELECT 4, `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 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.'
|
||||
SELECT 5, `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`;",
|
||||
);
|
||||
|
||||
@@ -40,11 +40,12 @@ class AdminAssignHotelFeaturesController extends ModuleAdminController
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'htl_branch_info` hi ON (hi.`id` = a.`id_hotel`)';
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hil
|
||||
ON (hi.`id` = hil.`id` AND hil.id_lang = '.(int)$this->context->language->id.')';
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_state` = hi.`state_id`)';
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = hi.`country_id`
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'address` addr ON (addr.`id_hotel` = hi.`id`)';
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_state` = addr.`id_state`)';
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = addr.`id_country`
|
||||
AND cl.`id_lang` = '.(int)$this->context->language->id.')';
|
||||
|
||||
$this->_select .= 'hi.`city` as htl_city, hi.`id` as htl_id, hil.`hotel_name` as htl_name,
|
||||
$this->_select .= 'addr.`city` as htl_city, hi.`id` as htl_id, hil.`hotel_name` as htl_name,
|
||||
s.`name` as `state_name`, cl.`name`';
|
||||
$this->_group = 'GROUP BY a.`id_hotel`';
|
||||
|
||||
@@ -57,12 +58,12 @@ class AdminAssignHotelFeaturesController extends ModuleAdminController
|
||||
'htl_name' => array(
|
||||
'title' => $this->l('Hotel Name'),
|
||||
'align' => 'center',
|
||||
'filter_key' => 'hi!hotel_name',
|
||||
'filter_key' => 'hil!hotel_name',
|
||||
),
|
||||
'htl_city' => array(
|
||||
'title' => $this->l('City'),
|
||||
'align' => 'center',
|
||||
'filter_key' => 'hi!city',
|
||||
'filter_key' => 'addr!city',
|
||||
),
|
||||
|
||||
'state_name' => array(
|
||||
|
||||
@@ -466,6 +466,19 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$bookingParams['date_from'] = $cal_date_from;
|
||||
$bookingParams['date_to'] = $cal_date_to;
|
||||
$eventData = $objBookingDetail->getBookingData($bookingParams);
|
||||
if (!$eventData) {
|
||||
$eventData['stats'] = array(
|
||||
'total_room_type' => 0,
|
||||
'total_rooms' => 0,
|
||||
'max_avail_occupancy' => 0,
|
||||
'num_unavail' => 0,
|
||||
'num_cart' => 0,
|
||||
'num_booked' => 0,
|
||||
'num_avail' => 0,
|
||||
'num_part_avai' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
$eventData['date_format'] = Tools::displayDate($cal_date_from);
|
||||
$events[strtotime($bookingParams['date_from'])] = array(
|
||||
'is_notification' => 1,
|
||||
|
||||
@@ -164,7 +164,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
}
|
||||
$this->fields_list = array(
|
||||
'id_order_return' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'title' => $this->l('Refund ID'),
|
||||
'align' => 'center',
|
||||
'class' => 'fixed-width-xs',
|
||||
),
|
||||
@@ -448,6 +448,8 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
|
||||
Hook::exec('actionOrderSlipAdd', array('order' => $objOrder, 'bookingList' => $bookingList));
|
||||
|
||||
$params['{credit_slip_url}'] = $this->context->link->getPageLink('order-slip', true);
|
||||
|
||||
@Mail::Send(
|
||||
(int)$objOrder->id_lang,
|
||||
'credit_slip',
|
||||
|
||||
@@ -411,65 +411,6 @@ $(document).ready(function() {
|
||||
$(this).parents('.child_feature_row').remove();
|
||||
});
|
||||
|
||||
/*For swaping rooms in the modal*/
|
||||
$("#realloc_allocated_rooms").on('click', function(e) {
|
||||
$(".error_text").text('');
|
||||
if ($('#realloc_avail_rooms').val() == 0) {
|
||||
$("#realloc_sel_rm_err_p").text(slct_rm_err);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$("#swap_allocated_rooms").on('click', function(e) {
|
||||
$(".error_text").text('');
|
||||
if ($('#swap_avail_rooms').val() == 0) {
|
||||
$("#swap_sel_rm_err_p").text(slct_rm_err);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#mySwappigModal').on('hidden.bs.modal', function(e) {
|
||||
$(".modal_date_from").val('');
|
||||
$(".modal_date_to").val('');
|
||||
$(".modal_id_room").val('');
|
||||
$(".modal_curr_room_num").val('');
|
||||
$(".cust_name").text('');
|
||||
$(".cust_email").text('');
|
||||
$(".swp_rm_opts").remove();
|
||||
$(".realloc_rm_opts").remove();
|
||||
});
|
||||
|
||||
$('#mySwappigModal').on('shown.bs.modal', function(e) {
|
||||
$(".modal_date_from").val(e.relatedTarget.dataset.date_from);
|
||||
$(".modal_date_to").val(e.relatedTarget.dataset.date_to);
|
||||
$(".modal_id_room").val(e.relatedTarget.dataset.id_room);
|
||||
$(".modal_curr_room_num").val(e.relatedTarget.dataset.room_num);
|
||||
$(".cust_name").text(e.relatedTarget.dataset.cust_name);
|
||||
$(".cust_email").text(e.relatedTarget.dataset.cust_email);
|
||||
html = '';
|
||||
if (e.relatedTarget.dataset.avail_rm_realloc) {
|
||||
var json_arr_rm_swp = JSON.parse(e.relatedTarget.dataset.avail_rm_swap);
|
||||
$.each(json_arr_rm_swp, function(key, val) {
|
||||
html += '<option class="swp_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
|
||||
});
|
||||
}
|
||||
if (html != '') {
|
||||
$("#swap_avail_rooms").append(html);
|
||||
}
|
||||
|
||||
html = '';
|
||||
if (e.relatedTarget.dataset.avail_rm_realloc) {
|
||||
var json_arr_rm_realloc = JSON.parse(e.relatedTarget.dataset.avail_rm_realloc);
|
||||
$.each(json_arr_rm_realloc, function(key, val) {
|
||||
html += '<option class="realloc_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
|
||||
});
|
||||
}
|
||||
if (html != '') {
|
||||
$("#realloc_avail_rooms").append(html);
|
||||
}
|
||||
});
|
||||
|
||||
/* ---- Book Now page Admin ---- */
|
||||
|
||||
/* ---- HotelConfigurationSettingController Admin ---- */
|
||||
|
||||
if ($('#WK_SHOW_MSG_ON_BO_on').prop('checked') === true) {
|
||||
|
||||
@@ -49,7 +49,7 @@ $(document).ready(function() {
|
||||
$(info.el).closest('td').find('.day-info svg circle').attr('fill', '#7EC77B');
|
||||
} else if (info.event.extendedProps.data.stats.num_part_avai > 0) {
|
||||
$(info.el).closest('td').find('.day-info svg circle').attr('fill', '#FFC224');
|
||||
} else if (info.event.extendedProps.data.stats.num_booked == info.event.extendedProps.data.stats.total_rooms) {
|
||||
} else if ((info.event.extendedProps.data.stats.num_booked == info.event.extendedProps.data.stats.total_rooms) && info.event.extendedProps.data.stats.total_rooms != 0) {
|
||||
$(info.el).closest('td').find('.day-info svg circle').attr('fill', '#00AFF0');
|
||||
} else {
|
||||
$(info.el).closest('td').find('.day-info svg circle').attr('fill', '#FF3838');
|
||||
@@ -954,4 +954,61 @@ $(document).ready(function() {
|
||||
return [true, ""];
|
||||
}
|
||||
}
|
||||
|
||||
/*For swaping rooms in the modal*/
|
||||
$("#realloc_allocated_rooms").on('click', function(e) {
|
||||
$(".error_text").text('');
|
||||
if ($('#realloc_avail_rooms').val() == 0) {
|
||||
$("#realloc_sel_rm_err_p").text(slct_rm_err);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$("#swap_allocated_rooms").on('click', function(e) {
|
||||
$(".error_text").text('');
|
||||
if ($('#swap_avail_rooms').val() == 0) {
|
||||
$("#swap_sel_rm_err_p").text(slct_rm_err);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#mySwappigModal').on('hidden.bs.modal', function(e) {
|
||||
$(".modal_date_from").val('');
|
||||
$(".modal_date_to").val('');
|
||||
$(".modal_id_room").val('');
|
||||
$(".modal_curr_room_num").val('');
|
||||
$(".cust_name").text('');
|
||||
$(".cust_email").text('');
|
||||
$(".swp_rm_opts").remove();
|
||||
$(".realloc_rm_opts").remove();
|
||||
});
|
||||
|
||||
$('#mySwappigModal').on('shown.bs.modal', function(e) {
|
||||
$(".modal_date_from").val(e.relatedTarget.dataset.date_from);
|
||||
$(".modal_date_to").val(e.relatedTarget.dataset.date_to);
|
||||
$(".modal_id_room").val(e.relatedTarget.dataset.id_room);
|
||||
$(".modal_curr_room_num").val(e.relatedTarget.dataset.room_num);
|
||||
$(".cust_name").text(e.relatedTarget.dataset.cust_name);
|
||||
$(".cust_email").text(e.relatedTarget.dataset.cust_email);
|
||||
html = '';
|
||||
if (e.relatedTarget.dataset.avail_rm_realloc) {
|
||||
var json_arr_rm_swp = JSON.parse(e.relatedTarget.dataset.avail_rm_swap);
|
||||
$.each(json_arr_rm_swp, function(key, val) {
|
||||
html += '<option class="swp_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
|
||||
});
|
||||
}
|
||||
if (html != '') {
|
||||
$("#swap_avail_rooms").append(html);
|
||||
}
|
||||
|
||||
html = '';
|
||||
if (e.relatedTarget.dataset.avail_rm_realloc) {
|
||||
var json_arr_rm_realloc = JSON.parse(e.relatedTarget.dataset.avail_rm_realloc);
|
||||
$.each(json_arr_rm_realloc, function(key, val) {
|
||||
html += '<option class="realloc_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
|
||||
});
|
||||
}
|
||||
if (html != '') {
|
||||
$("#realloc_avail_rooms").append(html);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -72,7 +72,7 @@
|
||||
<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>
|
||||
<label>{l s='Children'} <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>
|
||||
@@ -159,7 +159,7 @@
|
||||
<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>
|
||||
<label>{l s='Children'} <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>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][adults]" value="{$room_occupancy['adults']|escape:'htmlall':'UTF-8'}" min="1">
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
|
||||
<label>{l s='Children'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][children]" value="{$room_occupancy['children']|escape:'htmlall':'UTF-8'}" min="0" {if $max_child_in_room}max="{$max_child_in_room}"{/if}>
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
|
||||
</div>
|
||||
@@ -123,7 +123,7 @@
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1">
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
|
||||
<label>{l s='Children'} <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" {if $max_child_in_room}max="{$max_child_in_room}"{/if}>
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
|
||||
</div>
|
||||
@@ -218,7 +218,7 @@
|
||||
</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'}">
|
||||
<form method="post" action="">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="realloc_myModalLabel">{l s='Reallocate Rooms'}</h4>
|
||||
|
||||
@@ -641,7 +641,6 @@ class QloCleaner extends Module
|
||||
array('warehouse_carrier', 'id_carrier', 'carrier', 'id_carrier'),
|
||||
array('warehouse_product_location', 'id_product', 'product', 'id_product'),
|
||||
array('warehouse_product_location', 'id_warehouse', 'warehouse', 'id_warehouse'),
|
||||
array('product_comment', 'id_product', 'product', 'id_product'),
|
||||
array('specific_price', 'id_product', 'customer', 'id_customer'),
|
||||
array('specific_price', 'id_group', 'group', 'id_group'),
|
||||
array('htl_features_block_data_lang', 'id_features_block', 'htl_features_block_data', 'id_features_block'),
|
||||
|
||||
@@ -202,10 +202,11 @@ class StatsBestProducts extends ModuleGrid
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $id_lang .')
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
ON (hrt.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil
|
||||
ON (hbil.`id` = hrt.`id_hotel` AND hbil.`id_lang` = '.(int) $id_lang .')';
|
||||
ON (hbil.`id` = hrt.`id_hotel` AND hbil.`id_lang` = '.(int) $id_lang .')
|
||||
WHERE p.`booking_product` = 1';
|
||||
|
||||
if (Validate::IsName($this->_sort)) {
|
||||
$this->query .= ' ORDER BY `'.bqSQL($this->_sort).'`';
|
||||
|
||||
@@ -46,7 +46,7 @@ class StatsCatalog extends Module
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Catalog statistics');
|
||||
$this->displayName = $this->l('Hotel statistics');
|
||||
$this->description = $this->l('Adds a tab containing general statistics about your catalog to the Stats dashboard.');
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.7.0.99');
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class StatsCatalog extends Module
|
||||
LEFT JOIN `'._DB_PREFIX_.'page` pa ON pv.`id_page` = pa.`id_page`
|
||||
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = pa.`id_page_type`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = pa.`id_object`
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (p.`id_product` = hrt.`id_product`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (p.`id_product` = hrt.`id_product`)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
'.$this->join.'
|
||||
WHERE pt.`name` IN ("product.php", "product")
|
||||
@@ -149,7 +149,7 @@ class StatsCatalog extends Module
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = i.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
ON (hrt.`id_product` = i.`id_product`)
|
||||
WHERE hrt.`id_hotel` = hbi.`id`
|
||||
) AS room_type_images
|
||||
@@ -174,7 +174,7 @@ class StatsCatalog extends Module
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.`id_order` = od.`id_order`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = od.`product_id`
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (p.`id_product` = hrt.`id_product`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (p.`id_product` = hrt.`id_product`)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
'.$this->join.'
|
||||
WHERE o.valid = 1
|
||||
@@ -194,7 +194,7 @@ class StatsCatalog extends Module
|
||||
$sql = 'SELECT p.id_product, pl.name, pl.link_rewrite
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (p.`id_product` = hrt.`id_product`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (p.`id_product` = hrt.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = p.`id_product` AND pl.id_lang = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
'.$this->join.'
|
||||
@@ -282,12 +282,18 @@ class StatsCatalog extends Module
|
||||
<div class="row row-margin-bottom">
|
||||
<p>
|
||||
<i class="icon-asterisk"></i>'.$this->l('Defines the average conversion rate for the room type page. It is possible to book a room type without viewing the room type page, so this rate can be greater than 1.').'
|
||||
</p>';
|
||||
|
||||
$link = $this->context->link->getAdminLink('AdminModules').'&configure=statsdata';
|
||||
$html .='
|
||||
<p>
|
||||
<strong>'.$this->l('Note: ').'</strong>'.$this->l('You must enable the "Save global page views" option from ').'<a href="'.$link.'" target="_blank">Data mining for statistics</a>'.$this->l(' module for accurate data, or use the QloApps Google Analytics module.').'
|
||||
</p>
|
||||
</div>';
|
||||
|
||||
if (count($products_nb) && count($products_nb) < 50) {
|
||||
$html .= '
|
||||
<div class="panel-heading">'.$this->l('Room types never booked').'</div>
|
||||
<div class="col-sm-12"><div class="panel-heading">'.$this->l('Room types never booked').'</div></div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -91,6 +91,8 @@ class StatsCheckUp extends Module
|
||||
.$this->displayName.'
|
||||
</div>';
|
||||
|
||||
$activeTab = 'hotels';
|
||||
|
||||
if (Tools::isSubmit('submitCheckupRoomType')) {
|
||||
$confs = array(
|
||||
'ROOM_TYPE_CHECKUP_DESCRIPTIONS_LT',
|
||||
@@ -129,6 +131,25 @@ class StatsCheckUp extends Module
|
||||
$this->html .= $this->displayConfirmation($this->l('Configuration updated.'));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitCheckupService')) {
|
||||
$confs = array(
|
||||
'SERVICE_CHECKUP_DESCRIPTIONS_SHORT_LT',
|
||||
'SERVICE_CHECKUP_DESCRIPTIONS_SHORT_GT',
|
||||
'SERVICE_CHECKUP_IMAGES_LT',
|
||||
'SERVICE_CHECKUP_IMAGES_GT',
|
||||
'SERVICE_CHECKUP_ORDERS_LT',
|
||||
'SERVICE_CHECKUP_ORDERS_GT',
|
||||
);
|
||||
|
||||
foreach ($confs as $confname) {
|
||||
Configuration::updateValue($confname, (int)Tools::getValue($confname));
|
||||
}
|
||||
|
||||
$this->html .= $this->displayConfirmation($this->l('Configuration updated.'));
|
||||
|
||||
$activeTab = 'services';
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitCheckupOrder')) {
|
||||
$this->context->cookie->checkup_order = (int)Tools::getValue('submitCheckupOrder');
|
||||
$this->html .= $this->displayConfirmation($this->l('Configuration updated.'));
|
||||
@@ -142,6 +163,35 @@ class StatsCheckUp extends Module
|
||||
$this->id_hotel = (int) Tools::getValue('id_hotel');
|
||||
}
|
||||
|
||||
$this->html .= '
|
||||
<ul class="nav nav-tabs">
|
||||
<li '.($activeTab == 'hotels' ? 'class="active"' : '').'>
|
||||
<a href="#statscheckup_hotels" data-toggle="tab">
|
||||
<span>'.$this->l('Hotels').'</span>
|
||||
</a>
|
||||
</li>
|
||||
<li '.($activeTab == 'services' ? 'class="active"' : '').'>
|
||||
<a href="#statscheckup_services" data-toggle="tab">
|
||||
<span>'.$this->l('Services').'</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content panel panel-sm">
|
||||
<div class="tab-pane '.($activeTab == 'hotels' ? 'active' : '').'" id="statscheckup_hotels">
|
||||
'.$this->getHotelsTab().'
|
||||
</div>
|
||||
<div class="tab-pane '.($activeTab == 'services' ? 'active' : '').'" id="statscheckup_services">
|
||||
'.$this->getServicesTab().'
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
private function getHotelsTab()
|
||||
{
|
||||
$employee = Context::getContext()->employee;
|
||||
$prop30 = ((strtotime($employee->stats_date_to.' 23:59:59') - strtotime($employee->stats_date_from.' 00:00:00')) / 60 / 60 / 24) / 30;
|
||||
|
||||
@@ -187,7 +237,7 @@ class StatsCheckUp extends Module
|
||||
'TOTAL_ROOMS' => array('name' => $this->l('Total rooms'), 'text' => $this->l('rooms')),
|
||||
);
|
||||
|
||||
$this->html .= '
|
||||
$hotelsHtml = '
|
||||
<form action="'.Tools::safeOutput(AdminController::$currentIndex.'&token='.Tools::getValue('token').'&module='.$this->name.($this->id_hotel ? '&id_hotel='.$this->id_hotel : '')).'" method="post" class="checkup form-horizontal">
|
||||
<table class="table checkup">
|
||||
<thead>
|
||||
@@ -200,7 +250,7 @@ class StatsCheckUp extends Module
|
||||
foreach ($array_conf as $conf => $translations) {
|
||||
$confKeyLt = ($this->id_hotel ? 'ROOM_TYPE' : 'HOTEL').'_CHECKUP_'.$conf.'_LT';
|
||||
$confKeyGt = ($this->id_hotel ? 'ROOM_TYPE' : 'HOTEL').'_CHECKUP_'.$conf.'_GT';
|
||||
$this->html .= '
|
||||
$hotelsHtml .= '
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -227,7 +277,7 @@ class StatsCheckUp extends Module
|
||||
</tr>
|
||||
</tbody>';
|
||||
}
|
||||
$this->html .= '</table>
|
||||
$hotelsHtml .= '</table>
|
||||
<button type="submit" name="'.($this->id_hotel ? 'submitCheckupRoomType' : 'submitCheckupHotel').'" class="btn btn-default pull-right">
|
||||
<i class="icon-save"></i> '.$this->l('Save').'
|
||||
</button>
|
||||
@@ -251,12 +301,12 @@ class StatsCheckUp extends Module
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box active">'.$this->l('ID').'</span></th>
|
||||
<th><span class="title_box active">'.$this->l('Room type').'</span></th>
|
||||
<th><span class="title_box active">'.(!$this->id_hotel ? $this->l('Hotel') : $this->l('Room type')).'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Active').'</span></th>';
|
||||
foreach ($languages as $language) {
|
||||
$this->html .= '<th><span class="title_box active">'.$this->l('Desc.').' ('.Tools::strtoupper($language['iso_code']).')</span></th>';
|
||||
$hotelsHtml .= '<th><span class="title_box active">'.$this->l('Desc.').' ('.Tools::strtoupper($language['iso_code']).')</span></th>';
|
||||
}
|
||||
$this->html .= '
|
||||
$hotelsHtml .= '
|
||||
<th class="center"><span class="title_box active">'.$this->l('Images').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Orders').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Total rooms').'</span></th>
|
||||
@@ -280,17 +330,6 @@ class StatsCheckUp extends Module
|
||||
);
|
||||
|
||||
foreach ($result as $row) {
|
||||
$row['stock'] = 0;
|
||||
if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($row['id_product'])) {
|
||||
$bookingParams['hotel_id'] = $roomTypeInfo['id_hotel'];
|
||||
$bookingParams['id_room_type'] = $row['id_product'];
|
||||
if ($booking_data = $objBookingDtl->getBookingData($bookingParams)) {
|
||||
if (isset($booking_data['stats']['num_avail'])) {
|
||||
$row['stock'] = $booking_data['stats']['num_avail'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$totals['products']++;
|
||||
$scores = array(
|
||||
'active' => ($row['active'] ? 2 : 0),
|
||||
@@ -302,7 +341,7 @@ class StatsCheckUp extends Module
|
||||
$totals['images'] += (int)$scores['images'];
|
||||
$totals['orders'] += (int)$scores['orders'];
|
||||
$totals['total_rooms'] += (int)$scores['total_rooms'];
|
||||
$descriptions = $this->getDescriptions($row['id_object']);
|
||||
$descriptions = $this->getDescriptions($this->id_hotel ? 'room_type' : 'hotel', $row['id_object']);
|
||||
foreach ($descriptions as $description) {
|
||||
if (isset($description['iso_code']) && isset($description['description'])) {
|
||||
$row['desclength_'.$description['iso_code']] = Tools::strlen(strip_tags($description['description']));
|
||||
@@ -321,16 +360,16 @@ class StatsCheckUp extends Module
|
||||
} else {
|
||||
$objectLink = $this->context->link->getAdminLink('AdminAddHotel').'&updatehtl_branch_info&id='.$row['id_object'];
|
||||
}
|
||||
$this->html .= '
|
||||
$hotelsHtml .= '
|
||||
<tr>
|
||||
<td>'.$row['id_object'].'</td>
|
||||
<td><a href="'.$objectLink.'" target="_blank">'.Tools::substr($row['object_name'], 0, 42).'</a></td>
|
||||
<td class="center">'.$array_colors[$scores['active']].'</td>';
|
||||
foreach ($languages as $language) {
|
||||
if (isset($row['desclength_'.$language['iso_code']])) {
|
||||
$this->html .= '<td class="center">'.(int)$row['desclength_'.$language['iso_code']].' '.$array_colors[$scores['description_'.$language['iso_code']]].'</td>';
|
||||
$hotelsHtml .= '<td class="center">'.(int)$row['desclength_'.$language['iso_code']].' '.$array_colors[$scores['description_'.$language['iso_code']]].'</td>';
|
||||
} else {
|
||||
$this->html .= '<td>0 '.$array_colors[0].'</td>';
|
||||
$hotelsHtml .= '<td>0 '.$array_colors[0].'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +378,7 @@ class StatsCheckUp extends Module
|
||||
$objectViewLink = $this->context->link->getAdminLink('AdminStats').'&module='.$this->name.'&id_hotel='.$row['id_object'];
|
||||
}
|
||||
|
||||
$this->html .= '
|
||||
$hotelsHtml .= '
|
||||
<td class="center">'.(int)$row['nbImages'].' '.$array_colors[$scores['images']].'</td>
|
||||
<td class="center">'.(int)$row['nbOrders'].' '.$array_colors[$scores['orders']].'</td>
|
||||
<td class="center">'.(int)$row['totalRooms'].' '.$array_colors[$scores['total_rooms']].'</td>
|
||||
@@ -348,7 +387,7 @@ class StatsCheckUp extends Module
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$this->html .= '</tbody>';
|
||||
$hotelsHtml .= '</tbody>';
|
||||
|
||||
$totals['active'] = $totals['active'] / $totals['products'];
|
||||
$totals['active'] = ($totals['active'] < 1 ? 0 : ($totals['active'] > 1.5 ? 2 : 1));
|
||||
@@ -365,15 +404,15 @@ class StatsCheckUp extends Module
|
||||
$totals['average'] = array_sum($totals) / $divisor;
|
||||
$totals['average'] = ($totals['average'] < 1 ? 0 : ($totals['average'] > 1.5 ? 2 : 1));
|
||||
|
||||
$this->html .= '
|
||||
$hotelsHtml .= '
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="2"></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Active').'</span></th>';
|
||||
foreach ($languages as $language) {
|
||||
$this->html .= '<th class="center"><span class="title_box active">'.$this->l('Desc.').' ('.Tools::strtoupper($language['iso_code']).')</span></th>';
|
||||
$hotelsHtml .= '<th class="center"><span class="title_box active">'.$this->l('Desc.').' ('.Tools::strtoupper($language['iso_code']).')</span></th>';
|
||||
}
|
||||
$this->html .= '
|
||||
$hotelsHtml .= '
|
||||
<th class="center"><span class="title_box active">'.$this->l('Images').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Orders').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Total rooms').'</span></th>
|
||||
@@ -384,19 +423,248 @@ class StatsCheckUp extends Module
|
||||
<td colspan="2"></td>
|
||||
<td class="center">'.$array_colors[$totals['active']].'</td>';
|
||||
foreach ($languages as $language) {
|
||||
$this->html .= '<td class="center">'.$array_colors[$totals['description_'.$language['iso_code']]].'</td>';
|
||||
$hotelsHtml .= '<td class="center">'.$array_colors[$totals['description_'.$language['iso_code']]].'</td>';
|
||||
}
|
||||
$this->html .= '
|
||||
$hotelsHtml .= '
|
||||
<td class="center">'.$array_colors[$totals['images']].'</td>
|
||||
<td class="center">'.$array_colors[$totals['orders']].'</td>
|
||||
<td class="center">'.$array_colors[$totals['total_rooms']].'</td>
|
||||
<td class="center">'.$array_colors[$totals['average']].'</td>
|
||||
'.(!$this->id_hotel ? '<td></td>' : '').'
|
||||
</tr>
|
||||
'.($this->id_hotel ? '
|
||||
<tr>
|
||||
<td colspan="100%">
|
||||
<a class="btn btn-default" href="'.$this->context->link->getAdminLink('AdminStats').'&module='.$this->name.''.'">
|
||||
<i class="icon-arrow-circle-left"></i> '.$this->l('Back').'
|
||||
</a>
|
||||
</td>
|
||||
</tr>' : '').'
|
||||
</tfoot>
|
||||
</table></div>';
|
||||
|
||||
return $this->html;
|
||||
return $hotelsHtml;
|
||||
}
|
||||
|
||||
private function getServicesTab()
|
||||
{
|
||||
$employee = Context::getContext()->employee;
|
||||
$prop30 = ((strtotime($employee->stats_date_to.' 23:59:59') - strtotime($employee->stats_date_from.' 00:00:00')) / 60 / 60 / 24) / 30;
|
||||
|
||||
// Get languages
|
||||
$sql = 'SELECT l.*
|
||||
FROM '._DB_PREFIX_.'lang l'
|
||||
.Shop::addSqlAssociation('lang', 'l');
|
||||
$languages = Db::getInstance()->executeS($sql);
|
||||
|
||||
$array_colors = array(
|
||||
0 => '<img src="../modules/'.$this->name.'/img/red.png" alt="'.$this->l('Bad').'" title="'.$this->l('Bad').'" />',
|
||||
1 => '<img src="../modules/'.$this->name.'/img/orange.png" alt="'.$this->l('Average').'" title="'.$this->l('Average').'" />',
|
||||
2 => '<img src="../modules/'.$this->name.'/img/green.png" alt="'.$this->l('Good').'" title="'.$this->l('Good').'" />'
|
||||
);
|
||||
|
||||
$divisor = 4;
|
||||
$totals = array('services' => 0, 'active' => 0, 'images' => 0, 'orders' => 0, 'associated_room_types' => 0);
|
||||
foreach ($languages as $language) {
|
||||
$divisor++;
|
||||
$totals['description_'.$language['iso_code']] = 0;
|
||||
}
|
||||
|
||||
// set data from here
|
||||
$result = $this->getServiceStats();
|
||||
|
||||
if (!$result) {
|
||||
return $this->l('No service was found.');
|
||||
}
|
||||
|
||||
$array_conf = array(
|
||||
'DESCRIPTIONS_SHORT' => array('name' => $this->l('Descriptions'), 'text' => $this->l('chars (without HTML)')),
|
||||
'IMAGES' => array('name' => $this->l('Images'), 'text' => $this->l('images')),
|
||||
'ORDERS' => array('name' => $this->l('Orders'), 'text' => $this->l('orders / month')),
|
||||
);
|
||||
|
||||
$servicesHtml = '
|
||||
<form action="'.Tools::safeOutput(AdminController::$currentIndex.'&token='.Tools::getValue('token').'&module='.$this->name).'" method="post" class="checkup form-horizontal">
|
||||
<table class="table checkup">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><span class="title_box active">'.$array_colors[0].' '.$this->l('Not enough').'</span></th>
|
||||
<th><span class="title_box active">'.$array_colors[2].' '.$this->l('Alright').'</span></th>
|
||||
</tr>
|
||||
</thead>';
|
||||
foreach ($array_conf as $conf => $translations) {
|
||||
$confKeyLt = 'SERVICE_CHECKUP_'.$conf.'_LT';
|
||||
$confKeyGt = 'SERVICE_CHECKUP_'.$conf.'_GT';
|
||||
$servicesHtml .= '
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label col-lg-12">'.$translations['name'].'</label>
|
||||
</td>
|
||||
<td>
|
||||
<div class="row">
|
||||
<div class="col-lg-11 input-group">
|
||||
<span class="input-group-addon">'.$this->l('Less than').'</span>
|
||||
<input type="text" name="'.$confKeyLt.'" value="'.Tools::safeOutput(Tools::getValue($confKeyLt, Configuration::get($confKeyLt))).'" />
|
||||
<span class="input-group-addon">'.$translations['text'].'</span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 input-group">
|
||||
<span class="input-group-addon">'.$this->l('Greater than').'</span>
|
||||
<input type="text" name="'.$confKeyGt.'" value="'.Tools::safeOutput(Tools::getValue($confKeyGt, Configuration::get($confKeyGt))).'" />
|
||||
<span class="input-group-addon">'.$translations['text'].'</span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>';
|
||||
}
|
||||
$servicesHtml .= '</table>
|
||||
<button type="submit" name="submitCheckupService" class="btn btn-default pull-right">
|
||||
<i class="icon-save"></i> '.$this->l('Save').'
|
||||
</button>
|
||||
</form>
|
||||
<form action="'.Tools::safeOutput(AdminController::$currentIndex.'&token='.Tools::getValue('token').'&module='.$this->name).'" method="post" class="form-horizontal alert">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<label class="control-label pull-left">'.$this->l('Order by').'</label>
|
||||
<div class="col-lg-3">
|
||||
<select name="submitCheckupOrder" onchange="this.form.submit();">
|
||||
<option value="'.self::ORDER_BY_ID.'">'.$this->l('ID').'</option>
|
||||
<option value="'.self::ORDER_BY_NAME.'" '.($this->context->cookie->checkup_order == self::ORDER_BY_NAME ? 'selected="selected"' : '').'>'.$this->l('Name').'</option>
|
||||
<option value="'.self::ORDER_BY_ORDERS.'" '.($this->context->cookie->checkup_order == self::ORDER_BY_ORDERS ? 'selected="selected"' : '').'>'.$this->l('Orders').'</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div style="overflow-x:auto">
|
||||
<table class="table checkup2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box active">'.$this->l('ID').'</span></th>
|
||||
<th><span class="title_box active">'.$this->l('Service').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Active').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Associated room types').'</span></th>';
|
||||
foreach ($languages as $language) {
|
||||
$servicesHtml .= '<th class="center"><span class="title_box active">'.$this->l('Desc.').' ('.Tools::strtoupper($language['iso_code']).')</span></th>';
|
||||
}
|
||||
$servicesHtml .= '
|
||||
<th class="center"><span class="title_box active">'.$this->l('Images').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Orders').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Overall status').'</span></th>
|
||||
'.(!$this->id_hotel ? '<th class="center"><span class="title_box active">'.$this->l('Action').'</span></th>' : '').'
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
|
||||
$confCheckup = array(
|
||||
'IMAGES_LT' => Configuration::get('SERVICE_CHECKUP_IMAGES_LT'),
|
||||
'IMAGES_GT' => Configuration::get('SERVICE_CHECKUP_IMAGES_GT'),
|
||||
'ORDERS_LT' => Configuration::get('SERVICE_CHECKUP_ORDERS_LT'),
|
||||
'ORDERS_GT' => Configuration::get('SERVICE_CHECKUP_ORDERS_GT'),
|
||||
'DESCRIPTIONS_SHORT_LT' => Configuration::get('SERVICE_CHECKUP_DESCRIPTIONS_SHORT_LT'),
|
||||
'DESCRIPTIONS_SHORT_GT' => Configuration::get('SERVICE_CHECKUP_DESCRIPTIONS_SHORT_GT'),
|
||||
);
|
||||
|
||||
foreach ($result as $row) {
|
||||
$totals['services']++;
|
||||
$scores = array(
|
||||
'active' => ($row['active'] ? 2 : 0),
|
||||
'images' => ($row['nbImages'] < $confCheckup['IMAGES_LT'] ? 0 : ($row['nbImages'] > $confCheckup['IMAGES_GT'] ? 2 : 1)),
|
||||
'orders' => (($row['nbOrders'] * $prop30 < $confCheckup['ORDERS_LT']) ? 0 : (($row['nbOrders'] * $prop30 > $confCheckup['ORDERS_GT']) ? 2 : 1)),
|
||||
);
|
||||
$totals['active'] += (int)$scores['active'];
|
||||
$totals['images'] += (int)$scores['images'];
|
||||
$totals['orders'] += (int)$scores['orders'];
|
||||
$descriptions = $this->getDescriptions('service', $row['id_object']);
|
||||
foreach ($descriptions as $description) {
|
||||
if (isset($description['iso_code']) && isset($description['description_short'])) {
|
||||
$row['desclength_'.$description['iso_code']] = Tools::strlen(strip_tags($description['description_short']));
|
||||
}
|
||||
if (isset($description['iso_code'])) {
|
||||
$scores['description_'.$description['iso_code']] = ($row['desclength_'.$description['iso_code']] < $confCheckup['DESCRIPTIONS_SHORT_LT'] ? 0 : ($row['desclength_'.$description['iso_code']] > $confCheckup['DESCRIPTIONS_SHORT_GT'] ? 2 : 1));
|
||||
$totals['description_'.$description['iso_code']] += $scores['description_'.$description['iso_code']];
|
||||
}
|
||||
}
|
||||
$scores['average'] = array_sum($scores) / $divisor;
|
||||
$scores['average'] = ($scores['average'] < 1 ? 0 : ($scores['average'] > 1.5 ? 2 : 1));
|
||||
|
||||
$objectLink = $this->context->link->getAdminLink('AdminNormalProducts').'&updateproduct&id_product='.$row['id_object'];
|
||||
$servicesHtml .= '
|
||||
<tr>
|
||||
<td>'.$row['id_object'].'</td>
|
||||
<td><a href="'.$objectLink.'" target="_blank">'.Tools::substr($row['object_name'], 0, 42).'</a></td>
|
||||
<td class="center">'.$array_colors[$scores['active']].'</td>
|
||||
<td class="center">'.$row['nbAssociatedRoomTypes'].'</td>';
|
||||
foreach ($languages as $language) {
|
||||
if (isset($row['desclength_'.$language['iso_code']])) {
|
||||
$servicesHtml .= '<td class="center">'.(int)$row['desclength_'.$language['iso_code']].' '.$array_colors[$scores['description_'.$language['iso_code']]].'</td>';
|
||||
} else {
|
||||
$servicesHtml .= '<td class="center">0 '.$array_colors[0].'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
$servicesHtml .= '
|
||||
<td class="center">'.(int)$row['nbImages'].' '.$array_colors[$scores['images']].'</td>
|
||||
<td class="center">'.(int)$row['nbOrders'].' '.$array_colors[$scores['orders']].'</td>
|
||||
<td class="center">'.$array_colors[$scores['average']].'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$servicesHtml .= '</tbody>';
|
||||
|
||||
$totals['active'] = $totals['active'] / $totals['services'];
|
||||
$totals['active'] = ($totals['active'] < 1 ? 0 : ($totals['active'] > 1.5 ? 2 : 1));
|
||||
$totals['images'] = $totals['images'] / $totals['services'];
|
||||
$totals['images'] = ($totals['images'] < 1 ? 0 : ($totals['images'] > 1.5 ? 2 : 1));
|
||||
$totals['orders'] = $totals['orders'] / $totals['services'];
|
||||
$totals['orders'] = ($totals['orders'] < 1 ? 0 : ($totals['orders'] > 1.5 ? 2 : 1));
|
||||
$totals['associated_room_types'] = $totals['associated_room_types'] / $totals['services'];
|
||||
$totals['associated_room_types'] = ($totals['associated_room_types'] < 1 ? 0 : ($totals['associated_room_types'] > 1.5 ? 2 : 1));
|
||||
foreach ($languages as $language) {
|
||||
$totals['description_'.$language['iso_code']] = $totals['description_'.$language['iso_code']] / $totals['services'];
|
||||
$totals['description_'.$language['iso_code']] = ($totals['description_'.$language['iso_code']] < 1 ? 0 : ($totals['description_'.$language['iso_code']] > 1.5 ? 2 : 1));
|
||||
}
|
||||
$totals['average'] = array_sum($totals) / $divisor;
|
||||
$totals['average'] = ($totals['average'] < 1 ? 0 : ($totals['average'] > 1.5 ? 2 : 1));
|
||||
|
||||
$servicesHtml .= '
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="2"></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Active').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Associated room types').'</span></th>';
|
||||
foreach ($languages as $language) {
|
||||
$servicesHtml .= '<th class="center"><span class="title_box active">'.$this->l('Desc.').' ('.Tools::strtoupper($language['iso_code']).')</span></th>';
|
||||
}
|
||||
$servicesHtml .= '
|
||||
<th class="center"><span class="title_box active">'.$this->l('Images').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Orders').'</span></th>
|
||||
<th class="center"><span class="title_box active">'.$this->l('Overall status').'</span></th>
|
||||
'.(!$this->id_hotel ? '<th></th>' : '').'
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"></td>
|
||||
<td class="center">'.$array_colors[$totals['active']].'</td>
|
||||
<td class="center">NA</td>';
|
||||
foreach ($languages as $language) {
|
||||
$servicesHtml .= '<td class="center">'.$array_colors[$totals['description_'.$language['iso_code']]].'</td>';
|
||||
}
|
||||
$servicesHtml .= '
|
||||
<td class="center">'.$array_colors[$totals['images']].'</td>
|
||||
<td class="center">'.$array_colors[$totals['orders']].'</td>
|
||||
<td class="center">'.$array_colors[$totals['average']].'</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table></div>';
|
||||
|
||||
return $servicesHtml;
|
||||
}
|
||||
|
||||
public function getHotelStats()
|
||||
@@ -479,20 +747,49 @@ class StatsCheckUp extends Module
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public function getDescriptions($id_object)
|
||||
public function getServiceStats()
|
||||
{
|
||||
if ($this->id_hotel) {
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT l.`iso_code`, pl.`description`
|
||||
FROM '._DB_PREFIX_.'product_lang pl
|
||||
LEFT JOIN '._DB_PREFIX_.'lang l
|
||||
ON pl.`id_lang` = l.`id_lang`
|
||||
LEFT JOIN '._DB_PREFIX_.'htl_room_type hrt
|
||||
ON (hrt.`id_product` = pl.`id_product`)
|
||||
WHERE hrt.`id_hotel` = '.(int) $this->id_hotel.'
|
||||
AND pl.`id_product` = '.(int) $id_object
|
||||
);
|
||||
} else {
|
||||
$date_from = date('Y-m-d', strtotime($this->context->employee->stats_date_from));
|
||||
$date_to = date('Y-m-d', strtotime($this->context->employee->stats_date_to));
|
||||
$id_lang = $this->context->language->id;
|
||||
|
||||
$order_by = 'p.`id_product`';
|
||||
if ($this->context->cookie->checkup_order == self::ORDER_BY_NAME) {
|
||||
$order_by = 'object_name';
|
||||
} elseif ($this->context->cookie->checkup_order == self::ORDER_BY_ORDERS) {
|
||||
$order_by = 'nbOrders DESC';
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.`id_product` AS id_object, p.`active`, pl.`name` AS object_name,
|
||||
(
|
||||
SELECT COUNT(*)
|
||||
FROM '._DB_PREFIX_.'image i
|
||||
WHERE i.`id_product` = p.`id_product`
|
||||
) AS nbImages,
|
||||
(
|
||||
SELECT COUNT(DISTINCT rsod.`id_order`) FROM `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rsod
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = rsod.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id` = rsod.`id_htl_booking_detail`)
|
||||
WHERE rsod.`id_product` = p.`id_product` AND o.`valid` = 1
|
||||
AND hbd.`date_to` > "'.pSQL($date_from).'" AND hbd.`date_from` < "'.pSQL($date_to).'"
|
||||
) AS nbOrders,
|
||||
(
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp
|
||||
WHERE rsp.`id_product` = p.`id_product`
|
||||
) AS nbAssociatedRoomTypes
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl
|
||||
ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int) $id_lang.')
|
||||
WHERE p.`booking_product` = 0
|
||||
ORDER BY '.$order_by;
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public function getDescriptions($object_type, $id_object = null)
|
||||
{
|
||||
if ($object_type == 'hotel') {
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT l.`iso_code`, hbil.`description`
|
||||
FROM '._DB_PREFIX_.'htl_branch_info_lang hbil
|
||||
@@ -500,6 +797,27 @@ class StatsCheckUp extends Module
|
||||
ON hbil.`id_lang` = l.`id_lang`
|
||||
WHERE hbil.`id` = '.(int) $id_object
|
||||
);
|
||||
} elseif ($object_type == 'room_type') {
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT l.`iso_code`, pl.`description`
|
||||
FROM '._DB_PREFIX_.'product_lang pl
|
||||
LEFT JOIN '._DB_PREFIX_.'lang l
|
||||
ON pl.`id_lang` = l.`id_lang`
|
||||
INNER JOIN '._DB_PREFIX_.'htl_room_type hrt
|
||||
ON (hrt.`id_product` = pl.`id_product`)
|
||||
WHERE hrt.`id_hotel` = '.(int) $this->id_hotel.'
|
||||
AND pl.`id_product` = '.(int) $id_object
|
||||
);
|
||||
} elseif ($object_type == 'service') {
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT l.`iso_code`, pl.`description_short`
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl
|
||||
ON (pl.`id_product` = p.`id_product`)
|
||||
LEFT JOIN '._DB_PREFIX_.'lang l
|
||||
ON pl.`id_lang` = l.`id_lang`
|
||||
WHERE p.`booking_product` = 0'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ class StatsForecast extends Module
|
||||
|
||||
$this->html .= '
|
||||
<tr>
|
||||
<td class="fixed-width-sm">'.($this->context->cookie->stats_granularity == 42 ? (Tools::displayDate($row['fix_date']).' - '.Tools::displayDate($row['end_date'])) : Tools::displayDate($row['fix_date'])).'</td>
|
||||
<td class="fixed-width-sm">'.($this->context->cookie->stats_granularity == 42 ? (Tools::displayDate($row['fix_date']).' - '.Tools::displayDate($row['end_date'])) : $row['fix_date']).'</td>
|
||||
<td class="text-left">'.$visits_today.'</td>
|
||||
<td class="text-left">'.(int)$row['registrations'].'</td>
|
||||
<td class="text-left">'.(int)$row['countOrders'].'</td>
|
||||
|
||||
@@ -324,7 +324,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
// Total unknown
|
||||
$sql = 'SELECT COUNT(`id_customer`) as total
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `birthday` IS NULL
|
||||
WHERE `birthday` = "0000-00-00"
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (isset($result['total']) && $result['total']) {
|
||||
|
||||
@@ -119,6 +119,7 @@ class StatsProduct extends ModuleGraph
|
||||
$sql .= ' INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (hrt.`id_product` = p.`id_product` AND hrt.`id_hotel` = '.(int)Tools::getValue('id_hotel').')';
|
||||
}
|
||||
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang`='.(int)$this->context->language->id.')
|
||||
WHERE p.`booking_product` = 1
|
||||
ORDER BY pl.`name`';
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
@@ -302,20 +303,8 @@ class StatsProduct extends ModuleGraph
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
$bookingParams = array();
|
||||
$bookingParams['date_from'] = $dateFrom;
|
||||
$bookingParams['date_to'] = $dateTo;
|
||||
foreach ($this->getProducts($this->context->language->id) as $product) {
|
||||
$availRooms = 0;
|
||||
if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($product['id_product'])) {
|
||||
$bookingParams['hotel_id'] = $roomTypeInfo['id_hotel'];
|
||||
$bookingParams['id_room_type'] = $product['id_product'];
|
||||
if ($booking_data = $objBookingDtl->getBookingData($bookingParams)) {
|
||||
if (isset($booking_data['stats']['num_avail'])) {
|
||||
$availRooms = $booking_data['stats']['num_avail'];
|
||||
}
|
||||
}
|
||||
}
|
||||
// get room types info
|
||||
foreach ($this->getProducts() as $product) {
|
||||
$this->html .= '
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
{if !$order_date_restrict}
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="control-label">{l s='Check In - Check Out'}</label>
|
||||
<div class="form-control input-date" id="room_date_range" autocomplete="off" placeholder="{l s='Check-in - Check-out'}"><span>{l s='Check-in'} <i class="icon icon-minus"></i> {l s='Check-out'}</span></div>
|
||||
<input type="hidden" class="input-date" name="room_check_in" id="room_check_in" value="{if isset($date_from)}{$date_from}{/if}" />
|
||||
<input type="hidden" class="input-date" name="room_check_out" id="room_check_out" value="{if isset($date_to)}{$date_to}{/if}" />
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
</div>
|
||||
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block">
|
||||
<div class="row">
|
||||
<label class="col-sm-12">{l s='Child'}<span class="label-desc-txt"> ({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})</span></label>
|
||||
<label class="col-sm-12">{l s='Children'}<span class="label-desc-txt"> ({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})</span></label>
|
||||
<div class="col-sm-12">
|
||||
<input type="hidden" class="num_occupancy num_children room_occupancies" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][children]" max="{}" value="{$occupancy['children']|escape:'htmlall':'UTF-8'}">
|
||||
<div class="occupancy_count pull-left">
|
||||
@@ -134,7 +134,7 @@
|
||||
</div>
|
||||
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block">
|
||||
<div class="row">
|
||||
<label class="col-sm-12">{l s='Child'} <span class="label-desc-txt">({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})</span></label>
|
||||
<label class="col-sm-12">{l s='Children'} <span class="label-desc-txt">({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})</span></label>
|
||||
<div class="col-sm-12">
|
||||
<input type="hidden" class="num_occupancy num_children" name="num_children[]" value="0">
|
||||
<div class="occupancy_count pull-left">
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<div class="rm_qty_cont clearfix">
|
||||
<div class="rm_qty_cont form-group clearfix">
|
||||
<input type="hidden" class="text-center form-control quantity_wanted" min="1" name="qty" value="{if isset($quantity) && $quantity}{$quantity|escape:'html':'UTF-8'}{else}1{/if}">
|
||||
<input type="hidden" class="max_avail_type_qty" value="{if isset($total_available_rooms)} {$total_available_rooms|escape:'html':'UTF-8'}{/if}">
|
||||
<div class="qty_count pull-left">
|
||||
|
||||
@@ -50,11 +50,13 @@
|
||||
</div>
|
||||
{/if}-->
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="alert alert-success" id="guest_transform_success" style="display:none">
|
||||
{l s='Your guest account has been transformed into a customer account successfully and the login credentials have been sent to you. Please make sure to change the password for security.'}
|
||||
{if isset($smarty.get.guest_transform_success) && $smarty.get.guest_transform_success}
|
||||
<div class="col-xs-12">
|
||||
<div class="alert alert-success">
|
||||
{l s='Your guest account has been transformed into a customer account successfully and the login credentials have been sent to you. Please make sure to change the password for security.'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" method="post" id="create-account_form" class="box">
|
||||
<h3 class="page-subheading">{l s='Create an account'}</h3>
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
margin-bottom: 8px; }
|
||||
#create-account_form .form-group {
|
||||
margin: 0 0 20px 0; }
|
||||
#create-account_form .btn-transform {
|
||||
#authentication .btn-transform {
|
||||
padding: 0;
|
||||
font-size: 16px;
|
||||
font-size: 1em;
|
||||
cursor: pointer;
|
||||
vertical-align: initial;
|
||||
text-decoration: underline; }
|
||||
|
||||
@@ -195,13 +195,11 @@ p.capa_txt {
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
.rm_qty_cont {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.rm_qty_cont
|
||||
{
|
||||
width: 120px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.qty_txt
|
||||
{
|
||||
color: #333333;
|
||||
|
||||
@@ -1689,7 +1689,8 @@ ul.service-product-nav > li:hover {
|
||||
height: 200px;
|
||||
border-radius: 4px;
|
||||
object-fit: cover;
|
||||
transition: all 0.2s; }
|
||||
transition: all 0.2s;
|
||||
box-shadow: #00000029 0px 0px 2px 1px; }
|
||||
|
||||
#room_info_hotel_images .image-item img:hover {
|
||||
transform: scale(1.05); }
|
||||
|
||||
@@ -41,7 +41,8 @@ function submitFunction(submitAction) {
|
||||
var data = {
|
||||
controller: 'authentication',
|
||||
ajax: true,
|
||||
email_create: $('#email_create').val(),
|
||||
email_create: $('#email_create').val(), // for login page
|
||||
email: $('#email').val(), // for personal info page
|
||||
back: $('input[name=back]').val(),
|
||||
token: token
|
||||
};
|
||||
@@ -59,7 +60,7 @@ function submitFunction(submitAction) {
|
||||
// display confirmations
|
||||
if (jsonData.hasConfirmation) {
|
||||
if (in_array('TRANSFORM_OK', jsonData.confirmations)) {
|
||||
$('#guest_transform_success').show('slow');
|
||||
window.location = jsonData.ajaxExtraData.redirect_link
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1029,7 +1029,9 @@ function checkUrl() {
|
||||
/*#####################################################################*/
|
||||
|
||||
$(document).ready(function() {
|
||||
BookingForm.init();
|
||||
if (!PS_CATALOG_MODE) {
|
||||
BookingForm.init();
|
||||
}
|
||||
|
||||
$(document).on('QloApps:updateRoomOccupancy', function(e) {
|
||||
BookingForm.refresh();
|
||||
@@ -1204,6 +1206,13 @@ $(document).ready(function() {
|
||||
if (typeof(qty) == 'undefined') {
|
||||
qty = 1;
|
||||
}
|
||||
var added_service_product = [];
|
||||
$('#additional_products input.service_product').each(function () {
|
||||
added_service_product.push({
|
||||
'id_product': $(this).data('id_product'),
|
||||
'quantity':$(this).val(),
|
||||
});
|
||||
});
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
@@ -1218,31 +1227,36 @@ $(document).ready(function() {
|
||||
qty: qty,
|
||||
id_product: $('#product_page_product_id').val(),
|
||||
service_product: id_product,
|
||||
added_service_product: added_service_product,
|
||||
action: 'checkServiceProductWithRoomType',
|
||||
ajax: true,
|
||||
token: static_token
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.status) {
|
||||
if ($('input#service_product_'+ id_product).length) {
|
||||
var prevQty = $('input#service_product_'+ id_product).val();
|
||||
if (parseInt(prevQty) > 0) {
|
||||
qty = parseInt(qty) + parseInt(prevQty);
|
||||
if (result.success) {
|
||||
if (result.add) {
|
||||
if ($('input#service_product_'+ id_product).length) {
|
||||
var prevQty = $('input#service_product_'+ id_product).val();
|
||||
if (parseInt(prevQty) > 0) {
|
||||
qty = parseInt(qty) + parseInt(prevQty);
|
||||
}
|
||||
$('input#service_product_'+ id_product).val(qty);
|
||||
} else {
|
||||
$('<input type="hidden">').attr({
|
||||
id: 'service_product_'+ id_product,
|
||||
name: 'service_product['+ id_product +'][]',
|
||||
class: 'service_product',
|
||||
'data-id_product': id_product,
|
||||
value: qty
|
||||
}).appendTo('#additional_products');
|
||||
}
|
||||
$('input#service_product_'+ id_product).val(qty);
|
||||
} else {
|
||||
$('<input type="hidden">').attr({
|
||||
id: 'service_product_'+ id_product,
|
||||
name: 'service_product['+ id_product +'][]',
|
||||
class: 'service_product',
|
||||
'data-id_product': id_product,
|
||||
value: qty
|
||||
}).appendTo('#additional_products');
|
||||
}
|
||||
// reset input
|
||||
$(that).closest('.service_product_action_block').find('input.service_product_qty').val(1);
|
||||
$(that).closest('.service_product_action_block').find('.qty_count span').text(1);
|
||||
showSuccessMessage(cart_extra_service_add);
|
||||
if (result.msg) {
|
||||
showSuccessMessage(result.msg);
|
||||
}
|
||||
BookingForm.refresh();
|
||||
} else {
|
||||
if (result.error) {
|
||||
|
||||
@@ -408,7 +408,7 @@
|
||||
{/if}
|
||||
</span>
|
||||
<span class="voucher_apply_state pull-right">
|
||||
<img src="{$img_dir}img/icon/form-ok-circle.svg" /> {l s='Applied'}
|
||||
<img src="{$img_dir}/icon/form-ok-circle.svg" /> {l s='Applied'}
|
||||
</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-md-2 col-sm-3">
|
||||
<strong>{l s='Total Order Amount'} </strong>
|
||||
<strong>{l s='Total order amount'} </strong>
|
||||
</div>
|
||||
<div class="col-sm-9 col-md-10">
|
||||
{displayPrice price=$orderInfo['total_paid_tax_incl'] currency=$orderInfo['id_currency']}
|
||||
@@ -104,7 +104,7 @@
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-md-2 col-sm-3">
|
||||
<strong>{l s='Refund initiated on'} </strong>
|
||||
<strong>{l s='Request date'} </strong>
|
||||
</div>
|
||||
<div class="col-sm-9 col-md-10">
|
||||
{$orderReturnInfo['date_add']|date_format:"%d-%m-%Y %I:%M %p"}
|
||||
@@ -114,7 +114,7 @@
|
||||
{if $currentStateInfo['refunded']}
|
||||
<div class="form-group row">
|
||||
<div class="col-md-2 col-sm-3">
|
||||
<strong>{l s='Refunded Amount' mod='hotelreservationsystem'}</strong>
|
||||
<strong>{l s='Refunded amount' mod='hotelreservationsystem'}</strong>
|
||||
</div>
|
||||
<div class="col-sm-9 col-md-10">
|
||||
{displayPrice price=$orderReturnInfo['refunded_amount'] currency=$orderInfo['id_currency']}
|
||||
@@ -122,7 +122,7 @@
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-md-2 col-sm-3">
|
||||
<strong>{l s='Payment Mode' mod='hotelreservationsystem'}</strong>
|
||||
<strong>{l s='Payment mode' mod='hotelreservationsystem'}</strong>
|
||||
</div>
|
||||
<div class="col-sm-9 col-md-10">
|
||||
{$orderReturnInfo['payment_mode']|escape:'html':'UTF-8'}
|
||||
@@ -130,7 +130,7 @@
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-md-2 col-sm-3">
|
||||
<strong>{l s='Transaction Id' mod='hotelreservationsystem'}</strong>
|
||||
<strong>{l s='Transaction ID' mod='hotelreservationsystem'}</strong>
|
||||
</div>
|
||||
<div class="col-sm-9 col-md-10">
|
||||
{$orderReturnInfo['id_transaction']|escape:'html':'UTF-8'}
|
||||
|
||||
Reference in New Issue
Block a user