LP#1499086: Speed up bookbag retrieval by making acn the core class in basic_opac_cop...
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 16 Sep 2015 20:02:06 +0000 (13:02 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 23 Sep 2015 21:50:35 +0000 (14:50 -0700)
This is a modified version of some changes suggested by Mike Rylander.

Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm

index 44449f7..59cd140 100644 (file)
@@ -1995,55 +1995,51 @@ sub basic_opac_copy_query {
         },
 
         from => {
-            acp => {
-                ($iss_id ? (
-                    sitem => {
-                        fkey => 'id',
-                        field => 'unit',
-                        filter => {issuance => $iss_id},
-                        join => {
-                            sstr => { }
+            acn => {
+                acnp => { fkey => 'prefix' },
+                acns => { fkey => 'suffix' },
+                acp  => {
+                  fkey  => 'id',
+                  field => 'call_number',
+                  join  => {
+                    ($iss_id ? (
+                        sitem => {
+                            fkey => 'id',
+                            field => 'unit',
+                            filter => {issuance => $iss_id},
+                            join => {
+                                sstr => { }
+                            }
                         }
-                    }
-                ) : ()),
-                acn => {
-                    join => {
-                        acnp => { fkey => 'prefix' },
-                        acns => { fkey => 'suffix' }
+                    ) : ()),
+                    circ => { # If the copy is circulating, retrieve the open circ
+                        type => 'left',
+                        filter => {checkin_time => undef}
+                    },
+                    acpl => {
+                        filter => {
+                            deleted => 'f',
+                            ($staff ? () : ( opac_visible => 't' )),
+                        },
                     },
-                    filter => [
-                        {deleted => 'f'},
-                        ($rec_id ? {record => $rec_id} : ())
-                    ],
-                },
-                circ => { # If the copy is circulating, retrieve the open circ
-                    type => 'left',
-                    filter => {checkin_time => undef}
-                },
-                acpl => {
-                    filter => {
-                        deleted => 'f',
-                        ($staff ? () : ( opac_visible => 't' )),
+                    ccs => {
+                        ($staff ? () : (filter => { opac_visible => 't' }))
                     },
-                },
-                ccs => {
-                    ($staff ? () : (filter => { opac_visible => 't' }))
-                },
-                aou => {},
-                acpm => {
-                    type => 'left',
-                    join => {
-                        bmp => { type => 'left' }
+                    aou => {},
+                    acpm => {
+                        type => 'left',
+                        join => {
+                            bmp => { type => 'left' }
+                        }
                     }
+                  }
                 }
             }
         },
 
         where => {
-            '+acp' => {
-                deleted => 'f',
-                ($staff ? () : (opac_visible => 't'))
-            },
+            deleted => 'f',
+            ($rec_id ? (record => $rec_id) : ()),
             ($dist_id ? ( '+sstr' => { distribution => $dist_id } ) : ()),
             ($staff ? () : ( '+aou' => { opac_visible => 't' } ))
         },
index 418f884..1c9119a 100644 (file)
@@ -245,7 +245,7 @@ sub mk_copy_query {
 
     if($org != $self->ctx->{aou_tree}->()->id) { 
         # no need to add the org join filter if we're not actually filtering
-        $query->{from}->{acp}->{aou} = {
+        $query->{from}->{acn}->{acp}->{aou} = {
             fkey => 'circ_lib',
             field => 'id',
             filter => {