moved to cancel_time on hold as opposed to deleting it
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Aug 2006 18:03:26 +0000 (18:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Aug 2006 18:03:26 +0000 (18:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5302 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm

index 7948165..c4817fb 100644 (file)
@@ -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;
index f753b81..0fd4a18 100644 (file)
@@ -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;
index 0d3c96d..c5226f9 100644 (file)
@@ -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;
 
index c4fec43..07b8b59 100644 (file)
@@ -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);