[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch rel_2_5 updated. 84750b0da1531431425b8347e8cb555036630eff

Evergreen Git git at git.evergreen-ils.org
Thu Sep 25 17:17:39 EDT 2014


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_5 has been updated
       via  84750b0da1531431425b8347e8cb555036630eff (commit)
      from  83453832239df18255ba3ffd22e2778ce4505ee9 (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 84750b0da1531431425b8347e8cb555036630eff
Author: Chris Sharp <csharp at georgialibraries.org>
Date:   Thu Sep 25 11:45:44 2014 -0400

    LP#1373693: Speed up call number browse search at top level org.
    
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
index 4d4ed93..bf795e4 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
@@ -335,7 +335,7 @@ sub _label_sortkey_from_label {
     my $closest_cn = $_storage->request(
             "open-ils.cstore.direct.asset.call_number.search.atomic",
             { label      => { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label] } },
-              owning_lib => $ou_ids,
+              (scalar(@$ou_ids) ? (owning_lib => $ou_ids) : ()),
               deleted    => 'f',
               @$cp_filter
             },
@@ -375,22 +375,33 @@ sub cn_browse {
 
     my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-    my $o_search = { shortname => $ou };
-    if (!$ou || $ou eq '-') {
-        $o_search = { parent_ou => undef };
-    }
-
-    my $orgs = $_storage->request(
-        "open-ils.cstore.direct.actor.org_unit.search",
-        $o_search,
-        { flesh     => 100,
-          flesh_fields  => { aou    => [qw/children/] }
-        }
-    )->gather(1);
+    my @ou_ids;
+    # if OU is not specified, or if '-' is specified, do not enter the block
+    unless (!$ou || $ou eq '-') {
+        # check if the shortname of the top org_unit is specified
+	    my $top_org = $_storage->request(
+            "open-ils.cstore.direct.actor.org_unit.search",
+             { parent_ou => undef }
+	    )->gather(1);
+
+        if ($ou eq $top_org->shortname) {
+	        $logger->debug("Searching for CNs at top org $ou");
+	    } else {
+            my $o_search = { shortname => $ou };
+
+            my $orgs = $_storage->request(
+                "open-ils.cstore.direct.actor.org_unit.search",
+                $o_search,
+                { flesh     => 100,
+                flesh_fields  => { aou    => [qw/children/] }
+                }
+            )->gather(1);
 
-    my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
+            @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
 
-    $logger->debug("Searching for CNs at orgs [".join(',', at ou_ids)."], based on $ou");
+            $logger->debug("Searching for CNs at orgs [".join(',', at ou_ids)."], based on $ou");
+        }
+    }
 
     my @list = ();
 
@@ -416,7 +427,7 @@ sub cn_browse {
         my $before = $_storage->request(
             "open-ils.cstore.direct.asset.call_number.search.atomic",
             { label_sortkey => { "<" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
-              owning_lib    => \@ou_ids,
+              (scalar(@ou_ids) ? (owning_lib => \@ou_ids) : ()),
               deleted => 'f',
               @cp_filter
             },
@@ -434,7 +445,7 @@ sub cn_browse {
         my $after = $_storage->request(
             "open-ils.cstore.direct.asset.call_number.search.atomic",
             { label_sortkey => { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
-              owning_lib    => \@ou_ids,
+              (scalar(@ou_ids) ? (owning_lib => \@ou_ids) : ()),
               deleted => 'f',
               @cp_filter
             },

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/SuperCat.pm   |   45 ++++++++++++-------
 1 files changed, 28 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list