From db6be2256457e6e1c6ec468c8751a82e315d693c Mon Sep 17 00:00:00 2001 From: shreesh arora Date: Tue, 2 Feb 2021 12:27:54 +0530 Subject: [PATCH] added auto_generated column in address table --- classes/Address.php | 4 ++++ controllers/front/AuthController.php | 1 + install/data/db_structure.sql | 1 + 3 files changed, 6 insertions(+) diff --git a/classes/Address.php b/classes/Address.php index 5738b854b..58a17e07e 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -98,6 +98,9 @@ class AddressCore extends ObjectModel /** @var bool True if address has been deleted (staying in database as deleted) */ public $deleted = 0; + /** @var bool True if address has been created automatically (by system) */ + public $auto_generated; + protected static $_idZones = array(); protected static $_idCountries = array(); @@ -128,6 +131,7 @@ class AddressCore extends ObjectModel 'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16), 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), + 'auto_generated' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), ), diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 3667e993b..686694ef8 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -460,6 +460,7 @@ class AuthControllerCore extends FrontController $_POST['alias'] = 'My address'; $_POST['id_country'] = $objHotel->country_id; $_POST['id_state'] = $objHotel->state_id; + $_POST['auto_generated'] = true; // if form is shorter then address name will be customer name $lastnameAddress = $_POST['lastname']; $firstnameAddress = $_POST['firstname']; diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index 264faaabe..60fc52813 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -42,6 +42,7 @@ CREATE TABLE `PREFIX_address` ( `date_upd` datetime NOT NULL, `active` tinyint(1) unsigned NOT NULL DEFAULT '1', `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', + `auto_generated` tinyint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id_address`), KEY `address_customer` (`id_customer`), KEY `id_country` (`id_country`),