[open-ils-commits] r14652 - in trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage: CDBI Driver/Pg Publisher (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Oct 28 13:41:59 EDT 2009


Author: miker
Date: 2009-10-28 13:41:55 -0400 (Wed, 28 Oct 2009)
New Revision: 14652

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
Log:
add support for sorting the pull list by asset.copy_location_order when set

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm	2009-10-28 16:57:09 UTC (rev 14651)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm	2009-10-28 17:41:55 UTC (rev 14652)
@@ -13,6 +13,14 @@
 __PACKAGE__->columns( Essential => qw/name owning_lib holdable hold_verify opac_visible circulate/ );
 
 #-------------------------------------------------------------------------------
+package asset::copy_location_order;
+use base qw/asset/;
+
+__PACKAGE__->table( 'asset_copy_location_order' );
+__PACKAGE__->columns( Primary => qw/id/ );
+__PACKAGE__->columns( Essential => qw/location org position/ );
+
+#-------------------------------------------------------------------------------
 package asset::call_number;
 use base qw/asset/;
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm	2009-10-28 16:57:09 UTC (rev 14651)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm	2009-10-28 17:41:55 UTC (rev 14652)
@@ -292,6 +292,12 @@
 	asset::call_number->sequence( 'asset.call_number_id_seq' );
 	
 	#---------------------------------------------------------------------
+	package asset::copy_location_order;
+	
+	asset::copy_location_order->table( 'asset.copy_location_order' );
+	asset::copy_location_order->sequence( 'asset.copy_location_order_id_seq' );
+
+	#---------------------------------------------------------------------
 	package asset::copy_location;
 	
 	asset::copy_location->table( 'asset.copy_location' );

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm	2009-10-28 16:57:09 UTC (rev 14651)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm	2009-10-28 17:41:55 UTC (rev 14652)
@@ -408,6 +408,7 @@
 	return undef unless ($ou);
 	my $h_table = action::hold_request->table;
 	my $a_table = asset::copy->table;
+	my $ord_table = asset::copy_location_order->table;
 
 	my $idlist = 1 if ($self->api_name =~/id_list/o);
 
@@ -418,12 +419,13 @@
 		SELECT	h.*
 		  FROM	$h_table h
 		  	JOIN $a_table a ON (h.current_copy = a.id)
+		  	LEFT JOIN $ord_table ord (a.location = ord.location AND a.circ_lib = ord.org)
 		  WHERE	a.circ_lib = ?
 		  	AND h.capture_time IS NULL
 		  	AND h.cancel_time IS NULL
 		  	AND (h.expire_time IS NULL OR h.expire_time > NOW())
 			$status_filter
-		  ORDER BY h.request_time ASC
+		  ORDER BY CASE WHEN ord.position IS NOT NULL THEN ord.position ELSE 999 END, h.request_time
 		  LIMIT $limit
 		  OFFSET $offset
 	SQL



More information about the open-ils-commits mailing list