diff --git a/admin/themes/default/template/controllers/guest_registration/dynamic_tables.tpl b/admin/themes/default/template/controllers/guest_registration/dynamic_tables.tpl index 2477460e9..dae691adb 100644 --- a/admin/themes/default/template/controllers/guest_registration/dynamic_tables.tpl +++ b/admin/themes/default/template/controllers/guest_registration/dynamic_tables.tpl @@ -23,8 +23,8 @@

{l s='Purpose of visit'}

- {assign var=entity_name value='guest_reg_purpose'} - {assign var=entity_rows value=$guest_reg_purpose_rows} + {assign var=entity_name value='guest_visit_purpose'} + {assign var=entity_rows value=$guest_visit_purpose_rows} {if isset($smarty.post.$entity_name) && is_array($smarty.post.$entity_name)} {assign var=entity_rows value=$smarty.post.$entity_name} {/if} @@ -127,8 +127,8 @@

{l s='Identity proof'}

- {assign var=entity_name value='guest_reg_id_proof'} - {assign var=entity_rows value=$guest_reg_id_proof_rows} + {assign var=entity_name value='reg_id_proof'} + {assign var=entity_rows value=$reg_id_proof_rows} {if isset($smarty.post.$entity_name) && is_array($smarty.post.$entity_name)} {assign var=entity_rows value=$smarty.post.$entity_name} {/if} diff --git a/classes/GuestVisitPurpose.php b/classes/GuestVisitPurpose.php index f99c1557d..285f08f63 100644 --- a/classes/GuestVisitPurpose.php +++ b/classes/GuestVisitPurpose.php @@ -29,8 +29,8 @@ class GuestVisitPurposeCore extends ObjectModel public $date_upd; public static $definition = array( - 'table' => 'guest_reg_purpose', - 'primary' => 'id_guest_reg_purpose', + 'table' => 'guest_visit_purpose', + 'primary' => 'id_guest_visit_purpose', 'multilang' => true, 'fields' => array( 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), @@ -61,10 +61,10 @@ class GuestVisitPurposeCore extends ObjectModel $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` + 'SELECT a.`id_guest_visit_purpose`, al.`name` + FROM `'._DB_PREFIX_.'guest_visit_purpose` a + INNER JOIN `'._DB_PREFIX_.'guest_visit_purpose_lang` al + ON (a.`id_guest_visit_purpose` = al.`id_guest_visit_purpose` AND al.`id_lang` = '.(int)$idLang.') WHERE 1'.$activeCondition.' ORDER BY al.`name` ASC' @@ -80,16 +80,16 @@ class GuestVisitPurposeCore extends ObjectModel $rows = array(); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( - 'SELECT a.`id_guest_reg_purpose`, a.`active`, a.`date_add`, al.`id_lang`, al.`name` - FROM `'._DB_PREFIX_.'guest_reg_purpose` a - LEFT JOIN `'._DB_PREFIX_.'guest_reg_purpose_lang` al - ON (a.`id_guest_reg_purpose` = al.`id_guest_reg_purpose`) - ORDER BY a.`id_guest_reg_purpose` ASC' + 'SELECT a.`id_guest_visit_purpose`, a.`active`, a.`date_add`, al.`id_lang`, al.`name` + FROM `'._DB_PREFIX_.'guest_visit_purpose` a + LEFT JOIN `'._DB_PREFIX_.'guest_visit_purpose_lang` al + ON (a.`id_guest_visit_purpose` = al.`id_guest_visit_purpose`) + ORDER BY a.`id_guest_visit_purpose` ASC' ); if ($result) { foreach ($result as $row) { - $id = (int)$row['id_guest_reg_purpose']; + $id = (int)$row['id_guest_visit_purpose']; if (!isset($rows[$id])) { $rows[$id] = array( 'id' => $id, @@ -117,9 +117,9 @@ class GuestVisitPurposeCore extends ObjectModel public static function getGuestVisitPurposeIds(): array { $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( - 'SELECT `id_guest_reg_purpose` FROM `'._DB_PREFIX_.'guest_reg_purpose`' + 'SELECT `id_guest_visit_purpose` FROM `'._DB_PREFIX_.'guest_visit_purpose`' ); - return $result ? array_map('intval', array_column($result, 'id_guest_reg_purpose')) : array(); + return $result ? array_map('intval', array_column($result, 'id_guest_visit_purpose')) : array(); } } diff --git a/classes/IdProof.php b/classes/IdProof.php index 9292904f0..1b6298c43 100644 --- a/classes/IdProof.php +++ b/classes/IdProof.php @@ -29,8 +29,8 @@ class IdProofCore extends ObjectModel public $date_upd; public static $definition = array( - 'table' => 'guest_reg_id_proof', - 'primary' => 'id_guest_reg_id_proof', + 'table' => 'reg_id_proof', + 'primary' => 'id_reg_id_proof', 'multilang' => true, 'fields' => array( 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), @@ -61,10 +61,10 @@ class IdProofCore extends ObjectModel $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` + 'SELECT a.`id_reg_id_proof`, al.`name` + FROM `'._DB_PREFIX_.'reg_id_proof` a + INNER JOIN `'._DB_PREFIX_.'reg_id_proof_lang` al + ON (a.`id_reg_id_proof` = al.`id_reg_id_proof` AND al.`id_lang` = '.(int)$idLang.') WHERE 1'.$activeCondition.' ORDER BY al.`name` ASC' @@ -80,16 +80,16 @@ class IdProofCore extends ObjectModel $rows = array(); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( - 'SELECT a.`id_guest_reg_id_proof`, a.`active`, a.`date_add`, al.`id_lang`, al.`name` - FROM `'._DB_PREFIX_.'guest_reg_id_proof` a - LEFT JOIN `'._DB_PREFIX_.'guest_reg_id_proof_lang` al - ON (a.`id_guest_reg_id_proof` = al.`id_guest_reg_id_proof`) - ORDER BY a.`id_guest_reg_id_proof` ASC' + 'SELECT a.`id_reg_id_proof`, a.`active`, a.`date_add`, al.`id_lang`, al.`name` + FROM `'._DB_PREFIX_.'reg_id_proof` a + LEFT JOIN `'._DB_PREFIX_.'reg_id_proof_lang` al + ON (a.`id_reg_id_proof` = al.`id_reg_id_proof`) + ORDER BY a.`id_reg_id_proof` ASC' ); if ($result) { foreach ($result as $row) { - $id = (int)$row['id_guest_reg_id_proof']; + $id = (int)$row['id_reg_id_proof']; if (!isset($rows[$id])) { $rows[$id] = array( 'id' => $id, @@ -117,9 +117,9 @@ class IdProofCore extends ObjectModel public static function getRegistrationIdProofIds(): array { $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( - 'SELECT `id_guest_reg_id_proof` FROM `'._DB_PREFIX_.'guest_reg_id_proof`' + 'SELECT `id_reg_id_proof` FROM `'._DB_PREFIX_.'reg_id_proof`' ); - return $result ? array_map('intval', array_column($result, 'id_guest_reg_id_proof')) : array(); + return $result ? array_map('intval', array_column($result, 'id_reg_id_proof')) : array(); } } diff --git a/controllers/admin/AdminGuestRegistrationController.php b/controllers/admin/AdminGuestRegistrationController.php index a91c3b6a1..ae12b236c 100644 --- a/controllers/admin/AdminGuestRegistrationController.php +++ b/controllers/admin/AdminGuestRegistrationController.php @@ -31,9 +31,9 @@ class AdminGuestRegistrationControllerCore extends AdminController { $this->bootstrap = true; $this->context = Context::getContext(); - $this->table = 'guest_reg_purpose'; + $this->table = 'guest_visit_purpose'; $this->className = 'GuestVisitPurpose'; - $this->identifier = 'id_guest_reg_purpose'; + $this->identifier = 'id_guest_visit_purpose'; $this->lang = true; parent::__construct(); @@ -100,13 +100,13 @@ class AdminGuestRegistrationControllerCore extends AdminController $idLangDefault = (int)Configuration::get('PS_LANG_DEFAULT'); $guestRegPurposeData = $this->validateRegistrationFieldRows( - (array)Tools::getValue('guest_reg_purpose', array()), + (array)Tools::getValue('guest_visit_purpose', array()), $languages, $idLangDefault, $this->l('Purpose of visit') ); $idProofData = $this->validateRegistrationFieldRows( - (array)Tools::getValue('guest_reg_id_proof', array()), + (array)Tools::getValue('reg_id_proof', array()), $languages, $idLangDefault, $this->l('Identity proof') @@ -232,8 +232,8 @@ class AdminGuestRegistrationControllerCore extends AdminController 'languages' => $languages, 'default_form_language' => (int)Configuration::get('PS_LANG_DEFAULT'), 'dynamic_form_action' => self::$currentIndex.'&token='.$this->token, - 'guest_reg_purpose_rows' => GuestVisitPurpose::getGuestVisitPurposeRows(), - 'guest_reg_id_proof_rows' => IdProof::getRegistrationIdProofRows(), + 'guest_visit_purpose_rows' => GuestVisitPurpose::getGuestVisitPurposeRows(), + 'reg_id_proof_rows' => IdProof::getRegistrationIdProofRows(), 'guest_reg_payment_method_rows' => GuestRegistrationPaymentMethod::getRegistrationPaymentMethodRows(), )); diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index 4b63cce94..0dcadbb63 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -2777,35 +2777,35 @@ CREATE TABLE IF NOT EXISTS `PREFIX_maintenance_access` ( 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, +CREATE TABLE IF NOT EXISTS `PREFIX_guest_visit_purpose` ( + `id_guest_visit_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`) + PRIMARY KEY (`id_guest_visit_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, +CREATE TABLE IF NOT EXISTS `PREFIX_guest_visit_purpose_lang` ( + `id_guest_visit_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`), + PRIMARY KEY (`id_guest_visit_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, +CREATE TABLE IF NOT EXISTS `PREFIX_reg_id_proof` ( + `id_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`) + PRIMARY KEY (`id_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, +CREATE TABLE IF NOT EXISTS `PREFIX_reg_id_proof_lang` ( + `id_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`), + PRIMARY KEY (`id_reg_id_proof`, `id_lang`), KEY `id_lang` (`id_lang`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;