diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-27 16:28:13 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-27 16:28:13 +0100 |
| commit | 2a1242bff74c3aa12953a6496004188edc61033a (patch) | |
| tree | 4f65df4220aa42e790fa3d7cc951218eb6e329fe | |
| parent | 571c46a701c6fafa865379a38ac4d93dbc50772b (diff) | |
| download | liberty-2a1242bff74c3aa12953a6496004188edc61033a.tar.gz liberty-2a1242bff74c3aa12953a6496004188edc61033a.tar.bz2 liberty-2a1242bff74c3aa12953a6496004188edc61033a.zip | |
Fix LibertyXref: public mContentTypeGuid, format dates for Firebird
- Make mContentTypeGuid public so LibertyContent::storeXref() can set it
on a fresh LibertyXref instance
- Format start_date/end_date Unix timestamps as Y-m-d H:i:s UTC strings
before INSERT; Firebird rejects raw integers for TIMESTAMP columns
- Use null instead of empty string for ignored date fields
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rw-r--r-- | includes/classes/LibertyXref.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/includes/classes/LibertyXref.php b/includes/classes/LibertyXref.php index 1cd17f7..5327351 100644 --- a/includes/classes/LibertyXref.php +++ b/includes/classes/LibertyXref.php @@ -15,7 +15,7 @@ class LibertyXref extends LibertyBase { public $mXrefId; public $mContentId; public $mDate; - protected $mContentTypeGuid = ''; + public $mContentTypeGuid = ''; public function __construct( $iXrefId = NULL ) { $this->mXrefId = NULL; @@ -119,8 +119,8 @@ class LibertyXref extends LibertyBase { $timestamp = $this->mDate->getUTCFromDisplayDate( $dateString ); if( $timestamp !== -1 ) { $pParamHash['start_date'] = $timestamp; } } - if( !empty( $pParamHash['start_date'] ) ) { $pParamHash['xref_store']['start_date'] = $pParamHash['start_date']; } - if( isset( $pParamHash['ignore_start_date'] ) && $pParamHash['ignore_start_date'] == 'on' ) { $pParamHash['xref_store']['start_date'] = ''; } + if( !empty( $pParamHash['start_date'] ) ) { $pParamHash['xref_store']['start_date'] = $this->mDate->date("Y-m-d H:i:s", $pParamHash['start_date'], true); } + if( isset( $pParamHash['ignore_start_date'] ) && $pParamHash['ignore_start_date'] == 'on' ) { $pParamHash['xref_store']['start_date'] = null; } if( !empty( $pParamHash['end_Month'] ) ) { $dateString = $this->mDate->gmmktime( @@ -134,8 +134,8 @@ class LibertyXref extends LibertyBase { $timestamp = $this->mDate->getUTCFromDisplayDate( $dateString ); if( $timestamp !== -1 ) { $pParamHash['end_date'] = $timestamp; } } - if( !empty( $pParamHash['end_date'] ) ) { $pParamHash['xref_store']['end_date'] = $pParamHash['end_date']; } - if( isset( $pParamHash['ignore_end_date'] ) && $pParamHash['ignore_end_date'] == 'on' ) { $pParamHash['xref_store']['end_date'] = ''; } + if( !empty( $pParamHash['end_date'] ) ) { $pParamHash['xref_store']['end_date'] = $this->mDate->date("Y-m-d H:i:s", $pParamHash['end_date'], true); } + if( isset( $pParamHash['ignore_end_date'] ) && $pParamHash['ignore_end_date'] == 'on' ) { $pParamHash['xref_store']['end_date'] = null; } return count( $this->mErrors ) == 0; } |
