Fixed: added fax, fixed fatal error for the hotel import and warning in booking import incase the Room type does not exists

This commit is contained in:
vishalsingh.qlo325
2025-06-06 13:09:54 +05:30
parent 0540eadbeb
commit e6351529d7
2 changed files with 46 additions and 35 deletions

View File

@@ -145,6 +145,7 @@ class AdminImportControllerCore extends AdminController
'id_state' => array('label' => $this->l('State ID')),
'city' => array('label' => $this->l('City *')),
'postcode' => array('label' => $this->l('Zip Code *')),
'fax' => array('label' => $this->l('Fax')),
'policies' => array('label' => $this->l('Hotel Policies')),
'active_refund' => array('label' => $this->l('Allow Refund (0 = No, 1 = Yes)')),
'refund_ids' => array('label' => $this->l('Refund IDs (x,y,z...)')),
@@ -1200,6 +1201,11 @@ class AdminImportControllerCore extends AdminController
$this->l('Zip code is invalid for (ID: %1$s)'),
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null'
);
} else if (isset($info['fax']) && !Validate::isGenericName($info['fax'])) {
$this->errors[] = sprintf(
$this->l('Fax is invalid for (ID: %1$s)'),
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null'
);
} else if ($objCountry->active) {
if ($objCountry->contains_states) {
if (!isset($info['id_state'])
@@ -1254,6 +1260,7 @@ class AdminImportControllerCore extends AdminController
$objAddress->id_state = $info['id_state'];
$objAddress->city = $info['city'];
$objAddress->postcode = $info['postcode'];
$objHotelBranch->fax = $info['fax'];
$hotelName = $objHotelBranch->hotel_name[$idLangDefault];
$objAddress->alias = $hotelName;
$hotelName = trim(preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName));
@@ -1438,16 +1445,18 @@ class AdminImportControllerCore extends AdminController
$objHotelOrderRestrictDate->use_global_min_booking_offset = true;
if (isset($info['max_checkout_offset'])
&& (Configuration::get('PS_MIN_BOOKING_OFFSET') < $info['max_checkout_offset']
|| isset($info['min_booking_offset']) && $info['min_booking_offset'] < $info['max_checkout_offset'])
&& ((Configuration::get('PS_MIN_BOOKING_OFFSET') < $info['max_checkout_offset'])
|| (isset($info['min_booking_offset']) && ($info['min_booking_offset'] < $info['max_checkout_offset']))
)
) {
$objHotelOrderRestrictDate->use_global_max_checkout_offset = false;
$objHotelOrderRestrictDate->max_checkout_offset = $info['max_checkout_offset'];
}
if (isset($info['min_booking_offset'])
&& (Configuration::get('PS_MAX_CHECKOUT_OFFSET') > $info['min_booking_offset']
|| isset($info['max_checkout_offset']) && $info['max_checkout_offset'] > $info['min_booking_offset'])
&& ((Configuration::get('PS_MAX_CHECKOUT_OFFSET') > $info['min_booking_offset'])
|| (isset($info['max_checkout_offset']) && ($info['max_checkout_offset'] > $info['min_booking_offset']))
)
) {
$objHotelOrderRestrictDate->use_global_min_booking_offset = false;
$objHotelOrderRestrictDate->min_booking_offset = $info['min_booking_offset'];
@@ -2449,39 +2458,41 @@ class AdminImportControllerCore extends AdminController
$idHotel = 0;
$objCustomer = new Customer($info['id_customer']);
$objProduct = new Product($info['id_product']);
if (Validate::isLoadedObject($objCustomer)
&& Validate::isLoadedObject($objProduct)
) {
if (!isset($hotelRoomTypeInfo[$info['id_product']])) {
if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($singleRow->id_product)) {
if (Validate::isLoadedObject($objCustomer)) {
if (Validate::isLoadedObject($objProduct) || $objProduct->booking_product) {
if (!isset($hotelRoomTypeInfo[$info['id_product']])) {
if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($singleRow->id_product)) {
$singleRow->id_hotel = $roomInfo['id_hotel'];
$idHotel = $roomInfo['id_hotel'];
$singleRow->adults = $roomInfo['adults'];
$singleRow->children = $roomInfo['children'];
$hotelRoomTypeInfo[$info['id_product']] = $roomInfo;
}
} else {
$roomInfo = $hotelRoomTypeInfo[$info['id_product']];
$singleRow->id_hotel = $roomInfo['id_hotel'];
$idHotel = $roomInfo['id_hotel'];
$singleRow->adults = $roomInfo['adults'];
$singleRow->children = $roomInfo['children'];
$hotelRoomTypeInfo[$info['id_product']] = $roomInfo;
}
$ordersRow[$info['id_order']][$singleRow->id_hotel][] = (array) $singleRow;
if (!isset($orderInfo[$info['id_order']])) {
$orderInfo[$info['id_order']]['id_customer'] = $singleRow->id_customer;
if (isset($singleRow->id_order_status)) {
$orderInfo[$info['id_order']]['id_order_status'] = $singleRow->id_order_status;
} else {
$orderInfo[$info['id_order']]['id_order_status'] = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT');
}
if (isset($singleRow->id_currency)) {
$orderInfo[$info['id_order']]['id_currency'] = $singleRow->id_currency ;
} else {
$orderInfo[$info['id_order']]['id_currency'] = Configuration::get('PS_CURRENCY_DEFAULT');
}
}
} else {
$roomInfo = $hotelRoomTypeInfo[$info['id_product']];
$singleRow->id_hotel = $roomInfo['id_hotel'];
$idHotel = $roomInfo['id_hotel'];
$singleRow->adults = $roomInfo['adults'];
$singleRow->children = $roomInfo['children'];
}
$ordersRow[$info['id_order']][$singleRow->id_hotel][] = (array) $singleRow;
if (!isset($orderInfo[$info['id_order']])) {
$orderInfo[$info['id_order']]['id_customer'] = $singleRow->id_customer;
if (isset($singleRow->id_order_status)) {
$orderInfo[$info['id_order']]['id_order_status'] = $singleRow->id_order_status;
} else {
$orderInfo[$info['id_order']]['id_order_status'] = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT');
}
if (isset($singleRow->id_currency)) {
$orderInfo[$info['id_order']]['id_currency'] = $singleRow->id_currency ;
} else {
$orderInfo[$info['id_order']]['id_currency'] = Configuration::get('PS_CURRENCY_DEFAULT');
}
$this->warnings[] = $this->l('Invalid room type Id: ').$info['id_product'];
}
}
}
@@ -2667,7 +2678,7 @@ class AdminImportControllerCore extends AdminController
null,
false
)) {
$this->errors[] = $this->l('Failed to create order for order reference '.$orderRefKey);
$this->errors[] = $this->l('Failed to create booking for reference').' '.$orderRefKey;
}
foreach ($featurePrices as $idPrice) {

View File

@@ -1,3 +1,3 @@
Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Max booking offset;Min booking offset;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes)
2;1;The Kings Hotel;The Kings Hotel with king size rooms. visit for a wonderful experience.;The Kings Hotel with king-size rooms. visit for a wonderful experience.;0900000009;kingshotel@demo.com;Greene St, New York, NY 10003, USA;3;12:00;11:00;21;32;New York;10003;1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.;1;1;2024-01-01;0;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg;0
3;1;The Sunshine Palace Inn;The Sunshine Palace Inn is a beautiful hotel in japan.;The Sunshine Palace Inn is a beautiful hotel in japan.;0900000009;sunshine@demo.com;Shingashi, Itabashi, Tokyo;4;09:00;08:00;11;306;Tokyo;611-0043;1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred.;0;0;;3;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg;0
Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Fax;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Maximum checkout offset;Min booking offset;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes)
2;1;The Kings Hotel;The Kings Hotel with king size rooms. visit for a wonderful experience.;The Kings Hotel with king-size rooms. visit for a wonderful experience.;0900000009;kingshotel@demo.com;Greene St, New York, NY 10003, USA;3;12:00;11:00;21;32;New York;10003;;1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.;1;1;4;0;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg;0
3;1;The Sunshine Palace Inn;The Sunshine Palace Inn is a beautiful hotel in japan.;The Sunshine Palace Inn is a beautiful hotel in japan.;0900000009;sunshine@demo.com;Shingashi, Itabashi, Tokyo;4;09:00;08:00;11;306;Tokyo;611-0043;;1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred.;0;0;;3;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg;0
1 Hotel ID Active(0/1) Hotel Name Short Description Description Mobile Phone Email Address Rating Check-In Check-Out Country ID State ID City Zip Code Fax Hotel Policies Allow Refund(0/1) Max booking offset Refund IDs (x,y,z...) Maximum checkout offset Min booking offset Image URLs (x,y,z...) Delete Existing Images (0 = No, 1 = Yes)
2 2 1 The Kings Hotel The Kings Hotel with king size rooms. visit for a wonderful experience. The Kings Hotel with king-size rooms. visit for a wonderful experience. 0900000009 kingshotel@demo.com Greene St, New York, NY 10003, USA 3 12:00 11:00 21 32 New York 10003 1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred. 1 2024-01-01 1 4 0 http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg 0
3 3 1 The Sunshine Palace Inn The Sunshine Palace Inn is a beautiful hotel in japan. The Sunshine Palace Inn is a beautiful hotel in japan. 0900000009 sunshine@demo.com Shingashi, Itabashi, Tokyo 4 09:00 08:00 11 306 Tokyo 611-0043 1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred. 0 0 3 http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg 0