compatibility, minor changes, and version update

This commit is contained in:
@ambujkumar999
2026-10-21 17:23:59 +05:30
parent 47016eff50
commit 35f7398713
6 changed files with 1183 additions and 363 deletions

View File

@@ -1,12 +1,8 @@
---------------------------------------------------------------
# V5.0.6 | COMPATIBLE:: QloApps V1.7.x
# V7.0.0 | COMPATIBLE:: QloApps V1.8.x
---------------------------------------------------------------
+ [BO]: Addition of booking source and business source
- [BO]: Removed all remaining references to the "extra demands" feature
---------------------------------------------------------------
# V5.0.5 | COMPATIBLE:: QloApps V1.7.x
---------------------------------------------------------------
+ [BO]: Absorbed the Channel Manager Bookings admin list (previously provided by the separate `qlochannelmanagerconnector` module) — new `AdminQloappsChannelManagerConnector` tab lists orders detected via `orders.id_channel_manager_booking` (with `source` fallback), no separate DB table
+ [BO]: `qlochannelmanagerconnector` module (if present) is now automatically uninstalled and deleted from disk on install/upgrade of this module
+ [BO]: Channel Manager API booking creation no longer produces raw PHP fatal errors for any kind of unexpected failure — all errors now return as structured JSON

View File

@@ -19,7 +19,9 @@ https://qloapps.com/addons/
### Module Versions and Compatibility:
- **Current version:** `5.0.6`
- **Current version:** `7.0.0`
- Module version `7.0.0` compatible with QloApps version `1.8.x`
- Module version `5.0.6` compatible with QloApps version `1.8.x`

View File

@@ -149,7 +149,7 @@ class QcmcBooking extends QmkWebService
$serviceItem['total_price_with_tax'] = $service['total_price_tax_incl'];
$serviceItem['total_tax'] = ($service['total_price_tax_incl'] - $service['total_price_tax_excl']);
if (WebserviceSpecificManagementBookings::API_SERVICE_PRICE_MODE_PER_DAY == $service['price_calculation_method']) {
if (WebserviceSpecificManagementCmApi::isPerNightPriceCalculationMethod($service['price_calculation_method'])) {
$serviceItem['price_mode'] = 'per_night';
} else {
$serviceItem['price_mode'] = 'per_stay';
@@ -171,7 +171,12 @@ class QcmcBooking extends QmkWebService
// if a room is refunded or cancelled then the count will not be sent to the api response
// as we can not change the status room type booking wise for the API response
if (!$value['is_refunded']
// Refunds come from completed order returns; the old is_refunded column
// (shops upgraded from 1.7) is no longer written, so it only adds older rooms.
$isRefunded = !empty($value['is_refunded'])
|| (method_exists('OrderReturn', 'hasCompletelyRefundedBooking')
&& (new OrderReturn())->hasCompletelyRefundedBooking($value['id']));
if (!$isRefunded
&& isset($roomTypes[$key]['number_of_rooms'])
) {
$roomTypes[$key]['number_of_rooms'] += 1;

View File

@@ -124,7 +124,7 @@ class QcmcSourceHelper
{
$name = array();
foreach (Language::getLanguages(false) as $lang) {
$name[(int)$lang['id_lang']] = $this->formatSourceCode($sourceName);
$name[(int)$lang['id_lang']] = ucwords($sourceName);
}
$objBusinessSource = new BusinessSource();
@@ -143,7 +143,7 @@ class QcmcSourceHelper
{
$name = array();
foreach (Language::getLanguages(false) as $lang) {
$name[(int)$lang['id_lang']] = $this->formatSourceCode($sourceName);
$name[(int)$lang['id_lang']] = ucwords($sourceName);
}
$objSource = new Source();

View File

@@ -36,7 +36,7 @@ class QloCMConnector extends Module
{
$this->name = 'qlocmconnector';
$this->tab = 'analytics_stats';
$this->version = '5.0.6';
$this->version = '7.0.0';
$this->author = 'Webkul';
$this->bootstrap = true;
$this->secure_key = Tools::encrypt($this->name);
@@ -921,8 +921,10 @@ class QloCMConnector extends Module
public function hookActionAvailRoomSearchSqlModifier(&$params)
{
// Check if request is from trusted partners
if (!QcmcChannelManagerApiService::isAllowedRemoteAddr($_SERVER['REMOTE_ADDR'])) {
// CM only: trusted IP, or a cm_api booking request in progress.
if (!QcmcChannelManagerApiService::isAllowedRemoteAddr($_SERVER['REMOTE_ADDR'])
&& self::$idBookingCm === null
) {
return;
}
@@ -932,17 +934,13 @@ class QloCMConnector extends Module
// Modify the checked_out subquery to exclude rooms based on order ID
if (isset($params['exclude_room_id']['checked_out'])) {
// Add id_order condition to exclude only bookings NOT matching current order
$originalQuery = $params['exclude_room_id']['checked_out'];
// Insert id_order != {idOrder} condition after is_refunded = 0
$modifiedQuery = preg_replace(
'/`is_refunded` = 0 AND IF\(/',
'`is_refunded` = 0 AND `id_order` != ' . $idOrder . ' AND IF(',
$originalQuery
// The modified order's own rooms must not block its search (anchored on the leading WHERE).
$params['exclude_room_id']['checked_out'] = preg_replace(
'/WHERE\s+`id_hotel`\s*=/',
'WHERE `id_order` != ' . $idOrder . ' AND `id_hotel` =',
$params['exclude_room_id']['checked_out'],
1
);
$params['exclude_room_id']['checked_out'] = $modifiedQuery;
}
}
@@ -1051,8 +1049,10 @@ class QloCMConnector extends Module
public function hookActionPartiallyAvailRoomSearchSqlModifier(&$params)
{
// Check if request is from trusted partners
if (!QcmcChannelManagerApiService::isAllowedRemoteAddr($_SERVER['REMOTE_ADDR'])) {
// CM only: trusted IP, or a cm_api booking request in progress.
if (!QcmcChannelManagerApiService::isAllowedRemoteAddr($_SERVER['REMOTE_ADDR'])
&& self::$idBookingCm === null
) {
return;
}
@@ -1063,17 +1063,17 @@ class QloCMConnector extends Module
// Modify the SQL queries to exclude rooms based on order ID
if (isset($params['sql']) && is_array($params['sql'])) {
foreach ($params['sql'] as &$sqlQuery) {
// Check if this is the booking detail query
if (strpos($sqlQuery, 'qlo_htl_booking_detail') !== false) {
// Add id_order exclusion to exclude only bookings NOT matching current order
// Insert after is_refunded = 0 condition
// Booking detail query only: the modified order's own rooms must not block its search.
if (strpos($sqlQuery, '`'._DB_PREFIX_.'htl_booking_detail` AS bd') !== false) {
$sqlQuery = preg_replace(
'/`is_refunded` = 0 AND IF\(/',
'`is_refunded` = 0 AND `id_order` != ' . $idOrder . ' AND IF(',
$sqlQuery
'/WHERE\s+bd\.`id_hotel`\s*=/',
'WHERE bd.`id_order` != ' . $idOrder . ' AND bd.`id_hotel`=',
$sqlQuery,
1
);
}
}
unset($sqlQuery);
}
}
}