summaryrefslogtreecommitdiff
path: root/includes/lookup_contact_inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/lookup_contact_inc.php')
-rwxr-xr-xincludes/lookup_contact_inc.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/includes/lookup_contact_inc.php b/includes/lookup_contact_inc.php
index 1c77c99..6804d9d 100755
--- a/includes/lookup_contact_inc.php
+++ b/includes/lookup_contact_inc.php
@@ -10,13 +10,17 @@
*/
use Bitweaver\BitBase;
use Bitweaver\Contact\Contact;
-//require_once( TASKS_PKG_PATH.'Tasks.php');
+use Bitweaver\Liberty\LibertyContent;
// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if( empty( $gContent ) || !is_object( $gContent ) ) {
if( BitBase::verifyId( $_REQUEST['content_id'] ?? 0 ) ) {
- $gContent = new Contact( NULL, $_REQUEST['content_id'] );
- $gContent->load();
+ // getLibertyObject returns ContactPerson or ContactBusiness (already loaded)
+ $gContent = LibertyContent::getLibertyObject( (int)$_REQUEST['content_id'] );
+ if( !( $gContent instanceof Contact ) ) {
+ // Fallback: content_id exists but is not a contact type
+ $gContent = new Contact( NULL, (int)$_REQUEST['content_id'] );
+ }
} else {
$gContent = new Contact();
}