[open-ils-commits] r13044 - trunk/Open-ILS/src/perlmods/OpenILS/Application (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun May 3 20:17:04 EDT 2009


Author: miker
Date: 2009-05-03 20:17:03 -0400 (Sun, 03 May 2009)
New Revision: 13044

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
Log:
remove unwanted empty elements;  add ##URI## scoping support to tag browsing

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2009-05-03 20:41:39 UTC (rev 13043)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2009-05-04 00:17:03 UTC (rev 13044)
@@ -555,15 +555,28 @@
 					  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 @@
 					  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 @@
     $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 .= '<volumes>' . join(
-            '',
-            map {
-                OpenILS::Application::SuperCat::unAPI
-                    ->new( $_->call_number )
-                    ->as_xml({ %$args, no_uris=>1, no_copies=>1 })
-            } @{ $self->obj->call_number_maps }
-        ) . '</volumes>';
+    if (!$args->{no_volumes}) {
+        if (ref($self->obj->call_number_maps) && @{ $self->obj->call_number_maps }) {
+            $xml .= '<volumes>' . join(
+                '',
+                map {
+                    OpenILS::Application::SuperCat::unAPI
+                        ->new( $_->call_number )
+                        ->as_xml({ %$args, no_uris=>1, no_copies=>1 })
+                } @{ $self->obj->call_number_maps }
+            ) . '</volumes>';
 
-    } else {
-        $xml .= '<volumes/>';
+        } else {
+            $xml .= '<volumes/>';
+        }
     }
 
     $xml .= '</uri>';
@@ -1699,32 +1727,36 @@
     $xml .= 'lib="' . $self->obj->owning_lib->shortname . '" ';
     $xml .= 'label="' . $self->obj->label . '">';
 
-    if (!$args->{no_copies} && ref($self->obj->copies) && @{ $self->obj->copies }) {
-        $xml .= '<copies>' . join(
-            '',
-            map {
-                OpenILS::Application::SuperCat::unAPI
-                    ->new( $_ )
-                    ->as_xml({ %$args, no_volume=>1 })
-            } @{ $self->obj->copies }
-        ) . '</copies>';
+    if (!$args->{no_copies}) {
+        if (ref($self->obj->copies) && @{ $self->obj->copies }) {
+            $xml .= '<copies>' . join(
+                '',
+                map {
+                    OpenILS::Application::SuperCat::unAPI
+                        ->new( $_ )
+                        ->as_xml({ %$args, no_volume=>1 })
+                } @{ $self->obj->copies }
+            ) . '</copies>';
 
-    } else {
-        $xml .= '<copies/>';
+        } else {
+            $xml .= '<copies/>';
+        }
     }
 
-    if (!$args->{no_uris} && ref($self->obj->uri_maps) && @{ $self->obj->uri_maps }) {
-        $xml .= '<uris>' . join(
-            '',
-            map {
-                OpenILS::Application::SuperCat::unAPI
-                    ->new( $_->uri )
-                    ->as_xml({ %$args, no_volumes=>1 })
-            } @{ $self->obj->uri_maps }
-        ) . '</uris>';
+    if (!$args->{no_uris}) {
+        if (ref($self->obj->uri_maps) && @{ $self->obj->uri_maps }) {
+            $xml .= '<uris>' . join(
+                '',
+                map {
+                    OpenILS::Application::SuperCat::unAPI
+                        ->new( $_->uri )
+                        ->as_xml({ %$args, no_volumes=>1 })
+                } @{ $self->obj->uri_maps }
+            ) . '</uris>';
 
-    } else {
-        $xml .= '<uris/>';
+        } else {
+            $xml .= '<uris/>';
+        }
     }
 
 



More information about the open-ils-commits mailing list