[open-ils-commits] r15035 - in trunk/Open-ILS: examples src/perlmods/OpenILS/Application/Circ src/perlmods/OpenILS/Application/Storage/CDBI src/sql/Pg src/sql/Pg/upgrade (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Nov 25 21:09:11 EST 2009


Author: miker
Date: 2009-11-25 21:09:09 -0500 (Wed, 25 Nov 2009)
New Revision: 15035

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0095.schema.asset.copy.floating.sql
Modified:
   trunk/Open-ILS/examples/fm_IDL.xml
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/040.schema.asset.sql
Log:
DB and middle layer implementation of floating items -- no UI yet.

asset.copy gets a new BOOL column, floating, that when set to true causes
the circ_lib for that copy to be set to the check-in location if it would
otherwise be transited elsewhere simply to be reshelved.



Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml	2009-11-26 01:35:03 UTC (rev 15034)
+++ trunk/Open-ILS/examples/fm_IDL.xml	2009-11-26 02:09:09 UTC (rev 15035)
@@ -3561,6 +3561,7 @@
 			<field reporter:label="Copy Status" name="status" reporter:datatype="link"/>
 			<field reporter:label="Copy Status Changed Time" name="status_changed_time" reporter:datatype="timestamp"/>
 			<field reporter:label="Is Mint Condition" name="mint_condition" reporter:datatype="bool"/>
+			<field reporter:label="Is Floating" name="floating" reporter:datatype="bool"/>
 			<field reporter:label="Copy Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Stat-Cat entry maps" name="stat_cat_entry_copy_maps" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Circulations" name="circulations" oils_persist:virtual="true" reporter:datatype="link"/>

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2009-11-26 01:35:03 UTC (rev 15034)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2009-11-26 02:09:09 UTC (rev 15035)
@@ -1798,7 +1798,9 @@
     if( $self->copy ) {
         $self->transit(
             $self->editor->search_action_transit_copy(
-            { target_copy => $self->copy->id, dest_recv_time => undef })->[0]); 
+                { target_copy => $self->copy->id, dest_recv_time => undef }
+            )->[0]
+        ); 
     }
 
     if( $self->circ ) {
@@ -1828,12 +1830,12 @@
                 $U->copy_status($self->copy->status)->id 
                     == OILS_COPY_STATUS_ON_HOLDS_SHELF ) {
 
-         my $hold;
-         if( $hold_transit ) {
-            $hold = $self->editor->retrieve_action_hold_request($hold_transit->hold);
-         } else {
-                ($hold) = $U->fetch_open_hold_by_copy($self->copy->id);
-         }
+            my $hold;
+            if( $hold_transit ) {
+               $hold = $self->editor->retrieve_action_hold_request($hold_transit->hold);
+            } else {
+                   ($hold) = $U->fetch_open_hold_by_copy($self->copy->id);
+            }
 
             $self->hold($hold);
 
@@ -1871,7 +1873,7 @@
    # this copy can fulfill a hold or needs to be routed to a different location
    # ------------------------------------------------------------------------------
 
-    unless($self->noop) { # no-op checkins to not capture holds or put items into transit
+    if(!$self->noop) { # /not/ a no-op checkin, not capture for hold or put item into transit
 
         my $needed_for_hold = (!$self->remote_hold and $self->attempt_checkin_hold_capture());
         return if $self->bail_out;
@@ -1889,19 +1891,33 @@
             $logger->debug("circulator: circlib=$circ_lib, workstation=".$self->editor->requestor->ws_ou);
     
             if( $circ_lib == $self->editor->requestor->ws_ou ) {
+                # copy is where it needs to be, either for hold or reshelving
     
                 $self->checkin_handle_precat();
                 return if $self->bail_out;
     
             } else {
+                # copy needs to transit "home", or stick here if it's a floating copy
     
-                my $bc = $self->copy->barcode;
-                $logger->info("circulator: copy $bc at the wrong location, sending to $circ_lib");
-                $self->checkin_build_copy_transit($circ_lib);
-                return if $self->bail_out;
-                $self->push_events(OpenILS::Event->new('ROUTE_ITEM', org => $circ_lib));
+                if ($U->is_true( $self->copy->floating ) && !$self->remote_hold) { # copy is floating, stick here
+                    $self->checkin_changed(1);
+                    $self->copy->circ_lib( $self->editor->requestor->ws_ou );
+                    $self->update_copy;
+                } else {
+                    my $bc = $self->copy->barcode;
+                    $logger->info("circulator: copy $bc at the wrong location, sending to $circ_lib");
+                    $self->checkin_build_copy_transit($circ_lib);
+                    return if $self->bail_out;
+                    $self->push_events(OpenILS::Event->new('ROUTE_ITEM', org => $circ_lib));
+                }
             }
         }
+    } else { # no-op checkin
+        if ($U->is_true( $self->copy->floating )) { # XXX floating items still stick where they are even with no-op checkin?
+            $self->checkin_changed(1);
+            $self->copy->circ_lib( $self->editor->requestor->ws_ou );
+            $self->update_copy;
+        }
     }
 
     if($self->claims_never_checked_out and 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm	2009-11-26 01:35:03 UTC (rev 15034)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm	2009-11-26 02:09:09 UTC (rev 15035)
@@ -48,7 +48,7 @@
 				   fine_level circulate deposit price ref opac_visible
 				   circ_as_type circ_modifier deposit_amount location mint_condition
 				   holdable dummy_title dummy_author deleted alert_message
-				   age_protect/ );
+				   age_protect floating/ );
 
 #-------------------------------------------------------------------------------
 package asset::stat_cat;

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-11-26 01:35:03 UTC (rev 15034)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-11-26 02:09:09 UTC (rev 15035)
@@ -51,7 +51,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0094'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0095'); -- miker
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: trunk/Open-ILS/src/sql/Pg/040.schema.asset.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/040.schema.asset.sql	2009-11-26 01:35:03 UTC (rev 15034)
+++ trunk/Open-ILS/src/sql/Pg/040.schema.asset.sql	2009-11-26 02:09:09 UTC (rev 15035)
@@ -75,6 +75,7 @@
 	alert_message	TEXT,
 	opac_visible	BOOL				NOT NULL DEFAULT TRUE,
 	deleted		BOOL				NOT NULL DEFAULT FALSE,
+	floating		BOOL				NOT NULL DEFAULT FALSE,
 	dummy_isbn      TEXT,
 	status_changed_time TIMESTAMP WITH TIME ZONE,
 	mint_condition      BOOL        NOT NULL DEFAULT TRUE

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0095.schema.asset.copy.floating.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0095.schema.asset.copy.floating.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0095.schema.asset.copy.floating.sql	2009-11-26 02:09:09 UTC (rev 15035)
@@ -0,0 +1,9 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0095'); -- miker
+
+ALTER TABLE asset.copy ADD COLUMN floating BOOL NOT NULL DEFAULT FALSE;
+ALTER TABLE auditor.asset_copy_history ADD COLUMN floating BOOL;
+
+COMMIT;
+



More information about the open-ils-commits mailing list