Merge branch 'develop' into gli-2206

This commit is contained in:
vishalsingh.qlo325
2025-02-21 15:50:59 +05:30
37 changed files with 236 additions and 145 deletions

View File

@@ -101,8 +101,10 @@
</td>
<td class="col-sm-1 center">
{if isset($room_info['id'])}
<input type="hidden" class="booked-dates" name="{$var_name_room_info|cat:'[booked_dates]'}" value="{$room_info['booked_dates']|escape:'html':'UTF-8'}">
<a href="#" class="view_htl_room btn btn-default" data-toggle="modal" data-target="#room-dates-modal" data-id-room="{$room_info['id']}"><i class="icon-info"></i></a>
{if $room_info['booked_dates']}
<input type="hidden" class="booked-dates" name="{$var_name_room_info|cat:'[booked_dates]'}" value='{$room_info['booked_dates']|json_encode|escape:'html':'UTF-8'}'>
<a href="#" class="view_htl_room btn btn-default" data-toggle="modal" data-target="#room-dates-modal" data-id-room="{$room_info['id']}"><i class="icon-info"></i></a>
{/if}
<a href="#" class="rm_htl_room btn btn-default" data-id-htl-info="{$room_info['id']}"><i class="icon-trash"></i></a>
<input type="hidden" name="{$var_name_room_info|cat:'[id]'}" value="{$room_info['id']}">
{else}
@@ -564,15 +566,19 @@
if (confirm(confirmText)) {
var calendarEventId = parseInt($(this).parent().find('.fc-event-title').attr('data-id_calendar_event'));
var calendarEvent = DisableDatesCalendar.getEventById(calendarEventId);
if (DisableDatesObj.deleteDisableDate(calendarEvent.extendedProps.id_disable_date)) {
$('#disable_dates_full_calendar .id_calendar_event_'+calendarEventId).find('.fc-event-main-frame').tooltip('destroy');
calendarEvent.remove();
var formEventId = parseInt($('#disable_dates_form .id_calendar_event').val());
if (!isNaN(formEventId) && formEventId == eventId) {
DisableDatesForm.resetForm();
DisableDatesForm.hideForm();
}
}
$('#disable_dates_full_calendar .id_calendar_event_'+calendarEventId).find('.fc-event-main-frame').tooltip('hide');
DisableDatesObj.deleteDisableDate(calendarEvent.extendedProps.id_disable_date)
.then(function(response) {
if (response) {
$('#disable_dates_full_calendar .id_calendar_event_'+calendarEventId).find('.fc-event-main-frame').tooltip('destroy');
calendarEvent.remove();
var formEventId = parseInt($('#disable_dates_form .id_calendar_event').val());
if (!isNaN(formEventId) && formEventId == eventId) {
DisableDatesForm.resetForm();
DisableDatesForm.hideForm();
}
}
});
}
});
@@ -1188,20 +1194,24 @@
},
// This is called to delete the disable date object using the idDisableDate.
deleteDisableDate: function(idDisableDate) {
$.ajax({
url: prod_link,
type: 'POST',
data: {
ajax: true,
action: 'deleteDisableDate',
id_disable_date : idDisableDate,
},
dataType: 'JSON',
success: function(response) {
DisableDatesForm.showMessages(response.msg);
return response.status;
}
return new Promise(function(resolve, reject) {
$.ajax({
url: prod_link,
type: 'POST',
data: {
ajax: true,
action: 'deleteDisableDate',
id_disable_date : idDisableDate,
},
dataType: 'JSON',
success: function(response) {
DisableDatesForm.showMessages(response.msg);
resolve(response.status)
},
error: function(xhr, status, error) {
reject(error);
}
})
});
},
// This is called to get the all disable dates from the calander.

View File

@@ -27,5 +27,7 @@ class BoOrder extends PaymentModule
{
$this->displayName = $this->l('Back office order');
$this->validateOrderAmount = false;
// Default payment type for backoffice order should be PAY_AT_HOTEL
$this->payment_type = OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL;
}
}

View File

@@ -782,10 +782,8 @@ class CartCore extends ObjectModel
$unitPriceByProductTaxExcl = $objHotelServiceProductCartDetail->getHotelProductUnitPrice($this->id, (int)$row['id_product'], 0, false);
// Rounding as per configurations
$row['total'] += Tools::processPriceRounding($unitPriceByProductTaxExcl, $row['cart_quantity']);
$row['total_wt'] += Tools::processPriceRounding($unitPriceByProductTaxIncl, $row['cart_quantity']);
$row['price_wt'] = $row['price_with_reduction'];
$row['total'] = Tools::processPriceRounding($unitPriceByProductTaxExcl, $row['cart_quantity']);
$row['total_wt'] = Tools::processPriceRounding($unitPriceByProductTaxIncl, $row['cart_quantity']);
}
/*END*/
@@ -3849,7 +3847,7 @@ class CartCore extends ObjectModel
$product['advanced_stock_management'] && (bool)Context::getContext()->customer->isLogged() && ($delivery = $this->getDeliveryOption()) && !empty($delivery)) {
$product['stock_quantity'] = StockManager::getStockByCarrier((int)$product['id_product'], (int)$product['id_product_attribute'], $delivery);
}
if (!$product['active'] || !$product['available_for_order']
if (!$product['active'] || (!$product['auto_add_to_cart'] && !$product['available_for_order'])
|| (!$product['allow_oosp'] && $product['stock_quantity'] < $product['cart_quantity'])) {
return $return_product ? $product : false;
}

35
classes/FreeOrder.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License version 3.0
* that is bundled with this package in the file LICENSE.md
* It is also available through the world-wide-web at this URL:
* https://opensource.org/license/osl-3-0-php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to support@qloapps.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to a newer
* versions in the future. If you wish to customize this module for your needs
* please refer to https://store.webkul.com/customisation-guidelines for more information.
*
* @author Webkul IN
* @copyright Since 2010 Webkul
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*/
class FreeOrder extends PaymentModule
{
public $active = 1;
public $name = 'free_order';
public function __construct()
{
// Default payment type for Free order should be online
$this->displayName = $this->l('Free order');
$this->payment_type = OrderPayment::PAYMENT_TYPE_ONLINE;
}
}

View File

@@ -976,9 +976,6 @@ abstract class PaymentModuleCore extends Module
}
}
// delete cart feature prices after booking creation success
HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart);
if (self::DEBUG_MODE) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Hook validateOrder is about to be called', 1, null, 'Cart', (int)$id_cart, true);
}
@@ -1006,7 +1003,11 @@ abstract class PaymentModuleCore extends Module
$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
if ($send_mails) {
// Emails regarding awaiting payment should not be sent to customers if the payment amount in the order is 0.
$sendOrderStatusMail = (($id_order_state == Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT') || $id_order_state == Configuration::get('PS_OS_AWAITING_PAYMENT')) && $order->total_paid > 0) ? true : false;
if ($send_mails && $sendOrderStatusMail) {
$new_history->addWithemail(true, $extra_vars);
} else {
$new_history->add(true);
@@ -1382,6 +1383,9 @@ abstract class PaymentModuleCore extends Module
}
} // End foreach $order_detail_list
// delete cart feature prices after booking creation success
HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart);
if (count($cart_rules)) {
foreach ($cart_rules as $idCartRule => $cartRule) {

View File

@@ -3191,8 +3191,6 @@ abstract class ModuleCore
// Make a reflection of the override class and the module override class
$overrideClassFileArray = file($overrideClassFilePath);
$moduleClassFileArray = array_diff($moduleClassFileArray, array("\n")); // remove empty lines from array
eval(
preg_replace(
array(
@@ -3209,6 +3207,7 @@ abstract class ModuleCore
$reflectionClassOverride = new ReflectionClass($overrideClassName.'Original_remove'.$uniq);
$moduleClassFileArray = file($this->getLocalPath().'override/'.$parentClassFilePath);
$moduleClassFileArray = array_diff($moduleClassFileArray, array("\n")); // remove empty lines from array
eval(
preg_replace(
array(

View File

@@ -2737,7 +2737,10 @@ class OrderCore extends ObjectModel
$objHotelBooking = new HotelBookingDetail();
$objCurrentOrderState = $this->getCurrentOrderState();
if ($objCurrentOrderState->id == Configuration::get('PS_OS_REFUND')) {
// if new status is partial payment then do not allow if no entry is done for the payment in that order
if (($objNewOrderState->id == Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED')) && $this->total_paid_real <= 0) {
$result['errors'][] = Tools::displayError('The order status cannot be changed to Partial payment received until at least one partial payment has been made for this order.');
} elseif ($objCurrentOrderState->id == Configuration::get('PS_OS_REFUND')) {
$result['errors'][] = Tools::displayError('Order status can not be changed once order status is set to Refunded.');
} elseif ($objCurrentOrderState->id == Configuration::get('PS_OS_CANCELED')) {
$result['errors'][] = Tools::displayError('Order status can not be changed once order status is set to Cancelled.');

View File

@@ -473,7 +473,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$fullDate = ($this->context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to']))) ? true : false);
$fullDate = (isset($this->context->controller->show_full_date) && $this->context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to'])))) ? true : false;
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from'], null, $fullDate);
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to'], null, $fullDate);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;

View File

@@ -3499,7 +3499,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$orderData['date_to'],
$orderData['id_room'],
0,
$useTax
$useTax,
null
)) {
$roomInfo['services'] = array();
foreach ($additionalServices as $additionalService) {

View File

@@ -305,6 +305,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
case 'stores':
case 'features':
case 'hotels':
case 'extra_services':
case 'room_types':
switch ($this->wsObject->urlSegment[1]) {
case 'categories':
@@ -325,6 +326,9 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
case 'room_types':
$directory = _PS_PROD_IMG_DIR_;
break;
case 'extra_services':
$directory = _PS_PROD_IMG_DIR_;
break;
case 'hotels':
$directory = _PS_HOTEL_IMG_DIR_;
break;
@@ -622,7 +626,6 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
}
}
$available_image_ids = array_unique($available_image_ids, SORT_NUMERIC);
if ($this->wsObject->urlSegment[3] != '') {
if ($this->wsObject->urlSegment[3] == 'bin') {
$hotelCoverImage = HotelImage::getCover($object_id);
@@ -873,6 +876,9 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
if ($this->imageType == 'products') {
$image = new Image((int)$this->wsObject->urlSegment[3]);
return $image->delete();
} if ($this->imageType == 'hotels') {
$image = new HotelImage((int)$this->wsObject->urlSegment[3]);
return $image->deleteImage();
} elseif ($filename_exists) {
if (in_array($this->imageType, array('categories', 'manufacturers', 'suppliers', 'stores'))) {
/** @var ObjectModel $object */
@@ -888,7 +894,6 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
break;
// Add the image
case 'POST':
if ($filename_exists) {
throw new WebserviceException('This image already exists. To modify it, please use the PUT method', array(65, 400));
} else {
@@ -1123,7 +1128,6 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
throw new WebserviceException('Please set an "image" parameter with image data for value', array(76, 400));
}
} elseif ($this->wsObject->method == 'POST') {
if (isset($_FILES['image']['tmp_name']) && $_FILES['image']['tmp_name']) {
$file = $_FILES['image'];
@@ -1134,7 +1138,6 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
if ($error = ImageManager::validateUpload($file)) {
throw new WebserviceException('Image upload error : '.$error, array(76, 400));
}
if (isset($file['tmp_name']) && $file['tmp_name'] != null) {
if ($this->imageType == 'products') {
$product = new Product((int)$this->wsObject->urlSegment[2]);
@@ -1191,6 +1194,23 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
$this->output = $this->objOutput->renderEntity($image, 1);
$image_content = array('sqlId' => 'content', 'value' => base64_encode(file_get_contents($this->imgToDisplay)), 'encode' => 'base64');
$this->output .= $this->objOutput->objectRender->renderField($image_content);
} if ($this->imageType == 'hotels') {
$objHotelBranchInfo = new HotelBranchInformation((int)$this->wsObject->urlSegment[2]);
if (!Validate::isLoadedObject($objHotelBranchInfo)) {
throw new WebserviceException('Hotel '.(int)$this->wsObject->urlSegment[2].' does not exist', array(76, 400));
}
$objHotelImage = new HotelImage();
$addedImage = $objHotelImage->uploadHotelImages($file, $objHotelBranchInfo->id);
if (isset($addedImage['id'])) {
$objHotelImage = new HotelImage($addedImage['id']);
$this->imgToDisplay = _PS_HOTEL_IMG_DIR_.$objHotelImage->getImagePath().'.'.$objHotelImage->image_format;
$this->objOutput->setFieldsToDisplay('full');
$this->output = $this->objOutput->renderEntity($objHotelImage, 1);
$image_content = array('sqlId' => 'content', 'value' => base64_encode(file_get_contents($this->imgToDisplay)), 'encode' => 'base64');
$this->output .= $this->objOutput->objectRender->renderField($image_content);
} else {
throw new WebserviceException('An error occurred during the image upload', array(76, 400));
}
} elseif (in_array($this->imageType, array('categories', 'manufacturers', 'suppliers', 'stores'))) {
if (!($tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($file['tmp_name'], $tmp_name)) {
throw new WebserviceException('An error occurred during the image upload', array(76, 400));

View File

@@ -447,7 +447,6 @@ class AdminCustomersControllerCore extends AdminController
'type' => 'password',
'label' => $this->l('Password'),
'name' => 'passwd',
'required' => ($obj->id ? false : true),
'col' => '4',
'hint' => ($obj->id ? $this->l('Leave this field blank if there\'s no change.') :
sprintf($this->l('Password should be at least %s characters long.'), Validate::PASSWORD_LENGTH))
@@ -1088,6 +1087,10 @@ class AdminCustomersControllerCore extends AdminController
// Check that the new email is not already in use
$customer_email = trim(strval(Tools::getValue('email')));
$customer = new Customer();
if (trim(Tools::getValue('passwd')) == '') {
$_POST['passwd'] = md5(time()._COOKIE_KEY_);
}
if (Validate::isEmail($customer_email)) {
$customer->getByEmail($customer_email);
if ($customer->id) {
@@ -1097,10 +1100,6 @@ class AdminCustomersControllerCore extends AdminController
} elseif (Customer::customerExists($customer_email, false, false)) {
$this->errors[] = Tools::displayError('The email is already associated with a banned account. Please use a different one.');
$this->display = 'edit';
} elseif (trim(Tools::getValue('passwd')) == '') {
$this->validateRules();
$this->errors[] = Tools::displayError('Password can not be empty.');
$this->display = 'edit';
} elseif ($customer = parent::processAdd()) {
$this->context->smarty->assign('new_customer', $customer);
return $customer;

View File

@@ -230,7 +230,7 @@ class AdminImportControllerCore extends AdminController
'no' => array('label' => $this->l('Ignore this column')),
'room_num' => array('label' => $this->l('Room No *'),),
'floor' => array('label' => $this->l('Floor')),
'id_product' => array('label' => $this->l('Product ID *')),
'id_product' => array('label' => $this->l('Room Type ID *')),
'id_status' => array(
'label' => $this->l('Room status (1/2/3)'),
'help' => $this->l('1 = Active, 2 = Inactive, 3 = Temporarily Inactive')),
@@ -2043,7 +2043,7 @@ class AdminImportControllerCore extends AdminController
}
} else {
$this->errors[] = sprintf(
Tools::displayError('Invalid ID Product for %1$s (ID: %2$s).'),
Tools::displayError('Invalid ID Room Type for %1$s (ID: %2$s).'),
(isset($info['room_num']) && !empty($info['room_num']))? Tools::safeOutput($info['room_num']) : 'No Name',
(isset($info['id']) && !empty($info['id']))? Tools::safeOutput($info['id']) : 'No ID'
);

View File

@@ -437,6 +437,7 @@ class AdminOrdersControllerCore extends AdminController
'langs' => Language::getLanguages(true, Context::getContext()->shop->id),
'payment_modules' => $payment_modules,
'payment_types' => $paymentTypes,
'PAYMENT_TYPE_PAY_AT_HOTEL' => OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL,
'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'),
@@ -1750,18 +1751,15 @@ class AdminOrdersControllerCore extends AdminController
// Set transaction ID
$extraVars = $paymentTransactionId ? array('transaction_id' => $paymentTransactionId) : array();
} else {
$objPaymentModule = new FreeOrder();
// Set order state
if ($objCart->is_advance_payment) {
if ($advancePaymentAmount <= $orderTotal) {
$idOrderState = Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
} else {
$objPaymentModule->name = 'free_order';
$objPaymentModule->displayName = $this->l('Free order');
$idOrderState = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
}
} else {
$objPaymentModule->name = 'free_order';
$objPaymentModule->displayName = $this->l('Free order');
$idOrderState = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
}
@@ -6063,16 +6061,16 @@ class AdminOrdersControllerCore extends AdminController
protected function getPaymentsTypes()
{
return array(
OrderPayment::PAYMENT_TYPE_ONLINE => array(
'key' => 'PAYMENT_TYPE_ONLINE',
'value' => OrderPayment::PAYMENT_TYPE_ONLINE,
'name' => $this->l('Online')
),
OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL => array(
'key' => 'PAYMENT_TYPE_PAY_AT_HOTEL',
'value' => OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL,
'name' => $this->l('Pay at hotel')
),
OrderPayment::PAYMENT_TYPE_ONLINE => array(
'key' => 'PAYMENT_TYPE_ONLINE',
'value' => OrderPayment::PAYMENT_TYPE_ONLINE,
'name' => $this->l('Online')
),
OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT => array(
'key' => 'PAYMENT_TYPE_REMOTE_PAYMENT',
'value' => OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT,
@@ -6142,7 +6140,10 @@ class AdminOrdersControllerCore extends AdminController
if ($deleted) {
HotelRoomTypeFeaturePricing::deleteByIdCart($cart_id, $id_product, $room_id, $dt_frm, $dt_to );
$obj_product_process = new HotelCartBookingData();
$num_cart_rooms = $obj_product_process->getCountRoomsByIdCartIdProduct($cart_id, $id_product, $dt_frm, $dt_to);
$num_cart_rooms = 0;
if ($rooms = $obj_hotel_cart_detail->getCartCurrentDataByCartId($cart_id)) {
$num_cart_rooms = count($rooms);
}
$numDays = HotelHelper::getNumberOfDays($dt_frm, $dt_to);
$changed = $obj_product_process->changeProductDataByRoomId($room_id, $id_product, $numDays, $cart_id);

View File

@@ -2959,21 +2959,21 @@ class AdminProductsControllerCore extends AdminController
$data->assign('htl_full_info', $hotelFullInfo);
$objRoomDisableDates = new HotelRoomDisableDates();
$hotelRoomInfo = $objRoomInfo->getHotelRoomInfo($obj->id, $hotelRoomType['id_hotel']);
if ($hotelRoomInfo) {
if ($hotelRoomInfo = $objRoomInfo->getHotelRoomInfo($obj->id, $hotelRoomType['id_hotel'])) {
foreach ($hotelRoomInfo as &$room) {
$bookedDates = $objRoomInfo->getFutureBookings($room['id']);
foreach($bookedDates as &$bookedDate) {
$bookedDate['date_from_formatted'] = Tools::displayDate($bookedDate['date_from']);
$bookedDate['date_to_formatted'] = Tools::displayDate($bookedDate['date_to']);
}
$room['booked_dates'] = json_encode($bookedDates);
$room['booked_dates'] = $bookedDates;
if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disableDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
$room['disable_dates_json'] = json_encode($disableDates);
}
}
$data->assign('htl_room_info', $hotelRoomInfo);
}
}
@@ -3556,7 +3556,7 @@ class AdminProductsControllerCore extends AdminController
$this->errors[] = sprintf(Tools::displayError('Please add disable dates for room %s.'), $roomIndex);
}
}
Hook::exec('actionValidateRoomInformation', array('room_information', $roomInfo));
Hook::exec('actionValidateRoomInformation', array('room_information' => $roomInfo));
}
} else {
$this->errors[] = Tools::displayError('Please add at least one room.');
@@ -5070,7 +5070,7 @@ class AdminProductsControllerCore extends AdminController
'date_to' => $dateTo,
'id_room' => $idRoom
);
Hook::exec('actionRoomDisableDatesRemoveBefore', array('disable_dates', $params));
Hook::exec('actionRoomDisableDatesRemoveBefore', array('disable_dates' => $params));
if (empty($this->errors)
&& ($disableDates = $objRoomDisableDates->checkIfRoomAlreadyDisabled($params))
) {
@@ -5150,7 +5150,7 @@ class AdminProductsControllerCore extends AdminController
$response = array('status' => false);
if ($this->tabAccess['edit'] === '1') {
$idDisableDate = Tools::getValue('id_disable_date');
Hook::exec('actionDisableDateDeleteBefore', array('id_disable_date', $idDisableDate));
Hook::exec('actionDisableDateDeleteBefore', array('id_disable_date' => $idDisableDate));
if (empty($this->errors)
&& (int) $idDisableDate
&& Validate::isLoadedObject($objRoomDisableDates = new HotelRoomDisableDates($idDisableDate))

View File

@@ -608,31 +608,30 @@ class GuestTrackingControllerCore extends FrontController
// load Google Maps library if configured
if (!count($this->errors)) {
$ordersCollection = Order::getByReference(Tools::getValue('order_reference'));
if ($objOrder = $ordersCollection->getFirst()) {
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($objOrder->id)) {
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
if (Validate::isLoadedObject($objHotelBranchInformation)) {
if (($apiKey = Configuration::get('PS_API_KEY'))
&& Configuration::get('WK_GOOGLE_ACTIVE_MAP')
) {
if (floatval($objHotelBranchInformation->latitude) != 0
&& floatval($objHotelBranchInformation->longitude) != 0
if ($ordersCollection = Order::getByReference(Tools::getValue('order_reference'))) {
foreach ($ordersCollection as $objOrder) {
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($objOrder->id)) {
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
if (Validate::isLoadedObject($objHotelBranchInformation)) {
if (($apiKey = Configuration::get('PS_API_KEY'))
&& Configuration::get('WK_GOOGLE_ACTIVE_MAP')
) {
Media::addJsDef(array(
'hotel_location' => array(
'latitude' => $objHotelBranchInformation->latitude,
'longitude' => $objHotelBranchInformation->longitude,
'map_input_text' => $objHotelBranchInformation->map_input_text,
),
'hotel_name' => $objHotelBranchInformation->hotel_name,
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON'))
));
if (floatval($objHotelBranchInformation->latitude) != 0
&& floatval($objHotelBranchInformation->longitude) != 0
) {
Media::addJsDef(array(
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
'initiateMap' => 1,
));
$this->addJS(
'https://maps.googleapis.com/maps/api/js?key='.$apiKey.'&libraries=places&language='.
$this->context->language->iso_code.'&region='.$this->context->country->iso_code
);
$this->addJS(
'https://maps.googleapis.com/maps/api/js?key='.$apiKey.'&libraries=places&language='.
$this->context->language->iso_code.'&region='.$this->context->country->iso_code
);
// just need to load the map once for the first order with map details. So break the loop.
break;
}
}
}
}

View File

@@ -805,13 +805,8 @@ class OrderDetailControllerCore extends FrontController
&& floatval($objHotelBranchInformation->longitude) != 0
) {
Media::addJsDef(array(
'hotel_location' => array(
'latitude' => $objHotelBranchInformation->latitude,
'longitude' => $objHotelBranchInformation->longitude,
'map_input_text' => $objHotelBranchInformation->map_input_text,
),
'hotel_name' => $objHotelBranchInformation->hotel_name,
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON'))
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
'initiateMap' => 1,
));
$this->addJS(

View File

@@ -126,7 +126,7 @@ class OrderOpcControllerCore extends ParentOrderController
} elseif (Tools::strlen($phone) > $rules['size']['phone']) {
$this->errors[] = sprintf(Tools::displayError('Mobile phone number is too long. (%s chars max).'), $rules['size']['phone']);
} else {
$this->context->customer = $phone;
$this->context->customer->phone = $phone;
}
$_POST['lastname'] = $_POST['customer_lastname'];
@@ -692,7 +692,7 @@ class OrderOpcControllerCore extends ParentOrderController
'id_country' => (int)$address_delivery->id_country,
'id_state' => (int)$address_delivery->id_state,
'id_gender' => (int)$customer->id_gender,
'phone' => (int)$customer->phone,
'phone' => $customer->phone,
'sl_year' => $birthday[0],
'sl_month' => $birthday[1],
'sl_day' => $birthday[2],

View File

@@ -24,16 +24,6 @@
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* Class FreeOrder to use PaymentModule (abstract class, cannot be instancied)
*/
class FreeOrder extends PaymentModule
{
public $active = 1;
public $name = 'free_order';
public $displayName = 'free_order';
}
class ParentOrderControllerCore extends FrontController
{
public $ssl = true;
@@ -187,7 +177,7 @@ class ParentOrderControllerCore extends FrontController
$orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
}
$order->validateOrder($this->context->cart->id, $orderStatus, 0, Tools::displayError('Free order', false), null, array(), null, false, $this->context->cart->secure_key);
$order->validateOrder($this->context->cart->id, $orderStatus, 0, $order->displayName, null, array(), null, false, $this->context->cart->secure_key);
return (int)Order::getOrderByCartId($this->context->cart->id);
}
return false;

View File

@@ -1,3 +1,3 @@
Product ID;Active(0/1);Name;Hotel ID;Pre-Tax Retail Price;Pre-Tax Operating Cost;Tax Rule ID;Allow Advance Payment;Room Type Advance Payement (0/1/2);Advance Payment Value;Include Tax With Advance Payment;Minimum Lenght Of Stay;Maximum Lenght Of Stay;Base Adults;Base Children;Maximum Adults;Maximum Children;Maximmum Guest;Show At Front;Additional Facilities IDs;Service Products IDs (x, y, z...);Feature IDs (x, y, z...);Short Description;Description;Meta Title;Meta Keywords;Meta Description;URL Rewritten;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes)
ID;Active(0/1);Name;Hotel ID;Pre-Tax Retail Price;Pre-Tax Operating Cost;Tax Rule ID;Allow Advance Payment;Room Type Advance Payement (0/1/2);Advance Payment Value;Include Tax With Advance Payment;Minimum Lenght Of Stay;Maximum Lenght Of Stay;Base Adults;Base Children;Maximum Adults;Maximum Children;Maximmum Guest;Show At Front;Additional Facilities IDs;Service Products IDs (x, y, z...);Feature IDs (x, y, z...);Short Description;Description;Meta Title;Meta Keywords;Meta Description;URL Rewritten;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes)
6;1;The Sunshine Luxury;1;2200;0;1;1;1;10;0;1;0;2;0;2;2;4;1;1;12;1,2,3,4;The Sunshine Luxury;The Sunshine Luxury;;;;the-sunshine-luxury;http://localhost/hotelcommerce/img/p/4/4.jpg;0
10;1;King Premium Rooms;1;3200;0;1;;0;;;2;7;2;0;2;2;4;1;;;1,2,3,4;King Premium Rooms;King Premium Rooms;;;;king-premium-rooms;http://localhost/hotelcommerce/img/p/3/3.jpg;0
1 Product ID ID Active(0/1) Name Hotel ID Pre-Tax Retail Price Pre-Tax Operating Cost Tax Rule ID Allow Advance Payment Room Type Advance Payement (0/1/2) Advance Payment Value Include Tax With Advance Payment Minimum Lenght Of Stay Maximum Lenght Of Stay Base Adults Base Children Maximum Adults Maximum Children Maximmum Guest Show At Front Additional Facilities IDs Service Products IDs (x, y, z...) Feature IDs (x, y, z...) Short Description Description Meta Title Meta Keywords Meta Description URL Rewritten Image URLs (x,y,z...) Delete Existing Images (0 = No, 1 = Yes)
2 6 6 1 The Sunshine Luxury 1 2200 0 1 1 1 10 0 1 0 2 0 2 2 4 1 1 12 1,2,3,4 The Sunshine Luxury The Sunshine Luxury the-sunshine-luxury http://localhost/hotelcommerce/img/p/4/4.jpg 0
3 10 10 1 King Premium Rooms 1 3200 0 1 0 2 7 2 0 2 2 4 1 1,2,3,4 King Premium Rooms King Premium Rooms king-premium-rooms http://localhost/hotelcommerce/img/p/3/3.jpg 0

View File

@@ -1,3 +1,3 @@
Room No;Floor;Product ID;Room Status (1 = Active, 2 = Inactive, 3 = Temporarily Inactive);Extra Information;Disabled Dates And Reason Incase Of Temporary Inactive
Room No;Floor;Room Type ID;Room Status (1 = Active, 2 = Inactive, 3 = Temporarily Inactive);Extra Information;Disabled Dates And Reason Incase Of Temporary Inactive
GR-109;First;1;3;Newly added room;2024-01-01:2024-01-02:Reason1, 2023-02-03:2023-02-02:Reason2
DR-107;First;2;1;;
1 Room No Floor Product ID Room Type ID Room Status (1 = Active, 2 = Inactive, 3 = Temporarily Inactive) Extra Information Disabled Dates And Reason Incase Of Temporary Inactive
2 GR-109 First 1 1 3 Newly added room 2024-01-01:2024-01-02:Reason1, 2023-02-03:2023-02-02:Reason2
3 DR-107 First 2 2 1

View File

@@ -130,7 +130,7 @@
</content>
<link_rewrite>terms-and-conditions-of-use</link_rewrite>
</cms>
<cms id="Legal_Notice">
<cms id="About_us">
<meta_title>Právní upozornění</meta_title>
<meta_description>Právní upozornění</meta_description>
<meta_keywords>upozornění, právní, autorská práva</meta_keywords>

View File

@@ -93,7 +93,7 @@
</content>
<link_rewrite>note-legali</link_rewrite>
</cms>
<cms id='Terms_and_conditions_of_use'>
<cms id="Terms_and_conditions_of_use">
<meta_title>Condizioni d'Uso</meta_title>
<meta_description>Le nostre Condizioni d'Uso</meta_description>
<meta_keywords>condizioni, termini, utilizzo, vendita</meta_keywords>

View File

@@ -94,7 +94,7 @@
</content>
<link_rewrite>legal-notice</link_rewrite>
</cms>
<cms id="Terms_and_Conditions">
<cms id="Terms_and_conditions_of_use">
<meta_title>Điều khoản và Điều kiện</meta_title>
<meta_description>Điều khoản và điều kiện của chúng tôi</meta_description>
<meta_keywords>điều khoản, điều kiện, sử dụng, bán hàng</meta_keywords>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 194 KiB

View File

@@ -87,7 +87,7 @@ const RoomReallocationModal = {
// For Rooms Swapping
var json_arr_rm_swp = roomObj.data('avail_rm_swap');
if (roomObj.data('avail_rm_swap') != 'false' && json_arr_rm_swp.length != 0) {
if (json_arr_rm_swp != false && json_arr_rm_swp.length != 0) {
html = '<select class="form-control" name="swap_avail_rooms" id="swap_avail_rooms">';
$.each(json_arr_rm_swp, function(key,val) {
html += '<option class="swp_rm_opts" value="'+val.id_hotel_booking+'" >'+val.room_num+'</option>';
@@ -101,7 +101,7 @@ const RoomReallocationModal = {
// For Rooms Reallocation
var json_arr_realloc_room_types = roomObj.data('avail_realloc_room_types');
if (roomObj.data('avail_realloc_room_types') != 'false' && json_arr_realloc_room_types.length != 0) {
if (json_arr_realloc_room_types != false && json_arr_realloc_room_types.length != 0) {
var idCurrentRoomType = roomObj.data('id_room_type');
var roomsTypesHtml = '<select data-id_htl_booking="' + roomObj.data('id_htl_booking') + '" class="form-control" name="realloc_avail_room_type" id="realloc_avail_room_type">';
$.each(json_arr_realloc_room_types, function(key, room_type) {

View File

@@ -103,8 +103,8 @@ class HotelBookingDemands extends ObjectModel
$sql .= ' AND hb.`id_room`='.(int)$idRoom;
}
if ($dateFrom && $dateTo) {
$dateFrom = date('Y-m-d', strtotime($dateFrom));
$dateTo = date('Y-m-d', strtotime($dateTo));
$dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom));
$dateTo = date('Y-m-d H:i:s', strtotime($dateTo));
$sql .= ' AND hb.`date_from`=\''.pSQL($dateFrom).'\' AND hb.`date_to`= \''.pSQL($dateTo).'\'';
}

View File

@@ -2369,8 +2369,12 @@ class HotelBookingDetail extends ObjectModel
if (Validate::isLoadedObject($objHotelCartBookingFrom = new HotelCartBookingData($cartBookingInfoFrom['id']))
&& Validate::isLoadedObject($objHotelCartBookingTo = new HotelCartBookingData($cartBookingInfoTo['id']))
) {
$objHotelCartBookingFrom->id_room = $objHotelCartBookingTo->id_room;
$objHotelCartBookingTo->id_room = $objHotelCartBookingFrom->id_room;
$idRoomFrom = $objHotelCartBookingFrom->id_room;
$idRoomTo = $objHotelCartBookingTo->id_room;
$objHotelCartBookingFrom->id_room = $idRoomTo;
$objHotelCartBookingTo->id_room = $idRoomFrom;
$result &= $objHotelCartBookingFrom->save();
$result &= $objHotelCartBookingTo->save();
}
@@ -2396,7 +2400,6 @@ class HotelBookingDetail extends ObjectModel
$result &= $objHotelBookingFrom->save();
$result &= $objHotelBookingTo->save();
if ($result) {
Hook::exec(
'actionRoomSwapAfter',

View File

@@ -1032,9 +1032,7 @@ class HotelCartBookingData extends ObjectModel
$minBookingOffset = HotelOrderRestrictDate::getMinBookingOffset($roomData['id_hotel']);
if ($minBookingOffset !== false) {
$minOrderDate = date('Y-m-d', strtotime('+'. ($minBookingOffset) .' days'));
if (strtotime($minOrderDate) > strtotime($roomData['date_from'])
|| strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to'])
) {
if (strtotime($minOrderDate) > strtotime($roomData['date_from'])) {
$objHotelBranchInformation = new HotelBranchInformation(
$roomData['id_hotel'],
$context->language->id

View File

@@ -270,11 +270,18 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser
if (count($roomType['data']['unavailable'])) {
foreach ($roomType['data']['unavailable'] as $unavailableRooms) {
foreach ($unavailableRooms['detail'] as $unavailableDetail) {
for ($currentDate = date('Y-m-d', strtotime($unavailableDetail['date_from']));
$currentDate < date('Y-m-d', strtotime($unavailableDetail['date_to']));
if ($unavailableDetail['date_from'] && $unavailableDetail['date_to']) {
$startDate = date('Y-m-d', strtotime($unavailableDetail['date_from']));
$endDate = date('Y-m-d', strtotime($unavailableDetail['date_to']));
} else {
$startDate = $bookingParams['date_from'];
$endDate = $bookingParams['date_to'];
}
for ($currentDate = $startDate;
$currentDate < $endDate;
$currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))
) {
$unavailableDates[$currentDate][$roomType['id_product']][$bookedRoom['id_room']] = $bookedRoom['id_room'];
$unavailableDates[$currentDate][$roomType['id_product']][$unavailableRooms['id_room']] = $unavailableRooms['id_room'];
}
}
}
@@ -328,12 +335,12 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser
unset($roomDetail['available']);
}
if ($getUnavai) {
$ariDateInfo['total_unavailable_rooms'] += count($roomDetail['available']);
$ariDateInfo['total_unavailable_rooms'] += count($roomDetail['unavailable']);
} else {
unset($roomDetail['unavailable']);
}
if ($getBooked) {
$ariDateInfo['total_booked_rooms'] += count($roomDetail['available']);
$ariDateInfo['total_booked_rooms'] += count($roomDetail['booked']);
} else {
unset($roomDetail['booked']);
}

View File

@@ -88,6 +88,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$this->context->cart->save();
$this->context->cookie->id_cart = (int) $this->context->cart->id;
$this->context->cookie->write();
}
public function postProcess()

View File

@@ -34,11 +34,12 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
$this->_orderWay = 'DESC';
if ($idOrder = Tools::getValue('id_order')) {
$this->_select .= ', orsl.`name` as `status_name`, ors.`color`';
$this->_select .= ', orsl.`name` as `status_name`, ors.`color`, COUNT(ordrd.`id_order_return_detail`) as num_rooms';
$this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_return_state ors ON (ors.`id_order_return_state` = a.`state`)';
$this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$this->context->language->id.')';
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ordrd ON (a.`id_order_return` = ordrd.`id_order_return`)';
$this->_where = ' AND a.`id_order`='. (int)$idOrder;
$this->_group = '';
$this->_group = 'GROUP BY a.`id_order_return`';
} else {
$this->_select .= ', ord.`total_paid_tax_incl` AS total_order, os.`id_order_state`, os.`color`, COUNT(IF(a.`state` = '.(int) Configuration::get('PS_ORS_PENDING').', 1, NULL)) AS total_pending_requests, SUM(a.`refunded_amount`) AS refunded_amount';
$this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_state os ON (os.`id_order_state` = ord.`current_state`)';
@@ -79,6 +80,11 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
'havingFilter' => true,
'callback' => 'setCustomerLink',
);
$this->fields_list['num_rooms'] = array(
'title' => $this->l('Total Rooms'),
'align' => 'center',
'havingFilter' => true,
);
$this->fields_list['refunded_amount'] = array(
'title' => $this->l('Refunded Amount'),
'align' => 'center',

View File

@@ -81,6 +81,14 @@
{displayPrice price=$orderTotalPaid currency=$orderInfo['id_currency']}
</div>
</div>
<div class="form-group row">
<div class="col-sm-3">
<strong>{l s='Total rooms' mod='hotelreservationsystem'} :</strong>
</div>
<div class="col-sm-9">
{$refundReqBookings|count}
</div>
</div>
<div class="form-group row">
<div class="col-sm-3">
<strong>{l s='Way of payment' mod='hotelreservationsystem'} :</strong>

View File

@@ -69,7 +69,7 @@ class WkHotelRoom extends Module
$idProduct,
$dateFrom,
$dateTo,
$useTax,
1,
0,
0,
0,

View File

@@ -939,7 +939,7 @@ var ajaxCart = {
content += '<td class="num_rooms_in_date">' + date_diff_v.num_rm + '</td>';
content += '<td>' + formatCurrency(parseFloat(date_diff_v.amount) + parseFloat(date_diff_v.demand_price), currency_format, currency_sign, currency_blank) + '</td>';
content += '<td>';
content += '<a class="remove_rooms_from_cart_link" href="#" rm_price=' + date_diff_v.amount + ' id_product=' + productId + ' date_from=' + date_diff_v.data_form + ' date_to=' + date_diff_v.data_to + ' num_rooms=' + date_diff_v.num_rm + ' title="' + remove_rm_title + '"></a>';
content += '<a class="remove_rooms_from_cart_link" href="#" rm_price="' + date_diff_v.amount + '" id_product="' + productId + '" date_from="' + date_diff_v.data_form + '" date_to="' + date_diff_v.data_to + '" num_rooms="' + date_diff_v.num_rm + '" title="' + remove_rm_title + '"></a>';
content += '</td>';
content += '</tr>';
});

View File

@@ -134,12 +134,11 @@ function initRefundDeniedTooltip() {
}
function initMap() {
const hotelLocation = {
lat: Number(hotel_location.latitude),
lng: Number(hotel_location.longitude),
};
$('.booking-hotel-map-container').each(function (i, element) {
const hotelLocation = {
lat: Number($(this).attr('latitude')),
lng: Number($(this).attr('longitude')),
};
const map = new google.maps.Map(element, {
zoom: 10,
center: hotelLocation,
@@ -150,16 +149,16 @@ function initMap() {
const marker = new google.maps.Marker({
position: hotelLocation,
map: map,
title: hotel_name,
title: $(this).attr('title'),
icon: PS_STORES_ICON
});
marker.addListener('click', function() {
let query = '';
if (hotel_location.map_input_text != '') {
query = hotel_location.map_input_text;
if ($(this).attr('query') != '') {
query = $(this).attr('query');
} else {
query = hotel_location.latitude + ',' + hotel_location.longitude;
query = $(this).attr('latitude') + ',' + $(this).attr('longitude');
}
window.open('https://www.google.com/maps/search/?api=1&query='+encodeURIComponent(query), '_blank');
@@ -377,7 +376,8 @@ $(document).ready(function () {
if (typeof google === 'object'
&& typeof google.maps === 'object'
&& typeof hotel_location === 'object'
&& typeof initiateMap !== 'undefined'
&& initiateMap === 1
) {
initMap();
}

View File

@@ -177,7 +177,13 @@
{if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0) && $view_on_map}
<div class="hotel-location-map">
<div class="booking-hotel-map-container"></div>
<div
class="booking-hotel-map-container"
latitude="{$obj_hotel_branch_information->latitude|escape:'html':'UTF-8'}"
longitude="{$obj_hotel_branch_information->longitude|escape:'html':'UTF-8'}"
query="{$obj_hotel_branch_information->map_input_text|escape:'html':'UTF-8'}"
title="{$obj_hotel_branch_information->hotel_name|escape:'html':'UTF-8'}">
</div>
</div>
{/if}
@@ -626,7 +632,13 @@
{if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0) && $view_on_map}
<div class="hotel-location-map">
<div class="booking-hotel-map-container"></div>
<div
class="booking-hotel-map-container"
latitude="{$obj_hotel_branch_information->latitude|escape:'html':'UTF-8'}"
longitude="{$obj_hotel_branch_information->longitude|escape:'html':'UTF-8'}"
query="{$obj_hotel_branch_information->map_input_text|escape:'html':'UTF-8'}"
title="{$obj_hotel_branch_information->hotel_name|escape:'html':'UTF-8'}">
</div>
</div>
{/if}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 21 KiB