constituent record filtering methods: syntax, thinkos
authorBill Erickson <berick@esilibrary.com>
Fri, 31 Jan 2014 18:34:06 +0000 (13:34 -0500)
committerBill Erickson <berick@esilibrary.com>
Fri, 31 Jan 2014 18:34:06 +0000 (13:34 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm

index 35dd45e..6e3b31f 100644 (file)
@@ -2477,7 +2477,7 @@ sub do_possibility_checks {
 
     } elsif( $hold_type eq OILS_HOLD_TYPE_METARECORD ) {
 
-        my $recs = $self->method_lookup('open-ils.circ.holds.metarecord.filterd_records')->run($mrid, $holdable_formats);
+        my $recs = __PACKAGE__->method_lookup('open-ils.circ.holds.metarecord.filterd_records')->run($mrid, $holdable_formats);
         my @status = ();
         for my $rec (@$recs) {
             @status = _check_title_hold_is_possible(
index 7e476f2..66d7215 100644 (file)
@@ -1282,7 +1282,7 @@ sub MR_records_matching_format {
         )};
     }
 
-    my $records = metabib::metarecord->retrieve($hold->target)->source_records
+    my $records = metabib::metarecord->retrieve($MR)->source_records;
 
     if (!$mr_filter) {
         $client->respond( $_->id ) for @$records;
@@ -1290,7 +1290,7 @@ sub MR_records_matching_format {
         for my $r ( map { isTrue($_->deleted) ?  () : ($_->id) } @$records ) {
             $client->respond($r) if
                 @{action::hold_request->db_Main->selectcol_arrayref(
-                    'SELECT source FROM metabib.record_attr_vector_list WHERE source = ? AND vlist @@ ?'
+                    'SELECT source FROM metabib.record_attr_vector_list WHERE source = ? AND vlist @@ ?',
                     {},
                     $r,
                     $mr_filter
@@ -1457,23 +1457,21 @@ sub new_hold_copy_targeter {
 
             # find all the potential copies
             if ($hold->hold_type eq 'M') {
-                if(@$records > 0) {
-                    for my $r (
-                        $self->method_lookup(
-                            'open-ils.storage.metarecord.filtered_records'
-                        )->run( $hold->target, $hold->holdable_formats );
-                    ) {
-                        my ($rtree) = $self
-                            ->method_lookup( 'open-ils.storage.biblio.record_entry.ranged_tree')
-                            ->run( $r->id, $hold->selection_ou, $hold->selection_depth );
-
-                        for my $cn ( @{ $rtree->call_numbers } ) {
-                            push @$all_copies,
-                                asset::copy->search_where(
-                                    { id => [map {$_->id} @{ $cn->copies }],
-                                      deleted => 'f' }
-                                ) if ($cn && @{ $cn->copies });
-                        }
+                for my $r (
+                    $self->method_lookup(
+                        'open-ils.storage.metarecord.filtered_records'
+                    )->run( $hold->target, $hold->holdable_formats )
+                ) {
+                    my ($rtree) = $self
+                        ->method_lookup( 'open-ils.storage.biblio.record_entry.ranged_tree')
+                        ->run( $r->id, $hold->selection_ou, $hold->selection_depth );
+
+                    for my $cn ( @{ $rtree->call_numbers } ) {
+                        push @$all_copies,
+                            asset::copy->search_where(
+                                { id => [map {$_->id} @{ $cn->copies }],
+                                  deleted => 'f' }
+                            ) if ($cn && @{ $cn->copies });
                     }
                 }
             } elsif ($hold->hold_type eq 'T') {