[open-ils-commits] [GIT] Evergreen ILS branch master updated. 0cdae03f4029b3a66bda80f7d94fd3072c305db1
Evergreen Git
git at git.evergreen-ils.org
Wed Jan 2 16:38:06 EST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 0cdae03f4029b3a66bda80f7d94fd3072c305db1 (commit)
from 0483dc441e97873b48f8f72595cc577bc1ac9015 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0cdae03f4029b3a66bda80f7d94fd3072c305db1
Author: Bill Erickson <berick at esilibrary.com>
Date: Wed Dec 26 11:10:23 2012 -0500
SIP option to use SIP date format for due dates
New SIP configuration option "use_sip_date_format" which forces all SIP
dates to be formated using the SIP date format: YYYYMMDDZZZZHHMMSS
Without this setting, most dates already correctly use the SIP date
format. However, for some historical reason, due dates are formatted as
ISO 8601 dates. Enable this setting to force due dates to use the SIP
date format.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>
diff --git a/Open-ILS/examples/oils_sip.xml.example b/Open-ILS/examples/oils_sip.xml.example
index 5d4ebd3..8a1d7ab 100644
--- a/Open-ILS/examples/oils_sip.xml.example
+++ b/Open-ILS/examples/oils_sip.xml.example
@@ -103,6 +103,14 @@
If enabled, the PC field in patron-info requests will return the non-translated profile name
<option name='patron_type_uses_code' value='true' />
-->
+
+ <!--
+ By default, most dates use the SIP date format. Some,
+ like circulation due dates, use the ISO8601 date format
+ instead. If this setting is set to true, all dates will
+ use the SIP date format.
+ <option name='use_sip_date_format' value='true' />
+ -->
</options>
<checkin_override>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
index 9722327..a860910 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
@@ -25,6 +25,8 @@ use OpenSRF::Utils qw/:datetime/;
use DateTime::Format::ISO8601;
use Encode;
use Unicode::Normalize;
+use Sip::Constants qw(SIP_DATETIME);
+
my $U = 'OpenILS::Application::AppUtils';
my $editor;
@@ -178,9 +180,9 @@ sub format_date {
return "" unless $date;
- $date = DateTime::Format::ISO8601->new->
+ my $dt = DateTime::Format::ISO8601->new->
parse_datetime(OpenSRF::Utils::cleanse_ISO8601($date));
- my @time = localtime($date->epoch);
+ my @time = localtime($dt->epoch);
my $year = $time[5]+1900;
my $mon = $time[4]+1;
@@ -193,7 +195,16 @@ sub format_date {
# Due dates need hyphen separators and time of day as well
if ($type eq 'due') {
- $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $year, $mon, $day, $hour, $minute, $second);
+
+ my $use_sdf = $class->get_option_value('use_sip_date_format') | '';
+
+ if ($use_sdf =~ /true/i) {
+ $date = $dt->strftime(SIP_DATETIME);
+
+ } else {
+ $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d",
+ $year, $mon, $day, $hour, $minute, $second);
+ }
}
syslog('LOG_DEBUG', "OILS: formatted date [type=$type]: $date");
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/examples/oils_sip.xml.example | 8 ++++++++
Open-ILS/src/perlmods/lib/OpenILS/SIP.pm | 17 ++++++++++++++---
2 files changed, 22 insertions(+), 3 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list