From: erickson Date: Fri, 4 Aug 2006 18:03:26 +0000 (+0000) Subject: moved to cancel_time on hold as opposed to deleting it X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0b664bf6e9ee63e023c7daee26b9bdef17de92fd;p=Evergreen.git moved to cancel_time on hold as opposed to deleting it git-svn-id: svn://svn.open-ils.org/ILS/trunk@5302 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 794816504d..c4817fb013 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -903,23 +903,6 @@ sub get_org_types { __PACKAGE__->register_method( - method => "get_user_profiles", - api_name => "open-ils.actor.user.profiles.retrieve", -); - -my $user_profiles; -sub get_user_profiles { - return $user_profiles if $user_profiles; - - return $user_profiles = - $apputils->simple_scalar_request( - "open-ils.cstore", - "open-ils.cstore.direct.actor.profile.search.atomic", { id => { "!=" => undef }}); -} - - - -__PACKAGE__->register_method( method => "get_user_ident_types", api_name => "open-ils.actor.user.ident_types.retrieve", ); @@ -1642,8 +1625,11 @@ sub hold_request_count { my $holds = $apputils->simple_scalar_request( "open-ils.cstore", "open-ils.cstore.direct.action.hold_request.search.atomic", - { usr => $userid, - fulfillment_time => {"=" => undef } } + { + usr => $userid, + fulfillment_time => {"=" => undef }, + cancel_time => undef, + } ); my @ready; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm index f753b8166f..0fd4a18c8d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm @@ -513,7 +513,8 @@ sub fetch_open_hold_by_copy { { current_copy => $copyid , capture_time => { "!=" => undef }, - fulfillment_time => undef + fulfillment_time => undef, + cancel_time => undef, } ); $evt = OpenILS::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND', copyid => $copyid) unless $hold; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index 0d3c96d697..c5226f964f 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -809,8 +809,14 @@ sub handle_checkout_holds { my $copy = $self->copy; my $patron = $self->patron; + my $holds = $self->editor->search_action_hold_request( - { current_copy => $copy->id , fulfillment_time => undef }); + { + current_copy => $copy->id , + cancel_time => undef, + fulfillment_time => undef + } + ); my @fulfilled; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index c4fec43c29..07b8b59a69 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -100,7 +100,8 @@ sub create_hold { usr => $recipient->id, hold_type => $t, fulfillment_time => undef, - target => $hold->target + target => $hold->target, + cancel_time => undef, }; $sargs->{holdable_formats} = $hold->holdable_formats if $t eq 'M'; @@ -326,7 +327,13 @@ sub retrieve_holds { my $holds = $apputils->simplereq( 'open-ils.cstore', "open-ils.cstore.direct.action.hold_request.search.atomic", - { usr => $user_id , fulfillment_time => undef }, { order_by => { ahr => "request_time" } }); + { + usr => $user_id , + fulfillment_time => undef, + cancel_time => undef, + }, + { order_by => { ahr => "request_time" } } + ); for my $hold ( @$holds ) { $hold->transit( @@ -362,7 +369,12 @@ sub retrieve_holds_by_pickup_lib { my $holds = $apputils->simplereq( 'open-ils.cstore', "open-ils.cstore.direct.action.hold_request.search.atomic", - { pickup_lib => $ou_id , fulfillment_time => undef }, { order_by => { ahr => "request_time" } }); + { + pickup_lib => $ou_id , + fulfillment_time => undef, + cancel_time => undef + }, + { order_by => { ahr => "request_time" } }); for my $hold ( @$holds ) { $hold->transit( @@ -402,6 +414,8 @@ sub cancel_hold { return $e->event unless $e->allowed('CANCEL_HOLDS'); } + return 1 if $hold->cancel_time; + # If the hold is captured, reset the copy status if( $hold->capture_time and $hold->current_copy ) { @@ -418,7 +432,8 @@ sub cancel_hold { } } - $e->delete_action_hold_request($hold) + $hold->cancel_time('now'); + $e->update_action_hold_request($hold) or return $e->event; $e->commit; @@ -605,40 +620,6 @@ sub find_local_hold { } -=head deprecated -sub _find_local_hold_for_copy { - - my $session = shift; - my $copy = shift; - my $user = shift; - my $evt = OpenILS::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND'); - - # first see if this copy has already been selected to fulfill a hold - my $hold = $session->request( - "open-ils.storage.direct.action.hold_request.search_where", - { current_copy => $copy->id, capture_time => undef } )->gather(1); - - if($hold) {return $hold;} - - $logger->debug("searching for local hold at org " . - $user->ws_ou . " and copy " . $copy->id); - - my $holdid = $session->request( - "open-ils.storage.action.hold_request.nearest_hold", - $user->ws_ou, $copy->id )->gather(1); - - return (undef, $evt) unless defined $holdid; - - $logger->debug("Found hold id $holdid while ". - "searching nearest hold to " .$user->ws_ou); - - return $apputils->fetch_hold($holdid); -} -=cut - - - - @@ -673,7 +654,7 @@ sub fetch_open_hold_by_current_copy { my $hold = $apputils->simplereq( 'open-ils.cstore', 'open-ils.cstore.direct.action.hold_request.search.atomic', - { current_copy => $copyid , fulfillment_time => undef }); + { current_copy => $copyid , cancel_time => undef, fulfillment_time => undef }); return $hold->[0] if ref($hold); return undef; } @@ -684,7 +665,7 @@ sub fetch_related_holds { return $apputils->simplereq( 'open-ils.cstore', 'open-ils.cstore.direct.action.hold_request.search.atomic', - { current_copy => $copyid , fulfillment_time => undef }); + { current_copy => $copyid , cancel_time => undef, fulfillment_time => undef }); } @@ -710,7 +691,7 @@ sub hold_pull_list { return $U->storagereq( 'open-ils.storage.direct.action.hold_request.pull_list.search.current_copy_circ_lib.atomic', - $org, $limit, $offset ); # XXX change to workstation + $org, $limit, $offset ); } __PACKAGE__->register_method ( @@ -850,7 +831,7 @@ sub fetch_open_title_holds { # XXX make me return IDs in the future ^-- return $e->search_action_hold_request( - { target => $id, hold_type => $type, fulfillment_time => undef }); + { target => $id, cancel_time => undef, hold_type => $type, fulfillment_time => undef }); } @@ -879,7 +860,8 @@ sub fetch_captured_holds { capture_time => { "!=" => undef }, current_copy => { "!=" => undef }, fulfillment_time => undef, - pickup_lib => $org + pickup_lib => $org, + cancel_time => undef, } ); @@ -1013,7 +995,7 @@ sub find_nearest_permitted_hold { # first see if this copy has already been selected to fulfill a hold my $hold = $session->request( "open-ils.storage.direct.action.hold_request.search_where", - { current_copy => $copy->id, capture_time => undef } )->gather(1); + { current_copy => $copy->id, cancel_time => undef, capture_time => undef } )->gather(1); if( $hold ) { $logger->info("hold found which can be fulfilled by copy ".$copy->id);