diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-26 14:51:23 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-26 14:51:23 +0100 |
| commit | 620f081325c4e181a011781b5e72d251079b4271 (patch) | |
| tree | ce8ad2c6c0c0e2bca9585454eb61a68b2b05fbb0 /admin | |
| parent | 3ce59b8686582a514406b1a57574e846ce83a7c1 (diff) | |
| download | contact-620f081325c4e181a011781b5e72d251079b4271.tar.gz contact-620f081325c4e181a011781b5e72d251079b4271.tar.bz2 contact-620f081325c4e181a011781b5e72d251079b4271.zip | |
Migrate contact xref to liberty_xref tables; add address_postcode to schema
5.0.1 upgrade migrates contact_xref_type/source/xref data into
liberty_xref_group/item/xref with content_type_guid='contact'.
5.0.2 upgrade drops the old contact_xref* tables.
schema_inc.php updated for fresh installs:
- Removes contact_xref, contact_xref_source, contact_xref_type tables
- Adds address_postcode table (UK postcode lookup, LEFT JOIN'd in queries)
- Defaults now INSERT into liberty_xref_group and liberty_xref_item directly
- dependencies => 'liberty' ensures correct install ordering
PHP and templates: source→item, xref_type→group rename throughout.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'admin')
| -rwxr-xr-x | admin/schema_inc.php | 159 | ||||
| -rw-r--r-- | admin/upgrades/5.0.1.php | 10 |
2 files changed, 97 insertions, 72 deletions
diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 7868f90..2e6391c 100755 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -1,7 +1,7 @@ <?php $tables = [ - 'contact' => " + 'contact' => " content_id I8 PRIMARY, parent_id I8 DEFAULT 0, address_id I8 DEFAULT 0, @@ -9,7 +9,7 @@ $tables = [ xkey C(32) ", - 'contact_address' => " + 'contact_address' => " content_id I8 PRIMARY, address_id I8, uprn I8, @@ -28,6 +28,27 @@ $tables = [ cltype I2 ", + 'address_postcode' => " + postcode C(10) NOTNULL PRIMARY, + add1 C(32) DEFAULT '', + add2 C(32) DEFAULT '', + add3 C(32) DEFAULT '', + add4 C(32) DEFAULT '', + town C(20) DEFAULT '', + county C(20) DEFAULT '', + grideast C(6) DEFAULT '00000', + gridnorth C(6) DEFAULT '00000', + wcd C(6) DEFAULT '', + nhs C(3) DEFAULT '', + pcg C(5) DEFAULT '', + wnw C(32) DEFAULT '', + wna C(32) DEFAULT '', + pnp C(32) DEFAULT '', + pnh C(32) DEFAULT '', + nnh C(32) DEFAULT '', + nnr C(32) DEFAULT '' +", + ]; global $gBitInstaller; @@ -37,9 +58,10 @@ foreach( array_keys( $tables ) AS $tableName ) { } $gBitInstaller->registerPackageInfo( CONTACT_PKG_NAME, [ - 'description' => "Base Contact management package with contact xref and address books + 'description' => "Base Contact management package with contact xref and address books designed to be expanded with additional plugins.", - 'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>', + 'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>', + 'dependencies' => 'liberty', ] ); // ### Indexes @@ -50,79 +72,82 @@ $indices = [ $gBitInstaller->registerSchemaIndexes( CONTACT_PKG_NAME, $indices ); // ### Sequences -$sequences = []; -$gBitInstaller->registerSchemaSequences( CONTACT_PKG_NAME, $sequences ); +$gBitInstaller->registerSchemaSequences( CONTACT_PKG_NAME, [] ); // ### Defaults +// xref configuration now lives in liberty_xref_group and liberty_xref_item (content_type_guid='contact'). +// These replace the old contact_xref_type and contact_xref_source table defaults. +$gBitInstaller->registerSchemaDefault( CONTACT_PKG_NAME, [ + + // --- liberty_xref_group (formerly contact_xref_type: integer xref_type → sort_order, source text → x_group) --- + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('type', 'contact','Contact Type List', 0,3,'')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('contact','contact','General Contact Details', 1,3,'')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('links', 'contact','Linked Contact Items', 2,3,'')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('alarm', 'contact','Security System Links', 3,3,'')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('council','contact','Council reference links', 4,3,'')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('account','contact','Account Details', 5,4,'')", + + // --- liberty_xref_item (formerly contact_xref_source) --- + // group: type + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$00','contact','type','Personal', 0,3,'/contact/?type=0', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$01','contact','type','Business', 0,3,'/contact/?type=1', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$02','contact','type','Manufacturer', 0,3,'/contact/?type=2', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$03','contact','type','Distributor', 0,3,'/contact/?type=3', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$04','contact','type','Supplier', 0,3,'/contact/?type=4', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$05','contact','type','Record Company', 0,3,'/contact/?type=5', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$06','contact','type','Record Artist', 0,3,'/contact/?type=6', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$07','contact','type','Cartographer', 0,3,'/contact/?type=7', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$08','contact','type','PHX Client', 0,3,'/contact/?type=8', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$09','contact','type','LSCES Supplier', 0,3,'/contact/?type=9', NULL)", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('\$10','contact','type','Paypal Client', 0,3,'/contact/?type=10',NULL)", + // group: contact + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#C','contact','contact','Contact Address', 0,3,'../nlpg/?uprn=', 'address')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#E','contact','contact','eMail Address', 1,3,'../contact/?contact_id=','text' )", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#F','contact','contact','Fax', 1,3,'../contact/?contact_id=','text' )", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#I','contact','contact','Invoice Address', 0,3,'../nlpg/?uprn=', 'address')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#P','contact','contact','Telephone', 1,3,'../contact/?contact_id=','phone' )", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#R','contact','contact','Residential Address', 0,3,'../nlpg/?uprn=', 'address')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#S','contact','contact','Service Address', 0,3,'../nlpg/?uprn=', 'address')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#T','contact','contact','Tenant Address', 0,3,'../nlpg/?uprn=', 'address')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#W','contact','contact','Web Site Url', 1,3,'../contact/?contact_id=','text' )", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('0', 'contact','contact','Free format information', 1,3,'../contact/?xref=', 'text' )", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('CON','contact','contact','Contact', 1,3,'../nlpg/?uprn=', 'text' )", + // group: alarm + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#A', 'contact','alarm','Alarm Maintainer', 0,3,'../nlpg/?uprn=','text' )", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('#K', 'contact','alarm','Keyholder', 1,3,'../nlpg/?uprn=','phone')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('ALARM','contact','alarm','Alarm System', 0,3,'../nlpg/?uprn=','text' )", + // group: council + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('CTAX','contact','council','Council Tax', 0,3,'../nlpg/?uprn=','text')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('ER', 'contact','council','Electoral Roll', 0,3,'../nlpg/?uprn=','text')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('HBEN','contact','council','Housing Benefit', 0,3,'../nlpg/?uprn=','text')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('NNDR','contact','council','National Non-domestic Rates',0,3,'../nlpg/?uprn=','text')", + // group: account + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('ACC_TO','contact','account','Account Turnover', 0,3,'../vat/?vat=', 'text')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('SAGEID','contact','account','SAGE Account Reference', 0,3,'''sage''', 'text')", + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`) VALUES ('VAT_NO','contact','account','VAT Number', 0,3,'../vat/?vat=', 'text')", + +] ); // ### Default User Permissions $gBitInstaller->registerUserPermissions( CONTACT_PKG_NAME, [ - [ 'p_contact_view', 'Can browse the Contact List', 'basic', CONTACT_PKG_NAME ], - [ 'p_contact_update', 'Can update the Contact List content', 'registered', CONTACT_PKG_NAME ], - [ 'p_contact_create', 'Can create a new Contact List entry', 'registered', CONTACT_PKG_NAME ], - [ 'p_contact_admin', 'Can admin Contact List', 'admin', CONTACT_PKG_NAME ], - [ 'p_contact_expunge', 'Can remove a Contact entry', 'editors', CONTACT_PKG_NAME ], + [ 'p_contact_view', 'Can browse the Contact List', 'basic', CONTACT_PKG_NAME ], + [ 'p_contact_update', 'Can update the Contact List content','registered', CONTACT_PKG_NAME ], + [ 'p_contact_create', 'Can create a new Contact List entry','registered', CONTACT_PKG_NAME ], + [ 'p_contact_admin', 'Can admin Contact List', 'admin', CONTACT_PKG_NAME ], + [ 'p_contact_expunge', 'Can remove a Contact entry', 'editors', CONTACT_PKG_NAME ], ] ); // ### Default Preferences $gBitInstaller->registerPreferences( CONTACT_PKG_NAME, [ [ CONTACT_PKG_NAME, 'contact_default_ordering', 'title_desc' ], - [ CONTACT_PKG_NAME, 'contact_list_created', 'y' ], - [ CONTACT_PKG_NAME, 'contact_list_lastmodif', 'y' ], - [ CONTACT_PKG_NAME, 'contact_list_notes', 'y' ], - [ CONTACT_PKG_NAME, 'contact_list_title', 'y' ], - [ CONTACT_PKG_NAME, 'contact_list_user', 'y' ], -] ); - -// liberty_xref_type columns: xref_type, content_type_guid, title, sort_order, role_id, type_href -// liberty_xref_source columns: source, content_type_guid, xref_type, cross_ref_title, multi, role_id, cross_ref_href, template, data -$gBitInstaller->registerSchemaDefault( CONTACT_PKG_NAME, [ - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_type` (`xref_type`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('type', 'contact','Contact Type List', 0,3,'')", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_type` (`xref_type`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('contact','contact','General Contact Details', 1,3,'')", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_type` (`xref_type`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('links', 'contact','Linked Contact Items', 2,3,'')", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_type` (`xref_type`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('alarm', 'contact','Security System Links', 3,3,'')", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_type` (`xref_type`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('council','contact','Council reference links', 4,3,'')", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_type` (`xref_type`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('account','contact','Account Details', 5,4,'')", - - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$00','contact','type','Personal', 0,3,'/contact/?type=0', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$01','contact','type','Business', 0,3,'/contact/?type=1', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$02','contact','type','Manufacturer', 0,3,'/contact/?type=2', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$03','contact','type','Distributor', 0,3,'/contact/?type=3', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$04','contact','type','Supplier', 0,3,'/contact/?type=4', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$05','contact','type','Record Company', 0,3,'/contact/?type=5', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$06','contact','type','Record Artist', 0,3,'/contact/?type=6', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$07','contact','type','Cartographer', 0,3,'/contact/?type=7', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$08','contact','type','PHX Client', 0,3,'/contact/?type=8', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$09','contact','type','LSCES Supplier', 0,3,'/contact/?type=9', NULL,NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('\$10','contact','type','Paypal Client', 0,3,'/contact/?type=10',NULL,NULL)", - - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#C','contact','contact','Contact Address', 0,3,'../nlpg/?uprn=', 'address',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#E','contact','contact','eMail Address', 1,3,'../contact/?contact_id=', 'text', NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#F','contact','contact','Fax', 1,3,'../contact/?contact_id=', 'text', NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#I','contact','contact','Invoice Address', 0,3,'../nlpg/?uprn=', 'address',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#P','contact','contact','Telephone', 1,3,'../contact/?contact_id=', 'phone', NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#R','contact','contact','Residential Address', 0,3,'../nlpg/?uprn=', 'address',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#S','contact','contact','Service Address', 0,3,'../nlpg/?uprn=', 'address',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#T','contact','contact','Tenant Address', 0,3,'../nlpg/?uprn=', 'address',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#W','contact','contact','Web Site Url', 1,3,'../contact/?contact_id=', 'text', NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('0', 'contact','contact','Free format information',1,3,'../contact/?xref=', 'text', NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('CON','contact','links', 'Contact', 1,3,'../nlpg/?uprn=', 'text', NULL)", - - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#A', 'contact','alarm', 'Alarm Maintainer', 0,3,'../nlpg/?uprn=','text', NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('#K', 'contact','alarm', 'Keyholder', 1,3,'../nlpg/?uprn=','phone',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('ALARM','contact','alarm', 'Alarm System', 0,3,'../nlpg/?uprn=','text', NULL)", - - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('CTAX','contact','council','Council Tax', 0,3,'../nlpg/?uprn=','text',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('ER', 'contact','council','Electoral Roll', 0,3,'../nlpg/?uprn=','text',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('HBEN','contact','council','Housing Benefit', 0,3,'../nlpg/?uprn=','text',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('NNDR','contact','council','National Non-domestic Rates', 0,3,'../nlpg/?uprn=','text',NULL)", - - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('ACC_TO','contact','account','Account Turnover', 0,3,'../vat/?vat=', 'text',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('SAGEID','contact','account','SAGE Account Reference', 0,3,'''sage''', 'text',NULL)", - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` (`source`,`content_type_guid`,`xref_type`,`cross_ref_title`,`multi`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('VAT_NO','contact','account','VAT Number', 0,3,'../vat/?vat=', 'text',NULL)", + [ CONTACT_PKG_NAME, 'contact_list_created', 'y' ], + [ CONTACT_PKG_NAME, 'contact_list_lastmodif', 'y' ], + [ CONTACT_PKG_NAME, 'contact_list_notes', 'y' ], + [ CONTACT_PKG_NAME, 'contact_list_title', 'y' ], + [ CONTACT_PKG_NAME, 'contact_list_user', 'y' ], ] ); -// Requirements +// ### Requirements $gBitInstaller->registerRequirements( CONTACT_PKG_NAME, [ - 'liberty' => [ 'min' => '5.0.0' ], -] );
\ No newline at end of file + 'liberty' => [ 'min' => '5.0.1' ], +] ); diff --git a/admin/upgrades/5.0.1.php b/admin/upgrades/5.0.1.php index 538e498..b40ddc9 100644 --- a/admin/upgrades/5.0.1.php +++ b/admin/upgrades/5.0.1.php @@ -15,15 +15,15 @@ $gBitInstaller->registerPackageUpgrade( [ 'QUERY' => [ 'SQL92' => [ // contact_xref_type: integer xref_type becomes sort_order; text source becomes the xref_type key - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_type` - (`xref_type`, `content_type_guid`, `title`, `sort_order`, `role_id`, `type_href`) + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_group` + (`x_group`, `content_type_guid`, `title`, `sort_order`, `role_id`, `type_href`) SELECT `source`, 'contact', `title`, `xref_type`, `role_id`, `type_href` FROM `" . BIT_DB_PREFIX . "contact_xref_type`", // contact_xref_source: integer xref_type joined to get the text key - "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_source` - (`source`, `content_type_guid`, `xref_type`, `cross_ref_title`, `multi`, `role_id`, `cross_ref_href`, `template`, `data`) + "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref_item` + (`item`, `content_type_guid`, `x_group`, `cross_ref_title`, `multiple`, `role_id`, `cross_ref_href`, `template`, `data`) SELECT cs.`source`, 'contact', ct.`source`, cs.`cross_ref_title`, cs.`multi`, cs.`role_id`, cs.`cross_ref_href`, cs.`template`, cs.`data` FROM `" . BIT_DB_PREFIX . "contact_xref_source` cs @@ -31,7 +31,7 @@ $gBitInstaller->registerPackageUpgrade( // contact_xref: direct column mapping, xref_id preserved "INSERT INTO `" . BIT_DB_PREFIX . "liberty_xref` - (`xref_id`, `content_id`, `source`, `xorder`, `xref`, `xkey`, `xkey_ext`, `data`, `start_date`, `last_update_date`, `entry_date`, `end_date`) + (`xref_id`, `content_id`, `item`, `xorder`, `xref`, `xkey`, `xkey_ext`, `data`, `start_date`, `last_update_date`, `entry_date`, `end_date`) SELECT `xref_id`, `content_id`, `source`, `xorder`, `xref`, `xkey`, `xkey_ext`, `data`, `start_date`, `last_update_date`, `entry_date`, `end_date` FROM `" . BIT_DB_PREFIX . "contact_xref`", |
