From 0e855071b237c0dd6f5b5e19cf0fc3ef6e793767 Mon Sep 17 00:00:00 2001 From: varun kewlani Date: Wed, 6 May 2026 13:32:58 +0530 Subject: [PATCH] Fixed: Changed class names of guest registration files Co-authored-by: Name --- ...Proof.php => GuestRegistrationIdProof.php} | 43 +++++++++++-------- ...php => GuestRegistrationPaymentMethod.php} | 43 +++++++++++-------- ...stRegPurpose.php => GuestVisitPurpose.php} | 43 +++++++++++-------- classes/pdf/HTMLTemplateRegistrationForm.php | 6 +-- .../AdminGuestRegistrationController.php | 8 ++-- 5 files changed, 85 insertions(+), 58 deletions(-) rename classes/{GuestRegIdProof.php => GuestRegistrationIdProof.php} (52%) rename classes/{GuestRegPaymentMethod.php => GuestRegistrationPaymentMethod.php} (53%) rename classes/{GuestRegPurpose.php => GuestVisitPurpose.php} (52%) diff --git a/classes/GuestRegIdProof.php b/classes/GuestRegistrationIdProof.php similarity index 52% rename from classes/GuestRegIdProof.php rename to classes/GuestRegistrationIdProof.php index 4db0a9091..65e05142f 100644 --- a/classes/GuestRegIdProof.php +++ b/classes/GuestRegistrationIdProof.php @@ -1,30 +1,27 @@ - * @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 + * @author Webkul IN + * @copyright Since 2010 Webkul + * @license https://opensource.org/license/osl-3.0-php Open Software License version 3.0 */ -class GuestRegIdProofCore extends ObjectModel +class GuestRegistrationIdProofCore extends ObjectModel { public $active = 1; public $name; @@ -49,15 +46,27 @@ class GuestRegIdProofCore extends ObjectModel ), ); - public static function getActiveOptions($idLang) + /** + * @param int|null $active 1 = active only, 0 = inactive only, null = all + * @param int $idLang 0 falls back to current context language + * + * @return array|false + */ + public static function getRegistrationIdProofs($active = null, $idLang = 0) { + if (!$idLang) { + $idLang = (int)Context::getContext()->language->id; + } + + $activeCondition = ($active !== null) ? ' AND a.`active` = '.(int)$active : ''; + 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 + AND al.`id_lang` = '.(int)$idLang.') + WHERE 1'.$activeCondition.' ORDER BY al.`name` ASC' ); } diff --git a/classes/GuestRegPaymentMethod.php b/classes/GuestRegistrationPaymentMethod.php similarity index 53% rename from classes/GuestRegPaymentMethod.php rename to classes/GuestRegistrationPaymentMethod.php index 8e4036991..e417d67b9 100644 --- a/classes/GuestRegPaymentMethod.php +++ b/classes/GuestRegistrationPaymentMethod.php @@ -1,30 +1,27 @@ - * @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 + * @author Webkul IN + * @copyright Since 2010 Webkul + * @license https://opensource.org/license/osl-3.0-php Open Software License version 3.0 */ -class GuestRegPaymentMethodCore extends ObjectModel +class GuestRegistrationPaymentMethodCore extends ObjectModel { public $active = 1; public $name; @@ -49,15 +46,27 @@ class GuestRegPaymentMethodCore extends ObjectModel ), ); - public static function getActiveOptions($idLang) + /** + * @param int|null $active 1 = active only, 0 = inactive only, null = all + * @param int $idLang 0 falls back to current context language + * + * @return array|false + */ + public static function getRegistrationPaymentMethods($active = null, $idLang = 0) { + if (!$idLang) { + $idLang = (int)Context::getContext()->language->id; + } + + $activeCondition = ($active !== null) ? ' AND a.`active` = '.(int)$active : ''; + 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 + AND al.`id_lang` = '.(int)$idLang.') + WHERE 1'.$activeCondition.' ORDER BY al.`name` ASC' ); } diff --git a/classes/GuestRegPurpose.php b/classes/GuestVisitPurpose.php similarity index 52% rename from classes/GuestRegPurpose.php rename to classes/GuestVisitPurpose.php index 305cb637f..cbf870af1 100644 --- a/classes/GuestRegPurpose.php +++ b/classes/GuestVisitPurpose.php @@ -1,30 +1,27 @@ - * @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 + * @author Webkul IN + * @copyright Since 2010 Webkul + * @license https://opensource.org/license/osl-3.0-php Open Software License version 3.0 */ -class GuestRegPurposeCore extends ObjectModel +class GuestVisitPurposeCore extends ObjectModel { public $active = 1; public $name; @@ -49,15 +46,27 @@ class GuestRegPurposeCore extends ObjectModel ), ); - public static function getActiveOptions($idLang) + /** + * @param int|null $active 1 = active only, 0 = inactive only, null = all + * @param int $idLang 0 falls back to current context language + * + * @return array|false + */ + public static function getGuestVisitPurposes($active = null, $idLang = 0) { + if (!$idLang) { + $idLang = (int)Context::getContext()->language->id; + } + + $activeCondition = ($active !== null) ? ' AND a.`active` = '.(int)$active : ''; + 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 + AND al.`id_lang` = '.(int)$idLang.') + WHERE 1'.$activeCondition.' ORDER BY al.`name` ASC' ); } diff --git a/classes/pdf/HTMLTemplateRegistrationForm.php b/classes/pdf/HTMLTemplateRegistrationForm.php index a9c1fe3d8..76a3d8519 100644 --- a/classes/pdf/HTMLTemplateRegistrationForm.php +++ b/classes/pdf/HTMLTemplateRegistrationForm.php @@ -232,9 +232,9 @@ class HTMLTemplateRegistrationFormCore extends HTMLTemplate // 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), + 'purpose_of_visit_options' => GuestVisitPurpose::getGuestVisitPurposes(1, $idLang), + 'identity_proof_options' => GuestRegistrationIdProof::getRegistrationIdProofs(1, $idLang), + 'payment_method_options' => GuestRegistrationPaymentMethod::getRegistrationPaymentMethods(1, $idLang), // Optional section visibility flags 'show_property_logo' => in_array(1, $selectedSections), 'show_additional_guests' => in_array(2, $selectedSections), diff --git a/controllers/admin/AdminGuestRegistrationController.php b/controllers/admin/AdminGuestRegistrationController.php index a57d84d4e..dc71c7e0a 100644 --- a/controllers/admin/AdminGuestRegistrationController.php +++ b/controllers/admin/AdminGuestRegistrationController.php @@ -32,7 +32,7 @@ class AdminGuestRegistrationControllerCore extends AdminController $this->bootstrap = true; $this->context = Context::getContext(); $this->table = 'guest_reg_purpose'; - $this->className = 'GuestRegPurpose'; + $this->className = 'GuestVisitPurpose'; $this->identifier = 'id_guest_reg_purpose'; $this->lang = true; @@ -401,19 +401,19 @@ class AdminGuestRegistrationControllerCore extends AdminController { return array( 'purpose' => array( - 'class' => 'GuestRegPurpose', + 'class' => 'GuestVisitPurpose', 'table' => 'guest_reg_purpose', 'identifier' => 'id_guest_reg_purpose', 'title' => $this->l('Purpose of visit'), ), 'id_proof' => array( - 'class' => 'GuestRegIdProof', + 'class' => 'GuestRegistrationIdProof', 'table' => 'guest_reg_id_proof', 'identifier' => 'id_guest_reg_id_proof', 'title' => $this->l('Identity proof'), ), 'payment_method' => array( - 'class' => 'GuestRegPaymentMethod', + 'class' => 'GuestRegistrationPaymentMethod', 'table' => 'guest_reg_payment_method', 'identifier' => 'id_guest_reg_payment_method', 'title' => $this->l('Payment method'),