Skip to content

Commit

Permalink
Merge pull request #217 from shreesh-webkul/gli-507
Browse files Browse the repository at this point in the history
Added auto_generated column in address table to track address creation source
  • Loading branch information
rohit053 authored Feb 4, 2021
2 parents bc32b10 + db6be22 commit 5ce63a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions classes/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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),
),
Expand Down
1 change: 1 addition & 0 deletions controllers/front/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ protected function processSubmitAccount()
$_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'];
Expand Down
1 change: 1 addition & 0 deletions install/data/db_structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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`),
Expand Down

0 comments on commit 5ce63a8

Please sign in to comment.