Merge branch 'develop' into gli-1018
This commit is contained in:
@@ -60,22 +60,39 @@ $exclude_packs = (bool)Tools::getValue('exclude_packs', true);
|
||||
|
||||
$bookingProduct = (int) Tools::getValue('booking_product');
|
||||
|
||||
$idHotel = (int) Tools::getValue('id_hotel');
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
$sql = 'SELECT p.`id_product`, pl.`link_rewrite`, p.`reference`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, p.`cache_default_attribute`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)$context->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
$sqlSelect = 'SELECT p.`id_product`, pl.`link_rewrite`, p.`reference`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, p.`cache_default_attribute`';
|
||||
|
||||
$sqlFrom = ' FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p');
|
||||
|
||||
$sqlJoin =' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $context->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
|
||||
ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$context->language->id.')
|
||||
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
||||
ON (image_shop.`id_product` = p.`id_product` AND image_shop.`cover`=1 AND image_shop.`id_shop`='.(int) $context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int) $context->language->id.')';
|
||||
|
||||
$sqlWhere = ' WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||
(!empty($excludePackItself) ? ' AND p.id_product <> '.$excludePackItself.' ' : ' ').
|
||||
($excludeVirtuals ? 'AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '').
|
||||
($exclude_packs ? 'AND (p.cache_is_pack IS NULL OR p.cache_is_pack = 0)' : '').
|
||||
($bookingProduct ? 'AND p.`booking_product` = '.(int) $bookingProduct : '').
|
||||
' GROUP BY p.id_product';
|
||||
($bookingProduct ? 'AND p.`booking_product` = '.(int) $bookingProduct : '');
|
||||
|
||||
$sqlGroupBy = ' GROUP BY p.id_product';
|
||||
|
||||
if ($idHotel && $bookingProduct) {
|
||||
// To get hotel info for the booking product only
|
||||
$sqlSelect .= ', hbil.`hotel_name`, hbil.`id` AS id_hotel ';
|
||||
$sqlJoin .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
ON hrt.`id_product` = p.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil
|
||||
ON pl.`id_lang` = hbil.`id_lang` AND hbil.`id` = hrt.`id_hotel`';
|
||||
$sqlWhere .= ' AND hbil.`id`='.(int) $idHotel ;
|
||||
}
|
||||
|
||||
$sql = $sqlSelect.' '.$sqlFrom.' '.$sqlJoin.' '.$sqlWhere.' '.$sqlGroupBy;
|
||||
|
||||
$items = Db::getInstance()->executeS($sql);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -869,7 +869,7 @@
|
||||
<div class="panel" id="refundForm">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-bed"></i> {l s='Rooms Booking Detail'} <span class="badge">{$order_detail_data|@count}</span>
|
||||
{if !$order->hasBeenDelivered()}
|
||||
{if !$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED')}
|
||||
<button type="button" id="add_room" class="btn btn-primary pull-right">
|
||||
<i class="icon-plus-sign"></i> {l s='Add Rooms'}
|
||||
</button>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*}
|
||||
|
||||
<div class="modal-body">
|
||||
<form action="{$current_index}&viewOrder&id_order={$order->id}{if isset($smarty.get.token)}&token={$smarty.get.token|escape:'html':'UTF-8'}{/if}" method="post">
|
||||
<form action="{$current_index}&vieworder&id_order={$order->id}{if isset($smarty.get.token)}&token={$smarty.get.token|escape:'html':'UTF-8'}{/if}" method="post">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{l s='Note Detail'}</label>
|
||||
<input type="hidden" name="id_order_invoice" id="id_order_invoice" value="" />
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
$(form).find('table.table .field_optional').hide();
|
||||
$(form).find('table.table .field_optional').each(function(i, val) {
|
||||
if (list_fields_visibility.includes($(this).data('key'))) {
|
||||
$(this).show();
|
||||
$(this).css('display', '');
|
||||
}
|
||||
});
|
||||
updateListVisibility(list_fields_visibility)
|
||||
@@ -553,10 +553,11 @@
|
||||
<style>
|
||||
@media (max-width: 992px) {
|
||||
{foreach from=$fields_display item=param name=params}
|
||||
{if isset($params.displayed) && $params.displayed === false}{continue}{/if}
|
||||
.table-responsive-row td:nth-of-type({math equation="x+y" x=$smarty.foreach.params.index y=$y}):before {
|
||||
{if isset($param.displayed) && $param.displayed === false}{continue}{/if}
|
||||
.table-responsive-row td:nth-of-type({$y}):before {
|
||||
content: "{$param.title}";
|
||||
}
|
||||
{assign var=y value=$y+1}
|
||||
{/foreach}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -483,6 +483,14 @@ class AddressCore extends ObjectModel
|
||||
return array();
|
||||
}
|
||||
|
||||
public function cacheFieldsRequiredDatabase($all = false)
|
||||
{
|
||||
parent::cacheFieldsRequiredDatabase($all);
|
||||
if ($this->id_hotel) {
|
||||
self::$fieldsRequiredDatabase['Address'] = array();
|
||||
}
|
||||
}
|
||||
|
||||
public function searchByName($query, $idLang = false)
|
||||
{
|
||||
if (!$idLang) {
|
||||
|
||||
@@ -374,7 +374,7 @@ class CartCore extends ObjectModel
|
||||
if ($cart_vat_amount == 0 || $cart_amount_te == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return Tools::ps_round($cart_vat_amount / $cart_amount_te, 3);
|
||||
return Tools::ps_round($cart_vat_amount / $cart_amount_te, 6);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2407,7 +2407,8 @@ class CartCore extends ObjectModel
|
||||
$product['cart_quantity'] = $selectedProduct['quantity'];
|
||||
$product['total'] = $selectedProduct['total_price_tax_excl'];
|
||||
$product['total_wt'] = $selectedProduct['total_price_tax_incl'];
|
||||
$product['price_wt'] = $selectedProduct['unit_price_tax_incl'];
|
||||
$product['price_wt'] = $selectedProduct['total_price_tax_incl'] / $product['cart_quantity'];
|
||||
$product['price'] = $selectedProduct['total_price_tax_excl'] / $product['cart_quantity'];
|
||||
$product['id_hotel'] = $selectedProduct['id_hotel'];
|
||||
$orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $product;
|
||||
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'])) {
|
||||
|
||||
@@ -294,6 +294,13 @@ class CartRuleCore extends ObjectModel
|
||||
return array();
|
||||
}
|
||||
|
||||
// Remove cart rule that does not match the id_customer
|
||||
foreach ($result as $key => $cart_rule) {
|
||||
if ($cart_rule['id_customer'] && $cart_rule['id_customer'] != $id_customer) {
|
||||
unset($result[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove cart rule that does not match the customer groups
|
||||
$customerGroups = Customer::getGroupsStatic($id_customer);
|
||||
|
||||
@@ -1154,6 +1161,18 @@ class CartRuleCore extends ObjectModel
|
||||
$previous_reduction_amount = $prorata * $previous_reduction_amount * (1 + $cart_average_vat_rate);
|
||||
}
|
||||
|
||||
// First we convert the voucher value to the default currency
|
||||
$previousCartRuleCurrency = new Currency($this->reduction_currency);
|
||||
|
||||
if ($previous_reduction_amount == 0 || $previousCartRuleCurrency->conversion_rate == 0) {
|
||||
$previous_reduction_amount = 0;
|
||||
} else {
|
||||
$previous_reduction_amount /= $previousCartRuleCurrency->conversion_rate;
|
||||
}
|
||||
|
||||
// Then we convert the voucher value in the default currency into the cart currency
|
||||
$previous_reduction_amount *= $context->currency->conversion_rate;
|
||||
$previous_reduction_amount = Tools::ps_round($previous_reduction_amount, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$current_cart_amount = max($current_cart_amount - (float)$previous_reduction_amount, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,11 @@ class NotificationCore
|
||||
SELECT SQL_CALC_FOUND_ROWS o.`id_order`, o.`id_customer`, o.`total_paid`, o.`id_currency`, o.`date_upd`, c.`firstname`, c.`lastname`
|
||||
FROM `'._DB_PREFIX_.'orders` as o
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` as c ON (c.`id_customer` = o.`id_customer`)
|
||||
WHERE `id_order` > '.(int)$id_last_element.
|
||||
Shop::addSqlRestriction(false, 'o').'
|
||||
ORDER BY `id_order` DESC
|
||||
LEFT JOIN '._DB_PREFIX_.'htl_booking_detail hbd ON (hbd.id_order = o.id_order)
|
||||
WHERE o.`id_order` > '.(int)$id_last_element.
|
||||
Shop::addSqlRestriction(false, 'o'). HotelBranchInformation::addHotelRestriction(false, 'hbd').'
|
||||
GROUP BY o.`id_order`
|
||||
ORDER BY o.`id_order` DESC
|
||||
LIMIT 5';
|
||||
break;
|
||||
|
||||
|
||||
@@ -797,8 +797,9 @@ class OrderCore extends ObjectModel
|
||||
|
||||
public function getTaxesAverageUsed()
|
||||
{
|
||||
// @todo should use order table to get tax average
|
||||
return Cart::getTaxesAverageUsed((int)$this->id_cart);
|
||||
$cart = new Cart((int) $this->id_cart);
|
||||
|
||||
return $cart->getAverageProductsTaxRate() * 100;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,11 +42,11 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->allow_export = true;
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$this->_select = 'CONCAT(c.`firstname`, \' \', c.`lastname`) `customer`, a.id_cart total,
|
||||
TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', a.`date_add`)) AS `time_diff`,
|
||||
|
||||
IFNULL(GROUP_CONCAT(DISTINCT o.`id_order`), 0) AS `ids_order`,
|
||||
IF (IFNULL(o.id_order, \''.$this->l('Non ordered cart').'\') = \''.$this->l('Non ordered cart').'\', IF(TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', a.`date_add`)) > 86400, \''.$this->l('Abandoned cart').'\', \''.$this->l('Non ordered cart').'\'), GROUP_CONCAT(DISTINCT o.`id_order`)) AS filter_ids_order,
|
||||
IF (IFNULL(o.id_order, \''.$this->l('Non ordered cart').'\') = \''.$this->l('Non ordered cart').'\', IF(TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', a.`date_add`)) > '._TIME_1_DAY_.', \''.$this->l('Abandoned cart').'\', \''.$this->l('Non ordered cart').'\'), GROUP_CONCAT(DISTINCT o.`id_order`)) AS filter_ids_order,
|
||||
IF(o.id_order, 1, 0) badge_success, IF(o.id_order, 0, 1) badge_danger, IF(co.id_guest, 1, 0) id_guest';
|
||||
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = a.id_customer)
|
||||
LEFT JOIN '._DB_PREFIX_.'currency cu ON (cu.id_currency = a.id_currency)
|
||||
@@ -54,10 +54,6 @@ class AdminCartsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections` co ON (a.id_guest = co.id_guest AND TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', co.`date_add`)) < 1800)';
|
||||
$this->_group = ' GROUP BY a.`id_cart`';
|
||||
|
||||
if (Tools::getValue('action') == 'filterOnlyAbandonedCarts') {
|
||||
$this->_filterHaving = ' AND `ids_order` = 0 AND `time_diff` > 86400';
|
||||
}
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_cart' => array(
|
||||
'title' => $this->l('ID'),
|
||||
@@ -96,7 +92,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
'type' => 'bool',
|
||||
'havingFilter' => true,
|
||||
'class' => 'fixed-width-xs',
|
||||
'icon' => array(0 => 'icon-', 1 => 'icon-user')
|
||||
'callback' => 'getOnlineStatus',
|
||||
)
|
||||
);
|
||||
$this->shopLinkType = 'shop';
|
||||
@@ -117,10 +113,32 @@ class AdminCartsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->list_no_link = true;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::getValue('action') == 'filterOnlyAbandonedCarts') {
|
||||
$this->processResetFilters();
|
||||
$this->context->cookie->{'submitFilter'.$this->table} = true;
|
||||
$prefix = $this->getCookieFilterPrefix();
|
||||
$this->context->cookie->{$prefix.$this->table.'Filter_filter_ids_order'} = $this->l('Abandoned cart');
|
||||
if (($dateFrom = Tools::getValue('date_from'))
|
||||
&& ($dateTo = Tools::getValue('date_to'))
|
||||
&& strtotime($dateTo) >= strtotime($dateFrom)
|
||||
) {
|
||||
//Updating the date format of the filter dates to the required format.
|
||||
$dateFrom = date('Y-m-d', strtotime($dateFrom));
|
||||
$dateTo = date('Y-m-d', strtotime($dateTo));
|
||||
$this->context->cookie->{$prefix.$this->table.'Filter_'.$this->fields_list['date_add']['filter_key']} = json_encode(array($dateFrom, $dateTo));
|
||||
}
|
||||
|
||||
$this->redirect_after = $this->context->link->getAdminLink('AdminCarts');
|
||||
}
|
||||
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public function getOrderColumn($idsOrder, $tr)
|
||||
{
|
||||
$smartyVars = array();
|
||||
@@ -129,7 +147,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$smartyVars['type'] = 'orders';
|
||||
$smartyVars['ids_order'] = $idsOrder;
|
||||
} else {
|
||||
if ($tr['time_diff'] > 86400) {
|
||||
if ($tr['time_diff'] > _TIME_1_DAY_) {
|
||||
$smartyVars['type'] = 'abandoned';
|
||||
} else {
|
||||
$smartyVars['type'] = 'non_orderd';
|
||||
@@ -143,6 +161,11 @@ class AdminCartsControllerCore extends AdminController
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
public function getOnlineStatus($status)
|
||||
{
|
||||
return $status ? $this->l('Yes') : $this->l('No');
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
if (empty($this->display)) {
|
||||
@@ -184,7 +207,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$date_from = date(Context::getContext()->language->date_format_lite, strtotime('-2 day'));
|
||||
$date_to = date(Context::getContext()->language->date_format_lite, strtotime('-1 day'));
|
||||
$helper->subtitle = sprintf($this->l('From %s to %s', null, null, false), $date_from, $date_to);
|
||||
$helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts';
|
||||
$helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts&date_from='.$date_from.'&date_to='.$date_to;
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart';
|
||||
$kpis[] = $helper;
|
||||
|
||||
|
||||
@@ -3079,7 +3079,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
} else {
|
||||
$address->id_country = (int)$address_infos['id_country'];
|
||||
$address->id_state = (int)$address_infos['id_state'];
|
||||
$address->zipcode = $address_infos['postcode'];
|
||||
$address->postcode = $address_infos['postcode'];
|
||||
}
|
||||
$tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true);
|
||||
$tax_rates = array(
|
||||
|
||||
@@ -374,36 +374,17 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->errors[] = $this->l('You have to select a shop before creating new orders.');
|
||||
}
|
||||
|
||||
$id_cart = (int)Tools::getValue('id_cart');
|
||||
$cart = new Cart((int)$id_cart);
|
||||
if ($id_cart && !Validate::isLoadedObject($cart)) {
|
||||
$this->errors[] = $this->l('This cart does not exists');
|
||||
}
|
||||
if ($id_cart && Validate::isLoadedObject($cart) && !$cart->id_customer) {
|
||||
$this->errors[] = $this->l('The cart must have a customer');
|
||||
}
|
||||
if (count($this->errors) && !Tools::getValue('submitAddorder')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check page is whether ad new order page or order detail page
|
||||
if ((Tools::isSubmit('addorder') && ($id_cart = Tools::getValue('cart_id')))
|
||||
|| (Tools::isSubmit('submitAddOrder') && ($id_cart = Tools::getValue('id_cart')))
|
||||
) {
|
||||
// check page is new order creation page and cart id is set
|
||||
if (Tools::isSubmit('addorder') && ($id_cart = Tools::getValue('cart_id'))) {
|
||||
// set smarty variables if new order creation process has errors
|
||||
$cart = new Cart($id_cart);
|
||||
$cart_order_exists = $cart->orderExists();
|
||||
if (!$cart_order_exists) {
|
||||
$this->context->cart = $cart;
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$objHotelCartBookingData->removeBackdateRoomsFromCart($this->context->cart->id);
|
||||
}
|
||||
|
||||
// validate cart for removing invalid data from cart before new order creation
|
||||
$this->errors = array_merge($this->errors, HotelCartBookingData::validateCartBookings());
|
||||
|
||||
$this->context->currency = new Currency((int)$cart->id_currency);
|
||||
$cart_detail_data = array();
|
||||
$cart_detail_data_obj = new HotelCartBookingData();
|
||||
@@ -420,61 +401,68 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->context->smarty->assign('cart_normal_data', $normalCartProduct);
|
||||
}
|
||||
|
||||
if (empty($cart_detail_data) && empty($normalCartProduct)) {
|
||||
// if no rooms added in the cart and user visits add order page then redirect to BOOK NOW page
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking'));
|
||||
}
|
||||
|
||||
$payment_modules = array();
|
||||
foreach (PaymentModule::getInstalledPaymentModules() as $p_module) {
|
||||
$payment_modules[] = Module::getInstanceById((int)$p_module['id_module']);
|
||||
}
|
||||
|
||||
$paymentTypes = array();
|
||||
foreach ($this->getPaymentsTypes() as $paymentType) {
|
||||
if ($paymentType['value'] != OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT) {
|
||||
$paymentTypes[] = $paymentType;
|
||||
}
|
||||
}
|
||||
|
||||
$occupancyRequiredForBooking = false;
|
||||
if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$occupancyRequiredForBooking = true;
|
||||
}
|
||||
|
||||
$objHotelAdvancedPayment = new HotelAdvancedPayment();
|
||||
$this->context->smarty->assign(array(
|
||||
'order_total' => $cart->getOrderTotal(true),
|
||||
'is_advance_payment_active' => $objHotelAdvancedPayment->isAdvancePaymentAvailableForCurrentCart(),
|
||||
'advance_payment_amount_without_tax' => $cart->getOrderTotal(false, Cart::ADVANCE_PAYMENT),
|
||||
'advance_payment_amount_with_tax' => $cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT),
|
||||
'cart' => $cart,
|
||||
'currencies' => Currency::getCurrenciesByIdShop(Context::getContext()->shop->id),
|
||||
'langs' => Language::getLanguages(true, Context::getContext()->shop->id),
|
||||
'payment_modules' => $payment_modules,
|
||||
'payment_types' => $paymentTypes,
|
||||
'currency' => new Currency((int)$cart->id_currency),
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
|
||||
));
|
||||
|
||||
if (empty($cart_detail_data) && empty($normalCartProduct)) {
|
||||
// if no rooms added in the cart and user visits add order page then redirect to BOOK NOW page
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking'));
|
||||
}
|
||||
} else {
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking'));
|
||||
}
|
||||
$this->context->smarty->assign('is_order_created', $cart_order_exists);
|
||||
} else {
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking'));
|
||||
}
|
||||
|
||||
//end
|
||||
parent::renderForm();
|
||||
unset($this->toolbar_btn['save']);
|
||||
$this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch'));
|
||||
|
||||
$payment_modules = array();
|
||||
foreach (PaymentModule::getInstalledPaymentModules() as $p_module) {
|
||||
$payment_modules[] = Module::getInstanceById((int)$p_module['id_module']);
|
||||
}
|
||||
|
||||
$paymentTypes = array();
|
||||
foreach ($this->getPaymentsTypes() as $paymentType) {
|
||||
if ($paymentType['value'] != OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT) {
|
||||
$paymentTypes[] = $paymentType;
|
||||
}
|
||||
}
|
||||
|
||||
$occupancyRequiredForBooking = false;
|
||||
if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$occupancyRequiredForBooking = true;
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'recyclable_pack' => (int)Configuration::get('PS_RECYCLABLE_PACK'),
|
||||
'gift_wrapping' => (int)Configuration::get('PS_GIFT_WRAPPING'),
|
||||
'cart' => $cart,
|
||||
'currencies' => Currency::getCurrenciesByIdShop(Context::getContext()->shop->id),
|
||||
'langs' => Language::getLanguages(true, Context::getContext()->shop->id),
|
||||
'payment_modules' => $payment_modules,
|
||||
'payment_types' => $paymentTypes,
|
||||
'show_toolbar' => $this->show_toolbar,
|
||||
'toolbar_btn' => $this->toolbar_btn,
|
||||
'toolbar_scroll' => $this->toolbar_scroll,
|
||||
'PS_CATALOG_MODE' => Configuration::get('PS_CATALOG_MODE'),
|
||||
'title' => array($this->l('Orders'), $this->l('Create order')),
|
||||
'currency' => new Currency((int)$cart->id_currency),
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
|
||||
));
|
||||
|
||||
$this->content .= $this->createTemplate('form.tpl')->fetch();
|
||||
}
|
||||
|
||||
@@ -482,44 +470,44 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
if ($this->display == 'view') {
|
||||
/** @var Order $order */
|
||||
$order = $this->loadObject();
|
||||
if (Validate::isLoadedObject($order = $this->loadObject())) {
|
||||
// hotel link in header
|
||||
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) {
|
||||
$this->toolbar_btn['hotel'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminAddHotel').'&id='.$idHotel.'&updatehtl_branch_info',
|
||||
'desc' => $this->l('View Hotel'),
|
||||
'class' => 'icon-building',
|
||||
'target' => true,
|
||||
);
|
||||
}
|
||||
|
||||
// hotel link in header
|
||||
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) {
|
||||
$this->toolbar_btn['hotel'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminAddHotel').'&id='.$idHotel.'&updatehtl_branch_info',
|
||||
'desc' => $this->l('View Hotel'),
|
||||
'class' => 'icon-building',
|
||||
'target' => true,
|
||||
if (Configuration::get('PS_INVOICE') && $order->hasInvoice() && !$this->lite_display) {
|
||||
$this->toolbar_btn['file'] = array(
|
||||
'short' => $this->l('Invoice'),
|
||||
'href' => $this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.$order->id,
|
||||
'desc' => $this->l('View invoice'),
|
||||
'class' => 'icon-file-text',
|
||||
'target' => true,
|
||||
);
|
||||
}
|
||||
|
||||
$this->toolbar_btn['print'] = array(
|
||||
'short' => $this->l('Print'),
|
||||
'href' => 'javascript:window.print()',
|
||||
'desc' => $this->l('Print order'),
|
||||
'class' => 'icon-print',
|
||||
);
|
||||
}
|
||||
|
||||
if (Configuration::get('PS_INVOICE') && $order->hasInvoice() && !$this->lite_display) {
|
||||
$this->toolbar_btn['file'] = array(
|
||||
'short' => $this->l('Invoice'),
|
||||
'href' => $this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.$order->id,
|
||||
'desc' => $this->l('View invoice'),
|
||||
'class' => 'icon-file-text',
|
||||
'target' => true,
|
||||
);
|
||||
}
|
||||
|
||||
$this->toolbar_btn['print'] = array(
|
||||
'short' => $this->l('Print'),
|
||||
'href' => 'javascript:window.print()',
|
||||
'desc' => $this->l('Print order'),
|
||||
'class' => 'icon-print',
|
||||
);
|
||||
|
||||
if (((int) $order->isReturnable()) && !$order->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG)) {
|
||||
$this->toolbar_btn['cancel'] = array(
|
||||
'short' => ((float) $order->getTotalPaid()) ? $this->l('Refund') : $this->l('Cancel'),
|
||||
'href' => '#refundForm',
|
||||
'id' => 'desc-order-standard_refund',
|
||||
'desc' => ((float) $order->getTotalPaid()) ? $this->l('Initiate refund') : $this->l('Cancel bookings'),
|
||||
'class' => 'icon-exchange',
|
||||
'target' => true,
|
||||
);
|
||||
if (((int) $order->isReturnable()) && !$order->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG)) {
|
||||
$this->toolbar_btn['cancel'] = array(
|
||||
'short' => ((float) $order->getTotalPaid()) ? $this->l('Refund') : $this->l('Cancel'),
|
||||
'href' => '#refundForm',
|
||||
'id' => 'desc-order-standard_refund',
|
||||
'desc' => ((float) $order->getTotalPaid()) ? $this->l('Initiate refund') : $this->l('Cancel bookings'),
|
||||
'class' => 'icon-exchange',
|
||||
'target' => true,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1623,7 +1611,22 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('The date is invalid');
|
||||
} elseif (!Validate::isUnsignedInt($payment_type)) {
|
||||
$this->errors[] = Tools::displayError('Payment source is invalid');
|
||||
} else {
|
||||
// Amount cannot be less than paid amount by guest in negative price
|
||||
} elseif ($amount < 0) {
|
||||
if ($currency->id == $order->id_currency) {
|
||||
if (($order->total_paid_real + $amount) < 0) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Amount cannot be less than -%s'), Tools::displayPrice($order->total_paid_real, new Currency($order->id_currency)));
|
||||
}
|
||||
} else {
|
||||
$convertedAmount = Tools::ps_round(Tools::convertPriceFull($amount, $currency, new Currency($order->id_currency)), 6);
|
||||
$convertedPaidAmount = Tools::ps_round(Tools::convertPriceFull($order->total_paid_real, new Currency($order->id_currency), $currency), 6);
|
||||
if (($order->total_paid_real + $convertedAmount) < 0) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Amount cannot be less than -%s (-%s)'), Tools::displayPrice($convertedPaidAmount, $currency), Tools::displayPrice($order->total_paid_real, new Currency($order->id_currency)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if (!$order->addOrderPayment(
|
||||
$amount,
|
||||
Tools::getValue('payment_method'),
|
||||
@@ -1648,16 +1651,20 @@ class AdminOrdersControllerCore extends AdminController
|
||||
} elseif (Tools::isSubmit('submitEditNote')) {
|
||||
$note = Tools::getValue('note');
|
||||
$order_invoice = new OrderInvoice((int)Tools::getValue('id_order_invoice'));
|
||||
if (Validate::isLoadedObject($order_invoice) && Validate::isCleanHtml($note)) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
$order_invoice->note = $note;
|
||||
if ($order_invoice->save()) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order_invoice->id_order.'&vieworder&conf=4&token='.$this->token);
|
||||
if (Validate::isLoadedObject($order_invoice)) {
|
||||
if (Validate::isCleanHtml($note)) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
$order_invoice->note = $note;
|
||||
if ($order_invoice->save()) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order_invoice->id_order.'&vieworder&conf=4&token='.$this->token);
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('The invoice note was not saved.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('The invoice note was not saved.');
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
$this->errors[] = Tools::displayError('Invalid note found.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('The invoice for edit note was unable to load. ');
|
||||
@@ -1666,6 +1673,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
$objCart = new Cart($id_cart);
|
||||
if (Validate::isLoadedObject($objCart)) {
|
||||
$this->context->cart = $objCart;
|
||||
|
||||
$this->errors = HotelCartBookingData::validateCartBookings();
|
||||
$orderTotal = $objCart->getOrderTotal(true, Cart::BOTH);
|
||||
if ($objCart->is_advance_payment) {
|
||||
$advancePaymentAmount = $objCart->getOrderTotal(true, Cart::ADVANCE_PAYMENT);
|
||||
@@ -1683,7 +1693,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($paymentAmount == '') {
|
||||
$this->errors[] = Tools::displayError('Please enter valid Payment amount of the order.');
|
||||
} elseif ($paymentAmount && !Validate::isPrice($paymentAmount)) {
|
||||
$this->errors[] = Tools::displayError('Payment amount is invalid. Please enter correct amount.');
|
||||
$this->errors[] = Tools::displayError('Payment amount is invalid. Please enter valid amount.');
|
||||
} else {
|
||||
$paymentAmount = (float) $paymentAmount;
|
||||
}
|
||||
@@ -1710,23 +1720,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// Validate if booking dates are allowed
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if ($cartBookingData = $objCartBookingData->getCartCurrentDataByCartId($cart->id)) {
|
||||
foreach ($cartBookingData as $cartRoom) {
|
||||
if (strtotime($cartRoom['date_from']) < strtotime(date('Y-m-d'))) {
|
||||
$this->errors[] = Tools::displayError('You cannot book rooms before today date.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$this->context->currency = new Currency((int) $objCart->id_currency);
|
||||
$this->context->customer = new Customer((int) $objCart->id_customer);
|
||||
@@ -1804,10 +1797,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($objPaymentModule->currentOrder) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$objPaymentModule->currentOrder.'&vieworder'.'&token='.$this->token.'&conf=3');
|
||||
}
|
||||
} else {
|
||||
// if errors render add order form
|
||||
$_GET['addorder'] = '1';
|
||||
$_GET['cart_id'] = $id_cart;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Cart can not be loaded.');
|
||||
@@ -2210,60 +2199,62 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('The discount type is invalid.');
|
||||
}
|
||||
|
||||
$res = true;
|
||||
foreach ($cart_rules as &$cart_rule) {
|
||||
$cartRuleObj = new CartRule();
|
||||
$cartRuleObj->date_from = date('Y-m-d H:i:s', strtotime('-1 hour', strtotime($order->date_add)));
|
||||
$cartRuleObj->date_to = date('Y-m-d H:i:s', strtotime('+1 hour'));
|
||||
$cartRuleObj->name[Configuration::get('PS_LANG_DEFAULT')] = Tools::getValue('discount_name');
|
||||
$cartRuleObj->quantity = 0;
|
||||
$cartRuleObj->quantity_per_user = 1;
|
||||
if (Tools::getValue('discount_type') == 1) {
|
||||
$cartRuleObj->reduction_percent = $discount_value;
|
||||
} elseif (Tools::getValue('discount_type') == 2) {
|
||||
$cartRuleObj->reduction_amount = $cart_rule['value_tax_excl'];
|
||||
} elseif (Tools::getValue('discount_type') == 3) {
|
||||
$cartRuleObj->free_shipping = 1;
|
||||
if (!count($this->errors)) {
|
||||
$res = true;
|
||||
foreach ($cart_rules as &$cart_rule) {
|
||||
$cartRuleObj = new CartRule();
|
||||
$cartRuleObj->date_from = date('Y-m-d H:i:s', strtotime('-1 hour', strtotime($order->date_add)));
|
||||
$cartRuleObj->date_to = date('Y-m-d H:i:s', strtotime('+1 hour'));
|
||||
$cartRuleObj->name[Configuration::get('PS_LANG_DEFAULT')] = Tools::getValue('discount_name');
|
||||
$cartRuleObj->quantity = 0;
|
||||
$cartRuleObj->quantity_per_user = 1;
|
||||
if (Tools::getValue('discount_type') == 1) {
|
||||
$cartRuleObj->reduction_percent = $discount_value;
|
||||
} elseif (Tools::getValue('discount_type') == 2) {
|
||||
$cartRuleObj->reduction_amount = $cart_rule['value_tax_excl'];
|
||||
} elseif (Tools::getValue('discount_type') == 3) {
|
||||
$cartRuleObj->free_shipping = 1;
|
||||
}
|
||||
$cartRuleObj->active = 0;
|
||||
if ($res = $cartRuleObj->add()) {
|
||||
$cart_rule['id'] = $cartRuleObj->id;
|
||||
$cart_rule['free_shipping'] = $cartRuleObj->free_shipping;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$cartRuleObj->active = 0;
|
||||
if ($res = $cartRuleObj->add()) {
|
||||
$cart_rule['id'] = $cartRuleObj->id;
|
||||
$cart_rule['free_shipping'] = $cartRuleObj->free_shipping;
|
||||
|
||||
if ($res) {
|
||||
foreach ($cart_rules as $id_order_invoice => $cart_rule) {
|
||||
// Create OrderCartRule
|
||||
$order_cart_rule = new OrderCartRule();
|
||||
$order_cart_rule->id_order = $order->id;
|
||||
$order_cart_rule->id_cart_rule = $cart_rule['id'];
|
||||
$order_cart_rule->id_order_invoice = $id_order_invoice;
|
||||
$order_cart_rule->name = Tools::getValue('discount_name');
|
||||
$order_cart_rule->value = $cart_rule['value_tax_incl'];
|
||||
$order_cart_rule->value_tax_excl = $cart_rule['value_tax_excl'];
|
||||
$order_cart_rule->free_shipping = $cart_rule['free_shipping'];
|
||||
$res &= $order_cart_rule->add();
|
||||
|
||||
$order->total_discounts = Tools::ps_round($order->total_discounts + $order_cart_rule->value, 6);
|
||||
$order->total_discounts_tax_incl = Tools::ps_round($order->total_discounts_tax_incl + $order_cart_rule->value, 6);
|
||||
$order->total_discounts_tax_excl = Tools::ps_round($order->total_discounts_tax_excl + $order_cart_rule->value_tax_excl, 6);
|
||||
$order->total_paid = Tools::ps_round($order->total_paid - $order_cart_rule->value, 6);
|
||||
$order->total_paid_tax_incl = Tools::ps_round($order->total_paid_tax_incl - $order_cart_rule->value, 6);
|
||||
$order->total_paid_tax_excl = Tools::ps_round($order->total_paid_tax_excl - $order_cart_rule->value_tax_excl, 6);
|
||||
}
|
||||
|
||||
// Update Order
|
||||
$res &= $order->update();
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||
} else {
|
||||
break;
|
||||
$this->errors[] = Tools::displayError('An error occurred during the OrderCartRule creation');
|
||||
}
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
foreach ($cart_rules as $id_order_invoice => $cart_rule) {
|
||||
// Create OrderCartRule
|
||||
$order_cart_rule = new OrderCartRule();
|
||||
$order_cart_rule->id_order = $order->id;
|
||||
$order_cart_rule->id_cart_rule = $cart_rule['id'];
|
||||
$order_cart_rule->id_order_invoice = $id_order_invoice;
|
||||
$order_cart_rule->name = Tools::getValue('discount_name');
|
||||
$order_cart_rule->value = $cart_rule['value_tax_incl'];
|
||||
$order_cart_rule->value_tax_excl = $cart_rule['value_tax_excl'];
|
||||
$order_cart_rule->free_shipping = $cart_rule['free_shipping'];
|
||||
$res &= $order_cart_rule->add();
|
||||
|
||||
$order->total_discounts += $order_cart_rule->value;
|
||||
$order->total_discounts_tax_incl += $order_cart_rule->value;
|
||||
$order->total_discounts_tax_excl += $order_cart_rule->value_tax_excl;
|
||||
$order->total_paid -= $order_cart_rule->value;
|
||||
$order->total_paid_tax_incl -= $order_cart_rule->value;
|
||||
$order->total_paid_tax_excl -= $order_cart_rule->value_tax_excl;
|
||||
}
|
||||
|
||||
// Update Order
|
||||
$res &= $order->update();
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred during the OrderCartRule creation');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
@@ -2422,7 +2413,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$dateFrom = date(Context::getContext()->language->date_format_lite, strtotime('-2 day'));
|
||||
$dateTo = date(Context::getContext()->language->date_format_lite, strtotime('-1 day'));
|
||||
$helper->subtitle = sprintf($this->l('From %s to %s', null, null, false), $dateFrom, $dateTo);
|
||||
$helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts';
|
||||
$helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts&date_from='.$dateFrom.'&date_to='.$dateTo;
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart';
|
||||
$helper->tooltip = $this->l('Total number of abandoned carts in given period of time.', null, null, false);
|
||||
$kpis[] = $helper;
|
||||
@@ -2475,9 +2466,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
$order = new Order(Tools::getValue('id_order'));
|
||||
if (!Validate::isLoadedObject($order)) {
|
||||
$this->errors[] = Tools::displayError('The order cannot be found within your database.');
|
||||
if (!Validate::isLoadedObject($order = new Order(Tools::getValue('id_order')))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->content .= $this->renderKpis();
|
||||
@@ -4760,47 +4750,47 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($order_detail->id_order_invoice != $order_invoice->id) {
|
||||
$old_order_invoice = new OrderInvoice($order_detail->id_order_invoice);
|
||||
// We remove cost of products
|
||||
$old_order_invoice->total_products -= $order_detail->total_price_tax_excl;
|
||||
$old_order_invoice->total_products_wt -= $order_detail->total_price_tax_incl;
|
||||
$old_order_invoice->total_products -= Tools::ps_round($order_detail->total_price_tax_excl, 6);
|
||||
$old_order_invoice->total_products_wt -= Tools::ps_round($order_detail->total_price_tax_incl, 6);
|
||||
|
||||
$old_order_invoice->total_paid_tax_excl -= $order_detail->total_price_tax_excl;
|
||||
$old_order_invoice->total_paid_tax_incl -= $order_detail->total_price_tax_incl;
|
||||
$old_order_invoice->total_paid_tax_excl -= Tools::ps_round($order_detail->total_price_tax_excl, 6);
|
||||
$old_order_invoice->total_paid_tax_incl -= Tools::ps_round($order_detail->total_price_tax_incl, 6);
|
||||
|
||||
$res &= $old_order_invoice->update();
|
||||
|
||||
$order_invoice->total_products += $order_detail->total_price_tax_excl;
|
||||
$order_invoice->total_products_wt += $order_detail->total_price_tax_incl;
|
||||
$order_invoice->total_products += Tools::ps_round($order_detail->total_price_tax_excl, 6);
|
||||
$order_invoice->total_products_wt += Tools::ps_round($order_detail->total_price_tax_incl, 6);
|
||||
|
||||
$order_invoice->total_paid_tax_excl += $order_detail->total_price_tax_excl;
|
||||
$order_invoice->total_paid_tax_incl += $order_detail->total_price_tax_incl;
|
||||
$order_invoice->total_paid_tax_excl += Tools::ps_round($order_detail->total_price_tax_excl, 6);
|
||||
$order_invoice->total_paid_tax_incl += Tools::ps_round($order_detail->total_price_tax_incl, 6);
|
||||
|
||||
$order_detail->id_order_invoice = $order_invoice->id;
|
||||
}
|
||||
}
|
||||
|
||||
if ($diff_price_tax_incl != 0 && $diff_price_tax_excl != 0) {
|
||||
$order_detail->unit_price_tax_excl = $product_price_tax_excl;
|
||||
$order_detail->unit_price_tax_incl = $product_price_tax_incl;
|
||||
$order_detail->unit_price_tax_excl = Tools::ps_round($product_price_tax_excl, 6);
|
||||
$order_detail->unit_price_tax_incl = Tools::ps_round($product_price_tax_incl, 6);
|
||||
|
||||
$order_detail->total_price_tax_incl += (float)$diff_price_tax_incl;
|
||||
$order_detail->total_price_tax_excl += (float)$diff_price_tax_excl;
|
||||
$order_detail->total_price_tax_incl += Tools::ps_round((float)$diff_price_tax_incl, 6);
|
||||
$order_detail->total_price_tax_excl += Tools::ps_round((float)$diff_price_tax_excl, 6);
|
||||
|
||||
if (isset($order_invoice)) {
|
||||
// Apply changes on OrderInvoice
|
||||
$order_invoice->total_products += (float)$diff_price_tax_excl;
|
||||
$order_invoice->total_products_wt += (float)$diff_price_tax_incl;
|
||||
$order_invoice->total_products += Tools::ps_round((float)$diff_price_tax_excl, 6);
|
||||
$order_invoice->total_products_wt += Tools::ps_round((float)$diff_price_tax_incl, 6);
|
||||
|
||||
$order_invoice->total_paid_tax_excl += (float)$diff_price_tax_excl;
|
||||
$order_invoice->total_paid_tax_incl += (float)$diff_price_tax_incl;
|
||||
$order_invoice->total_paid_tax_excl += Tools::ps_round((float)$diff_price_tax_excl, 6);
|
||||
$order_invoice->total_paid_tax_incl += Tools::ps_round((float)$diff_price_tax_incl, 6);
|
||||
}
|
||||
|
||||
// Apply changes on Order
|
||||
$order = new Order($order_detail->id_order);
|
||||
$order->total_products += (float)$diff_price_tax_excl;
|
||||
$order->total_products_wt += (float)$diff_price_tax_incl;
|
||||
$order->total_paid += (float)$diff_price_tax_incl;
|
||||
$order->total_paid_tax_excl += (float)$diff_price_tax_excl;
|
||||
$order->total_paid_tax_incl += (float)$diff_price_tax_incl;
|
||||
$order->total_products += Tools::ps_round((float)$diff_price_tax_excl, 6);
|
||||
$order->total_products_wt += Tools::ps_round((float)$diff_price_tax_incl, 6);
|
||||
$order->total_paid += Tools::ps_round((float)$diff_price_tax_incl, 6);
|
||||
$order->total_paid_tax_excl += Tools::ps_round((float)$diff_price_tax_excl, 6);
|
||||
$order->total_paid_tax_incl += Tools::ps_round((float)$diff_price_tax_incl, 6);
|
||||
|
||||
$res &= $order->update();
|
||||
}
|
||||
@@ -5364,8 +5354,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
} else {
|
||||
// Calculate differences of price (Before / After)
|
||||
|
||||
$order_detail->total_price_tax_incl -= $diff_products_tax_incl;
|
||||
$order_detail->total_price_tax_excl -= $diff_products_tax_excl;
|
||||
$order_detail->total_price_tax_incl -= Tools::ps_round($diff_products_tax_incl, 6);
|
||||
$order_detail->total_price_tax_excl -= Tools::ps_round($diff_products_tax_excl, 6);
|
||||
|
||||
$old_quantity = $order_detail->product_quantity;
|
||||
|
||||
@@ -5384,8 +5374,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($service['quantity'] >= $serviceOrderDetail->product_quantity) {
|
||||
$serviceOrderDetail->delete();
|
||||
} else {
|
||||
$order_detail->total_price_tax_incl -= $service['total_price_tax_incl'];
|
||||
$order_detail->total_price_tax_excl -= $service['total_price_tax_excl'];
|
||||
$order_detail->total_price_tax_incl -= Tools::ps_round($service['total_price_tax_incl'], 6);
|
||||
$order_detail->total_price_tax_excl -= Tools::ps_round($service['total_price_tax_excl'], 6);
|
||||
|
||||
$serviceOldQuantity = $serviceOrderDetail->product_quantity;
|
||||
$serviceOrderDetail->product_quantity = $serviceOldQuantity - $service['quantity'];
|
||||
@@ -5403,20 +5393,37 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($order_detail->id_order_invoice != 0) {
|
||||
// values changes as values are calculated accoding to the quantity of the product by webkul
|
||||
$order_invoice = new OrderInvoice($order_detail->id_order_invoice);
|
||||
$order_invoice->total_paid_tax_excl -= ($diff_products_tax_excl + $roomExtraDemandTE + $additionlServicesTE);
|
||||
$order_invoice->total_paid_tax_incl -= ($diff_products_tax_incl + $roomExtraDemandTI + $additionlServicesTI);
|
||||
$order_invoice->total_products -= $diff_products_tax_excl;
|
||||
$order_invoice->total_products_wt -= $diff_products_tax_incl;
|
||||
$order_invoice->total_paid_tax_excl -= Tools::ps_round(($diff_products_tax_excl + $roomExtraDemandTE + $additionlServicesTE), 6);
|
||||
$order_invoice->total_paid_tax_excl = $order_invoice->total_paid_tax_excl > 0 ? $order_invoice->total_paid_tax_excl : 0;
|
||||
|
||||
$order_invoice->total_paid_tax_incl -= Tools::ps_round(($diff_products_tax_incl + $roomExtraDemandTI + $additionlServicesTI), 6);
|
||||
$order_invoice->total_paid_tax_incl = $order_invoice->total_paid_tax_incl > 0 ? $order_invoice->total_paid_tax_incl : 0;
|
||||
|
||||
$order_invoice->total_products -= Tools::ps_round($diff_products_tax_excl, 6);
|
||||
$order_invoice->total_products = $order_invoice->total_products > 0 ? $order_invoice->total_products : 0;
|
||||
|
||||
$order_invoice->total_products_wt -= Tools::ps_round($diff_products_tax_incl, 6);
|
||||
$order_invoice->total_products_wt = $order_invoice->total_products_wt > 0 ? $order_invoice->total_products_wt : 0;
|
||||
|
||||
$res &= $order_invoice->update();
|
||||
}
|
||||
|
||||
// Update Order
|
||||
// values changes as values are calculated accoding to the quantity of the product by webkul
|
||||
$order->total_paid -= ($diff_products_tax_incl + $roomExtraDemandTI + $additionlServicesTI);
|
||||
$order->total_paid_tax_incl -= ($diff_products_tax_incl + $roomExtraDemandTI + $additionlServicesTI);
|
||||
$order->total_paid_tax_excl -= ($diff_products_tax_excl + $roomExtraDemandTE + $additionlServicesTE);
|
||||
$order->total_products -= ($diff_products_tax_excl + $additionlServicesTE);
|
||||
$order->total_products_wt -= ($diff_products_tax_incl + $additionlServicesTI);
|
||||
$order->total_paid -= Tools::ps_round(($diff_products_tax_incl + $roomExtraDemandTI + $additionlServicesTI), 6);
|
||||
$order->total_paid = $order->total_paid > 0 ? $order->total_paid : 0;
|
||||
|
||||
$order->total_paid_tax_incl -= Tools::ps_round(($diff_products_tax_incl + $roomExtraDemandTI + $additionlServicesTI), 6);
|
||||
$order->total_paid_tax_incl = $order->total_paid_tax_incl > 0 ? $order->total_paid_tax_incl : 0;
|
||||
|
||||
$order->total_paid_tax_excl -= Tools::ps_round(($diff_products_tax_excl + $roomExtraDemandTE + $additionlServicesTE), 6);
|
||||
$order->total_paid_tax_excl = $order->total_paid_tax_excl > 0 ? $order->total_paid_tax_excl : 0;
|
||||
|
||||
$order->total_products -= Tools::ps_round(($diff_products_tax_excl + $additionlServicesTE), 6);
|
||||
$order->total_products = $order->total_products > 0 ? $order->total_products : 0;
|
||||
|
||||
$order->total_products_wt -= Tools::ps_round(($diff_products_tax_incl + $additionlServicesTI), 6);
|
||||
$order->total_products_wt = $order->total_products_wt > 0 ? $order->total_products_wt : 0;
|
||||
|
||||
$res &= $order->update();
|
||||
|
||||
|
||||
@@ -3180,12 +3180,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
$objRoomTypeServiceProductPrice->id_element = $idProduct;
|
||||
$objRoomTypeServiceProductPrice->element_type = RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE;
|
||||
}
|
||||
|
||||
$objRoomTypeServiceProductPrice->price = $price;
|
||||
if ($idTaxRulesGroup) {
|
||||
$objRoomTypeServiceProductPrice->id_tax_rules_group = $idTaxRulesGroup;
|
||||
}
|
||||
|
||||
$objRoomTypeServiceProductPrice->id_tax_rules_group = $idTaxRulesGroup;
|
||||
$objRoomTypeServiceProductPrice->save();
|
||||
} else {
|
||||
// create new association
|
||||
@@ -3912,7 +3908,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
} else {
|
||||
$address->id_country = (int)$address_infos['id_country'];
|
||||
$address->id_state = (int)$address_infos['id_state'];
|
||||
$address->zipcode = $address_infos['postcode'];
|
||||
$address->postcode = $address_infos['postcode'];
|
||||
}
|
||||
|
||||
$tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true);
|
||||
|
||||
@@ -78,13 +78,15 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
return $visits;
|
||||
}
|
||||
|
||||
public static function getAbandonedCarts($date_from, $date_to)
|
||||
|
||||
public static function getAbandonedCarts($date_from, $date_to, $timeDiff = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(DISTINCT id_guest)
|
||||
FROM `'._DB_PREFIX_.'cart`
|
||||
WHERE `date_add` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"
|
||||
AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'orders` WHERE `'._DB_PREFIX_.'orders`.id_cart = `'._DB_PREFIX_.'cart`.id_cart)
|
||||
SELECT COUNT(`id_cart`)
|
||||
FROM `'._DB_PREFIX_.'cart` c
|
||||
WHERE `date_add` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"'.
|
||||
(($timeDiff) ? 'AND TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', `date_add`)) > '.$timeDiff : ' ').'
|
||||
AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'orders` o WHERE o.`id_cart` = c.`id_cart`)
|
||||
'.Shop::addSqlRestriction());
|
||||
}
|
||||
|
||||
@@ -638,7 +640,11 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
break;
|
||||
|
||||
case 'abandoned_cart':
|
||||
$value = AdminStatsController::getAbandonedCarts(date('Y-m-d H:i:s', strtotime('-2 day')), date('Y-m-d H:i:s', strtotime('-1 day')));
|
||||
$value = AdminStatsController::getAbandonedCarts(
|
||||
date('Y-m-d', strtotime('-2 day')).' 0:0:0',
|
||||
date('Y-m-d', strtotime('-1 day')).' 23:59:59',
|
||||
_TIME_1_DAY_
|
||||
);
|
||||
break;
|
||||
|
||||
case 'installed_modules':
|
||||
|
||||
@@ -438,6 +438,12 @@ class AuthControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('You must register at least one phone number.');
|
||||
}
|
||||
|
||||
if (!Tools::getValue('is_new_customer', 1)) {
|
||||
if ($idCustomer = Customer::customerExists(Tools::getValue('email'), true, false)) {
|
||||
$customer = new Customer($idCustomer);
|
||||
}
|
||||
}
|
||||
|
||||
$this->errors = array_unique(array_merge($this->errors, $customer->validateController()));
|
||||
|
||||
// Check the requires fields which are settings in the BO
|
||||
@@ -601,13 +607,7 @@ class AuthControllerCore extends FrontController
|
||||
$customer->active = 1;
|
||||
// New Guest customer
|
||||
if (Tools::isSubmit('is_new_customer')) {
|
||||
if (isset($idCustomer) && $idCustomer) {
|
||||
// update guest customer details
|
||||
$customer = new Customer($idCustomer);
|
||||
$customer->firstname = Tools::getValue('firstname');
|
||||
$customer->lastname = Tools::getValue('lastname');
|
||||
}
|
||||
$customer->is_guest = 1;
|
||||
$customer->is_guest = !Tools::getValue('is_new_customer', 1);
|
||||
} else {
|
||||
$customer->is_guest = 0;
|
||||
}
|
||||
|
||||
@@ -181,22 +181,6 @@ class CategoryControllerCore extends FrontController
|
||||
|
||||
$booking_data = $objBookingDetail->dataForFrontSearch($bookingParams);
|
||||
|
||||
// set default occupancies in required format
|
||||
if (isset($booking_data['rm_data']) && $booking_data['rm_data']) {
|
||||
foreach ($booking_data['rm_data'] as &$roomTypeData) {
|
||||
$occupancy = array(
|
||||
array(
|
||||
'adults' => $roomTypeData['adults'],
|
||||
'children' => 0,
|
||||
'child_ages' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
$roomTypeData['occupancies'] = $occupancy;
|
||||
$roomTypeData['occupancy_adults'] = $roomTypeData['adults']; // only one room by default
|
||||
}
|
||||
}
|
||||
|
||||
$obj_booking_detail = new HotelBookingDetail();
|
||||
$num_days = $obj_booking_detail->getNumberOfDays($date_from, $date_to);
|
||||
|
||||
|
||||
@@ -426,7 +426,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
public function initContent()
|
||||
{
|
||||
// validate room types before payment by customer
|
||||
$orderRestrictErr = HotelCartBookingData::validateCartBookings();
|
||||
$this->errors = HotelCartBookingData::validateCartBookings();
|
||||
|
||||
parent::initContent();
|
||||
|
||||
@@ -494,7 +494,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
// $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'orderRestrictErr' => $orderRestrictErr,
|
||||
'orderRestrictErr' => count($this->errors) ? 1 : 0,
|
||||
// 'allDemands' => $allDemands,
|
||||
// 'defaultcurrencySign' => $objCurrency->sign,
|
||||
'THEME_DIR' => _THEME_DIR_,
|
||||
|
||||
@@ -427,14 +427,27 @@ class ProductControllerCore extends FrontController
|
||||
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY) {
|
||||
$occupancy_value = 1;
|
||||
} else {
|
||||
$occupancy_value = array(
|
||||
array(
|
||||
'adults' => $room_info_by_product_id['adults'],
|
||||
'children' => 0,
|
||||
'child_ages' => array(),
|
||||
),
|
||||
);
|
||||
$useDefaultOccupancy = true;
|
||||
// if coming from hotel page do not set occupancy, otherwise set base adult occupancy
|
||||
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] == Tools::secureReferrer($_SERVER['HTTP_REFERER'])) { // Assure us the previous page was one of the site
|
||||
$idCategoryHotel = $hotel_branch_obj->id_category;
|
||||
$categoryPageLink = $this->context->link->getCategoryLink($idCategoryHotel);
|
||||
if (Tools::strpos($_SERVER['HTTP_REFERER'], $categoryPageLink) === 0) {
|
||||
$useDefaultOccupancy = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($useDefaultOccupancy) {
|
||||
$occupancy_value = array(
|
||||
array(
|
||||
'adults' => $room_info_by_product_id['adults'],
|
||||
'children' => 0,
|
||||
'child_ages' => array(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->assignBookingFormVars($this->product->id, $date_from, $date_to, $occupancy_value);
|
||||
$this->assignServiceProductVars();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Получено частично плащане</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>আংশিক পেমেন্ট প্রাপ্ত</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Pagamento parcial recebido</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Částečná platba přijata</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Teilzahlung erhalten</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Partial payment received</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Pago parcial recibido</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>پرداخت جزئی دریافت شد</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Paiement partiel reçu</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>תשלום חלקי התקבל</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Primljena djelomična uplata</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Részleges kifizetés megérkezett</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Pembayaran sebagian diterima</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Pagamento parziale ricevuto</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Gautas dalinis apmokėjimas</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Примено е делумно плаќање</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Gedeeltelijke betaling ontvangen</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Partial payment received</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Otrzymano częściową płatność</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Pagamento parcial recebido</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Paiement partiel reçu</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Plata parțială primită</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Частичная оплата получена</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>අර්ධ ගෙවීමක් ලැබී ඇත</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Делимична уплата примљена</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Delbetalning mottagen</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>已收到部分付款</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>Đã nhận được một phần thanh toán</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<name>已收到部分付款</name>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -90,10 +90,10 @@ div#leftpannel{
|
||||
}
|
||||
|
||||
div#buttons{
|
||||
clear:both;
|
||||
margin:0 0 0 295px;
|
||||
height:60px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
width:650px;
|
||||
padding:0 14px;
|
||||
}
|
||||
* html div#buttons {
|
||||
margin-bottom:60px;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
</div><!-- div id="sheet_step" -->
|
||||
</div><!-- div id="sheets" -->
|
||||
|
||||
<div id="buttons">
|
||||
<?php if (!$this->isLastStep()): ?>
|
||||
<?php if ($this->next_button): ?>
|
||||
<input id="btNext" class="button little" type="submit" name="submitNext" value="<?php echo $this->l('Next') ?>" />
|
||||
<?php else: ?>
|
||||
<input id="btNext" class="button little disabled" type="submit" name="submitNext" value="<?php echo $this->l('Next') ?>" disabled="disabled" />
|
||||
<div id="buttons" class="clearfix">
|
||||
<?php if (!$this->isLastStep()): ?>
|
||||
<?php if ($this->next_button): ?>
|
||||
<input id="btNext" class="button little" type="submit" name="submitNext" value="<?php echo $this->l('Next') ?>" />
|
||||
<?php else: ?>
|
||||
<input id="btNext" class="button little disabled" type="submit" name="submitNext" value="<?php echo $this->l('Next') ?>" disabled="disabled" />
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!$this->isFirstStep() && $this->previous_button): ?>
|
||||
<input id="btBack" class="button little" type="submit" name="submitPrevious" value="<?php echo $this->l('Back') ?>" />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (!$this->isFirstStep() && $this->previous_button): ?>
|
||||
<input id="btBack" class="button little" type="submit" name="submitPrevious" value="<?php echo $this->l('Back') ?>" />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div><!-- div id="sheets" -->
|
||||
</form>
|
||||
|
||||
<div id="phone_help">
|
||||
<?php echo sprintf($this->l('If you need some assistance, you can <a href="%1$s" onclick="return !window.open(this.href);">get tailored help</a> from our support team. <a href="%2$s" onclick="return !window.open(this.href);">The official documentation</a> is also here to guide you.'), $this->getTailoredHelp(), $this->getDocumentationLink()) ?>
|
||||
</div>
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Page content -->
|
||||
<form id="mainForm" action="index.php" method="post">
|
||||
<form id="mainForm" class="clearfix" action="index.php" method="post">
|
||||
<div id="sheets" class="sheet shown">
|
||||
<div id="sheet_<?php echo $this->step ?>" class="sheet shown clearfix">
|
||||
<div class="contentTitle">
|
||||
|
||||
@@ -2515,13 +2515,6 @@ const AddRoomBookingModal = {
|
||||
$('#new_product .booking_guest_occupancy').removeClass('disabled');
|
||||
setRoomTypeGuestOccupancy($('#new_product .booking_occupancy_wrapper'));
|
||||
}
|
||||
if (data.room_type_info) {
|
||||
$('#new_product .max_adults').val(data.room_type_info.max_adults);
|
||||
$('#new_product .max_children').val(data.room_type_info.max_children);
|
||||
$('#new_product .max_guests').val(data.room_type_info.max_guests);
|
||||
$('#new_product .num_adults').attr('max', data.room_type_info.max_adults);
|
||||
$('#new_product .num_children').attr('max', data.room_type_info.max_children);
|
||||
}
|
||||
|
||||
// Keep product variable
|
||||
current_product = data;
|
||||
|
||||
@@ -208,14 +208,16 @@ class Bankwire extends PaymentModule
|
||||
}
|
||||
|
||||
$objOrder = $params['objOrder'];
|
||||
$orderState = $objOrder->getCurrentState();
|
||||
$idOrderState = $objOrder->getCurrentState();
|
||||
$objOrderState = new OrderState($idOrderState);
|
||||
$history = $objOrder->getHistory($this->context->language->id);
|
||||
$initialStatus = array_pop($history);
|
||||
$smartyVars = array();
|
||||
if (in_array(
|
||||
$orderState,
|
||||
array(
|
||||
Configuration::get('PS_OS_AWAITING_PAYMENT'),
|
||||
if ($idOrderState == Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
|| ($objOrderState->logable
|
||||
&& $initialStatus['id_order_state'] == Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
)
|
||||
)) {
|
||||
) {
|
||||
$objCart = new Cart($objOrder->id_cart);
|
||||
if ($objCart->is_advance_payment) {
|
||||
$cartTotal = $objOrder->getOrdersTotalPaid(1);
|
||||
|
||||
@@ -478,6 +478,9 @@ var ajaxCart = {
|
||||
else
|
||||
$(callerElement).removeProp('disabled');
|
||||
}
|
||||
if (!addedFromProductPage) {
|
||||
resetOccupancyField($(callerElement).closest('.booking_room_fields').find('.booking_occupancy_wrapper'));
|
||||
}
|
||||
emptyCustomizations();
|
||||
|
||||
},
|
||||
|
||||
@@ -191,13 +191,15 @@ class Cheque extends PaymentModule
|
||||
return;
|
||||
}
|
||||
$objOrder = $params['objOrder'];
|
||||
$orderState = $objOrder->getCurrentState();
|
||||
if (in_array(
|
||||
$orderState,
|
||||
array(
|
||||
Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
)
|
||||
)) {
|
||||
$idOrderState = $objOrder->getCurrentState();
|
||||
$objOrderState = new OrderState($idOrderState);
|
||||
$history = $objOrder->getHistory($this->context->language->id);
|
||||
$initialStatus = array_pop($history);
|
||||
if ($idOrderState == Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
|| ($objOrderState->logable
|
||||
&& $initialStatus['id_order_state'] == Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
)
|
||||
) {
|
||||
$objCart = new Cart($objOrder->id_cart);
|
||||
if ($objCart->is_advance_payment) {
|
||||
$cartTotal = $objOrder->getOrdersTotalPaid(1);
|
||||
|
||||
@@ -248,7 +248,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
*/
|
||||
public function getCartCurrentDataByCartId($cart_id)
|
||||
{
|
||||
$result = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `id_cart`='.$cart_id);
|
||||
$result = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `id_cart`='.(int)$cart_id);
|
||||
if ($result) {
|
||||
return $result;
|
||||
} else {
|
||||
@@ -925,23 +925,34 @@ class HotelCartBookingData extends ObjectModel
|
||||
return true;
|
||||
}
|
||||
|
||||
// validate cart data if not available then remove from cart
|
||||
public static function validateCartBookings()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$errors = array();
|
||||
$objModule = Module::getInstanceByName('hotelreservationsystem');
|
||||
|
||||
// For admin cart validations use this variable
|
||||
$forAdminCart = 0;
|
||||
if (isset($context->employee->id)) {
|
||||
$forAdminCart = 1;
|
||||
}
|
||||
|
||||
// validate room types if bookable from front office
|
||||
if ($cartProducts = $context->cart->getProducts()) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
foreach ($cartProducts as $product) {
|
||||
if ($product['booking_product'] && !$product['show_at_front']) {
|
||||
$objHotelCartBookingData->deleteCartBookingData($context->cart->id, $product['id_product']);
|
||||
if (!$forAdminCart) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
foreach ($cartProducts as $product) {
|
||||
if ($product['booking_product'] && !$product['show_at_front']) {
|
||||
$objHotelCartBookingData->deleteCartBookingData($context->cart->id, $product['id_product']);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errors[] = $objModule->l('No booking found in the cart.', 'HotelOrderRestrictDate');
|
||||
}
|
||||
|
||||
// validate service products
|
||||
// validate service products if not active not then remove from cart
|
||||
if ($cartProducts = $context->cart->getProducts()) {
|
||||
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
|
||||
foreach ($cartProducts as $product) {
|
||||
@@ -954,8 +965,20 @@ class HotelCartBookingData extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
// for admin/employee remove bookings of the back dates from cart if not allowed
|
||||
if ($forAdminCart) {
|
||||
if ($context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$objHotelCartBookingData->removeBackdateRoomsFromCart($context->cart->id);
|
||||
}
|
||||
}
|
||||
|
||||
// validate room types for restriction date
|
||||
$objModule = Module::getInstanceByName('hotelreservationsystem');
|
||||
if ($cartProducts = $context->cart->getProducts()) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$objHotelBookingDetail = new HotelBookingDetail();
|
||||
@@ -977,43 +1000,43 @@ class HotelCartBookingData extends ObjectModel
|
||||
}
|
||||
|
||||
foreach ($cartData as $roomData) {
|
||||
if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) {
|
||||
if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from'])
|
||||
|| strtotime($maxOrderDate) < strtotime($roomData['date_to'])
|
||||
) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation(
|
||||
$roomData['id_hotel'],
|
||||
$context->language->id
|
||||
);
|
||||
$errors[] = sprintf(
|
||||
'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.',
|
||||
$objHotelBranchInformation->hotel_name,
|
||||
Tools::displayDate($maxOrderDate),
|
||||
Tools::displayDate($roomData['date_from']),
|
||||
Tools::displayDate($roomData['date_to'])
|
||||
);
|
||||
$error = true;
|
||||
if (!$forAdminCart) {
|
||||
if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) {
|
||||
if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from'])
|
||||
|| strtotime($maxOrderDate) < strtotime($roomData['date_to'])
|
||||
) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation(
|
||||
$roomData['id_hotel'],
|
||||
$context->language->id
|
||||
);
|
||||
$errors[] = sprintf(
|
||||
'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.',
|
||||
$objHotelBranchInformation->hotel_name,
|
||||
Tools::displayDate($maxOrderDate),
|
||||
Tools::displayDate($roomData['date_from']),
|
||||
Tools::displayDate($roomData['date_to'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']);
|
||||
if ($preparationTime !== false) {
|
||||
$minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
|
||||
if (strtotime($minOrderDate) > strtotime($roomData['date_from'])
|
||||
|| strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to'])
|
||||
) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation(
|
||||
$roomData['id_hotel'],
|
||||
$context->language->id
|
||||
);
|
||||
$errors[] = sprintf(
|
||||
'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.',
|
||||
$objHotelBranchInformation->hotel_name,
|
||||
Tools::displayDate($minOrderDate),
|
||||
Tools::displayDate($roomData['date_from']),
|
||||
Tools::displayDate($roomData['date_to'])
|
||||
);
|
||||
$error = true;
|
||||
$preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']);
|
||||
if ($preparationTime !== false) {
|
||||
$minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
|
||||
if (strtotime($minOrderDate) > strtotime($roomData['date_from'])
|
||||
|| strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to'])
|
||||
) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation(
|
||||
$roomData['id_hotel'],
|
||||
$context->language->id
|
||||
);
|
||||
$errors[] = sprintf(
|
||||
'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.',
|
||||
$objHotelBranchInformation->hotel_name,
|
||||
Tools::displayDate($minOrderDate),
|
||||
Tools::displayDate($roomData['date_from']),
|
||||
Tools::displayDate($roomData['date_to'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1025,32 +1048,27 @@ class HotelCartBookingData extends ObjectModel
|
||||
'only_search_data' => 1,
|
||||
);
|
||||
$bookingSearchData = $objHotelBookingDetail->dataForFrontSearch($bookingParams);
|
||||
$isRmBooked = 0;
|
||||
$isRoomBooked = 0;
|
||||
if (count($bookingSearchData['rm_data'][$product['id_product']]['data']['available']) < count($roomData['id_rms'])) {
|
||||
foreach ($roomData['id_rms'] as $searchRoomData) {
|
||||
if($isRmBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){
|
||||
if($isRoomBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($isRmBooked) {
|
||||
if ($isRoomBooked) {
|
||||
$errors[] = sprintf($objModule->l('The Room \'%s\' has been booked by another customer from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
|
||||
$error = true;
|
||||
} else {
|
||||
$errors[] = sprintf($objModule->l('The Room \'%s\' is no longer avalable from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error = true;
|
||||
$errors[] = $objModule->l('You can not book rooms from "', 'HotelOrderRestrictDate'). $product['name'] .$objModule->l('". Please remove rooms from "', 'HotelOrderRestrictDate'). $product['name'] . $objModule->l('" from cart to proceed.', 'HotelOrderRestrictDate');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$context->controller->errors = array_merge($context->controller->errors, $errors);
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
@@ -794,14 +794,14 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
* @param [int] $id_product [id of the product]
|
||||
* @return [array] [returns all feature prices by product]
|
||||
*/
|
||||
public function getFeaturePricesbyIdProduct($id_product)
|
||||
public function getFeaturePricesbyIdProduct($id_product, $id_cart = 0, $id_guest = 0, $id_room = 0)
|
||||
{
|
||||
$idLang = Context::getContext()->language->id;
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hrfp.*, hrfpl.`feature_price_name` FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` hrfp
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_lang` hrfpl
|
||||
ON(hrfp.`id_feature_price` = hrfpl.`id_feature_price` AND hrfpl.`id_lang` = '.(int)$idLang.')
|
||||
WHERE `id_product` = '.(int)$id_product
|
||||
WHERE `id_product` = '.(int)$id_product.' AND `id_cart` = '.(int)$id_cart.' AND `id_guest` = '.(int)$id_guest.' AND `id_room` = '.(int)$id_room
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
|
||||
)) {
|
||||
$updateQty = $product['quantity'];
|
||||
if (Product::getProductPriceCalculation($product['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData($idHtlCartData);
|
||||
$objHotelCartBookingData = new HotelCartBookingData($htlCartBookingId);
|
||||
$numdays = HotelHelper::getNumberOfDays($objHotelCartBookingData->date_from, $objHotelCartBookingData->date_to);
|
||||
$updateQty *= $numdays;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$objCart = new Cart($this->context->cookie->id_cart);
|
||||
if (Validate::isLoadedObject($objCart) && !$objCart->orderExists()) {
|
||||
$this->context->cart = $objCart;
|
||||
|
||||
// validate cart for removing invalid data from cart
|
||||
HotelCartBookingData::validateCartBookings();
|
||||
} else {
|
||||
$this->context->cookie->id_cart = 0; // remove invalid id_cart
|
||||
$this->context->cart = new Cart();
|
||||
@@ -63,15 +66,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$objCustomer->id_guest = (int) $this->context->cookie->id_guest;
|
||||
|
||||
$this->context->customer = $objCustomer;
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$htlCart = new HotelCartBookingData();
|
||||
$htlCart->removeBackdateRoomsFromCart($this->context->cart->id);
|
||||
}
|
||||
}
|
||||
|
||||
protected function createNewCart()
|
||||
@@ -819,19 +813,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
foreach ($booking_data['rm_data'] as $key_bk_data => $value_bk_data) {
|
||||
$booking_data['rm_data'][$key_bk_data]['room_type_info'] = $objHotelRoomType->getRoomTypeInfoByIdProduct($value_bk_data['id_product']);
|
||||
|
||||
// set default occupancies in required format
|
||||
$occupancy = array(
|
||||
array(
|
||||
'adults' => $value_bk_data['adults'],
|
||||
'children' => 0,
|
||||
'child_ages' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
$booking_data['rm_data'][$key_bk_data]['occupancies'] = $occupancy;
|
||||
$booking_data['rm_data'][$key_bk_data]['occupancy_adults'] = $booking_data['rm_data'][$key_bk_data]['adults']; // only one room by default
|
||||
|
||||
if (isset($value_bk_data['data']['booked']) && $value_bk_data['data']['booked']) {
|
||||
foreach ($value_bk_data['data']['booked'] as $booked_k1 => $booked_v1) {
|
||||
if (isset($booked_v1['detail']) && $booked_v1['detail']) {
|
||||
|
||||
@@ -150,18 +150,6 @@ class AdminHotelFeaturesController extends ModuleAdminController
|
||||
$this->errors[] = $this->l('Please add atleast one Child features.');
|
||||
}
|
||||
|
||||
foreach ($languages as $lang) {
|
||||
if (!trim(Tools::getValue('parent_ftr_name_'.$lang['id_lang']))) {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'parent_ftr_name_'.$defaultLangId
|
||||
);
|
||||
} else {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'parent_ftr_name_'.$lang['id_lang']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if (isset($parentFeatureId) && $parentFeatureId) {
|
||||
$objHotelFeatures = new HotelFeatures($parentFeatureId);
|
||||
@@ -297,13 +285,20 @@ class AdminHotelFeaturesController extends ModuleAdminController
|
||||
|
||||
public function ajaxProcessDeleteFeature()
|
||||
{
|
||||
$idFeature = Tools::getValue('feature_id');
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
if ($objHotelFeatures->deleteHotelFeatures($idFeature)) {
|
||||
die('success');
|
||||
$response = array('status' => false);
|
||||
if ($this->tabAccess['delete']) {
|
||||
$idFeature = Tools::getValue('feature_id');
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
if ($objHotelFeatures->deleteHotelFeatures($idFeature)) {
|
||||
$response['status'] = true;
|
||||
} else {
|
||||
$response['msg'] = $this->l('Some error occurred while deleting feature. Please try again.');
|
||||
}
|
||||
} else {
|
||||
echo 0;
|
||||
$response['msg'] = $this->l('You do not have the permission to delete this.');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
|
||||
@@ -493,7 +493,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
$cartrule->date_from = date('Y-m-d H:i:s', $now);
|
||||
$cartrule->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */
|
||||
$cartrule->active = 1;
|
||||
|
||||
$cartrule->highlight = 1;
|
||||
$cartrule->reduction_amount = $totalRefundedAmount;
|
||||
$cartrule->reduction_tax = true;
|
||||
$cartrule->minimum_amount_currency = $objOrder->id_currency;
|
||||
|
||||
@@ -463,12 +463,13 @@ $(document).ready(function() {
|
||||
action: 'deleteFeature',
|
||||
},
|
||||
method: 'POST',
|
||||
success: function(data) {
|
||||
if (data == 'success') {
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
alert(success_delete_msg);
|
||||
$('#grand_feature_div_' + ftr_id).remove();
|
||||
} else {
|
||||
alert(error_delete_msg);
|
||||
alert(response.msg);
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
|
||||
@@ -56,79 +56,40 @@
|
||||
<td class="booking_occupancy">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-default btn-left btn-block booking_guest_occupancy input-occupancy" type="button">
|
||||
<span>
|
||||
{if isset($book_v['occupancies']) && $book_v['occupancies']}
|
||||
{if (isset($book_v['occupancy_adults']) && $book_v['occupancy_adults'])}{$book_v['occupancy_adults']} {if $book_v['occupancy_adults'] > 1}{l s='Adults' mod='hotelreservationsystem'}{else}{l s='Adult' mod='hotelreservationsystem'}{/if}, {if isset($book_v['occupancy_children']) && $book_v['occupancy_children']}{$book_v['occupancy_children']} {if $book_v['occupancy_children'] > 1} {l s='Children' mod='hotelreservationsystem'}{else}{l s='Child' mod='hotelreservationsystem'}{/if}, {/if}{$book_v['occupancies']|count} {if $book_v['occupancies']|count > 1}{l s='Rooms' mod='hotelreservationsystem'}{else}{l s='Room' mod='hotelreservationsystem'}{/if}{else}{l s='1 Adult, 1 Room' mod='hotelreservationsystem'}{/if}
|
||||
{else}
|
||||
{l s='Select occupancy' mod='hotelreservationsystem'}
|
||||
{/if}
|
||||
</span>
|
||||
<span>{l s='Select occupancy' mod='hotelreservationsystem'}</span>
|
||||
</button>
|
||||
<div class="dropdown-menu booking_occupancy_wrapper well well-sm">
|
||||
<input type="hidden" class="max_adults" value="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
<input type="hidden" class="max_children" value="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{/if}">
|
||||
<input type="hidden" class="max_guests" value="{if isset($book_v)}{$book_v['max_guests']|escape:'html':'UTF-8'}{/if}">
|
||||
<div class="booking_occupancy_inner row">
|
||||
{if isset($book_v['occupancies']) && $book_v['occupancies']}
|
||||
{assign var=countRoom value=1}
|
||||
{foreach from=$book_v['occupancies'] key=key item=$occupancy name=occupancyInfo}
|
||||
<div class="occupancy_info_block selected col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][adults]" value="{$occupancy['adults']|escape:'htmlall':'UTF-8'}" min="1" data-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='Children' mod='hotelreservationsystem'} <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="{$occupancy['children']|escape:'htmlall':'UTF-8'}" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" data-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='Children' mod='hotelreservationsystem'} <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" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{assign var=countRoom value=$countRoom+1}
|
||||
{/foreach}
|
||||
{else}
|
||||
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" max="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <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' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{* <hr class="occupancy-info-separator"> *}
|
||||
</div>
|
||||
{/if}
|
||||
{* <hr class="occupancy-info-separator"> *}
|
||||
</div>
|
||||
</div>
|
||||
{* <div class="add_occupancy_block">
|
||||
<a class="add_new_occupancy_btn" href="#"><i class="icon-plus"></i> <span>{l s='Add Room'}</span></a>
|
||||
@@ -183,79 +144,40 @@
|
||||
<td class="booking_occupancy">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-default btn-left btn-block booking_guest_occupancy input-occupancy" type="button">
|
||||
<span>
|
||||
{if isset($book_v['occupancies']) && $book_v['occupancies']}
|
||||
{if (isset($book_v['occupancy_adults']) && $book_v['occupancy_adults'])}{$book_v['occupancy_adults']} {if $book_v['occupancy_adults'] > 1}{l s='Adults' mod='hotelreservationsystem'}{else}{l s='Adult' mod='hotelreservationsystem'}{/if}, {if isset($book_v['occupancy_children']) && $book_v['occupancy_children']}{$book_v['occupancy_children']} {if $book_v['occupancy_children'] > 1} {l s='Children' mod='hotelreservationsystem'}{else}{l s='Child' mod='hotelreservationsystem'}{/if}, {/if}{$book_v['occupancies']|count} {if $book_v['occupancies']|count > 1}{l s='Rooms' mod='hotelreservationsystem'}{else}{l s='Room' mod='hotelreservationsystem'}{/if}{else}{l s='1 Adult, 1 Room' mod='hotelreservationsystem'}{/if}
|
||||
{else}
|
||||
{l s='Select occupancy' mod='hotelreservationsystem'}
|
||||
{/if}
|
||||
</span>
|
||||
<span>{l s='Select occupancy' mod='hotelreservationsystem'}</span>
|
||||
</button>
|
||||
<div class="dropdown-menu booking_occupancy_wrapper well well-sm">
|
||||
<input type="hidden" class="max_adults" value="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
<input type="hidden" class="max_children" value="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{/if}">
|
||||
<input type="hidden" class="max_guests" value="{if isset($book_v)}{$book_v['max_guests']|escape:'html':'UTF-8'}{/if}">
|
||||
<div class="booking_occupancy_inner row">
|
||||
{if isset($book_v['occupancies']) && $book_v['occupancies']}
|
||||
{assign var=countRoom value=1}
|
||||
{foreach from=$book_v['occupancies'] key=key item=$occupancy name=occupancyInfo}
|
||||
<div class="occupancy_info_block selected col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][adults]" value="{$occupancy['adults']|escape:'htmlall':'UTF-8'}" min="1" data-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='Children' mod='hotelreservationsystem'} <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="{$occupancy['children']|escape:'htmlall':'UTF-8'}" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" data-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='Children' mod='hotelreservationsystem'} <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" data-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' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{assign var=countRoom value=$countRoom+1}
|
||||
{/foreach}
|
||||
{else}
|
||||
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" data-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='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{* <hr class="occupancy-info-separator"> *}
|
||||
</div>
|
||||
{/if}
|
||||
{* <hr class="occupancy-info-separator"> *}
|
||||
</div>
|
||||
</div>
|
||||
{* <div class="add_occupancy_block">
|
||||
<a class="add_new_occupancy_btn" href="#"><i class="icon-plus"></i> <span>{l s='Add Room'}</span></a>
|
||||
|
||||
@@ -188,13 +188,14 @@ class QloHotelReview extends Module
|
||||
if (QhrHotelReviewHelper::getIsReviewable($idOrder)
|
||||
&& !QhrHotelReview::getByIdOrder($idOrder)
|
||||
) {
|
||||
$hotel = QhrHotelReviewHelper::getHotelByOrder($idOrder);
|
||||
$this->smarty->assign(array(
|
||||
'id_order' => (int) $idOrder,
|
||||
'id_hotel' => $hotel['id_hotel'],
|
||||
'hotel_name' => $hotel['hotel_name'],
|
||||
));
|
||||
return $this->display(__FILE__, 'booking-action.tpl');
|
||||
if ($hotel = QhrHotelReviewHelper::getHotelByOrder($idOrder)) {
|
||||
$this->smarty->assign(array(
|
||||
'id_order' => (int) $idOrder,
|
||||
'id_hotel' => $hotel['id_hotel'],
|
||||
'hotel_name' => $hotel['hotel_name'],
|
||||
));
|
||||
return $this->display(__FILE__, 'booking-action.tpl');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,12 +109,12 @@ $(document).ready(function()
|
||||
$('.sort_btn_span').attr('data-sort-value', 0);
|
||||
|
||||
$('#gst_rating .sort_btn_span').html($('#gst_rating .sort_btn_span').attr('data-sort-for'));
|
||||
$('#price_ftr .sort_btn_span').html($('#price_ftr .sort_btn_span').attr('data-sort-for'));
|
||||
|
||||
// select btn data enter
|
||||
var sort_text = $(this).html();
|
||||
var dp_btn_span = $(this).parents('div.filter_dw_cont').find('button span.sort_btn_span');
|
||||
dp_btn_span.html(sort_text);
|
||||
dp_btn_span.attr('data-sort-for', sort_text);
|
||||
dp_btn_span.attr('data-sort-by', $(this).attr('data-sort-by'));
|
||||
dp_btn_span.attr('data-sort-value', $(this).attr('data-value'));
|
||||
|
||||
|
||||
@@ -29,11 +29,20 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
$this->bootstrap = true;
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$this->_select = ' pl.`name`, hbil.`hotel_name` ';
|
||||
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = a.`id_product` AND pl.id_lang = '.(int) $this->context->language->id.')';
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
ON (hrt.`id_product` = a.`id_product`)';
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil
|
||||
ON (hrt.`id_hotel` = hbil.`id` AND hbil.`id_lang` = pl.`id_lang`)';
|
||||
|
||||
$this->fields_options = array(
|
||||
'global' => array(
|
||||
'title' => $this->l('Hotel Room Display Setting'),
|
||||
'icon' => 'icon-cogs',
|
||||
'fields' => array(
|
||||
'title' => $this->l('Hotel Room Display Setting'),
|
||||
'icon' => 'icon-cogs',
|
||||
'fields' => array(
|
||||
'HOTEL_ROOM_DISPLAY_HEADING' => array(
|
||||
'title' => $this->l('Hotel Room Block Title'),
|
||||
'type' => 'textLang',
|
||||
@@ -73,6 +82,16 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
'search' => false,
|
||||
'callback' => 'getProductImage',
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Room Type'),
|
||||
'align' => 'center',
|
||||
'orderby' => false,
|
||||
),
|
||||
'hotel_name' => array(
|
||||
'title' => $this->l('Hotel'),
|
||||
'align' => 'center',
|
||||
'orderby' => false,
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Active'),
|
||||
'align' => 'center',
|
||||
@@ -109,6 +128,24 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
$this->identifier = 'id_room_block';
|
||||
|
||||
parent::__construct();
|
||||
if ($this->hotelList = HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1)) {
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
if ($this->loadObject(true)
|
||||
&& $this->object->id
|
||||
&& ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct((int) $this->object->id_product))
|
||||
) {
|
||||
$idsHotel = array_column($this->hotelList, 'id_hotel');
|
||||
if (!in_array($roomTypeInfo['id_hotel'], $idsHotel)) {
|
||||
$this->tabAccess['edit'] = 0;
|
||||
$this->tabAccess['view'] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($this->loadObject(true) && $this->object->id) {
|
||||
$this->tabAccess['view'] =0;
|
||||
$this->tabAccess['edit'] =0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getProductImage($idProduct)
|
||||
@@ -152,23 +189,27 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!($obj = $this->loadObject(true))) {
|
||||
if (!($this->loadObject(true))) {
|
||||
return;
|
||||
} else if (!$this->object->id && empty($this->hotelList)) {
|
||||
$this->warnings[] = $this->l('No hotel found to create new hotel room block.');
|
||||
return;
|
||||
}
|
||||
|
||||
$productName = $idProduct = false;
|
||||
|
||||
if ($this->display == 'edit') {
|
||||
$objRoomBlock = new WkHotelRoomDisplay($obj->id);
|
||||
$idProduct = $objRoomBlock->id_product;
|
||||
$productName = false;
|
||||
if ($idProduct = $this->object->id_product) {
|
||||
$product = new Product($idProduct, false, Configuration::get('PS_LANG_DEFAULT'));
|
||||
$productName = $product->name;
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct((int) $product->id)) {
|
||||
$this->fields_value['id_hotel'] = $roomInfo['id_hotel'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'productName' => $productName,
|
||||
'idProduct' => $idProduct,
|
||||
'idProduct' => $idProduct
|
||||
)
|
||||
);
|
||||
$html = $this->context->smarty->fetch(
|
||||
@@ -182,6 +223,19 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
'icon' => 'icon-globe'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Select hotel'),
|
||||
'name' => 'id_hotel',
|
||||
'required' => true,
|
||||
'class' => 'chosen',
|
||||
'options' => array(
|
||||
'query' => $this->hotelList,
|
||||
'id' => 'id_hotel',
|
||||
'name' => 'hotel_name'
|
||||
),
|
||||
'hint' => $this->l('Select the hotel to search for the room types.'),
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Search Room Type'),
|
||||
'type' => 'html',
|
||||
@@ -384,7 +438,7 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
if (isset($pos[2]) && (int) $pos[2] === $idRoomBlock) {
|
||||
if ($objRoomBlock = new WkHotelRoomDisplay((int) $pos[2])) {
|
||||
if (isset($position)
|
||||
&& $objRoomBlock->updatePosition($way, $position, $idRoomBlock)
|
||||
&& $objRoomBlock->updatePosition($way, $position)
|
||||
) {
|
||||
echo 'ok position '.(int) $position.' for hotel room block '.(int) $pos[1].'\r\n';
|
||||
} else {
|
||||
|
||||
@@ -32,27 +32,31 @@ $(document).ready(function() {
|
||||
var word = $(this).val();
|
||||
var d = new Date();
|
||||
var n = d.getTime();
|
||||
trigger_ajax = $.ajax({
|
||||
url: "ajax_products_list.php",
|
||||
dataType: 'json',
|
||||
data: {
|
||||
q: word,
|
||||
_: n,
|
||||
booking_product: '1',
|
||||
},
|
||||
success: function(result) {
|
||||
if (result) {
|
||||
var html = '';
|
||||
$.each(result, function(key, value) {
|
||||
html += '<li class="suggestion_li"><a class="suggestion_a text-capitalize" data-primary="' + value.id + '" data-secondary="' + value.name + '">' + value.name + '</a></li>';
|
||||
});
|
||||
suggestion_ul.html(html).show();
|
||||
} else {
|
||||
suggestion_ul.empty().hide();
|
||||
suggestion_ul.siblings("input#id_product").val(null);
|
||||
var id_hotel = parseInt($('#id_hotel').val());
|
||||
if (!isNaN(id_hotel)) {
|
||||
trigger_ajax = $.ajax({
|
||||
url: "ajax_products_list.php",
|
||||
dataType: 'json',
|
||||
data: {
|
||||
q: word,
|
||||
_: n,
|
||||
booking_product: '1',
|
||||
id_hotel: id_hotel
|
||||
},
|
||||
success: function(result) {
|
||||
if (result) {
|
||||
var html = '';
|
||||
$.each(result, function(key, value) {
|
||||
html += '<li class="suggestion_li"><a class="suggestion_a text-capitalize" data-primary="' + value.id + '" data-secondary="' + value.name + '">'+value.name+' (#'+value.id+')</a></li>';
|
||||
});
|
||||
suggestion_ul.html(html).show();
|
||||
} else {
|
||||
suggestion_ul.empty().hide();
|
||||
suggestion_ul.siblings("input#id_product").val(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -73,4 +77,9 @@ $(document).ready(function() {
|
||||
$('ul.prod_suggest_ul').empty().hide();
|
||||
}
|
||||
});
|
||||
$(document).on('change', '#id_hotel', function () {
|
||||
// resetting the fields on hotel change
|
||||
$('#id_product').val('');
|
||||
$('#productName').val('');
|
||||
});
|
||||
});
|
||||
@@ -159,11 +159,13 @@ class WkRoomSearchHelper
|
||||
$searchedData['location'] = $objLocationCategory->name;
|
||||
} else {
|
||||
$locationCategoryId = $objCategory->id_parent;
|
||||
$searchedData['location'] = $searchedData['htl_dtl']['city'];
|
||||
if (isset($searchedData['htl_dtl']['state_name'])) {
|
||||
$searchedData['location'] .= ', '.$searchedData['htl_dtl']['state_name'];
|
||||
if ($searchedData['htl_dtl']) {
|
||||
$searchedData['location'] = $searchedData['htl_dtl']['city'];
|
||||
if (isset($searchedData['htl_dtl']['state_name'])) {
|
||||
$searchedData['location'] .= ', '.$searchedData['htl_dtl']['state_name'];
|
||||
}
|
||||
$searchedData['location'] .= ', '.$searchedData['htl_dtl']['country_name'];
|
||||
}
|
||||
$searchedData['location'] .= ', '.$searchedData['htl_dtl']['country_name'];
|
||||
}
|
||||
$searchedData['location_category_id'] = $locationCategoryId;
|
||||
|
||||
|
||||
@@ -79,8 +79,6 @@
|
||||
{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict}
|
||||
{if isset($occupancy_required_for_booking) && $occupancy_required_for_booking}
|
||||
<div class="booking_guest_occupancy_conatiner">
|
||||
{assign var=occupancies value=$room_v['occupancies']}
|
||||
{assign var=occupancy_adults value=$room_v['occupancy_adults']}
|
||||
{include file="./occupancy_field.tpl" room_type_info=$room_v total_available_rooms=$room_v['room_left']}
|
||||
</div>
|
||||
{else}
|
||||
|
||||
@@ -32,10 +32,11 @@
|
||||
<div class="col-sm-3">
|
||||
<div class="filter_dw_cont">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="price_ftr" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="pull-left sort_btn_span" data-sort-by="0" data-sort-value="0" data-sort-for="{l s='Price'}">{l s='Price'}</span>
|
||||
<span class="pull-left sort_btn_span" data-sort-by="0" data-sort-value="0" data-sort-for="{l s='Recommended'}">{l s='Recommended'}</span>
|
||||
<span class="caret pull-right margin-top-7"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="price_ftr">
|
||||
<li><a href="#" class="sort_result" data-sort-by="0" data-value="0">{l s='Recommended'}</a></li>
|
||||
<li><a href="#" class="sort_result" data-sort-by="2" data-value="1">{l s='Price : Lowest First'}</a></li>
|
||||
<li><a href="#" class="sort_result" data-sort-by="2" data-value="2">{l s='Price : Highest first '}</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -86,10 +86,6 @@
|
||||
line-height: 27px;
|
||||
}
|
||||
|
||||
.card.card-toolbar .card-header {
|
||||
padding: 8px 18px;
|
||||
}
|
||||
|
||||
.card .card-subheader {
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
@@ -211,6 +207,10 @@
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.payment-details .detail-row .status .processing {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.hotel-location p.hotel-address {
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
@@ -251,6 +251,10 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.room-details .card-header .booking-actions-wrap {
|
||||
margin: -6px 0;
|
||||
}
|
||||
|
||||
.room-details .card-header .booking-actions-wrap .col-xs-12 {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
{/if}
|
||||
{if $discountDetail.reduction_amount > 0}
|
||||
{if $discountDetail.reduction_percent > 0} + {/if}
|
||||
{convertPrice price=$discountDetail.reduction_amount} ({if $discountDetail.reduction_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if})
|
||||
{displayPrice price=$discountDetail.reduction_amount currency=$discountDetail.reduction_currency} ({if $discountDetail.reduction_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if})
|
||||
{/if}
|
||||
{if $discountDetail.free_shipping}
|
||||
{if $discountDetail.reduction_percent > 0 || $discountDetail.reduction_amount > 0} + {/if}
|
||||
@@ -73,7 +73,7 @@
|
||||
{if $discountDetail.minimal == 0}
|
||||
{l s='None'}
|
||||
{else}
|
||||
{convertPrice price=$discountDetail.minimal} ({if $discountDetail.minimum_amount_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if})
|
||||
{displayPrice price=$discountDetail.minimal currency=$discountDetail.reduction_currency} ({if $discountDetail.minimum_amount_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if})
|
||||
{/if}
|
||||
</td>
|
||||
<td class="discount_cumulative">
|
||||
|
||||
@@ -478,6 +478,9 @@ var ajaxCart = {
|
||||
else
|
||||
$(callerElement).removeProp('disabled');
|
||||
}
|
||||
if (!addedFromProductPage) {
|
||||
resetOccupancyField($(callerElement).closest('.booking_room_fields').find('.booking_occupancy_wrapper'));
|
||||
}
|
||||
emptyCustomizations();
|
||||
|
||||
},
|
||||
|
||||
@@ -380,3 +380,19 @@ function getRoomTypeGuestOccupancyFormated(adults, children, rooms)
|
||||
return guestButtonVal;
|
||||
}
|
||||
|
||||
|
||||
function resetOccupancyField(booking_occupancy_wrapper)
|
||||
{
|
||||
$(booking_occupancy_wrapper).siblings('.booking_guest_occupancy').find('span').text(select_occupancy_txt);
|
||||
$(booking_occupancy_wrapper).find('.booking_occupancy_inner > div').each(function(index, element){
|
||||
let num_adults = $(booking_occupancy_wrapper).find('.base_adult').val();
|
||||
if (index == 0) {
|
||||
$(this).removeClass('selected');
|
||||
$(this).find('.num_adults').val(num_adults).siblings('.occupancy_count').find('span').text(num_adults);
|
||||
$(this).find('.num_children').val(0).siblings('.occupancy_count').find('span').text(0);
|
||||
$(this).find('.children_ages > div').remove();
|
||||
} else {
|
||||
$(element).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -116,13 +116,17 @@
|
||||
<div class="detail-row">
|
||||
<div class="pull-left title">{l s='Status'}</div>
|
||||
<div class="pull-right value status">
|
||||
<span{if isset($order_history[0].color) && $order_history[0].color} style="background-color:{$order_history[0].color|escape:'html':'UTF-8'}30; border: 1px solid {$order_history[0].color|escape:'html':'UTF-8'};" {/if} class="label">
|
||||
{if $order_history[0].id_order_state|in_array:$overbooking_order_states}
|
||||
{l s='Order Not Confirmed'}
|
||||
{else}
|
||||
{$order_history[0].ostate_name|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</span>
|
||||
{if isset($order_history[0]) && $order_history[0]}
|
||||
<span{if isset($order_history[0].color) && $order_history[0].color} style="background-color:{$order_history[0].color|escape:'html':'UTF-8'}30; border: 1px solid {$order_history[0].color|escape:'html':'UTF-8'};" {/if} class="label">
|
||||
{if $order_history[0].id_order_state|in_array:$overbooking_order_states}
|
||||
{l s='Order Not Confirmed'}
|
||||
{else}
|
||||
{$order_history[0].ostate_name|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</span>
|
||||
{else}
|
||||
<span class="processing">{l s='Processing'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -173,7 +177,7 @@
|
||||
{/if}
|
||||
|
||||
{hook h='displayOrderDetailRoomDetailsBefore' id_order=$order->id}
|
||||
<div class="card room-details card-toolbar">
|
||||
<div class="card room-details">
|
||||
<div class="card-header">
|
||||
{l s='Room Details'}
|
||||
<div class="booking-actions-wrap">
|
||||
@@ -499,13 +503,17 @@
|
||||
<div class="detail-row">
|
||||
<div class="pull-left title">{l s='Status'}</div>
|
||||
<div class="pull-right value status">
|
||||
<span{if isset($order_history[0].color) && $order_history[0].color} style="background-color:{$order_history[0].color|escape:'html':'UTF-8'}30; border: 1px solid {$order_history[0].color|escape:'html':'UTF-8'};" {/if} class="label">
|
||||
{if $order_history[0].id_order_state|in_array:$overbooking_order_states}
|
||||
{l s='Order Not Confirmed'}
|
||||
{else}
|
||||
{$order_history[0].ostate_name|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</span>
|
||||
{if isset($order_history[0]) && $order_history[0]}
|
||||
<span{if isset($order_history[0].color) && $order_history[0].color} style="background-color:{$order_history[0].color|escape:'html':'UTF-8'}30; border: 1px solid {$order_history[0].color|escape:'html':'UTF-8'};" {/if} class="label">
|
||||
{if $order_history[0].id_order_state|in_array:$overbooking_order_states}
|
||||
{l s='Order Not Confirmed'}
|
||||
{else}
|
||||
{$order_history[0].ostate_name|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</span>
|
||||
{else}
|
||||
<span class="processing">{l s='Processing'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -777,7 +785,10 @@
|
||||
{if $hotel_booking_detail.is_refunded || $hotel_booking_detail.is_cancelled}<span class="badge badge-danger badge-cancelled">{l s='Cancelled'}</span>{/if}
|
||||
</div>
|
||||
</div>
|
||||
{assign var='has_services' value=(isset($rm_v.additional_services) && isset($rm_v.additional_services[$hotel_booking_detail.id_room]) && isset($rm_v.additional_services[$hotel_booking_detail.id_room]['additional_services']))}
|
||||
|
||||
{* Services are indexed with id_htl_booking *}
|
||||
{assign var='has_services' value=(isset($rm_v.additional_services) && isset($rm_v.additional_services[$hotel_booking_detail.id_htl_booking]) && isset($rm_v.additional_services[$hotel_booking_detail.id_htl_booking]['additional_services']))}
|
||||
{* Additional Facilities are indexed with id_room *}
|
||||
{assign var='has_facilities' value=(isset($rm_v.extra_demands) && isset($rm_v.extra_demands[$hotel_booking_detail.id_room]) && isset($rm_v.extra_demands[$hotel_booking_detail.id_room]['extra_demands']))}
|
||||
{if $has_services || $has_facilities}
|
||||
<div class="extra-services-wrap clearfix">
|
||||
@@ -787,7 +798,7 @@
|
||||
<strong>{l s='Services'}</strong>
|
||||
</div>
|
||||
<div class="col-xs-9">
|
||||
{foreach from=$rm_v.additional_services[$hotel_booking_detail.id_room]['additional_services'] item=service}
|
||||
{foreach from=$rm_v.additional_services[$hotel_booking_detail.id_htl_booking]['additional_services'] item=service}
|
||||
<span class="service">{$service.name}</span>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user