summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-14 09:51:41 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-14 09:51:41 +0100
commit72119ef864e1a5ffa377a504dc2ef430d7e6cd4a (patch)
tree24a4b9539cf4f4b8116bd38d3444001843cb8e45 /includes
parent72312119fe678d14b61e3c508db98a6dd0ee4ec0 (diff)
downloadcontact-72119ef864e1a5ffa377a504dc2ef430d7e6cd4a.tar.gz
contact-72119ef864e1a5ffa377a504dc2ef430d7e6cd4a.tar.bz2
contact-72119ef864e1a5ffa377a504dc2ef430d7e6cd4a.zip
php-cs-fixer tidies to php8.5 standards
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'includes')
-rwxr-xr-xincludes/bit_setup_inc.php2
-rwxr-xr-xincludes/classes/Contact.php89
-rwxr-xr-xincludes/classes/ContactType.php17
-rwxr-xr-xincludes/classes/ContactXref.php49
-rwxr-xr-xincludes/classes/ContactXrefType.php17
-rwxr-xr-xincludes/lookup_contact_inc.php2
-rwxr-xr-xincludes/lookup_contact_xref_type_inc.php2
7 files changed, 91 insertions, 87 deletions
diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php
index f7aa0fe..45f7742 100755
--- a/includes/bit_setup_inc.php
+++ b/includes/bit_setup_inc.php
@@ -14,7 +14,7 @@ $pRegisterHash = [
define( 'CONTACT_PKG_NAME', $pRegisterHash['package_name'] );
define( 'CONTACT_PKG_URL', BIT_ROOT_URL . basename( $pRegisterHash['package_path'] ) . '/' );
define( 'CONTACT_PKG_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/' );
-define( 'CONTACT_PKG_INCLUDE_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/includes/');
+define( 'CONTACT_PKG_INCLUDE_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/includes/');
$gBitSystem->registerPackage( $pRegisterHash );
if( $gBitSystem->isPackageActive( 'contact' ) ) {
diff --git a/includes/classes/Contact.php b/includes/classes/Contact.php
index 2401d9f..91a5973 100755
--- a/includes/classes/Contact.php
+++ b/includes/classes/Contact.php
@@ -13,6 +13,7 @@
* required setup
*/
namespace Bitweaver\Contact;
+
use Bitweaver\BitBase;
use Bitweaver\BitDate;
use Bitweaver\Liberty\LibertyContent; // Contact base class
@@ -37,14 +38,14 @@ class Contact extends LibertyContent {
*/
public function __construct( $pContactId = NULL, $pContentId = NULL ) {
parent::__construct();
- $this->registerContentType( CONTACT_CONTENT_TYPE_GUID, array(
+ $this->registerContentType( CONTACT_CONTENT_TYPE_GUID, [
'content_type_guid' => CONTACT_CONTENT_TYPE_GUID,
'content_name' => 'Contact Entry',
'handler_class' => 'Contact',
'handler_package' => 'contact',
'handler_file' => 'Contact.php',
- 'maintainer_url' => 'http://lsces.co.uk'
- ) );
+ 'maintainer_url' => 'http://lsces.co.uk',
+ ] );
$this->mContentId = (int)$pContentId;
$this->mContentTypeGuid = CONTACT_CONTENT_TYPE_GUID;
@@ -71,7 +72,7 @@ class Contact extends LibertyContent {
public function load( $pContentId = NULL, $pPluginParams = NULL ) {
if ( $pContentId ) $this->mContentId = (int)$pContentId;
if( $this->verifyId( $this->mContentId ) ) {
- $query = "select con.*, lc.*,
+ $query = "select con.*, lc.*,
ap.*, xhA.`xkey_ext` AS house,
img.`xkey` AS client_gallery,
x00.`xkey_ext` as name, lc.`title` as organisation,
@@ -88,7 +89,7 @@ class Contact extends LibertyContent {
LEFT JOIN `".BIT_DB_PREFIX."contact_xref` xhL ON xhL.`content_id` = con.`content_id` AND xhL.`source` = '#L' AND ( xhL.`end_date` IS NULL OR xhL.`end_date` > CURRENT_TIMESTAMP )
LEFT JOIN `".BIT_DB_PREFIX."address_postcode` ap ON ap.`postcode` = xhA.`xkey`
WHERE con.`content_id`=?";
- $result = $this->mDb->query( $query, array( $this->mContentId ) );
+ $result = $this->mDb->query( $query, [ $this->mContentId ] );
// LEFT JOIN `".BIT_DB_PREFIX."contact` ci ON ci.contact_id = pro.owner_id
// LEFT JOIN `".BIT_DB_PREFIX."contact_address` a ON a.contact_id = pro.address_id
// LEFT JOIN `".BIT_DB_PREFIX."postcode` p ON p.`postcode` = a.`postcode`
@@ -129,7 +130,7 @@ class Contact extends LibertyContent {
}
}
LibertyContent::load();
- return;
+
}
/**
@@ -190,7 +191,7 @@ class Contact extends LibertyContent {
// mContentId will not be set until the secondary data has commited
if( !empty( $pParamHash['contact_store']['content_id'] ) ) {
- $result = $this->mDb->associateUpdate( $table, $pParamHash['contact_store'], array( "content_id" => $this->mContentId ) );
+ $result = $this->mDb->associateUpdate( $table, $pParamHash['contact_store'], [ "content_id" => $this->mContentId ] );
} else {
$pParamHash['contact_store']['content_id'] = $pParamHash['content_id'];
$pParamHash['contact_store']['parent_id'] = $pParamHash['content_id'];
@@ -206,17 +207,17 @@ class Contact extends LibertyContent {
}
if( !empty( $pParamHash['contact_types'] ) ) {
$query = "DELETE FROM `".BIT_DB_PREFIX."contact_xref` WHERE `content_id` = ? AND `source` LIKE '$%'";
- $result = $this->mDb->query($query, array($this->mContentId ) );
+ $result = $this->mDb->query($query, [$this->mContentId ] );
foreach ( $pParamHash['contact_types'] as $key => $source ) {
if ( $source == '$00' ) {
$query = "INSERT INTO `".BIT_DB_PREFIX."contact_xref` (`content_id`, `source`, `xkey_ext`, `last_update_date`) VALUES ( ?, ?, ?, NULL )";
- $result = $this->mDb->query($query, array( $this->mContentId, $source, $pParamHash['name'] ) );
+ $result = $this->mDb->query($query, [ $this->mContentId, $source, $pParamHash['name'] ] );
} else if ( $source == '$01' ) {
$query = "INSERT INTO `".BIT_DB_PREFIX."contact_xref` (`content_id`, `source`, `xkey_ext`, `last_update_date`) VALUES ( ?, ?, ?, NULL )";
- $result = $this->mDb->query($query, array( $this->mContentId, $source, $pParamHash['organisation'] ) );
+ $result = $this->mDb->query($query, [ $this->mContentId, $source, $pParamHash['organisation'] ] );
} else {
$query = "INSERT INTO `".BIT_DB_PREFIX."contact_xref` (`content_id`, `source`, `last_update_date`) VALUES ( ?, ?, NULL )";
- $result = $this->mDb->query($query, array( $this->mContentId, $source ) );
+ $result = $this->mDb->query($query, [ $this->mContentId, $source ] );
}
}
}
@@ -240,7 +241,7 @@ class Contact extends LibertyContent {
if ($this->isValid() ) {
$this->mDb->StartTrans();
$query = "DELETE FROM `".BIT_DB_PREFIX."contact_xref` WHERE `content_id` = ?";
- $result = $this->mDb->query($query, array($this->mContentId ) );
+ $result = $this->mDb->query($query, [$this->mContentId ] );
if (LibertyContent::expunge() ) {
$ret = TRUE;
$this->mDb->CompleteTrans();
@@ -285,8 +286,8 @@ class Contact extends LibertyContent {
public function getDisplayLink( $pLinkText=NULL, $pMixed=NULL, $pAnchor=NULL ) {
if ( $this->mContentId != $pMixed['content_id'] ) $this->load($pMixed['content_id']);
- $ret = ( empty( $this->mInfo['content_id'] ) )
- ? '<a href="' . $this->getDisplayUrl( $pMixed['content_id'] ) . '">' . $pMixed['title'] . '</a>'
+ $ret = ( empty( $this->mInfo['content_id'] ) )
+ ? '<a href="' . $this->getDisplayUrl( $pMixed['content_id'] ) . '">' . $pMixed['title'] . '</a>'
: '<a href="' . $this->getDisplayUrl( $pMixed['content_id'] ) . '">' . "Contact - " . $this->mInfo['title'] . '</a>';
return $ret;
}
@@ -331,10 +332,10 @@ class Contact extends LibertyContent {
$selectSql = '';
$joinSql = '';
$whereSql = '';
- $bindVars = array();
+ $bindVars = [];
if ( isset( $pParamHash['role_id'] ) ) {
- array_push( $bindVars, $this->mContentTypeGuid );
+ array_push( $bindVars, $this->mContentTypeGuid );
if ( $pParamHash['role_id'] > 0 ) {
$whereSql .= " AND con.`role_id` = ? ";
$bindVars[] = $pParamHash['role_id'];
@@ -355,10 +356,10 @@ class Contact extends LibertyContent {
}
if ( !isset( $pParamHash['role_id'] ) ) {
- array_push( $bindVars, $this->mContentTypeGuid );
+ array_push( $bindVars, $this->mContentTypeGuid );
}
- $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, NULL, $pParamHash );
+ $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, NULL, $pParamHash );
// $pParamHash["listInfo"]["ihash"]['contact_type_guid'] = $contact_type_guid;
@@ -391,10 +392,10 @@ class Contact extends LibertyContent {
}
/* if( isset( $find_name ) and is_string( $find_name ) and $find_name <> '' ) {
- $split = preg_split('|[,. ]|', $find_name, 2);
+ $split = preg_split('|[,. ]|', $find_name, 2);
$whereSql .= " AND UPPER( ci.`surname` ) STARTING ? ";
$bindVars[] = strtoupper( $split[0] );
- if ( array_key_exists( 1, $split ) ) {
+ if ( array_key_exists( 1, $split ) ) {
$split[1] = trim( $split[1] );
$whereSql .= " AND UPPER( ci.`forename` ) STARTING ? ";
$bindVars[] = strtoupper( $split[1] );
@@ -441,7 +442,7 @@ class Contact extends LibertyContent {
$joinSql WHERE lc.`content_type_guid` = ? $whereSql ";
$result = $this->mDb->query( $query, $bindVars, $max_records, $offset );
- $ret = array();
+ $ret = [];
while( $res = $result->fetchRow() ) {
if (!empty($parse_split)) {
$res = array_merge($this->parseSplit($res), $res);
@@ -464,15 +465,15 @@ class Contact extends LibertyContent {
global $gBitUser, $gBitSmarty;
$roles = array_keys($gBitUser->mRoles);
- $bindVars = array();
- $bindVars = array_merge( $bindVars, $roles, array( $gBitUser->mUserId ) );
+ $bindVars = [];
+ $bindVars = array_merge( $bindVars, $roles, [ $gBitUser->mUserId ] );
$query = "SELECT g.* FROM `".BIT_DB_PREFIX."contact_xref_type` g
LEFT OUTER JOIN `".BIT_DB_PREFIX."users_roles_map` purm ON ( purm.`user_id`=".$gBitUser->mUserId." ) AND ( purm.`role_id`=g.`role_id` )
WHERE g.`xref_type` > 0 AND (g.`role_id` IN(". implode(',', array_fill(0, count($roles), '?')) ." ) OR purm.`user_id`=?)
ORDER BY g.`xref_type`";
$result = $this->mDb->query( $query, $bindVars );
- $ret = array();
+ $ret = [];
while ($res = $result->fetchRow()) {
$ret[] = $res;
}
@@ -489,7 +490,7 @@ class Contact extends LibertyContent {
$roles = array_keys($gBitUser->mRoles);
$bindVars = [];
- $bindVars = array_merge( $bindVars, $roles, array( $gBitUser->mUserId ) );
+ $bindVars = array_merge( $bindVars, $roles, [ $gBitUser->mUserId ] );
$query = "SELECT g.`cross_ref_title` AS `type_name`, g.`source` FROM `".BIT_DB_PREFIX."contact_xref_source` g
LEFT OUTER JOIN `".BIT_DB_PREFIX."users_roles_map` purm ON ( purm.`user_id`=".$gBitUser->mUserId." ) AND ( purm.`role_id`=g.`role_id` )
@@ -515,21 +516,21 @@ class Contact extends LibertyContent {
$query = "SELECT s.`cross_ref_title` AS `type_name`, s.`source`, s.`template` FROM `".BIT_DB_PREFIX."contact_xref_source` s
WHERE s.`template` = '$xrefTemplate'
ORDER BY s.`cross_ref_title`";
- $result = $this->mDb->query($query, array( $this->mContentId, $xrefGroup ) );
+ $result = $this->mDb->query($query, [ $this->mContentId, $xrefGroup ] );
} elseif ( $xrefGroup > -1 ) {
$query = "SELECT s.`cross_ref_title` AS `type_name`, s.`source`, s.`template` FROM `".BIT_DB_PREFIX."contact_xref_source` s
LEFT JOIN `".BIT_DB_PREFIX."contact_xref` x ON x.`source` = s.`source` AND x.`content_id` = ? AND ( x.`end_date` IS NULL OR x.`end_date` > CURRENT_TIMESTAMP )
WHERE s.`xref_type` = ? AND ( x.`xref_id` IS NULL OR x.`xorder` > 0 )
ORDER BY s.`cross_ref_title`";
- $result = $this->mDb->query($query, array( $this->mContentId, $xrefGroup ) );
+ $result = $this->mDb->query($query, [ $this->mContentId, $xrefGroup ] );
} else {
$query = "SELECT s.`cross_ref_title` AS `type_name`, s.`source`, s.`template` FROM `".BIT_DB_PREFIX."contact_xref_source` s
LEFT JOIN `".BIT_DB_PREFIX."contact_xref` x ON x.`source` = s.`source` AND x.`content_id` = ? AND ( x.`end_date` IS NULL OR x.`end_date` > CURRENT_TIMESTAMP )
WHERE s.`xref_type` > 0 AND ( x.`xref_id` IS NULL OR x.`xorder` > 0 )
ORDER BY s.`cross_ref_title`";
- $result = $this->mDb->query($query, array( $this->mContentId ) );
+ $result = $this->mDb->query($query, [ $this->mContentId ] );
}
- $ret = array();
+ $ret = [];
while ($res = $result->fetchRow()) {
$ret['list'][$res["source"]] = trim($res["type_name"]);
@@ -547,15 +548,15 @@ class Contact extends LibertyContent {
global $gBitUser, $gBitSmarty;
$roles = array_keys($gBitUser->mRoles);
- $bindVars = array();
- $bindVars = array_merge( $bindVars, $roles, array( $gBitUser->mUserId ) );
+ $bindVars = [];
+ $bindVars = array_merge( $bindVars, $roles, [ $gBitUser->mUserId ] );
$query = "SELECT DISTINCT g.`template` FROM `".BIT_DB_PREFIX."contact_xref_source` g
LEFT OUTER JOIN `".BIT_DB_PREFIX."users_roles_map` purm ON ( purm.`user_id`=".$gBitUser->mUserId." ) AND ( purm.`role_id`=g.`role_id` )
WHERE (g.`role_id` IN(". implode(',', array_fill(0, count($roles), '?')) ." ) OR purm.`user_id`=?)
ORDER BY g.`template`";
$result = $this->mDb->query( $query, $bindVars );
- $ret = array();
+ $ret = [];
$cnt = 0;
while ($res = $result->fetchRow()) {
$ret[] = trim($res["template"]) <> '' ? trim($res["template"]) : 'generic';
@@ -579,9 +580,9 @@ class Contact extends LibertyContent {
LEFT JOIN `".BIT_DB_PREFIX."address_postcode` ap ON ap.`postcode` = xhA.`xkey`
WHERE r.`source` = 'KEY_S' AND r.`xref` = ? AND ( r.`end_date` IS NULL OR r.`end_date` > CURRENT_TIMESTAMP )
ORDER BY r.`xref`, XORDERBY";
- $result = $this->mDb->query($query, array( $contract ) );
+ $result = $this->mDb->query($query, [ $contract ] );
- $ret = array();
+ $ret = [];
while ($res = $result->fetchRow()) {
$ret[] = $res;
}
@@ -605,9 +606,9 @@ class Contact extends LibertyContent {
global $gBitUser;
$roles = array_keys($gBitUser->mRoles);
- $bindVars = array();
+ $bindVars = [];
array_push( $bindVars, $this->mContentId );
- $bindVars = array_merge( $bindVars, $roles, array( $gBitUser->mUserId ) );
+ $bindVars = array_merge( $bindVars, $roles, [ $gBitUser->mUserId ] );
$sql = "SELECT r.`source`, r.`cross_ref_title`, d.`content_id`
FROM `".BIT_DB_PREFIX."contact_xref_source` r
@@ -633,10 +634,10 @@ class Contact extends LibertyContent {
global $gBitUser;
$roles = array_keys($gBitUser->mRoles);
- $bindVars = array();
+ $bindVars = [];
array_push( $bindVars, $this->mDb->NOW() );
array_push( $bindVars, $this->mContentId );
- $bindVars = array_merge( $bindVars, $roles, array( $gBitUser->mUserId ) );
+ $bindVars = array_merge( $bindVars, $roles, [ $gBitUser->mUserId ] );
$sql = "SELECT s.xref_type, x.`xref_id`, x.`last_update_date`, x.`source`, t.`title` AS type_title,
CASE
@@ -688,7 +689,7 @@ class Contact extends LibertyContent {
* store or update xref records for this contact record
*/
public function storeXref( &$pParamHash ) {
- $xref = new ContactXref( isset($pParamHash['xref_id']) ? $pParamHash['xref_id'] : NULL );
+ $xref = new ContactXref( $pParamHash['xref_id'] ?? NULL );
if ( $xref->store( $pParamHash ) ) {
$this->mInfo['xref_title'] = $xref->mContentId;
$this->mInfo['xref_store'] = $xref->mInfo;
@@ -696,7 +697,7 @@ class Contact extends LibertyContent {
$this->load();
return true;
- } else return false;
+ } return false;
}
/**
@@ -711,7 +712,7 @@ class Contact extends LibertyContent {
$this->load();
return true;
- } else return false;
+ } return false;
}
/**
@@ -724,7 +725,7 @@ class Contact extends LibertyContent {
global $gBitUser;
$roles = array_keys($gBitUser->mRoles);
- $bindVars = array();
+ $bindVars = [];
array_push( $bindVars, $this->mDb->NOW() );
array_push( $bindVars, $this->mContentId );
// $bindVars = array_merge( $bindVars, $roles, array( $gBitUser->mUserId ) );
@@ -759,10 +760,10 @@ class Contact extends LibertyContent {
global $gBitUser;
$roles = array_keys($gBitUser->mRoles);
- $bindVars = array();
+ $bindVars = [];
array_push( $bindVars, $this->mDb->NOW() );
array_push( $bindVars, $this->mContentId );
- $bindVars = array_merge( $bindVars, $roles, array( $gBitUser->mUserId ) );
+ $bindVars = array_merge( $bindVars, $roles, [ $gBitUser->mUserId ] );
$sql = "SELECT s.xref_type, x.`xref_id`, x.`last_update_date`, x.`source`, t.`title` AS type_title,
CASE
diff --git a/includes/classes/ContactType.php b/includes/classes/ContactType.php
index 88a0823..479c855 100755
--- a/includes/classes/ContactType.php
+++ b/includes/classes/ContactType.php
@@ -12,6 +12,7 @@
* Required setup
*/
namespace Bitweaver\Contact;
+
use Bitweaver\BitBase;
/**
@@ -33,7 +34,7 @@ class ContactType extends BitBase {
$roles = array_keys($gBitUser->mRoles);
$bindVars = [];
- $bindVars = array_merge( $bindVars, $roles, array( $gBitUser->mUserId ) );
+ $bindVars = array_merge( $bindVars, $roles, [ $gBitUser->mUserId ] );
$sql = "SELECT r.`source`, r.`cross_ref_title`
FROM `".BIT_DB_PREFIX."contact_xref_source` r
@@ -91,14 +92,14 @@ class ContactType extends BitBase {
$result = $gBitSystem->mDb->query( $query, $bindVars );
- $ret = [];
+ $ret = [];
- while( $res = $result->fetchRow() ) {
- $res["num_types"] = $gBitSystem->mDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."contact_xref_source` WHERE `xref_type`= ?", array( $res["xref_type"] ) );
+ while( $res = $result->fetchRow() ) {
+ $res["num_types"] = $gBitSystem->mDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."contact_xref_source` WHERE `xref_type`= ?", [ $res["xref_type"] ] );
- $ret[] = $res;
- }
+ $ret[] = $res;
+ }
- return $ret;
- }
+ return $ret;
+ }
}
diff --git a/includes/classes/ContactXref.php b/includes/classes/ContactXref.php
index 6a4184b..598c356 100755
--- a/includes/classes/ContactXref.php
+++ b/includes/classes/ContactXref.php
@@ -12,6 +12,7 @@
* Required setup
*/
namespace Bitweaver\Contact;
+
use Bitweaver\BitBase;
use Bitweaver\BitDate;
@@ -55,7 +56,7 @@ class ContactXref extends BitBase {
JOIN `".BIT_DB_PREFIX."contact_xref_source` s ON s.`source` = x.`source`
WHERE x.`xref_id` = ?
ORDER BY x.`xorder`";
- $result = $this->mDb->getRow( $sql, array( $pXref_id ) );
+ $result = $this->mDb->getRow( $sql, [ $pXref_id ] );
if( $result['content_id'] ) {
$this->mXrefId = $pXref_id;
$this->mContentId = $result['content_id'];
@@ -76,26 +77,26 @@ class ContactXref extends BitBase {
if ( isset( $pParamHash['content_id'] )) {
$pParamHash['xref_store']['content_id'] = $pParamHash['content_id'];
- }
+ }
if ( isset( $pParamHash['source'] )) {
$pParamHash['xref_store']['source'] = $pParamHash['source'];
- }
-
+ }
+
$pParamHash['xref_store']['xorder'] = 0;
if ( isset ( $pParamHash['fAddXref'] ) ) {
$pParamHash['xref_store']['source'] = isset( $pParamHash['Array_xref_type_list'] ) ? $pParamHash['Array_xref_type_list']['Array.source'] : $pParamHash['source'];
$pParamHash['xref_store']['content_id'] = $pParamHash['content_id'];
- $sql = "SELECT x.`multi` FROM `".BIT_DB_PREFIX."contact_xref_source` x WHERE x.`source` = ?";
- $next = $this->mDb->getOne( $sql, array( $pParamHash['xref_store']['source'] ) );
+ $sql = "SELECT x.`multi` FROM `".BIT_DB_PREFIX."contact_xref_source` x WHERE x.`source` = ?";
+ $next = $this->mDb->getOne( $sql, [ $pParamHash['xref_store']['source'] ] );
if ( $next > 0 ) {
$sql = "SELECT COALESCE( MAX(x.`xorder`) + 1, 1 ) FROM `".BIT_DB_PREFIX."contact_xref` x
WHERE x.`content_id` = ? AND x.`source` = ?";
- $next = $this->mDb->getOne( $sql, array( $pParamHash['xref_store']['content_id'], $pParamHash['xref_store']['source'] ) );
+ $next = $this->mDb->getOne( $sql, [ $pParamHash['xref_store']['content_id'], $pParamHash['xref_store']['source'] ] );
}
$pParamHash['xref_store']['xorder'] = $next;
- }
+ }
if ( isset ( $pParamHash['fStepXref'] ) ) {
$pParamHash['xref_store']['source'] = $this->mSource;
@@ -108,19 +109,19 @@ class ContactXref extends BitBase {
$pParamHash['xref_store']['xkey_ext'] = '';
$pParamHash['xref_store']['data'] = '';
}
-
+
if ( isset( $pParamHash['xref'] )) {
$pParamHash['xref_store']['xref'] = $pParamHash['xref'];
- }
+ }
if ( isset( $pParamHash['xkey'] )) {
$pParamHash['xref_store']['xkey'] = $pParamHash['xkey'];
- }
+ }
if ( isset( $pParamHash['xkey_ext'] )) {
$pParamHash['xref_store']['xkey_ext'] = $pParamHash['xkey_ext'];
- }
+ }
if ( isset( $pParamHash['edit'] )) {
$pParamHash['xref_store']['data'] = $pParamHash['edit'];
- }
+ }
$pParamHash['xref_store']['last_update_date'] = $this->mDb->NOW();
// If start and/or end dates are supplied these are updated as well
@@ -128,12 +129,12 @@ class ContactXref extends BitBase {
$dateString = $this->mDate->gmmktime(
$pParamHash['start_Hour'],
$pParamHash['start_Minute'],
- isset($pParamHash['start_Second']) ? $pParamHash['start_Second'] : 0,
+ $pParamHash['start_Second'] ?? 0,
$pParamHash['start_Month'],
$pParamHash['start_Day'],
- $pParamHash['start_Year']
+ $pParamHash['start_Year'],
);
-
+
$timestamp = $this->mDate->getUTCFromDisplayDate( $dateString );
if( $timestamp !== -1 ) {
$pParamHash['start_date'] = $timestamp;
@@ -145,17 +146,17 @@ class ContactXref extends BitBase {
if( isset ($pParamHash['ignore_start_date']) && $pParamHash['ignore_start_date'] == 'on' ) {
$pParamHash['xref_store']['start_date'] = '';
}
-
+
if( !empty( $pParamHash['end_Month'] ) ) {
$dateString = $this->mDate->gmmktime(
$pParamHash['end_Hour'],
$pParamHash['end_Minute'],
- isset($pParamHash['end_Second']) ? $pParamHash['end_Second'] : 0,
+ $pParamHash['end_Second'] ?? 0,
$pParamHash['end_Month'],
$pParamHash['end_Day'],
- $pParamHash['end_Year']
+ $pParamHash['end_Year'],
);
-
+
$timestamp = $this->mDate->getUTCFromDisplayDate( $dateString );
if( $timestamp !== -1 ) {
$pParamHash['end_date'] = $timestamp;
@@ -177,7 +178,7 @@ class ContactXref extends BitBase {
$this->mDb->StartTrans();
if( isset( $pParamHash['xref_id'] ) ) {
- $result = $this->mDb->associateUpdate( $table, $pParamHash['xref_store'], array( "xref_id" => $pParamHash['xref_id'] ) );
+ $result = $this->mDb->associateUpdate( $table, $pParamHash['xref_store'], [ "xref_id" => $pParamHash['xref_id'] ] );
} else {
$this->mXrefId = $this->mDb->GenID( 'contact_xref_seq' );
$pParamHash['xref_id'] = $this->mXrefId;
@@ -188,9 +189,9 @@ class ContactXref extends BitBase {
$this->load( $this->mXrefId );
$this->mDb->CompleteTrans();
return true;
- } else {
- return false;
}
+ return false;
+
}
public function stepXref( &$pParamHash = NULL ) {
@@ -213,5 +214,5 @@ class ContactXref extends BitBase {
$this->store( $pParamHash );
return true;
}
-
+
} \ No newline at end of file
diff --git a/includes/classes/ContactXrefType.php b/includes/classes/ContactXrefType.php
index b87bfe9..17af008 100755
--- a/includes/classes/ContactXrefType.php
+++ b/includes/classes/ContactXrefType.php
@@ -12,6 +12,7 @@
* Required setup
*/
namespace Bitweaver\Contact;
+
use Bitweaver\BitBase;
/**
@@ -28,7 +29,7 @@ class ContactXrefType extends BitBase {
global $gBitSystem;
$where = '';
- $bindVars = array();
+ $bindVars = [];
if( !empty( $pOptionHash['active_role'] ) ) {
$where = " WHERE cxs.`role_id` = ? ";
$bindVars[] = $pOptionHash['active_role'];
@@ -44,14 +45,14 @@ class ContactXrefType extends BitBase {
$result = $gBitSystem->mDb->query( $query, $bindVars );
- $ret = [];
+ $ret = [];
- while( $res = $result->fetchRow() ) {
- $res["num_entries"] = $gBitSystem->mDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."contact_xref` WHERE `source`= ?", array( $res["source"] ) );
+ while( $res = $result->fetchRow() ) {
+ $res["num_entries"] = $gBitSystem->mDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."contact_xref` WHERE `source`= ?", [ $res["source"] ] );
- $ret[] = $res;
- }
+ $ret[] = $res;
+ }
- return $ret;
- }
+ return $ret;
+ }
} \ No newline at end of file
diff --git a/includes/lookup_contact_inc.php b/includes/lookup_contact_inc.php
index b159407..1c77c99 100755
--- a/includes/lookup_contact_inc.php
+++ b/includes/lookup_contact_inc.php
@@ -20,7 +20,7 @@ use Bitweaver\Contact\Contact;
} else {
$gContent = new Contact();
}
-
+
$gBitSmarty->clearAssign( 'gContent' );
$gBitSmarty->assign( 'gContent', $gContent );
}
diff --git a/includes/lookup_contact_xref_type_inc.php b/includes/lookup_contact_xref_type_inc.php
index 27db728..ec39dce 100755
--- a/includes/lookup_contact_xref_type_inc.php
+++ b/includes/lookup_contact_xref_type_inc.php
@@ -11,7 +11,7 @@
global $gContent;
use Bitweaver\Contact\Contact;
use Bitweaver\Contact\ContactXref;
-
+
// 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 (!empty($_REQUEST['xref_id']) && is_numeric($_REQUEST['xref_id'])) {