diff --git a/admin/themes/default/template/controllers/guest_registration/preview_modal.tpl b/admin/themes/default/template/controllers/guest_registration/preview_modal.tpl
new file mode 100644
index 000000000..6ea9b54e8
--- /dev/null
+++ b/admin/themes/default/template/controllers/guest_registration/preview_modal.tpl
@@ -0,0 +1,85 @@
+{*
+* 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
+*
+* @author Webkul IN
+* @copyright Since 2010 Webkul
+* @license https://opensource.org/license/osl-3.0-php Open Software License version 3.0
+*}
+
+
+
+
+
+
+

+
+
+
+
+
+
\ No newline at end of file
diff --git a/cache/smarty/cache/index.php b/cache/smarty/cache/index.php
deleted file mode 100644
index 369a7a3f3..000000000
--- a/cache/smarty/cache/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2014 PrestaShop SA
-* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
-
-header("Cache-Control: no-store, no-cache, must-revalidate");
-header("Cache-Control: post-check=0, pre-check=0", false);
-header("Pragma: no-cache");
-
-header("Location: ../");
-exit;
diff --git a/classes/pdf/HTMLTemplateRegistrationForm.php b/classes/pdf/HTMLTemplateRegistrationForm.php
index 77136b7e8..a9c1fe3d8 100644
--- a/classes/pdf/HTMLTemplateRegistrationForm.php
+++ b/classes/pdf/HTMLTemplateRegistrationForm.php
@@ -1,11 +1,12 @@
order = $objOrder;
$this->smarty = $smarty;
- // Grab the ID directly from the URL parameters
$this->id_hotel_booking_detail = (int)Tools::getValue('id_hotel_booking_detail');
$this->date = Tools::displayDate($objOrder->date_add);
$this->title = $objOrder->getUniqReference();
@@ -50,7 +49,7 @@ class HTMLTemplateRegistrationFormCore extends HTMLTemplate
*/
public function getHeader()
{
- if ($this->isPdfHeaderEnabled()) {
+ if ((bool)Configuration::get('QLO_GUEST_REG_ENABLE_HEADER')) {
return parent::getHeader();
}
@@ -59,7 +58,7 @@ class HTMLTemplateRegistrationFormCore extends HTMLTemplate
public function requestMinimalMargins()
{
- return !$this->isPdfHeaderEnabled();
+ return !(bool)Configuration::get('QLO_GUEST_REG_ENABLE_HEADER');
}
/**
@@ -69,34 +68,180 @@ class HTMLTemplateRegistrationFormCore extends HTMLTemplate
*/
public function getContent()
{
- $objCustomer = new Customer((int)$this->order->id_customer);
+ $idLang = (int)$this->order->id_lang;
+ $idHotel = (int)HotelBookingDetail::getIdHotelByIdOrder($this->order->id);
+
$objHotelBookingDetail = new HotelBookingDetail();
$hotelBookingDetails = $objHotelBookingDetail->getBookingDataByOrderId($this->order->id);
-
- // Filter booking details if room_id is provided
if ($this->id_hotel_booking_detail) {
- $hotelBookingDetails = array_filter($hotelBookingDetails, function($detail) {
+ $hotelBookingDetails = array_filter($hotelBookingDetails, function ($detail) {
return $detail['id'] == $this->id_hotel_booking_detail;
});
}
-
- $this->id_hotel = (int)HotelBookingDetail::getIdHotelByIdOrder($this->order->id);
- $data = array(
- 'order' => $this->order,
- 'registration_form' => array(
- 'guest' => $this->getGuestData($objCustomer),
- 'hotel' => $this->getHotelData($hotelBookingDetails),
- 'stay' => $this->getStayData($hotelBookingDetails),
- 'property' => $this->getPropertyData($hotelBookingDetails),
- 'config' => $this->getRegistrationConfig(),
- 'dynamic_fields' => $this->getDynamicFields(),
- ),
- );
+ // Hotel info from HotelBranchInformation (authoritative)
+ $hotelName = '';
+ $hotelCheckInTime = '';
+ $hotelCheckOutTime = '';
+ $hotelPolicies = '';
+ $hotelCity = '';
+ $hotelCountry = '';
+
+ if ($idHotel) {
+ $objHotelBranchInformation = new HotelBranchInformation($idHotel, $idLang);
+ if (Validate::isLoadedObject($objHotelBranchInformation)) {
+ $hotelName = $objHotelBranchInformation->hotel_name;
+ $hotelCity = (string)$objHotelBranchInformation->city;
+ $policies = $objHotelBranchInformation->policies;
+ $hotelPolicies = is_array($policies) ? '' : (string)$policies;
+
+ $checkIn = $objHotelBranchInformation->check_in;
+ $hotelCheckInTime = ($checkIn && $checkIn != '00:00:00') ? date('h:i a', strtotime($checkIn)) : '';
+
+ $checkOut = $objHotelBranchInformation->check_out;
+ $hotelCheckOutTime = ($checkOut && $checkOut != '00:00:00') ? date('h:i a', strtotime($checkOut)) : '';
+
+ if ($objHotelBranchInformation->id_country) {
+ $objCountry = new Country((int)$objHotelBranchInformation->id_country, $idLang);
+ if (Validate::isLoadedObject($objCountry)) {
+ $hotelCountry = (string)$objCountry->name;
+ }
+ }
+ }
+ }
+
+ // Fallback to booking detail row for name/city/country if branch info unavailable
+ if ((!$hotelName || !$hotelCity || !$hotelCountry) && !empty($hotelBookingDetails)) {
+ $firstDetail = reset($hotelBookingDetails);
+ if (!$hotelName) {
+ $hotelName = $firstDetail['hotel_name'];
+ }
+ if (!$hotelCity) {
+ $hotelCity = $firstDetail['city'];
+ }
+ if (!$hotelCountry) {
+ $hotelCountry = $firstDetail['country'];
+ }
+ }
+
+ // Property logo: hotel image first, then shop logo
+ $propertyLogoPath = '';
+ if ($idHotel && ($cover = HotelImage::getCover($idHotel))) {
+ $imgPath = rtrim(_PS_HOTEL_IMG_DIR_, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.(int)$idHotel.DIRECTORY_SEPARATOR.(int)$cover['id'].'.jpg';
+ if (file_exists($imgPath)) {
+ $propertyLogoPath = $imgPath;
+ }
+ }
+ if (!$propertyLogoPath) {
+ $propertyLogoPath = (string)$this->getLogo();
+ }
+
+ // Stay data: dates, rooms, guests, rate
+ $arrivalDate = '';
+ $departureDate = '';
+ $roomNumbers = array();
+ $roomTypes = array();
+ $adults = 0;
+ $children = 0;
+ $ratePerNight = '';
+ $arrivalDateTime = '';
+ $departureDateTime = '';
+
+ if (!empty($hotelBookingDetails)) {
+ $currency = new Currency((int)$this->order->id_currency);
+ $totalRate = 0;
+ $totalRateCount = 0;
+ foreach ($hotelBookingDetails as $detail) {
+ if (!$arrivalDate || strtotime($detail['date_from']) < strtotime($arrivalDate)) {
+ $arrivalDate = $detail['date_from'];
+ }
+ if (!$departureDate || strtotime($detail['date_to']) > strtotime($departureDate)) {
+ $departureDate = $detail['date_to'];
+ }
+ if (!empty($detail['room_num'])) {
+ $roomNumbers[] = $detail['room_num'];
+ }
+ if (!empty($detail['room_type_name'])) {
+ $roomTypes[] = $detail['room_type_name'];
+ }
+ $adults += (int)$detail['adults'];
+ $children += (int)$detail['children'];
+ $nights = (int)HotelHelper::getNumberOfDays($detail['date_from'], $detail['date_to']);
+ if ($nights > 0) {
+ $totalRate += ((float)$detail['total_price_tax_incl'] / $nights);
+ ++$totalRateCount;
+ }
+ }
+
+ if ($totalRateCount) {
+ $ratePerNight = Tools::displayPrice($totalRate / $totalRateCount, $currency, false);
+ }
+
+ $arrivalDateTime = $arrivalDate ? Tools::displayDate($arrivalDate) : '';
+ $departureDateTime = $departureDate ? Tools::displayDate($departureDate) : '';
+ if ($arrivalDateTime && $hotelCheckInTime) {
+ $arrivalDateTime .= ' '.$hotelCheckInTime;
+ }
+ if ($departureDateTime && $hotelCheckOutTime) {
+ $departureDateTime .= ' '.$hotelCheckOutTime;
+ }
+ }
+
+ // Additional guests rows based on max_guests of the room type
+ $additionalGuestsRows = 0;
+ if (!empty($hotelBookingDetails)) {
+ $idProducts = array_unique(array_filter(array_map('intval', array_column($hotelBookingDetails, 'id_product'))));
+ if (!empty($idProducts)) {
+ $objHotelRoomType = new HotelRoomType();
+ $roomTypeDetails = $objHotelRoomType->getRoomTypeDetailByRoomTypeIds(implode(',', $idProducts), false);
+ if (!empty($roomTypeDetails) && isset($roomTypeDetails[0]['max_guests'])) {
+ $maxGuests = (int)$roomTypeDetails[0]['max_guests'];
+ $additionalGuestsRows = ($maxGuests > 1) ? ($maxGuests - 1) : 0;
+ }
+ }
+ }
+
+ // Optional sections
+ $sectionsValue = Configuration::get('QLO_GUEST_REG_OPTIONAL_SECTIONS');
+ if ($sectionsValue === false || $sectionsValue === '') {
+ $selectedSections = array(1, 2, 3, 4, 5, 6);
+ } else {
+ $decoded = Tools::jsonDecode($sectionsValue, true);
+ $selectedSections = is_array($decoded) ? array_map('intval', $decoded) : array();
+ }
- $this->smarty->assign($data);
$this->smarty->assign(array(
- 'style_tab' => $this->smarty->fetch($this->getTemplate('invoice.style-tab')),
+ 'style_tab' => $this->smarty->fetch($this->getTemplate('invoice.style-tab')),
+ // Hotel / property header
+ 'hotel_name' => $hotelName,
+ 'property_logo_path' => $propertyLogoPath,
+ 'property_city_country' => implode(', ', array_filter(array($hotelCity, $hotelCountry))),
+ // Booking stay info
+ 'booking_reference' => $this->order->getUniqReference(),
+ 'arrival_date_time' => $arrivalDateTime,
+ 'departure_date_time' => $departureDateTime,
+ 'room_type' => implode(', ', array_unique($roomTypes)),
+ 'room_number' => implode(', ', array_unique($roomNumbers)),
+ 'adults' => $adults,
+ 'children' => $children,
+ 'rate_per_night' => $ratePerNight,
+ // Property regulations section
+ 'hotel_check_in_time' => $hotelCheckInTime,
+ 'hotel_check_out_time' => $hotelCheckOutTime,
+ 'hotel_policies' => $hotelPolicies,
+ // Additional guests table
+ 'additional_guests_rows' => $additionalGuestsRows,
+ // Dynamic field options
+ 'purpose_of_visit_options' => GuestRegPurpose::getActiveOptions($idLang),
+ 'identity_proof_options' => GuestRegIdProof::getActiveOptions($idLang),
+ 'payment_method_options' => GuestRegPaymentMethod::getActiveOptions($idLang),
+ // Optional section visibility flags
+ 'show_property_logo' => in_array(1, $selectedSections),
+ 'show_additional_guests' => in_array(2, $selectedSections),
+ 'show_billing_corporate_details' => in_array(3, $selectedSections),
+ 'show_payment_deposit' => in_array(4, $selectedSections),
+ 'show_property_regulations' => in_array(5, $selectedSections),
+ 'show_office_use_only' => in_array(6, $selectedSections),
));
return $this->smarty->fetch($this->getTemplate('registration-form'));
@@ -123,390 +268,7 @@ class HTMLTemplateRegistrationFormCore extends HTMLTemplate
if ($this->id_hotel_booking_detail) {
$filename .= '-room-'.$this->id_hotel_booking_detail;
}
+
return $filename.'.pdf';
}
-
- /**
- * @param Customer $objCustomer
- *
- * @return array
- */
- protected function getGuestData(Customer $objCustomer)
- {
- $idGender = (int)$objCustomer->id_gender;
- $guestFullName = trim($objCustomer->firstname.' '.$objCustomer->lastname);
- $guestEmail = $objCustomer->email;
- $guestPhone = '';
- $guestAddress = '';
- $guestCityCountry = '';
- $guestPostcode = '';
-
- if ($this->order->id_address_invoice
- && Validate::isLoadedObject($objGuestAddress = new Address((int)$this->order->id_address_invoice))
- ) {
- if ($objGuestAddress->firstname || $objGuestAddress->lastname) {
- $guestFullName = trim($objGuestAddress->firstname.' '.$objGuestAddress->lastname);
- }
-
- if ($objGuestAddress->phone_mobile) {
- $guestPhone = $objGuestAddress->phone_mobile;
- } elseif ($objGuestAddress->phone) {
- $guestPhone = $objGuestAddress->phone;
- }
-
- $guestAddress = $objGuestAddress->address1;
- if (!empty($objGuestAddress->address2)) {
- $guestAddress .= ', ' . $objGuestAddress->address2;
- }
-
- $guestPostcode = (string)$objGuestAddress->postcode;
- $guestCityCountryParts = array();
- if ($objGuestAddress->city) {
- $guestCityCountryParts[] = $objGuestAddress->city;
- }
- if ($objGuestAddress->id_country && Validate::isLoadedObject($objCountry = new Country((int)$objGuestAddress->id_country, (int)$this->order->id_lang))) {
- $guestCityCountryParts[] = $objCountry->name;
- }
- $guestCityCountry = implode(', ', array_filter($guestCityCountryParts));
- }
-
- if ($id_order_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($this->order->id)) {
- if (Validate::isLoadedObject(
- $objOrderCustomerGuestDetail = new OrderCustomerGuestDetail((int)$id_order_customer_guest_detail)
- )) {
- $guestFullName = trim($objOrderCustomerGuestDetail->firstname.' '.$objOrderCustomerGuestDetail->lastname);
- $guestEmail = $objOrderCustomerGuestDetail->email;
- $guestPhone = $objOrderCustomerGuestDetail->phone;
- }
- }
-
- return array(
- 'id_gender' => $idGender,
- 'full_name' => $guestFullName,
- 'email' => $guestEmail,
- 'mobile' => $guestPhone,
- 'address' => $guestAddress,
- 'city_country' => $guestCityCountry,
- 'postcode' => $guestPostcode,
- );
- }
-
- /**
- * @param array $hotelBookingDetails
- *
- * @return array
- */
- protected function getHotelData($hotelBookingDetails)
- {
- $hotelName = '';
- $hotelAddress = '';
- $hotelEmail = '';
- $hotelPhone = '';
- $checkInTime = '';
- $checkOutTime = '';
- $hotelPolicies = '';
- $hotelCity = '';
- $hotelCountry = '';
-
- if (!empty($hotelBookingDetails)) {
- $hotelBookingDetail = reset($hotelBookingDetails);
- $hotelName = $hotelBookingDetail['hotel_name'];
- $hotelEmail = $hotelBookingDetail['email'];
- $hotelPhone = $hotelBookingDetail['phone'];
- $checkInTime = $this->formatHotelTime($hotelBookingDetail['check_in_time']);
- $checkOutTime = $this->formatHotelTime($hotelBookingDetail['check_out_time']);
- $hotelCity = $hotelBookingDetail['city'];
- $hotelCountry = $hotelBookingDetail['country'];
- }
-
- if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($this->order->id)) {
- $objHotelBranchInformation = new HotelBranchInformation((int)$idHotel, (int)$this->order->id_lang);
- if (Validate::isLoadedObject($objHotelBranchInformation)) {
- $hotelName = $objHotelBranchInformation->hotel_name;
- $hotelEmail = $objHotelBranchInformation->email;
- $hotelPhone = $objHotelBranchInformation->phone;
- $checkInTime = $this->formatHotelTime($objHotelBranchInformation->check_in);
- $checkOutTime = $this->formatHotelTime($objHotelBranchInformation->check_out);
- $hotelPolicies = (string)$objHotelBranchInformation->policies;
- $hotelCity = (string)$objHotelBranchInformation->city;
- if ($objHotelBranchInformation->id_country && Validate::isLoadedObject($objCountry = new Country((int)$objHotelBranchInformation->id_country, (int)$this->order->id_lang))) {
- $hotelCountry = (string)$objCountry->name;
- }
-
- if ($idHotelAddress = $objHotelBranchInformation->getHotelIdAddress()) {
- if (Validate::isLoadedObject($objHotelAddress = new Address((int)$idHotelAddress))) {
- $objHotelAddress->firstname = $hotelName;
- $objHotelAddress->lastname = '';
- $hotelAddress = AddressFormat::generateAddress($objHotelAddress, array(), '
', ' ');
- if (!$hotelCity && $objHotelAddress->city) {
- $hotelCity = (string)$objHotelAddress->city;
- }
- if (!$hotelCountry && $objHotelAddress->id_country && Validate::isLoadedObject($objCountry = new Country((int)$objHotelAddress->id_country, (int)$this->order->id_lang))) {
- $hotelCountry = (string)$objCountry->name;
- }
- }
- }
- }
- }
-
- if (!$hotelAddress && !empty($hotelBookingDetails)) {
- $hotelBookingDetail = reset($hotelBookingDetails);
- $hotelAddressParts = array(
- $hotelBookingDetail['hotel_name'],
- $hotelBookingDetail['city'],
- $hotelBookingDetail['state'],
- $hotelBookingDetail['country'],
- $hotelBookingDetail['zipcode'],
- );
- $hotelAddress = implode(', ', array_filter($hotelAddressParts));
- }
-
- return array(
- 'name' => $hotelName,
- 'address' => $hotelAddress,
- 'email' => $hotelEmail,
- 'phone' => $hotelPhone,
- 'check_in_time' => $checkInTime,
- 'check_out_time' => $checkOutTime,
- 'policies' => $hotelPolicies,
- 'city' => $hotelCity,
- 'country' => $hotelCountry,
- );
- }
-
- /**
- * @param array $hotelBookingDetails
- *
- * @return array
- */
- protected function getStayData($hotelBookingDetails)
- {
- $arrivalDate = '';
- $departureDate = '';
- $roomNumbers = array();
- $roomTypes = array();
- $adults = 0;
- $children = 0;
- $ratePerNight = '';
- $arrivalDateTime = '';
- $departureDateTime = '';
-
- if (!empty($hotelBookingDetails)) {
- $currency = new Currency((int)$this->order->id_currency);
- $totalRate = 0;
- $totalRateCount = 0;
- foreach ($hotelBookingDetails as $hotelBookingDetail) {
- if (!$arrivalDate || strtotime($hotelBookingDetail['date_from']) < strtotime($arrivalDate)) {
- $arrivalDate = $hotelBookingDetail['date_from'];
- }
-
- if (!$departureDate || strtotime($hotelBookingDetail['date_to']) > strtotime($departureDate)) {
- $departureDate = $hotelBookingDetail['date_to'];
- }
-
- if (!empty($hotelBookingDetail['room_num'])) {
- $roomNumbers[] = $hotelBookingDetail['room_num'];
- }
-
- if (!empty($hotelBookingDetail['room_type_name'])) {
- $roomTypes[] = $hotelBookingDetail['room_type_name'];
- }
-
- $adults += (int)$hotelBookingDetail['adults'];
- $children += (int)$hotelBookingDetail['children'];
-
- $nights = (int)HotelHelper::getNumberOfDays($hotelBookingDetail['date_from'], $hotelBookingDetail['date_to']);
- if ($nights > 0) {
- $totalRate += ((float)$hotelBookingDetail['total_price_tax_incl'] / $nights);
- ++$totalRateCount;
- }
- }
-
- if ($totalRateCount) {
- $avgRate = $totalRate / $totalRateCount;
- $ratePerNight = Tools::displayPrice($avgRate, $currency, false);
- }
-
- $firstBookingDetail = reset($hotelBookingDetails);
- $checkInTime = isset($firstBookingDetail['check_in_time']) ? $this->formatHotelTime($firstBookingDetail['check_in_time']) : '';
- $checkOutTime = isset($firstBookingDetail['check_out_time']) ? $this->formatHotelTime($firstBookingDetail['check_out_time']) : '';
- $arrivalDateTime = $arrivalDate ? Tools::displayDate($arrivalDate) : '';
- $departureDateTime = $departureDate ? Tools::displayDate($departureDate) : '';
- if ($arrivalDateTime && $checkInTime) {
- $arrivalDateTime .= ' '.$checkInTime;
- }
- if ($departureDateTime && $checkOutTime) {
- $departureDateTime .= ' '.$checkOutTime;
- }
- }
-
- return array(
- 'arrival_date' => $arrivalDate ? Tools::displayDate($arrivalDate) : '',
- 'departure_date' => $departureDate ? Tools::displayDate($departureDate) : '',
- 'arrival_date_time' => $arrivalDateTime,
- 'departure_date_time' => $departureDateTime,
- 'room_number' => implode(', ', array_unique($roomNumbers)),
- 'room_type' => implode(', ', array_unique($roomTypes)),
- 'booking_reference' => $this->order->getUniqReference(),
- 'adults' => $adults,
- 'children' => $children,
- 'rate_per_night' => $ratePerNight,
- );
- }
-
- /**
- * @param array $hotelBookingDetails
- *
- * @return array
- */
- protected function getPropertyData($hotelBookingDetails)
- {
- $propertyLogo = '';
- if ($this->id_hotel) {
- $propertyLogo = $this->getHotelLogoPath($this->id_hotel);
- }
- if (!$propertyLogo) {
- $propertyLogo = (string)$this->getLogo();
- }
-
- $cityCountry = '';
- if (!empty($hotelBookingDetails)) {
- $hotelBookingDetail = reset($hotelBookingDetails);
- $cityCountry = implode(', ', array_filter(array($hotelBookingDetail['city'], $hotelBookingDetail['country'])));
- }
- if (!$cityCountry) {
- $hotelData = $this->getHotelData($hotelBookingDetails);
- $cityCountry = implode(', ', array_filter(array($hotelData['city'], $hotelData['country'])));
- }
-
- $website = '';
- if (method_exists('Tools', 'getShopDomainSsl')) {
- $website = Tools::getShopDomainSsl(true, true);
- } else {
- $website = Tools::getHttpHost(true);
- }
- $website .= __PS_BASE_URI__;
-
- $additionalGuestsRows = 0;
- if (!empty($hotelBookingDetails)) {
- $idProducts = array();
- foreach ($hotelBookingDetails as $hotelBookingDetail) {
- if (!empty($hotelBookingDetail['id_product'])) {
- $idProducts[] = (int)$hotelBookingDetail['id_product'];
- }
- }
- $idProducts = array_unique($idProducts);
- if (!empty($idProducts)) {
- $objHotelRoomType = new HotelRoomType();
- $roomTypes = $objHotelRoomType->getRoomTypeDetailByRoomTypeIds(implode(',', $idProducts), false);
- if (!empty($roomTypes) && isset($roomTypes[0]['max_guests'])) {
- $maxGuests = (int)$roomTypes[0]['max_guests'];
- $additionalGuestsRows = ($maxGuests > 1) ? ($maxGuests - 1) : 0;
- }
- }
- }
-
- return array(
- 'logo_path' => $propertyLogo,
- 'city_country' => $cityCountry,
- 'website' => $website,
- 'additional_guests_rows' => (int)$additionalGuestsRows,
- );
- }
-
- /**
- * @param int $idHotel
- *
- * @return string
- */
- protected function getHotelLogoPath($idHotel)
- {
- if (!$idHotel) {
- return '';
- }
-
- if ($cover = HotelImage::getCover((int)$idHotel)) {
- $imgPath = rtrim(_PS_HOTEL_IMG_DIR_, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.(int)$idHotel.DIRECTORY_SEPARATOR.(int)$cover['id'].'.jpg';
- if (file_exists($imgPath)) {
- return $imgPath;
- }
- }
-
- return '';
- }
-
- /**
- * @return bool
- */
- protected function isPdfHeaderEnabled()
- {
- return (bool)Configuration::get('QLO_GUEST_REG_ENABLE_HEADER');
- }
-
- /**
- * @return array
- */
- protected function getRegistrationConfig()
- {
- $selectedSections = $this->getSelectedOptionalSections();
-
- return array(
- 'show_header' => $this->isPdfHeaderEnabled(),
- 'show_additional_guests' => in_array(1, $selectedSections),
- 'show_billing_corporate_details' => in_array(2, $selectedSections),
- 'show_payment_deposit' => in_array(3, $selectedSections),
- 'show_property_regulations' => in_array(4, $selectedSections),
- 'show_office_use_only' => in_array(5, $selectedSections),
- 'show_property_logo' => in_array(6, $selectedSections),
- );
- }
-
- /**
- * @return array
- */
- protected function getDynamicFields()
- {
- $idLang = (int)$this->order->id_lang;
-
- return array(
- 'purpose_of_visit' => GuestRegPurpose::getActiveOptions($idLang),
- 'identity_proof' => GuestRegIdProof::getActiveOptions($idLang),
- 'payment_method' => GuestRegPaymentMethod::getActiveOptions($idLang),
- );
- }
-
- /**
- * @return array
- */
- protected function getSelectedOptionalSections()
- {
- $value = Configuration::get('QLO_GUEST_REG_OPTIONAL_SECTIONS');
-
- if ($value === false || $value === '') {
- return array(1, 2, 3, 4, 5, 6);
- }
-
- $value = Tools::jsonDecode($value, true);
-
- if (!is_array($value)) {
- return array();
- }
-
- return array_map('intval', $value);
- }
-
- /**
- * @param string $hotelTime
- *
- * @return string
- */
- protected function formatHotelTime($hotelTime)
- {
- if (!$hotelTime || $hotelTime == '00:00:00') {
- return '';
- }
-
- return date('h:i a', strtotime($hotelTime));
- }
}
-
diff --git a/controllers/admin/AdminGuestRegistrationController.php b/controllers/admin/AdminGuestRegistrationController.php
index 21fc54957..a57d84d4e 100644
--- a/controllers/admin/AdminGuestRegistrationController.php
+++ b/controllers/admin/AdminGuestRegistrationController.php
@@ -1,28 +1,26 @@
-* @copyright 2007-2017 PrestaShop SA
-* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
+
+/**
+ * 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 AdminGuestRegistrationControllerCore extends AdminController
{
@@ -97,7 +95,6 @@ class AdminGuestRegistrationControllerCore extends AdminController
public function postProcess()
{
- // ddd(Tools::getAllValues());
if (Tools::isSubmit('submitBulkGuestRegistrationValues')) {
$this->processBulkDynamicFieldSave();
@@ -116,21 +113,16 @@ class AdminGuestRegistrationControllerCore extends AdminController
$this->fields_options['general']['fields'][self::CONF_OPTIONAL_SECTIONS]['value'] = '';
$html = parent::renderOptions();
- $selectedSections = Tools::jsonEncode($this->getSelectedOptionalSections());
- $html .= '
- ';
+ $this->context->smarty->assign(array(
+ 'guest_reg_preview_img_url' => $this->context->link->getBaseLink().'img/admin/guest_registration_preview.jpg',
+ 'guest_reg_selected_sections' => $this->getSelectedOptionalSections(),
+ 'guest_reg_conf_key' => self::CONF_OPTIONAL_SECTIONS,
+ 'guest_reg_preview_title' => $this->l('Guest Registration Card Preview'),
+ 'guest_reg_preview_btn_title' => $this->l('Preview'),
+ ));
+
+ $html .= $this->createTemplate('preview_modal.tpl')->fetch();
return $html;
}
@@ -432,12 +424,12 @@ class AdminGuestRegistrationControllerCore extends AdminController
protected function getOptionalSectionChoices()
{
return array(
- 1 => $this->l('Additional Guests'),
- 2 => $this->l('Billing & Corporate Details'),
- 3 => $this->l('Payment & Deposit'),
- 4 => $this->l('Property Regulations'),
- 5 => $this->l('For Office Use Only'),
- 6 => $this->l('Property Logo'),
+ 1 => $this->l('Property Logo'),
+ 2 => $this->l('Additional Guests'),
+ 3 => $this->l('Billing & Corporate Details'),
+ 4 => $this->l('Payment & Deposit'),
+ 5 => $this->l('Property Regulations'),
+ 6 => $this->l('For Office Use Only'),
);
}
diff --git a/img/admin/guest_registration_preview.jpg b/img/admin/guest_registration_preview.jpg
new file mode 100644
index 000000000..fc7c5cd4f
Binary files /dev/null and b/img/admin/guest_registration_preview.jpg differ
diff --git a/pdf/registration-form.tpl b/pdf/registration-form.tpl
index 86ef753c7..36658e851 100644
--- a/pdf/registration-form.tpl
+++ b/pdf/registration-form.tpl
@@ -28,11 +28,11 @@
{l s='GUEST REGISTRATION CARD' pdf='true'}
- {if $registration_form.config.show_property_logo}
+ {if $show_property_logo}
- {if $registration_form.property.logo_path}
-
+ {if $property_logo_path}
+
{else}
[PROPERTY LOGO]
{/if}
@@ -41,12 +41,12 @@
{/if}
|
|
- {$registration_form.hotel.name|escape:'html':'UTF-8'}
+ {$hotel_name|escape:'html':'UTF-8'}
|
|
- {$registration_form.property.city_country|escape:'html':'UTF-8'}
+ {$property_city_country|escape:'html':'UTF-8'}
|
@@ -64,44 +64,44 @@
-
-
-
-
- | {l s='TITLE:' pdf='true'} |
-
- □ {l s='Mr.' pdf='true'}
- □ {l s='Ms.' pdf='true'}
- |
- {l s='Full Name (As per ID):' pdf='true'} |
- ________________________ |
-
-
- | {l s='Phone / Mobile:' pdf='true'} |
- ________________________ |
- {l s='Email:' pdf='true'} |
- ________________________ |
-
-
- | {l s='Date of Birth:' pdf='true'} |
- ____ / ____ / ________ |
- {l s='Nationality:' pdf='true'} |
- ________________________ |
-
-
- | {l s='City / Country:' pdf='true'} |
- ________________________ |
- {l s='Postal Code:' pdf='true'} |
- ________________________ |
-
-
- | {l s='Address:' pdf='true'} |
- __________________________________________________________________________________ |
-
-
- |
-
-
+
+
+
+
+ | {l s='TITLE:' pdf='true'} |
+
+ □ {l s='Mr.' pdf='true'}
+ □ {l s='Ms.' pdf='true'}
+ |
+ {l s='Full Name (As per ID):' pdf='true'} |
+ ________________________ |
+
+
+ | {l s='Phone / Mobile:' pdf='true'} |
+ ________________________ |
+ {l s='Email:' pdf='true'} |
+ ________________________ |
+
+
+ | {l s='Date of Birth:' pdf='true'} |
+ ____ / ____ / ________ |
+ {l s='Nationality:' pdf='true'} |
+ ________________________ |
+
+
+ | {l s='City / Country:' pdf='true'} |
+ ________________________ |
+ {l s='Postal Code:' pdf='true'} |
+ ________________________ |
+
+
+ | {l s='Address:' pdf='true'} |
+ __________________________________________________________________________________ |
+
+
+ |
+
+
@@ -134,7 +134,7 @@
| {l s='Purpose of Visit:' pdf='true'} |
- {if $registration_form.dynamic_fields.purpose_of_visit|@count}{foreach from=$registration_form.dynamic_fields.purpose_of_visit item=item name=purposeOfVisit}{if !$smarty.foreach.purposeOfVisit.first} {/if}□ {$item.name|escape:'html':'UTF-8'|replace:' ':' '}{/foreach}{else}________________________{/if} |
+ {if $purpose_of_visit_options|@count}{foreach from=$purpose_of_visit_options item=item name=purposeOfVisit}{if !$smarty.foreach.purposeOfVisit.first} {/if}□ {$item.name|escape:'html':'UTF-8'|replace:' ':' '}{/foreach}{else}________________________{/if} |
@@ -160,11 +160,11 @@
| {l s='Booking Reference No.:' pdf='true'} |
- {$registration_form.stay.booking_reference|escape:'html':'UTF-8'} |
+ {$booking_reference|escape:'html':'UTF-8'} |
{l s='Rate per Night:' pdf='true'} |
- {if $registration_form.stay.rate_per_night}
- {$registration_form.stay.rate_per_night|escape:'html':'UTF-8'}
+ {if $rate_per_night}
+ {$rate_per_night|escape:'html':'UTF-8'}
{else}
__________
{/if}
@@ -173,16 +173,16 @@
|
| {l s='Arrival Date & Time:' pdf='true'} |
- {if $registration_form.stay.arrival_date_time}
- {$registration_form.stay.arrival_date_time|escape:'html':'UTF-8'}
+ {if $arrival_date_time}
+ {$arrival_date_time|escape:'html':'UTF-8'}
{else}
____ / ____ / ____ ______
{/if}
|
{l s='Departure Date & Time:' pdf='true'} |
- {if $registration_form.stay.departure_date_time}
- {$registration_form.stay.departure_date_time|escape:'html':'UTF-8'}
+ {if $departure_date_time}
+ {$departure_date_time|escape:'html':'UTF-8'}
{else}
____ / ____ / ____ ______
{/if}
@@ -190,15 +190,15 @@
|
| {l s='Room Type:' pdf='true'} |
- {$registration_form.stay.room_type|escape:'html':'UTF-8'} |
+ {$room_type|escape:'html':'UTF-8'} |
{l s='Room Number:' pdf='true'} |
- {$registration_form.stay.room_number|escape:'html':'UTF-8'} |
+ {$room_number|escape:'html':'UTF-8'} |
| {l s='Number of Guests:' pdf='true'} |
- {l s='Adults:' pdf='true'} {$registration_form.stay.adults|escape:'html':'UTF-8'}
- {l s='Children:' pdf='true'} {$registration_form.stay.children|escape:'html':'UTF-8'}
+ {l s='Adults:' pdf='true'} {$adults|escape:'html':'UTF-8'}
+ {l s='Children:' pdf='true'} {$children|escape:'html':'UTF-8'}
|
@@ -221,59 +221,59 @@
-
- □ {l s='LOCAL GUEST' pdf='true'}
-
-
- | {l s='Identity Proof:' pdf='true'} |
- {if $registration_form.dynamic_fields.identity_proof|@count}
- {foreach from=$registration_form.dynamic_fields.identity_proof item=item name=identityProof}{if !$smarty.foreach.identityProof.first} {/if}□ {$item.name|escape:'html':'UTF-8'|replace:' ':' '}{/foreach} |
+
+ □ {l s='LOCAL GUEST' pdf='true'}
+
+
+ | {l s='Identity Proof:' pdf='true'} |
+ {if $identity_proof_options|@count}
+ {foreach from=$identity_proof_options item=item name=identityProof}{if !$smarty.foreach.identityProof.first} {/if}□ {$item.name|escape:'html':'UTF-8'|replace:' ':' '}{/foreach} |
{else}
________________________________ |
{/if}
-
-
- | {l s='ID Number:' pdf='true'} |
- ________________________________ |
-
-
- |
-
-
-
- □ {l s='INTERNATIONAL GUEST' pdf='true'}
-
-
- | {l s='Passport No.:' pdf='true'} |
- ____________________ |
- {l s='Place of Issue:' pdf='true'} |
- ____________________ |
-
-
- | {l s='Date of Issue:' pdf='true'} |
- ____ / ____ / ____ |
- {l s='Date of Expiry:' pdf='true'} |
- ____ / ____ / ____ |
-
-
- | {l s='Visa Number:' pdf='true'} |
- ____________________ |
- {l s='Valid Until:' pdf='true'} |
- ____ / ____ / ____ |
-
-
- | {l s='Arrival Date in Country:' pdf='true'} |
- ____ / ____ / ____ |
-
-
- |
-
+
+
+ | {l s='ID Number:' pdf='true'} |
+ ________________________________ |
+
+
+ |
+
+
+
+ □ {l s='INTERNATIONAL GUEST' pdf='true'}
+
+
+ | {l s='Passport No.:' pdf='true'} |
+ ____________________ |
+ {l s='Place of Issue:' pdf='true'} |
+ ____________________ |
+
+
+ | {l s='Date of Issue:' pdf='true'} |
+ ____ / ____ / ____ |
+ {l s='Date of Expiry:' pdf='true'} |
+ ____ / ____ / ____ |
+
+
+ | {l s='Visa Number:' pdf='true'} |
+ ____________________ |
+ {l s='Valid Until:' pdf='true'} |
+ ____ / ____ / ____ |
+
+
+ | {l s='Arrival Date in Country:' pdf='true'} |
+ ____ / ____ / ____ |
+
+
+ |
+
- {if $registration_form.config.show_additional_guests}
+ {if $show_additional_guests}
| |
@@ -295,7 +295,7 @@
- {section name=ag loop=$registration_form.property.additional_guests_rows}
+ {section name=ag loop=$additional_guests_rows}
| {$smarty.section.ag.iteration} |
______________________________ |
@@ -304,7 +304,7 @@
____________ |
{/section}
- {if !$registration_form.property.additional_guests_rows}
+ {if !$additional_guests_rows}
| 1 |
______________________________ |
@@ -322,7 +322,7 @@
{/if}
- {if $registration_form.config.show_billing_corporate_details}
+ {if $show_billing_corporate_details}
| |
@@ -354,7 +354,7 @@
{/if}
- {if $registration_form.config.show_payment_deposit}
+ {if $show_payment_deposit}
| |
@@ -371,7 +371,7 @@
| {l s='Payment Method:' pdf='true'} |
- {if $registration_form.dynamic_fields.payment_method|@count}{foreach from=$registration_form.dynamic_fields.payment_method item=item name=paymentMethod}{if !$smarty.foreach.paymentMethod.first} {/if}□ {$item.name|escape:'html':'UTF-8'|replace:' ':' '}{/foreach}{else}________________________________{/if} |
+ {if $payment_method_options|@count}{foreach from=$payment_method_options item=item name=paymentMethod}{if !$smarty.foreach.paymentMethod.first} {/if}□ {$item.name|escape:'html':'UTF-8'|replace:' ':' '}{/foreach}{else}________________________________{/if} |
| {l s='Credit Card Number:' pdf='true'} |
@@ -388,7 +388,7 @@
{/if}
- {if $registration_form.config.show_property_regulations}
+ {if $show_property_regulations}
| |
@@ -400,32 +400,20 @@
- {*
-
-
-
- | {l s='Guest Signature:' pdf='true'} |
- ______________________________ |
- {l s='Date:' pdf='true'} |
- ____ / ____ / ________ |
-
-
- |
-
*}
|
{l s='Check-in Time:' pdf='true'}
- {if $registration_form.hotel.check_in_time}{$registration_form.hotel.check_in_time|escape:'html':'UTF-8'}{else}__________{/if}
+ {if $hotel_check_in_time}{$hotel_check_in_time|escape:'html':'UTF-8'}{else}__________{/if}
{l s='Check-out Time:' pdf='true'}
- {if $registration_form.hotel.check_out_time}{$registration_form.hotel.check_out_time|escape:'html':'UTF-8'}{else}__________{/if}
+ {if $hotel_check_out_time}{$hotel_check_out_time|escape:'html':'UTF-8'}{else}__________{/if}
|
{l s='Hotel Policies:' pdf='true'}
- {if $registration_form.hotel.policies}
- {$registration_form.hotel.policies}
+ {if $hotel_policies}
+ {$hotel_policies}
{else}
______________________________
______________________________
@@ -439,7 +427,7 @@
|
{/if}
- {if $registration_form.config.show_office_use_only}
+ {if $show_office_use_only}
| |
@@ -463,7 +451,8 @@
| {l s='ID Verified:' pdf='true'} |
□ {l s='Yes' pdf='true'} □ {l s='No' pdf='true'} |
- {l s='Registration No.:' pdf='true'} | ____________________ |
+ {l s='Registration No.:' pdf='true'} |
+ ____________________ |
@@ -474,31 +463,10 @@
{/if}
- {* {if $registration_form.config.show_footer}
- | |
-
-
-
-
-
-
- {if $registration_form.hotel.address}{$registration_form.hotel.address}{else}[Property Address]{/if}
-
- {l s='Phone No.:' pdf='true'} {if $registration_form.hotel.phone}{$registration_form.hotel.phone|escape:'html':'UTF-8'}{else}__________{/if}
- |
- {l s='Email:' pdf='true'} {if $registration_form.hotel.email}{$registration_form.hotel.email|escape:'html':'UTF-8'}{else}__________{/if}
- |
- {l s='Website:' pdf='true'} {$registration_form.property.website|escape:'html':'UTF-8'}
- |
-
-
- |
-
- {/if} *}
| |
-
+
@@ -520,7 +488,6 @@
-
{if isset($HOOK_DISPLAY_PDF)}
| |
|