added the ability to pass in a total-items-out number for async permit calls
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 10 Oct 2006 22:04:22 +0000 (22:04 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 10 Oct 2006 22:04:22 +0000 (22:04 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6436 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/ScriptBuilder.pm

index 330e071..7dcccc3 100644 (file)
@@ -341,6 +341,7 @@ my @AUTOLOAD_FIELDS = qw/
        force
        old_circ
        permit_override
+       pending_checkouts
 /;
 
 
@@ -455,6 +456,11 @@ sub mk_script_runner {
        $$args{fetch_patron_by_circ_copy} = 1;
        $$args{fetch_patron_circ_info} = 1 unless $self->is_checkin;
 
+       if( my $pco = $self->pending_checkouts ) {
+               $logger->info("circulator: we were given a pending checkouts number of $pco");
+               $$args{patronItemsOut} = $pco;
+       }
+
        # This fetches most of the objects we need
        $self->script_runner(
                OpenILS::Application::Circ::ScriptBuilder->build($args));
@@ -520,7 +526,6 @@ sub do_permit {
                        unless( $self->editor->allowed('VIEW_PERMIT_CHECKOUT') );
        }
 
-
        $self->check_captured_holds();
        $self->do_copy_checks();
        return if $self->bail_out;
@@ -855,14 +860,17 @@ sub do_checkout {
        $self->handle_checkout_holds();
        return if $self->bail_out;
 
+
    # ------------------------------------------------------------------------------
    # Update the patron penalty info in the DB
    # ------------------------------------------------------------------------------
-   $U->update_patron_penalties(
-      authtoken => $self->editor->authtoken,
-      patron    => $self->patron,
-      background  => 1,
-   );
+       if( $self->permit_override ) {
+               $U->update_patron_penalties(
+                       authtoken => $self->editor->authtoken,
+                       patron    => $self->patron,
+                       background  => 1,
+               );
+       }
 
        my $record = $U->record_to_mvr($self->title) unless $self->is_precat;
        $self->push_events(
index 09b2c17..ea7a2fc 100644 (file)
@@ -220,7 +220,11 @@ sub fetch_user_data {
                        OpenILS::Application::Actor::_checked_out(1, $e, $patron->id);
 
                $ctx->{patronOverdue} = $circ_counts->{overdue} || 0;
-               $ctx->{patronItemsOut} = $ctx->{patronOverdue} + $circ_counts->{out};
+               my $out = $ctx->{patronOverdue} + $circ_counts->{out};
+
+               $ctx->{patronItemsOut} = $out 
+                       unless( $ctx->{patronItemsOut} and $ctx->{patronItemsOut} > $out );
+
                $logger->debug("script_builder: patron overdue count is " . $ctx->{patronOverdue});
        }