From 9c61df1c7432307d1cffbfc3a38e27f94ed91542 Mon Sep 17 00:00:00 2001 From: varun kewlani Date: Thu, 26 Mar 2026 18:05:50 +0530 Subject: [PATCH] gli-407: Added: Guest registration form button in order detail page, and made a new COntroller AdminGuestRegistration for back office configuration --- .../guest_registration/dynamic_tables.tpl | 348 +++++++++++ .../controllers/orders/helpers/view/view.tpl | 4 + classes/GuestRegIdProof.php | 64 ++ classes/GuestRegPaymentMethod.php | 64 ++ classes/GuestRegPurpose.php | 64 ++ classes/pdf/HTMLTemplateRegistrationForm.php | 510 ++++++++++++++++ classes/pdf/PDF.php | 4 + classes/pdf/PDFGenerator.php | 15 +- .../AdminGuestRegistrationController.php | 423 +++++++++++++ controllers/admin/AdminOrdersController.php | 2 +- controllers/admin/AdminPdfController.php | 39 ++ install/data/db_structure.sql | 48 ++ pdf/registration-form.tpl | 567 ++++++++++++++++++ 13 files changed, 2150 insertions(+), 2 deletions(-) create mode 100644 admin/themes/default/template/controllers/guest_registration/dynamic_tables.tpl create mode 100644 classes/GuestRegIdProof.php create mode 100644 classes/GuestRegPaymentMethod.php create mode 100644 classes/GuestRegPurpose.php create mode 100644 classes/pdf/HTMLTemplateRegistrationForm.php create mode 100644 controllers/admin/AdminGuestRegistrationController.php create mode 100644 pdf/registration-form.tpl diff --git a/admin/themes/default/template/controllers/guest_registration/dynamic_tables.tpl b/admin/themes/default/template/controllers/guest_registration/dynamic_tables.tpl new file mode 100644 index 000000000..f3ccb918f --- /dev/null +++ b/admin/themes/default/template/controllers/guest_registration/dynamic_tables.tpl @@ -0,0 +1,348 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +*} + +
+ {assign var=default_iso_code value=''} + {foreach from=$languages item=language} + {if $language.id_lang == $default_form_language} + {assign var=default_iso_code value=$language.iso_code} + {/if} + {/foreach} +
+

{l s='Dynamic values'}

+ +
+

{l s='Purpose of visit'}

+ {assign var=entity_name value='guest_reg_purpose'} + {assign var=entity_rows value=$guest_reg_purpose_rows} +
+ + + + + + + + + + + {foreach from=$entity_rows item=row} + + + + + + + {/foreach} + + + + + + + +
{l s='ID'}{l s='Name'}{l s='Active'}{l s='Action'}
+ + + {foreach from=$languages item=language} +
+
+ +
+
+ + +
+
+ {/foreach} +
+ + + +
+
+ +
+ +
+

{l s='Identity proof'}

+ {assign var=entity_name value='guest_reg_id_proof'} + {assign var=entity_rows value=$guest_reg_id_proof_rows} +
+ + + + + + + + + + + {foreach from=$entity_rows item=row} + + + + + + + {/foreach} + + + + + + + +
{l s='ID'}{l s='Name'}{l s='Active'}{l s='Action'}
+ + + {foreach from=$languages item=language} +
+
+ +
+
+ + +
+
+ {/foreach} +
+ + + +
+
+ +
+ +
+

{l s='Payment method'}

+ {assign var=entity_name value='guest_reg_payment_method'} + {assign var=entity_rows value=$guest_reg_payment_method_rows} +
+ + + + + + + + + + + {foreach from=$entity_rows item=row} + + + + + + + {/foreach} + + + + + + + +
{l s='ID'}{l s='Name'}{l s='Active'}{l s='Action'}
+ + + {foreach from=$languages item=language} +
+
+ +
+
+ + +
+
+ {/foreach} +
+ + + +
+
+ +
+ + +
+
+ + diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index c0c841758..a0c81ff58 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -145,6 +145,10 @@ {if $data.num_checkin_documents > 0}{$data.num_checkin_documents}{else}0{/if} + + {l s='Registration'} + + {if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded} {if $data.is_cancelled}{l s='Cancelled'}{else}{l s='Refunded'}{/if} {elseif $can_edit} diff --git a/classes/GuestRegIdProof.php b/classes/GuestRegIdProof.php new file mode 100644 index 000000000..4db0a9091 --- /dev/null +++ b/classes/GuestRegIdProof.php @@ -0,0 +1,64 @@ + + * @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 + */ + +class GuestRegIdProofCore extends ObjectModel +{ + public $active = 1; + public $name; + public $date_add; + public $date_upd; + + public static $definition = array( + 'table' => 'guest_reg_id_proof', + 'primary' => 'id_guest_reg_id_proof', + 'multilang' => true, + 'fields' => array( + 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), + 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), + 'name' => array( + 'type' => self::TYPE_STRING, + 'lang' => true, + 'validate' => 'isCatalogName', + 'required' => true, + 'size' => 255, + ), + ), + ); + + public static function getActiveOptions($idLang) + { + return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( + 'SELECT a.`id_guest_reg_id_proof`, al.`name` + FROM `'._DB_PREFIX_.'guest_reg_id_proof` a + INNER JOIN `'._DB_PREFIX_.'guest_reg_id_proof_lang` al + ON (a.`id_guest_reg_id_proof` = al.`id_guest_reg_id_proof` + AND al.`id_lang` = '.(int) $idLang.') + WHERE a.`active` = 1 + ORDER BY al.`name` ASC' + ); + } +} diff --git a/classes/GuestRegPaymentMethod.php b/classes/GuestRegPaymentMethod.php new file mode 100644 index 000000000..8e4036991 --- /dev/null +++ b/classes/GuestRegPaymentMethod.php @@ -0,0 +1,64 @@ + + * @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 + */ + +class GuestRegPaymentMethodCore extends ObjectModel +{ + public $active = 1; + public $name; + public $date_add; + public $date_upd; + + public static $definition = array( + 'table' => 'guest_reg_payment_method', + 'primary' => 'id_guest_reg_payment_method', + 'multilang' => true, + 'fields' => array( + 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), + 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), + 'name' => array( + 'type' => self::TYPE_STRING, + 'lang' => true, + 'validate' => 'isCatalogName', + 'required' => true, + 'size' => 255, + ), + ), + ); + + public static function getActiveOptions($idLang) + { + return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( + 'SELECT a.`id_guest_reg_payment_method`, al.`name` + FROM `'._DB_PREFIX_.'guest_reg_payment_method` a + INNER JOIN `'._DB_PREFIX_.'guest_reg_payment_method_lang` al + ON (a.`id_guest_reg_payment_method` = al.`id_guest_reg_payment_method` + AND al.`id_lang` = '.(int) $idLang.') + WHERE a.`active` = 1 + ORDER BY al.`name` ASC' + ); + } +} diff --git a/classes/GuestRegPurpose.php b/classes/GuestRegPurpose.php new file mode 100644 index 000000000..305cb637f --- /dev/null +++ b/classes/GuestRegPurpose.php @@ -0,0 +1,64 @@ + + * @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 + */ + +class GuestRegPurposeCore extends ObjectModel +{ + public $active = 1; + public $name; + public $date_add; + public $date_upd; + + public static $definition = array( + 'table' => 'guest_reg_purpose', + 'primary' => 'id_guest_reg_purpose', + 'multilang' => true, + 'fields' => array( + 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), + 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), + 'name' => array( + 'type' => self::TYPE_STRING, + 'lang' => true, + 'validate' => 'isCatalogName', + 'required' => true, + 'size' => 255, + ), + ), + ); + + public static function getActiveOptions($idLang) + { + return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( + 'SELECT a.`id_guest_reg_purpose`, al.`name` + FROM `'._DB_PREFIX_.'guest_reg_purpose` a + INNER JOIN `'._DB_PREFIX_.'guest_reg_purpose_lang` al + ON (a.`id_guest_reg_purpose` = al.`id_guest_reg_purpose` + AND al.`id_lang` = '.(int) $idLang.') + WHERE a.`active` = 1 + ORDER BY al.`name` ASC' + ); + } +} diff --git a/classes/pdf/HTMLTemplateRegistrationForm.php b/classes/pdf/HTMLTemplateRegistrationForm.php new file mode 100644 index 000000000..e172d1426 --- /dev/null +++ b/classes/pdf/HTMLTemplateRegistrationForm.php @@ -0,0 +1,510 @@ +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(); + $this->shop = new Shop((int)$this->order->id_shop); + } + + /** + * Returns the template's HTML header + * + * @return string HTML header + */ + public function getHeader() + { + if ($this->isPdfHeaderEnabled()) { + return parent::getHeader(); + } + + return ''; + } + + public function requestMinimalMargins() + { + return !$this->isPdfHeaderEnabled(); + } + + /** + * Returns the template's HTML content + * + * @return string HTML content + */ + public function getContent() + { + $objCustomer = new Customer((int)$this->order->id_customer); + $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) { + 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(), + ), + ); + + $this->smarty->assign($data); + $this->smarty->assign(array( + 'style_tab' => $this->smarty->fetch($this->getTemplate('invoice.style-tab')), + )); + + return $this->smarty->fetch($this->getTemplate('registration-form')); + } + + /** + * Returns the template filename when using bulk rendering + * + * @return string filename + */ + public function getBulkFilename() + { + return 'registration-forms.pdf'; + } + + /** + * Returns the template filename + * + * @return string filename + */ + public function getFilename() + { + $filename = 'registration-form-'.$this->order->reference; + 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) + { + $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( + '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_footer' => 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/classes/pdf/PDF.php b/classes/pdf/PDF.php index 626d3a51a..7062cfba5 100644 --- a/classes/pdf/PDF.php +++ b/classes/pdf/PDF.php @@ -37,6 +37,7 @@ class PDFCore protected $smarty; const TEMPLATE_INVOICE = 'Invoice'; + const TEMPLATE_REGISTRATION_FORM = 'RegistrationForm'; const TEMPLATE_ORDER_RETURN = 'OrderReturn'; const TEMPLATE_ORDER_SLIP = 'OrderSlip'; const TEMPLATE_DELIVERY_SLIP = 'DeliverySlip'; @@ -88,6 +89,9 @@ class PDFCore $this->filename = $template->getBulkFilename(); } } + if (method_exists($template, 'requestMinimalMargins') && $template->requestMinimalMargins()) { + $this->pdf_renderer->setMinimalMargins(true); + } $template->assignHookData($object); diff --git a/classes/pdf/PDFGenerator.php b/classes/pdf/PDFGenerator.php index 4cd27a6bb..d1cd6f585 100644 --- a/classes/pdf/PDFGenerator.php +++ b/classes/pdf/PDFGenerator.php @@ -38,6 +38,7 @@ class PDFGeneratorCore extends TCPDF public $pagination; public $content; public $font; + protected $force_minimal_margins = false; public $font_by_lang = array( 'ja' => 'cid0jp', @@ -207,6 +208,11 @@ class PDFGeneratorCore extends TCPDF return $this->output($filename, $output); } + public function setMinimalMargins($minimal = true) + { + $this->force_minimal_margins = $minimal; + } + /** * Write a PDF page */ @@ -214,7 +220,14 @@ class PDFGeneratorCore extends TCPDF { $this->SetHeaderMargin(5); $this->SetFooterMargin(21); - $this->setMargins(10, 40, 10); + if ($this->force_minimal_margins) { + $this->SetAutoPageBreak(true, 25); + $this->setPrintHeader(false); + $this->setMargins(10, 10, 10); // Reclaim the 40mm space + } else { + $this->setPrintHeader(true); + $this->setMargins(10, 40, 10); + } $this->AddPage(); $this->writeHTML($this->content, true, false, true, false, ''); } diff --git a/controllers/admin/AdminGuestRegistrationController.php b/controllers/admin/AdminGuestRegistrationController.php new file mode 100644 index 000000000..31d58a2fc --- /dev/null +++ b/controllers/admin/AdminGuestRegistrationController.php @@ -0,0 +1,423 @@ + +* @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 +*/ + +class AdminGuestRegistrationControllerCore extends AdminController +{ + const CONF_ENABLE_HEADER = 'QLO_GUEST_REG_ENABLE_HEADER'; + const CONF_OPTIONAL_SECTIONS = 'QLO_GUEST_REG_OPTIONAL_SECTIONS'; + + public function __construct() + { + $this->bootstrap = true; + $this->context = Context::getContext(); + $this->table = 'guest_reg_purpose'; + $this->className = 'GuestRegPurpose'; + $this->identifier = 'id_guest_reg_purpose'; + $this->lang = true; + $this->override_folder = 'guest_registration'.DIRECTORY_SEPARATOR; + + parent::__construct(); + + $this->fields_options = array( + 'general' => array( + 'title' => $this->l('Guest Registration Card settings'), + 'icon' => 'icon-cogs', + 'fields' => array( + self::CONF_ENABLE_HEADER => array( + 'title' => $this->l('Enable PDF header'), + 'desc' => $this->l('Display the standard QloApps PDF header on the Guest Registration Card.'), + 'cast' => 'intval', + 'type' => 'bool', + ), + self::CONF_OPTIONAL_SECTIONS => array( + 'title' => $this->l('Optional sections'), + 'desc' => $this->l('Choose which optional sections should appear on the Guest Registration Card.'), + 'type' => 'checkbox', + 'auto_value' => false, + 'choices' => $this->getOptionalSectionChoices(), + ), + ), + 'submit' => array( + 'title' => $this->l('Save'), + ), + ), + ); + } + + public function initContent() + { + $this->display = 'options'; + $this->initToolbar(); + $this->initPageHeaderToolbar(); + + $this->content = $this->renderOptions(); + $this->content .= $this->renderDynamicFieldManagement(); + + $this->context->smarty->assign(array( + 'content' => $this->content, + 'url_post' => self::$currentIndex.'&token='.$this->token, + 'show_page_header_toolbar' => $this->show_page_header_toolbar, + 'page_header_toolbar_title' => $this->page_header_toolbar_title, + 'page_header_toolbar_btn' => $this->page_header_toolbar_btn, + )); + } + + public function initToolbarTitle() + { + $this->toolbar_title = array($this->l('Guest Registration Card')); + } + + public function initPageHeaderToolbar() + { + parent::initPageHeaderToolbar(); + unset($this->page_header_toolbar_btn['cancel']); + } + + public function postProcess() + { + if (Tools::isSubmit('submitBulkGuestRegistrationValues')) { + $this->processBulkDynamicFieldSave(); + + if (!count($this->errors)) { + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4'); + } + + return; + } + + parent::postProcess(); + } + + public function renderOptions() + { + $this->fields_options['general']['fields'][self::CONF_OPTIONAL_SECTIONS]['value'] = ''; + + $html = parent::renderOptions(); + $selectedSections = Tools::jsonEncode($this->getSelectedOptionalSections()); + + $html .= ' + '; + + return $html; + } + + protected function updateOptionQloGuestRegOptionalSections($value) + { + if (!is_array($value)) { + $value = array(); + } + + $allowed = array_map('intval', array_keys($this->getOptionalSectionChoices())); + $selected = array(); + + foreach ($value as $sectionId) { + $sectionId = (int)$sectionId; + if (in_array($sectionId, $allowed)) { + $selected[] = $sectionId; + } + } + + Configuration::updateValue(self::CONF_OPTIONAL_SECTIONS, Tools::jsonEncode(array_values(array_unique($selected)))); + } + + protected function renderDynamicFieldManagement() + { + $languages = Language::getLanguages(false); + $defaultFormLanguage = (int)Configuration::get('PS_LANG_DEFAULT'); + + $this->context->smarty->assign(array( + 'languages' => $languages, + 'default_form_language' => $defaultFormLanguage, + 'dynamic_form_action' => self::$currentIndex.'&token='.$this->token, + 'guest_reg_purpose_rows' => $this->getEntityRows('purpose'), + 'guest_reg_id_proof_rows' => $this->getEntityRows('id_proof'), + 'guest_reg_payment_method_rows' => $this->getEntityRows('payment_method'), + )); + + return $this->createTemplate('dynamic_tables.tpl')->fetch(); + } + + protected function processBulkDynamicFieldSave() + { + $languages = Language::getLanguages(false); + $savedRows = array(); + + foreach ($this->getManagedEntities() as $entityKey => $entity) { + $postedRows = Tools::getValue($entity['table'], array()); + if (!is_array($postedRows)) { + $postedRows = array(); + } + + $savedRows[$entityKey] = $this->prepareEntityRowsForSave($entityKey, $postedRows, $languages); + } + + if (count($this->errors)) { + return false; + } + + foreach ($savedRows as $entityKey => $rows) { + $this->persistEntityRows($entityKey, $rows); + } + + return true; + } + + protected function prepareEntityRowsForSave($entityKey, $postedRows, $languages) + { + $entity = $this->getManagedEntity($entityKey); + $rows = array(); + + // Get the system's default language ID + $idLangDefault = (int)Configuration::get('PS_LANG_DEFAULT'); + + foreach ($postedRows as $rowKey => $row) { + if (!is_array($row)) { + continue; + } + + if ($this->isEmptyEntityRow($row, $languages)) { + continue; + } + + $preparedRow = array( + 'id' => !empty($row['id']) ? (int)$row['id'] : 0, + 'active' => !empty($row['active']) ? 1 : 0, + 'name' => array(), + ); + + // Capture the default language value first to use as a fallback + $defaultValue = ''; + if (isset($row['name'][$idLangDefault])) { + $defaultValue = trim($row['name'][$idLangDefault]); + } + + foreach ($languages as $language) { + $idLang = (int)$language['id_lang']; + $value = ''; + + if (isset($row['name'][$idLang])) { + $value = trim($row['name'][$idLang]); + } + + // AUTOMATIC FALLBACK: If current language is blank, use the default language text + if ($value === '' && $defaultValue !== '') { + $value = $defaultValue; + } + + // Validation + if ($value === '') { + $this->errors[] = sprintf($this->l('%s: name is required for %s (or for the default language).'), $entity['title'], $language['name']); + } elseif (!Validate::isCatalogName($value)) { + $this->errors[] = sprintf($this->l('%s: name is invalid for %s.'), $entity['title'], $language['name']); + } + + $preparedRow['name'][$idLang] = $value; + } + + $rows[$rowKey] = $preparedRow; + } + + return $rows; + } + + protected function persistEntityRows($entityKey, $rows) + { + $entity = $this->getManagedEntity($entityKey); + $existingIds = $this->getEntityIds($entityKey); + $savedIds = array(); + + foreach ($rows as $row) { + $object = $row['id'] ? new $entity['class']((int)$row['id']) : new $entity['class'](); + $object->active = (int)$row['active']; + $object->name = $row['name']; + + if (!$object->save()) { + $this->errors[] = sprintf($this->l('An error occurred while saving %s.'), Tools::strtolower($entity['title'])); + continue; + } + + $savedIds[] = (int)$object->id; + } + + if (count($this->errors)) { + return false; + } + + foreach (array_diff($existingIds, $savedIds) as $idToDelete) { + $object = new $entity['class']((int)$idToDelete); + if (Validate::isLoadedObject($object)) { + $object->delete(); + } + } + + return true; + } + + protected function getEntityRows($entityKey) + { + $entity = $this->getManagedEntity($entityKey); + $languages = Language::getLanguages(false); + $rows = array(); + + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( + 'SELECT a.`'.$entity['identifier'].'`, a.`active`, a.`date_add`, al.`id_lang`, al.`name` + FROM `'._DB_PREFIX_.$entity['table'].'` a + LEFT JOIN `'._DB_PREFIX_.$entity['table'].'_lang` al + ON (a.`'.$entity['identifier'].'` = al.`'.$entity['identifier'].'`) + ORDER BY a.`'.$entity['identifier'].'` ASC' + ); + + if ($result) { + foreach ($result as $row) { + $idEntity = (int)$row[$entity['identifier']]; + if (!isset($rows[$idEntity])) { + $rows[$idEntity] = array( + 'id' => $idEntity, + 'active' => (int)$row['active'], + 'date_add' => $row['date_add'], + 'name' => array(), + ); + + foreach ($languages as $language) { + $rows[$idEntity]['name'][(int)$language['id_lang']] = ''; + } + } + + if ((int)$row['id_lang']) { + $rows[$idEntity]['name'][(int)$row['id_lang']] = $row['name']; + } + } + } + + return array_values($rows); + } + + protected function getManagedEntity($entityKey) + { + $entities = $this->getManagedEntities(); + + return $entities[$entityKey]; + } + + protected function getManagedEntities() + { + return array( + 'purpose' => array( + 'class' => 'GuestRegPurpose', + 'table' => 'guest_reg_purpose', + 'identifier' => 'id_guest_reg_purpose', + 'title' => $this->l('Purpose of visit'), + ), + 'id_proof' => array( + 'class' => 'GuestRegIdProof', + 'table' => 'guest_reg_id_proof', + 'identifier' => 'id_guest_reg_id_proof', + 'title' => $this->l('Identity proof'), + ), + 'payment_method' => array( + 'class' => 'GuestRegPaymentMethod', + 'table' => 'guest_reg_payment_method', + 'identifier' => 'id_guest_reg_payment_method', + 'title' => $this->l('Payment method'), + ), + ); + } + + 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('Footer'), + ); + } + + protected function getSelectedOptionalSections() + { + $value = Configuration::get(self::CONF_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); + } + + protected function getEntityIds($entityKey) + { + $entity = $this->getManagedEntity($entityKey); + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( + 'SELECT `'.$entity['identifier'].'` + FROM `'._DB_PREFIX_.$entity['table'].'`' + ); + + if (!$result) { + return array(); + } + + return array_map('intval', array_column($result, $entity['identifier'])); + } + + protected function isEmptyEntityRow($row, $languages) + { + if (!empty($row['id'])) { + return false; + } + + if (!isset($row['name']) || !is_array($row['name'])) { + return true; + } + + foreach ($languages as $language) { + $idLang = (int)$language['id_lang']; + if (!empty($row['name'][$idLang])) { + return false; + } + } + + return true; + } +} diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 30026bcca..09a61d9c3 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -498,7 +498,7 @@ class AdminOrdersControllerCore extends AdminController 'target' => true, ); } - + $this->toolbar_btn['print'] = array( 'short' => $this->l('Print'), 'href' => 'javascript:window.print()', diff --git a/controllers/admin/AdminPdfController.php b/controllers/admin/AdminPdfController.php index 7fba0f8e1..860b0f25a 100644 --- a/controllers/admin/AdminPdfController.php +++ b/controllers/admin/AdminPdfController.php @@ -64,6 +64,15 @@ class AdminPdfControllerCore extends AdminController } } + public function processGenerateRegistrationFormPDF() + { + if (Tools::isSubmit('id_order')) { + $this->generateRegistrationFormPDFByIdOrder(Tools::getValue('id_order')); + } else { + die(Tools::displayError('The order ID is missing.')); + } + } + public function processGenerateOrderSlipPDF() { $order_slip = new OrderSlip((int)Tools::getValue('id_order_slip')); @@ -202,6 +211,36 @@ class AdminPdfControllerCore extends AdminController $this->generatePDF($order_invoice, PDF::TEMPLATE_INVOICE); } + public function generateRegistrationFormPDFByIdOrder($id_order) + { + $order = new Order((int)$id_order); + if (!Validate::isLoadedObject($order)) { + die(Tools::displayError('The order cannot be found within your database.')); + } + + if (!HotelBookingDetail::getIdHotelByIdOrder($order->id)) { + die(Tools::displayError('The registration form cannot be generated for this order.')); + } + + $pdf = new PDF($order, PDF::TEMPLATE_REGISTRATION_FORM, Context::getContext()->smarty); + $pdf->render('I'); + } + + public function generateRegistrationFormPDFByRoom($id_order, $id_hotel_booking_detail) + { + $order = new Order((int)$id_order); + if (!Validate::isLoadedObject($order)) { + die(Tools::displayError('The order cannot be found within your database.')); + } + + if (!HotelBookingDetail::getIdHotelByIdOrder($order->id)) { + die(Tools::displayError('The registration form cannot be generated for this order.')); + } + + $pdf = new PDF($order, PDF::TEMPLATE_REGISTRATION_FORM, Context::getContext()->smarty, $id_hotel_booking_detail); + $pdf->render('I'); + } + public function generatePDF($object, $template) { $pdf = new PDF($object, $template, Context::getContext()->smarty); diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index 7550fbcad..4b63cce94 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -2776,3 +2776,51 @@ CREATE TABLE IF NOT EXISTS `PREFIX_maintenance_access` ( `date_add` datetime NOT NULL, PRIMARY KEY (`id_maintenance_access`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `PREFIX_guest_reg_purpose` ( + `id_guest_reg_purpose` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, + `date_add` DATETIME NOT NULL, + `date_upd` DATETIME NOT NULL, + PRIMARY KEY (`id_guest_reg_purpose`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `PREFIX_guest_reg_purpose_lang` ( + `id_guest_reg_purpose` INT(10) UNSIGNED NOT NULL, + `id_lang` INT(10) UNSIGNED NOT NULL, + `name` VARCHAR(255) NOT NULL, + PRIMARY KEY (`id_guest_reg_purpose`, `id_lang`), + KEY `id_lang` (`id_lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `PREFIX_guest_reg_id_proof` ( + `id_guest_reg_id_proof` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, + `date_add` DATETIME NOT NULL, + `date_upd` DATETIME NOT NULL, + PRIMARY KEY (`id_guest_reg_id_proof`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `PREFIX_guest_reg_id_proof_lang` ( + `id_guest_reg_id_proof` INT(10) UNSIGNED NOT NULL, + `id_lang` INT(10) UNSIGNED NOT NULL, + `name` VARCHAR(255) NOT NULL, + PRIMARY KEY (`id_guest_reg_id_proof`, `id_lang`), + KEY `id_lang` (`id_lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `PREFIX_guest_reg_payment_method` ( + `id_guest_reg_payment_method` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, + `date_add` DATETIME NOT NULL, + `date_upd` DATETIME NOT NULL, + PRIMARY KEY (`id_guest_reg_payment_method`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `PREFIX_guest_reg_payment_method_lang` ( + `id_guest_reg_payment_method` INT(10) UNSIGNED NOT NULL, + `id_lang` INT(10) UNSIGNED NOT NULL, + `name` VARCHAR(255) NOT NULL, + PRIMARY KEY (`id_guest_reg_payment_method`, `id_lang`), + KEY `id_lang` (`id_lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pdf/registration-form.tpl b/pdf/registration-form.tpl new file mode 100644 index 000000000..d7d7dfbf2 --- /dev/null +++ b/pdf/registration-form.tpl @@ -0,0 +1,567 @@ +{* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License version 3.0 +* that is bundled with this package in the file LICENSE.txt +* It is also available through the world-wide-web at this URL: +* https://opensource.org/licenses/AFL-3.0 +* +* 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 CustomizationPolicy.txt file inside our module for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 +*} + +{$style_tab} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $registration_form.config.show_additional_guests} + + + + + + {/if} + + {if $registration_form.config.show_billing_corporate_details} + + + + + + {/if} + + {if $registration_form.config.show_payment_deposit} + + + + + + {/if} + + {if $registration_form.config.show_property_regulations} + + + + + + {/if} + + {if $registration_form.config.show_office_use_only} + + + + + + {/if} + + {if $registration_form.config.show_footer} + + + + + + {/if} + + {if isset($HOOK_DISPLAY_PDF)} + + + + + + + {/if} +
+ + + + + + + + + + + + + +
+ {l s='GUEST REGISTRATION CARD' pdf='true'} +
+ {if $registration_form.property.logo_path} + + {else} + [PROPERTY LOGO] + {/if} +
+ {$registration_form.hotel.name|escape:'html':'UTF-8'} +
+ {$registration_form.property.city_country|escape:'html':'UTF-8'} +
+
 
+ + + + {* *} + + + + + + + + + + +
{l s='1. GUEST INFORMATION' 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'}{$registration_form.guest.full_name|escape:'html':'UTF-8'}
{l s='Phone / Mobile:' pdf='true'}{$registration_form.guest.mobile|escape:'html':'UTF-8'}{l s='Email:' pdf='true'}{$registration_form.guest.email|escape:'html':'UTF-8'}
{l s='Date of Birth:' pdf='true'}____ / ____ / ________{l s='Nationality:' pdf='true'}________________________
{l s='City / Country:' pdf='true'} + {if $registration_form.guest.city_country} + {$registration_form.guest.city_country|escape:'html':'UTF-8'} + {else} + ________________________ + {/if} + {l s='Postal Code:' pdf='true'} + {if $registration_form.guest.postcode} + {$registration_form.guest.postcode|escape:'html':'UTF-8'} + {else} + __________ + {/if} +
{l s='Address:' pdf='true'}{$registration_form.guest.address}
+
+
 
+ + + + {* *} + + + + + + + +
{l s='2. TRAVEL INFORMATION' pdf='true'}
+ + + + + + + + + + + + + + +
{l s='Arrived From:' pdf='true'}________________________{l s='Next Destination:' pdf='true'}___________________
+ {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} + [ ] {$item.name|escape:'html':'UTF-8'}   + {/foreach} + {else} + ________________________ + {/if} +
{l s='Flight / Train Number:' pdf='true'}___________________
+
+
 
+ + + + {* *} + + + + + + + +
{l s='3. BOOKING INFORMATION' pdf='true'}
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{l s='Booking Reference No.:' pdf='true'}{$registration_form.stay.booking_reference|escape:'html':'UTF-8'}{l s='Vehicle Reg. No.:' pdf='true'}________________
{l s='Arrival Date & Time:' pdf='true'} + {if $registration_form.stay.arrival_date_time} + {$registration_form.stay.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'} + {else} + ____ / ____ / ____ ______ + {/if} +
{l s='Room Type:' pdf='true'}{$registration_form.stay.room_type|escape:'html':'UTF-8'}{l s='Room Number:' pdf='true'}{$registration_form.stay.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='Rate per Night:' pdf='true'} + {if $registration_form.stay.rate_per_night} + {$registration_form.stay.rate_per_night|escape:'html':'UTF-8'} + {else} + __________ + {/if} +
+
+
 
+ + + + {* *} + + + + + + + + + + + + + +
{l s='4. IDENTIFICATION DOCUMENT' pdf='true'}
+ [ ] {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} + [ ] {$item.name|escape:'html':'UTF-8'}   + {/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 Hotel Country:' 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 Hotel Country:' pdf='true'}____ / ____ / ____
+
+
 
+ + + + + + + + + + + +
{l s='ADDITIONAL GUESTS (if any)' pdf='true'}
+ + + + + + + + + {section name=ag loop=$registration_form.property.additional_guests_rows} + + + + + + + + {/section} + {if !$registration_form.property.additional_guests_rows} + + + + + + + + {/if} +
{l s='S.No.' pdf='true'}{l s='Guest Name' pdf='true'}{l s='ID Type' pdf='true'}{l s='ID Number' pdf='true'}{l s='Nationality' pdf='true'}
{$smarty.section.ag.iteration}__________________________________________________________________________
1__________________________________________________________________________
+
+
 
+ + + + {* *} + + + + + + + +
{l s='6. BILLING & CORPORATE DETAILS' pdf='true'}
+ + + + + + + + + +
{l s='Company / Agent:' pdf='true'}______________________________________________
{l s='Tax ID / VAT No.:' pdf='true'}______________________________________________
+
+
 
+ + + + {* *} + + + + + + + + + + +
{l s='7. PAYMENT & DEPOSIT' pdf='true'}
+ {l s='Payment Method:' pdf='true'} + {if $registration_form.dynamic_fields.payment_method|@count} + {foreach from=$registration_form.dynamic_fields.payment_method item=item} + [ ] {$item.name|escape:'html':'UTF-8'}   + {/foreach} + {else} + ________________________ + {/if} +
+ + + + + + + +
{l s='Credit Card Number:' pdf='true'}________________________________{l s='Security Deposit:' pdf='true'}__________
+
+
 
+ + + + {* *} + + + + + + + + + + + + + +
{l s='8. PROPERTY REGULATIONS' pdf='true'}
+ + + + + + + +
{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} +     + {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} +
+ {l s='Hotel Policies:' pdf='true'}
+ {if $registration_form.hotel.policies} + {$registration_form.hotel.policies} + {else} + ______________________________
+ ______________________________
+ ______________________________ + {/if} +
+
 
+ + + + {* *} + + + + + + + +
{l s='FOR OFFICE USE ONLY' pdf='true'}
+ + + + + + + + + + + + + +
{l s='Staff Name:' pdf='true'}____________________{l s='Check-in Time:' pdf='true'}____________________
{l s='ID Verified:' pdf='true'}[ ] {l s='Yes' pdf='true'}   [ ] {l s='No' pdf='true'}{l s='Registration No.:' pdf='true'}____________________
+
+
 
+ + + + +
+ {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'} +
+
 
+ {$HOOK_DISPLAY_PDF} +