From: miker Date: Thu, 26 Nov 2009 02:09:09 +0000 (+0000) Subject: DB and middle layer implementation of floating items -- no UI yet. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=693542f3bcbe31e7d5aaf8f7abf0d975a6fceb8b;p=evergreen%2Ftadl.git 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. git-svn-id: svn://svn.open-ils.org/ILS/trunk@15035 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index aeabe144a1..78b7c65501 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3561,6 +3561,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index 67dca9a78f..26ebdeacc1 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -1798,7 +1798,9 @@ sub do_checkin { 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 @@ sub do_checkin { $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 @@ sub do_checkin { # 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 @@ sub do_checkin { $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 diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm index 1b29698b42..a93af68203 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm @@ -48,7 +48,7 @@ __PACKAGE__->columns( Essential => qw/call_number barcode creator create_date ed 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; diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 7a9d220dcc..e36f9d4029 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( 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, diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index f701f47762..c35d188834 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -75,6 +75,7 @@ CREATE TABLE asset.copy ( 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 diff --git a/Open-ILS/src/sql/Pg/upgrade/0095.schema.asset.copy.floating.sql b/Open-ILS/src/sql/Pg/upgrade/0095.schema.asset.copy.floating.sql new file mode 100644 index 0000000000..58af03501d --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0095.schema.asset.copy.floating.sql @@ -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; +