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

Evergreen Git git at git.evergreen-ils.org
Tue Jun 21 23:35:19 EDT 2011


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  c1ad78f19abd2acfe09da7049d5c1be5948629dd (commit)
       via  c53187a7cd141a33b4b0a2b9b837fc2c15fc6b03 (commit)
      from  3d2301405894b7fb75fd551c9138b2ca9b63e8f5 (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 c1ad78f19abd2acfe09da7049d5c1be5948629dd
Author: Dan Scott <dan at coffeecode.net>
Date:   Tue Jun 21 23:31:01 2011 -0400

    Add unit tests for LP 800269 - holdings for captions only
    
    Running "prove -l lib" in Open-ILS/src/perlmods shows that the two new
    unit tests pass, whereas they fail using the previously installed
    version of MFHD.pm. Good evidence that the fix from dbwells does indeed
    solve the reported bug.
    
    Signed-off-by: Dan Scott <dan at coffeecode.net>

diff --git a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t
index 70f988d..f24e980 100644
--- a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t
+++ b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t
@@ -1,6 +1,6 @@
 #!perl -T
 
-use Test::More tests => 17;
+use Test::More tests => 19;
 
 use_ok( 'OpenILS::Utils::Cronscript' );
 use_ok( 'OpenILS::Utils::CStoreEditor' );
@@ -19,3 +19,20 @@ use_ok( 'OpenILS::Utils::RemoteAccount' );
 use_ok( 'OpenILS::Utils::ScriptRunner' );
 use_ok( 'OpenILS::Utils::SpiderMonkey' );
 use_ok( 'OpenILS::Utils::ZClient' );
+
+# LP 800269 - Test MFHD holdings for records that only contain a caption field
+my $co_marc = MARC::Record->new();
+$co_marc->append_fields(
+    MARC::Field->new('853','','',
+        '8' => '1',
+        'a' => 'v.',
+        'b' => '[no.]',
+    )
+);
+my $co_mfhd = MFHD->new($co_marc);
+
+my @comp_holdings = $co_mfhd->get_compressed_holdings($co_mfhd->field('853'));
+is(@comp_holdings, 0, "Compressed holdings for an MFHD record that only has a caption");
+
+my @decomp_holdings = $co_mfhd->get_decompressed_holdings($co_mfhd->field('853'));
+is(@decomp_holdings, 0, "Decompressed holdings for an MFHD record that only has a caption");

commit c53187a7cd141a33b4b0a2b9b837fc2c15fc6b03
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Tue Jun 21 11:44:10 2011 -0400

    MFHD compressed holdings short-circuit logic
    
    If you attempt to get compressed (or uncompressed) holdings from
    a MFHD record with only a caption, the code should short-circuit
    and return an empty list.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Dan Scott <dan at coffeecode.net>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm
index 48f00cb..5b728c0 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm
@@ -357,6 +357,8 @@ sub get_compressed_holdings {
         @decomp_holdings = $self->get_decompressed_holdings($caption, {'dedupe' => 1});
     }
 
+    return () if !@decomp_holdings;
+
     my $runner = $decomp_holdings[0]->clone->increment;   
     my $curr_holding = shift(@decomp_holdings);
     $curr_holding = $curr_holding->clone;
@@ -414,6 +416,9 @@ sub get_decompressed_holdings {
     my $link_id = $caption->link_id;
     $htag =~ s/^85/86/;
     my @holdings = $self->holdings($htag, $link_id);
+
+    return () if !@holdings;
+
     my @decomp_holdings;
 
     foreach my $holding (@holdings) {

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

Summary of changes:
 Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm |    5 +++++
 Open-ILS/src/perlmods/t/14-OpenILS-Utils.t      |   19 ++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list