From: miker Date: Mon, 4 May 2009 00:17:03 +0000 (+0000) Subject: remove unwanted empty elements; add ##URI## scoping support to tag browsing X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=425a7fe087fe83eb14406557de9f22a4ed96ab4c;p=Evergreen.git remove unwanted empty elements; add ##URI## scoping support to tag browsing git-svn-id: svn://svn.open-ils.org/ILS/trunk@13044 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index 7ed9187ad9..82e00d3e84 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -555,15 +555,28 @@ sub tag_sf_browse { subfield => $subfield, value => { '<' => lc($value) } }, - '-exists' => - { select=> { acp => [ 'id' ] }, - from => { acn => { acp => { field => 'call_number', fkey => 'id' } } }, - where => - { '+acn' => { record => { '=' => { '+mfr' => 'record' } } }, - '+acp' => { deleted => 'f', (@ou_ids) ? ( circ_lib => \@ou_ids) : () } - }, - limit => 1 - } + '-or' => [ + { '-exists' => + { select=> { acp => [ 'id' ] }, + from => { acn => { acp => { field => 'call_number', fkey => 'id' } } }, + where => + { '+acn' => { record => { '=' => { '+mfr' => 'record' } } }, + '+acp' => { deleted => 'f', (@ou_ids) ? ( circ_lib => \@ou_ids) : () } + }, + limit => 1 + } + }, + { '-exists' => + { select=> { auri => [ 'id' ] }, + from => { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } }, + where => + { '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () }, + '+auri' => { active => 't' } + }, + limit => 1 + } + } + ] }, order_by => { mfr => { value => 'desc' } }, limit => $before_limit, @@ -584,15 +597,28 @@ sub tag_sf_browse { subfield => $subfield, value => { '>=' => lc($value) } }, - '-exists' => - { select=> { acp => [ 'id' ] }, - from => { acn => { acp => { field => 'call_number', fkey => 'id' } } }, - where => - { '+acn' => { record => { '=' => { '+mfr' => 'record' } } }, - '+acp' => { deleted => 'f', (@ou_ids) ? ( circ_lib => \@ou_ids) : () } - }, - limit => 1 - } + '-or' => [ + { '-exists' => + { select=> { acp => [ 'id' ] }, + from => { acn => { acp => { field => 'call_number', fkey => 'id' } } }, + where => + { '+acn' => { record => { '=' => { '+mfr' => 'record' } } }, + '+acp' => { deleted => 'f', (@ou_ids) ? ( circ_lib => \@ou_ids) : () } + }, + limit => 1 + } + }, + { '-exists' => + { select=> { auri => [ 'id' ] }, + from => { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } }, + where => + { '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () }, + '+auri' => { active => 't' } + }, + limit => 1 + }, + } + ] }, order_by => { mfr => { value => 'asc' } }, limit => $after_limit, @@ -1667,18 +1693,20 @@ sub as_xml { $xml .= 'label="' . $self->escape( $self->obj->label ) . '" '; $xml .= 'href="' . $self->escape( $self->obj->href ) . '">'; - if (!$args->{no_volumes} && ref($self->obj->call_number_maps) && @{ $self->obj->call_number_maps }) { - $xml .= '' . join( - '', - map { - OpenILS::Application::SuperCat::unAPI - ->new( $_->call_number ) - ->as_xml({ %$args, no_uris=>1, no_copies=>1 }) - } @{ $self->obj->call_number_maps } - ) . ''; - - } else { - $xml .= ''; + if (!$args->{no_volumes}) { + if (ref($self->obj->call_number_maps) && @{ $self->obj->call_number_maps }) { + $xml .= '' . join( + '', + map { + OpenILS::Application::SuperCat::unAPI + ->new( $_->call_number ) + ->as_xml({ %$args, no_uris=>1, no_copies=>1 }) + } @{ $self->obj->call_number_maps } + ) . ''; + + } else { + $xml .= ''; + } } $xml .= ''; @@ -1699,32 +1727,36 @@ sub as_xml { $xml .= 'lib="' . $self->obj->owning_lib->shortname . '" '; $xml .= 'label="' . $self->obj->label . '">'; - if (!$args->{no_copies} && ref($self->obj->copies) && @{ $self->obj->copies }) { - $xml .= '' . join( - '', - map { - OpenILS::Application::SuperCat::unAPI - ->new( $_ ) - ->as_xml({ %$args, no_volume=>1 }) - } @{ $self->obj->copies } - ) . ''; - - } else { - $xml .= ''; + if (!$args->{no_copies}) { + if (ref($self->obj->copies) && @{ $self->obj->copies }) { + $xml .= '' . join( + '', + map { + OpenILS::Application::SuperCat::unAPI + ->new( $_ ) + ->as_xml({ %$args, no_volume=>1 }) + } @{ $self->obj->copies } + ) . ''; + + } else { + $xml .= ''; + } } - if (!$args->{no_uris} && ref($self->obj->uri_maps) && @{ $self->obj->uri_maps }) { - $xml .= '' . join( - '', - map { - OpenILS::Application::SuperCat::unAPI - ->new( $_->uri ) - ->as_xml({ %$args, no_volumes=>1 }) - } @{ $self->obj->uri_maps } - ) . ''; - - } else { - $xml .= ''; + if (!$args->{no_uris}) { + if (ref($self->obj->uri_maps) && @{ $self->obj->uri_maps }) { + $xml .= '' . join( + '', + map { + OpenILS::Application::SuperCat::unAPI + ->new( $_->uri ) + ->as_xml({ %$args, no_volumes=>1 }) + } @{ $self->obj->uri_maps } + ) . ''; + + } else { + $xml .= ''; + } }