LP#1022582: MARC Exporter includes deleted copies in holdings export
authorMark Cooper <markchristophercooper@gmail.com>
Thu, 11 Oct 2012 06:20:02 +0000 (23:20 -0700)
committerBill Erickson <berick@esilibrary.com>
Wed, 6 Mar 2013 19:24:50 +0000 (14:24 -0500)
Added check to filter out callnumbers/copies if deleted.

Signed-off-by: Mark Cooper <markchristophercooper@gmail.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm
Open-ILS/src/support-scripts/marc_export.in

index 2fc4462..373effd 100644 (file)
@@ -218,10 +218,11 @@ sub handler {
 
                        if ($holdings) {
                                $req->delete_field( $_ ) for ($req->field('852')); # remove any legacy 852s
-                               my $cn_list = $bib->call_numbers;
+
+                               my $cn_list = [ grep { $_->deleted eq 'f' } @{ $bib->call_numbers } ];
                                if ($cn_list && @$cn_list) {
 
-                                       my $cp_list = [ map { @{ $_->copies } } @$cn_list ];
+                                       my $cp_list = [ grep { $_->deleted eq 'f' } map { @{ $_->copies } } @$cn_list ];
                                        if ($cp_list && @$cp_list) {
 
                                                my %cn_map;
index 588f8dd..709c613 100755 (executable)
@@ -383,12 +383,12 @@ sub add_bib_holdings {
     my $bib = shift;
     my $r = shift;
 
-    my $cn_list = $bib->call_numbers;
+    my $cn_list = [ grep { $_->deleted eq 'f' } @{ $bib->call_numbers } ];
     if ($cn_list && @$cn_list) {
 
         $count{cn} += @$cn_list;
-    
-        my $cp_list = [ map { @{ $_->copies } } @$cn_list ];
+
+        my $cp_list = [ grep { $_->deleted eq 'f' } map { @{ $_->copies } } @$cn_list ];
         if ($cp_list && @$cp_list) {
 
             my %cn_map;