made title_is_empty call more efficient
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Sep 2006 03:33:18 +0000 (03:33 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Sep 2006 03:33:18 +0000 (03:33 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5940 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Cat.pm

index adcd295..749f574 100644 (file)
@@ -896,13 +896,18 @@ sub merge {
 sub title_is_empty {
        my( $editor, $rid ) = @_;
 
+       return 0 if $rid == OILS_PRECAT_RECORD;
+
        my $cnlist = $editor->search_asset_call_number(
                { record => $rid, deleted => 'f' }, { idlist => 1 } );
        return 1 unless @$cnlist;
 
        for my $cn (@$cnlist) {
                my $copylist = $editor->search_asset_copy(
-                       { call_number => $cn, deleted => 'f' }, { idlist => 1 });
+                       [
+                               { call_number => $cn, deleted => 'f' }, 
+                               { limit => 1 },
+                       ], { idlist => 1 });
                return 0 if @$copylist; # false if we find any copies
        }