[open-ils-commits] [GIT] Evergreen ILS branch master updated. 4e53a6eb2355f3eda8828371d954d66e7efc5c65

Evergreen Git git at git.evergreen-ils.org
Mon Jun 27 09:53:55 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  4e53a6eb2355f3eda8828371d954d66e7efc5c65 (commit)
       via  77a999bdcdc00f95b296c4d584b623db28fa3d31 (commit)
      from  bf77824abbf31b7738edc03b86c9e1275e1e290c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4e53a6eb2355f3eda8828371d954d66e7efc5c65
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Fri Jun 24 15:40:32 2011 -0400

    with scan missing pieces, retarget affected holds prior to recirculating to previous patron, lest the checkout reset the holds for us without retargeting
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
index df81b27..f5cc14c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
@@ -1306,79 +1306,100 @@ __PACKAGE__->register_method(
 sub mark_item_missing_pieces {
 	my( $self, $conn, $auth, $copy_id, $args ) = @_;
     ### FIXME: We're starting a transaction here, but we're doing a lot of things outside of the transaction
-	my $e = new_editor(authtoken=>$auth, xact =>1);
-	return $e->die_event unless $e->checkauth;
+    ### FIXME: Even better, we're going to use two transactions, the first to affect pertinent holds before checkout can
+
+	my $e2 = new_editor(authtoken=>$auth, xact =>1);
+	return $e2->die_event unless $e2->checkauth;
     $args ||= {};
 
-    my $copy = $e->retrieve_asset_copy([
+    my $copy = $e2->retrieve_asset_copy([
         $copy_id,
         {flesh => 1, flesh_fields => {'acp' => ['call_number']}}])
-            or return $e->die_event;
+            or return $e2->die_event;
 
     my $owning_lib = 
         ($copy->call_number->id == OILS_PRECAT_CALL_NUMBER) ? 
             $copy->circ_lib : $copy->call_number->owning_lib;
 
-    return $e->die_event unless $e->allowed('MARK_ITEM_MISSING_PIECES', $owning_lib);
+    return $e2->die_event unless $e2->allowed('MARK_ITEM_MISSING_PIECES', $owning_lib);
 
     #### grab the last circulation
-    my $circ = $e->search_action_circulation([
+    my $circ = $e2->search_action_circulation([
         {   target_copy => $copy->id}, 
         {   limit => 1, 
             order_by => {circ => "xact_start DESC"}
         }
     ])->[0];
 
-    if ($circ) {
-        if (! $circ->checkin_time) { # if circ active, attempt renew
-            my ($res) = $self->method_lookup('open-ils.circ.renew')->run($e->authtoken,{'copy_id'=>$circ->target_copy});
-            if (ref $res ne 'ARRAY') { $res = [ $res ]; }
-            if ( $res->[0]->{textcode} eq 'SUCCESS' ) {
-                $circ = $res->[0]->{payload}{'circ'};
-                $circ->target_copy( $copy->id );
-                $logger->info('open-ils.circ.mark_item_missing_pieces: successful renewal');
-            } else {
-                $logger->info('open-ils.circ.mark_item_missing_pieces: non-successful renewal');
-            }
-        } else {
+    if (!$circ) {
+        $logger->info('open-ils.circ.mark_item_missing_pieces: no previous checkout');
+        $e2->rollback;
+        return OpenILS::Event->new('ACTION_CIRCULATION_NOT_FOUND',{'copy'=>$copy});
+    }
 
-            my $co_params = {
-                'copy_id'=>$circ->target_copy,
-                'patron_id'=>$circ->usr,
-                'skip_deposit_fee'=>1,
-                'skip_rental_fee'=>1
-            };
+	my $holds = $e2->search_action_hold_request(
+		{ 
+			current_copy => $copy->id,
+			fulfillment_time => undef,
+			cancel_time => undef,
+		}
+	);
 
-            if ($U->ou_ancestor_setting_value($e->requestor->ws_ou, 'circ.block_renews_for_holds')) {
+    $logger->debug("resetting holds that target the marked copy");
+    OpenILS::Application::Circ::Holds->_reset_hold($e2->requestor, $_) for @$holds;
 
-                my ($hold, undef, $retarget) = $holdcode->find_nearest_permitted_hold(
-                    $e, $copy, $e->requestor, 1 );
+    
+	if (! $e2->commit) {
+        return $e2->die_event;
+    }
 
-                if ($hold) { # needed for hold? then due now
+	my $e = new_editor(authtoken=>$auth, xact =>1);
+	return $e->die_event unless $e->checkauth;
 
-                    $logger->info('open-ils.circ.mark_item_missing_pieces: item needed for hold, shortening due date');
-                    my $due_date = DateTime->now(time_zone => 'local');
-                    $co_params->{'due_date'} = cleanse_ISO8601( $due_date->strftime('%FT%T%z') );
-                } else {
-                    $logger->info('open-ils.circ.mark_item_missing_pieces: item not needed for hold');
-                }
-            }
+    if (! $circ->checkin_time) { # if circ active, attempt renew
+        my ($res) = $self->method_lookup('open-ils.circ.renew')->run($e->authtoken,{'copy_id'=>$circ->target_copy});
+        if (ref $res ne 'ARRAY') { $res = [ $res ]; }
+        if ( $res->[0]->{textcode} eq 'SUCCESS' ) {
+            $circ = $res->[0]->{payload}{'circ'};
+            $circ->target_copy( $copy->id );
+            $logger->info('open-ils.circ.mark_item_missing_pieces: successful renewal');
+        } else {
+            $logger->info('open-ils.circ.mark_item_missing_pieces: non-successful renewal');
+        }
+    } else {
+
+        my $co_params = {
+            'copy_id'=>$circ->target_copy,
+            'patron_id'=>$circ->usr,
+            'skip_deposit_fee'=>1,
+            'skip_rental_fee'=>1
+        };
+
+        if ($U->ou_ancestor_setting_value($e->requestor->ws_ou, 'circ.block_renews_for_holds')) {
+
+            my ($hold, undef, $retarget) = $holdcode->find_nearest_permitted_hold(
+                $e, $copy, $e->requestor, 1 );
 
-            my ($res) = $self->method_lookup('open-ils.circ.checkout.full.override')->run($e->authtoken,$co_params);
-            if (ref $res ne 'ARRAY') { $res = [ $res ]; }
-            if ( $res->[0]->{textcode} eq 'SUCCESS' ) {
-                $logger->info('open-ils.circ.mark_item_missing_pieces: successful checkout');
-                $circ = $res->[0]->{payload}{'circ'};
+            if ($hold) { # needed for hold? then due now
+
+                $logger->info('open-ils.circ.mark_item_missing_pieces: item needed for hold, shortening due date');
+                my $due_date = DateTime->now(time_zone => 'local');
+                $co_params->{'due_date'} = cleanse_ISO8601( $due_date->strftime('%FT%T%z') );
             } else {
-                $logger->info('open-ils.circ.mark_item_missing_pieces: non-successful checkout');
-                $e->rollback;
-                return $res;
+                $logger->info('open-ils.circ.mark_item_missing_pieces: item not needed for hold');
             }
         }
-    } else {
-        $logger->info('open-ils.circ.mark_item_missing_pieces: no previous checkout');
-        $e->rollback;
-        return OpenILS::Event->new('ACTION_CIRCULATION_NOT_FOUND',{'copy'=>$copy});
+
+        my ($res) = $self->method_lookup('open-ils.circ.checkout.full.override')->run($e->authtoken,$co_params);
+        if (ref $res ne 'ARRAY') { $res = [ $res ]; }
+        if ( $res->[0]->{textcode} eq 'SUCCESS' ) {
+            $logger->info('open-ils.circ.mark_item_missing_pieces: successful checkout');
+            $circ = $res->[0]->{payload}{'circ'};
+        } else {
+            $logger->info('open-ils.circ.mark_item_missing_pieces: non-successful checkout');
+            $e->rollback;
+            return $res;
+        }
     }
 
     ### Update the item status
@@ -1396,17 +1417,6 @@ sub mark_item_missing_pieces {
 
 	$e->update_asset_copy($copy) or return $e->die_event;
 
-	my $holds = $e->search_action_hold_request(
-		{ 
-			current_copy => $copy->id,
-			fulfillment_time => undef,
-			cancel_time => undef,
-		}
-	);
-
-    $logger->debug("resetting holds that target the marked copy");
-    OpenILS::Application::Circ::Holds->_reset_hold($e->requestor, $_) for @$holds;
-
 	if ($e->commit) {
 
         my $ses = OpenSRF::AppSession->create('open-ils.trigger');

commit 77a999bdcdc00f95b296c4d584b623db28fa3d31
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Wed Jun 22 14:04:40 2011 -0400

    retarget title holds after transfering to a new bib
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
index 1be6838..de3f75e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -3453,6 +3453,8 @@ sub change_hold_title {
 
     $e->commit;
 
+    _reset_hold($self, $e->requestor, $_) for @$holds;
+
     return 1;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 .../src/perlmods/lib/OpenILS/Application/Circ.pm   |  126 +++++++++++---------
 .../perlmods/lib/OpenILS/Application/Circ/Holds.pm |    2 +
 2 files changed, 70 insertions(+), 58 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list