diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-11 19:26:25 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-11 19:26:25 +0100 |
| commit | 64aae1e41d9288a6d9709781af29b06fe6adb5ca (patch) | |
| tree | d5d5e74420cee938d7e8ff90b9e6792d5f44cc77 /list_businesses.php | |
| parent | 27c615a0a26edb985543e520587e3043d91489f6 (diff) | |
| download | contact-64aae1e41d9288a6d9709781af29b06fe6adb5ca.tar.gz contact-64aae1e41d9288a6d9709781af29b06fe6adb5ca.tar.bz2 contact-64aae1e41d9288a6d9709781af29b06fe6adb5ca.zip | |
Introduce ContactPerson and ContactBusiness subclasses
Splits the Contact class into ContactPerson (content_type_guid='contactperson')
and ContactBusiness (content_type_guid='contactbusiness'), each using 'contact'
as the shared package-level xref schema. Replaces the $isPerson/$00 xref hack
with proper class identity via instanceof.
- ContactPerson.php, ContactBusiness.php: new subclasses
- Contact.php: loadXrefTypeList() reads type tags directly from liberty_xref;
getAvailableTypeItems() for edit form (schema-driven with pre-upgrade fallback);
getDisplayUrl() now points to display_contact.php
- Type item codes: P01/P02 (person), B01-B04 (business, B01=Service new)
- list_people.php, list_businesses.php: separate list pages per type
- list_contacts.php: combined display-layer merge of both types
- 5.0.3.php: upgrade script migrating existing data to new content types and codes
- Templates: isPerson flag from instanceof; horizontal type checkboxes; list.tpl
accepts $listTitle; menu adds People/Businesses entries
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'list_businesses.php')
| -rw-r--r-- | list_businesses.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/list_businesses.php b/list_businesses.php new file mode 100644 index 0000000..b4dd4b1 --- /dev/null +++ b/list_businesses.php @@ -0,0 +1,36 @@ +<?php +/** + * @package contact + */ + +require_once '../kernel/includes/setup_inc.php'; + +use Bitweaver\Contact\ContactBusiness; +use Bitweaver\Contact\ContactType; +use Bitweaver\KernelTools; +use Bitweaver\Liberty\LibertyXrefType; + +$gBitSystem->verifyPackage( 'contact' ); +$gBitSystem->verifyPermission( 'p_contact_view' ); + +$gContent = new ContactBusiness(); +$gContent->invokeServices( 'content_list_function', $_REQUEST ); +$gContent->mTypes->processRequestHash( $_REQUEST, $_SESSION['contact'] ); + +// Business type filter: contactbusiness type markers only (never mix with contactperson) +$businessTypes = ( new LibertyXrefType( CONTACTBUSINESS_CONTENT_TYPE_GUID ) )->getTypeMarkers(); +$gBitSmarty->assign( 'contContactTypes', array_column( $businessTypes, 'name', 'item' ) ); + +$listHash = $_REQUEST; +$listcontacts = $gContent->getList( $listHash ); + +if( $listHash['listInfo']['count'] == 1 ) { + KernelTools::bit_redirect( CONTACT_PKG_URL . "display_contact.php?content_id=" . $listcontacts[0]['content_id'] ); +} + +$gBitSmarty->assign( 'listcontacts', $listcontacts ); +$gBitSmarty->assign( 'listInfo', $listHash['listInfo'] ); +$gBitSmarty->assign( 'listTitle', KernelTools::tra( 'Businesses' ) ); + +$gBitSystem->setBrowserTitle( KernelTools::tra( 'Businesses' ) ); +$gBitSystem->display( 'bitpackage:contact/list.tpl', NULL, [ 'display_mode' => 'list' ] ); |
