Merge branch 'develop' into gli-1799
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);
|
||||
|
||||
|
||||
@@ -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="" />
|
||||
|
||||
@@ -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'])) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -449,7 +449,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
);
|
||||
|
||||
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $order->id_lang);
|
||||
$objHotelBranchInformation = new HotelBranchInformation($idHotel);
|
||||
$fields = array_merge(
|
||||
$objHotelBranchInformation->getFields(),
|
||||
$objHotelBranchInformation->getFieldsLang()[$order->id_lang],
|
||||
|
||||
@@ -45,8 +45,8 @@ class AdminCartsControllerCore extends AdminController
|
||||
|
||||
$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(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(o.`id_order`)) AS filter_ids_order,
|
||||
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(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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -470,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,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1611,6 +1611,9 @@ 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');
|
||||
// Amount cannot be less than paid amount by guest in negative price
|
||||
} elseif ($amount < 0 && ($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 {
|
||||
if (!$order->addOrderPayment(
|
||||
$amount,
|
||||
@@ -1636,16 +1639,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. ');
|
||||
@@ -2445,9 +2452,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();
|
||||
@@ -4730,47 +4736,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();
|
||||
}
|
||||
@@ -5334,8 +5340,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;
|
||||
|
||||
@@ -5354,8 +5360,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'];
|
||||
@@ -5373,20 +5379,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();
|
||||
|
||||
|
||||
@@ -1089,16 +1089,18 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$id_product = Tools::getValue('id_product');
|
||||
|
||||
$id_adv_pmt = Tools::getValue('id_adv_pmt');
|
||||
if ($id_adv_pmt) {
|
||||
$obj_adv_pmt = new HotelAdvancedPayment($id_adv_pmt);
|
||||
} else {
|
||||
$obj_adv_pmt = new HotelAdvancedPayment();
|
||||
if ($adv_pmt_info = $obj_adv_pmt->getIdAdvPaymentByIdProduct($id_product)) {
|
||||
// To prevent duplication from two separate tabs
|
||||
$obj_adv_pmt = new HotelAdvancedPayment((int) $adv_pmt_info['id']);
|
||||
}
|
||||
}
|
||||
|
||||
$adv_payment_active = Tools::getValue('adv_payment_active');
|
||||
|
||||
$obj_adv_pmt->id_product = $id_product;
|
||||
$obj_adv_pmt->active = $adv_payment_active;
|
||||
|
||||
@@ -3178,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
|
||||
@@ -3910,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);
|
||||
|
||||
@@ -92,10 +92,11 @@ class GuestTrackingControllerCore extends FrontController
|
||||
$customer = new Customer((int)$order->id_customer);
|
||||
if (!Validate::isLoadedObject($customer)) {
|
||||
$this->errors[] = Tools::displayError('Invalid customer');
|
||||
} elseif (!Tools::getValue('password')) {
|
||||
} elseif (!Tools::getValue('password')
|
||||
|| !Validate::isPasswd(Tools::getValue('password')
|
||||
)) {
|
||||
$this->errors[] = Tools::displayError('Invalid password.');
|
||||
} elseif (!$customer->transformToCustomer($this->context->language->id, Tools::getValue('password'))) {
|
||||
// @todo clarify error message
|
||||
$this->errors[] = Tools::displayError('An error occurred while transforming a guest into a registered customer.');
|
||||
} else {
|
||||
$this->context->smarty->assign('transformSuccess', true);
|
||||
|
||||
@@ -173,7 +173,9 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$customer = new Customer($this->context->customer->id);
|
||||
if ($customer->transformToCustomer($this->context->language->id, $passwd)) {
|
||||
if (!$customer->isGuest()) {
|
||||
$this->errors[] = Tools::displayError('This account is already registered as a customer.');
|
||||
} else if ($customer->transformToCustomer($this->context->language->id, $passwd)) {
|
||||
$this->context->updateCustomer($customer);
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while transforming your account into a registered customer.');
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -68,7 +68,7 @@ class HotelAdvancedPayment extends ObjectModel
|
||||
*/
|
||||
public function getIdAdvPaymentByIdProduct($id_product)
|
||||
{
|
||||
$result = Db::getInstance()->getRow("SELECT * FROM `"._DB_PREFIX_."htl_advance_payment` WHERE `id_product`=".$id_product);
|
||||
$result = Db::getInstance()->getRow("SELECT * FROM `"._DB_PREFIX_."htl_advance_payment` WHERE `id_product`=".(int) $id_product);
|
||||
|
||||
if ($result) {
|
||||
return $result;
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="copyRightWrapper">
|
||||
<p class="copyRight">
|
||||
© {$WK_HTL_ESTABLISHMENT_YEAR}-{'Y'|date} <a href="{$base_dir}"> {$WK_HTL_CHAIN_NAME}</a>. {l s=' All rights reserved.' mod='hotelreservationsystem'}
|
||||
©{if isset($WK_HTL_ESTABLISHMENT_YEAR) && $WK_HTL_ESTABLISHMENT_YEAR} {$WK_HTL_ESTABLISHMENT_YEAR}-{'Y'|date} {/if}<a href="{$base_dir}"> {$WK_HTL_CHAIN_NAME}</a>. {l s=' All rights reserved.' mod='hotelreservationsystem'}
|
||||
</p>
|
||||
</div>
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user