[open-ils-commits] [GIT] Evergreen ILS branch rel_2_9 updated. 43319f4b31639d90ac5167763aafd2e3a1dc273a

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, rel_2_9 has been updated
       via  43319f4b31639d90ac5167763aafd2e3a1dc273a (commit)
       via  188029b6a60e53c3a91d5374592ad04957dc5d74 (commit)
      from  036ce850ba7b625077078137704001128a6de025 (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 43319f4b31639d90ac5167763aafd2e3a1dc273a
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 188029b6a60e53c3a91d5374592ad04957dc5d74
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 ac4f05c..eebf03e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -261,7 +261,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