diff options
| author | Lester Caine <lsces@lsces.co.uk> | 2010-12-08 13:00:24 +0000 |
|---|---|---|
| committer | Lester Caine <lsces@lsces.co.uk> | 2010-12-08 13:00:24 +0000 |
| commit | e592c415e311beea23920c101e9d35935b78f882 (patch) | |
| tree | 16e849b7fe4760d66de417033db3d308b7054b5d | |
| parent | 9dea71d31454b31da1da41dda384338fd96dfca2 (diff) | |
| download | contact-e592c415e311beea23920c101e9d35935b78f882.tar.gz contact-e592c415e311beea23920c101e9d35935b78f882.tar.bz2 contact-e592c415e311beea23920c101e9d35935b78f882.zip | |
Add basic xref crosslink ... this should have been included originally
| -rw-r--r-- | Contact.php | 2 | ||||
| -rw-r--r-- | ContactXref.php | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Contact.php b/Contact.php index 0ff998d..c87ac8e 100644 --- a/Contact.php +++ b/Contact.php @@ -575,7 +575,7 @@ class Contact extends LibertyContent { WHEN x.`xorder` = 0 THEN s.`cross_ref_title` ELSE s.`cross_ref_title` || '-' || x.`xorder` END AS source_title, - x.`xkey` AS cross_reference, x.`xkey`, x.`xkey_ext`, x.`data`, + x.`xref`, x.`xkey`, x.`xkey_ext`, x.`data`, x.`start_date`, x.`end_date` FROM `".BIT_DB_PREFIX."contact_xref` x JOIN `".BIT_DB_PREFIX."contact_xref_source` s ON s.`source` = x.`source` diff --git a/ContactXref.php b/ContactXref.php index 6d46ec8..5c0b1e4 100644 --- a/ContactXref.php +++ b/ContactXref.php @@ -83,7 +83,7 @@ class ContactXref extends BitBase { $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'] ) ); if ( $next > 0 ) { - $sql = "SELECT MAX(x.`xorder`) + 1 FROM `".BIT_DB_PREFIX."contact_xref` x + $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'] ) ); } @@ -96,11 +96,15 @@ class ContactXref extends BitBase { $pParamHash['xref_store']['content_id'] = $this->mContentId; $pParamHash['start_date'] = $this->mDb->NOW(); $pParamHash['ignore_end_date'] = 'on'; + $pParamHash['xref_store']['xref'] = 0; $pParamHash['xref_store']['xkey'] = ''; $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']; } |
