[open-ils-commits] [GIT] Evergreen ILS branch master updated. 524a3dc3713745ed22966446b97a302cd1593eed

Evergreen Git git at git.evergreen-ils.org
Wed Mar 2 15:40:13 EST 2016


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  524a3dc3713745ed22966446b97a302cd1593eed (commit)
       via  86c5da0b4da0cf20141ef774536a7f1723f3592b (commit)
      from  f2ca2d7f9c79561a04f6ac1ae61bc6537f0acc65 (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 524a3dc3713745ed22966446b97a302cd1593eed
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Wed Mar 2 15:38:52 2016 -0500

    LP#1516757: add Perl test case
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/t/12-OpenILS-SIP.t b/Open-ILS/src/perlmods/t/12-OpenILS-SIP.t
index cf93a0c..454a21a 100644
--- a/Open-ILS/src/perlmods/t/12-OpenILS-SIP.t
+++ b/Open-ILS/src/perlmods/t/12-OpenILS-SIP.t
@@ -1,6 +1,8 @@
-#!perl -T
+#!perl
+# note that taint mode is explicitly off; see
+# https://rt.cpan.org/Public/Bug/Display.html?id=94520 for why
 
-use Test::More tests => 8;
+use Test::More tests => 9;
 
 BEGIN {
 	use_ok( 'OpenILS::SIP' );
@@ -13,3 +15,8 @@ use_ok( 'OpenILS::SIP::Transaction' );
 use_ok( 'OpenILS::SIP::Transaction::Checkin' );
 use_ok( 'OpenILS::SIP::Transaction::Checkout' );
 use_ok( 'OpenILS::SIP::Transaction::Renew' );
+
+$ENV{TZ} = 'America/New_York'; # chosen to exercise the LP#1516757 bug
+my $dob = '1960-12-31';
+my $dob_formatted = OpenILS::SIP->format_date($dob, 'dob');
+is($dob_formatted, '19601231', 'LP#1516757: ensure dates of birth do not get offset');

commit 86c5da0b4da0cf20141ef774536a7f1723f3592b
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Nov 16 14:48:23 2015 -0500

    LP#1516757: ensure that SIP2 returns DOB correctly
    
    Parse dates of birth using the local timezone to ensure that the date in
    the database will match what is sent to SIP clients.  Otherwise, the
    date will be parsed as UTC and may result in the DoB value being offset
    by one day in the SIP response.
    
    To test
    -------
    [1] Fire up a SIP client of some sort and retrieve a patron record;
        verify that the patron's date of birth is correct, and not
        offset by one day.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
index bd11e19..cf98f33 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
@@ -186,12 +186,19 @@ sub patron_barcode_from_id {
 sub format_date {
     my $class = shift;
     my $date = shift;
-    my $type = shift || 'dob';
+    my $type = shift || '';
 
     return "" unless $date;
 
     my $dt = DateTime::Format::ISO8601->new->
         parse_datetime(OpenSRF::Utils::cleanse_ISO8601($date));
+
+    # actor.usr.dob stores dates without time/timezone, which causes
+    # DateTime to assume the date is stored as UTC.  Tell DateTime
+    # to use the local time zone, instead.
+    # Other dates will have time zones and should be parsed as-is.
+    $dt->set_time_zone('local') if $type eq 'dob';
+
     my @time = localtime($dt->epoch);
 
     my $year   = $time[5]+1900;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index 16f2563..130d9bf 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -299,7 +299,7 @@ sub home_phone {
 
 sub sip_birthdate {
     my $self = shift;
-    my $dob = OpenILS::SIP->format_date($self->{user}->dob);
+    my $dob = OpenILS::SIP->format_date($self->{user}->dob, 'dob');
     syslog('LOG_DEBUG', "OILS: Patron DOB = $dob");
     return $dob;
 }

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/perlmods/lib/OpenILS/SIP.pm        |    9 ++++++++-
 Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm |    2 +-
 Open-ILS/src/perlmods/t/12-OpenILS-SIP.t        |   11 +++++++++--
 3 files changed, 18 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list