renewals now do not call the penalty server since renewals should be allowed
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 Oct 2006 16:43:40 +0000 (16:43 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 Oct 2006 16:43:40 +0000 (16:43 +0000)
regardless of patron penalties.

the penalty server is now invoked on renewals at the end of checkout the
same way permit-override checkouts are.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@6441 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index a6b9655..a04d69c 100644 (file)
@@ -641,7 +641,7 @@ sub run_patron_permit_scripts {
        my $runner              = $self->script_runner;
        my $patronid    = $self->patron->id;
 
-       $self->send_penalty_request();
+       $self->send_penalty_request() unless $self->is_renewal;
 
        # ---------------------------------------------------------------------
        # Now run the patron permit script 
@@ -653,18 +653,15 @@ sub run_patron_permit_scripts {
        my $patron_events = $result->{events};
        my @allevents; 
 
-       my $penalties = $self->gather_penalty_request();
 
-       for my $p (@$penalties, @$patron_events) {
-
-               # this is policy directly in the code, not a good idea in general, but
-               # the penalty server doesn't know anything about renewals, so we
-               # have to strip the event out here
-               next if $self->is_renewal and $p eq 'PATRON_EXCEEDS_OVERDUE_COUNT';
+       # ---------------------------------------------------------------------
+       # this is policy directly in the code, not a good idea in general, but
+       # the penalty server doesn't know anything about renewals, so we
+       # have to strip the event out here
+       my $penalties = ($self->is_renewal) ? [] : $self->gather_penalty_request();
+       # ---------------------------------------------------------------------
 
-
-               push( @allevents, OpenILS::Event->new($p))
-       }
+       push( @allevents, OpenILS::Event->new($_)) for (@$penalties, @$patron_events);
 
        $logger->info("circulator: permit_patron script returned events: @allevents") if @allevents;
 
@@ -859,11 +856,12 @@ sub do_checkout {
        $self->handle_checkout_holds();
        return if $self->bail_out;
 
-
    # ------------------------------------------------------------------------------
-   # Update the patron penalty info in the DB
+   # Update the patron penalty info in the DB.  Run it for permit-overrides or
+       # renewals since both of those cases do not require the penalty server to
+       # run during the permit phase of the checkout
    # ------------------------------------------------------------------------------
-       if( $self->permit_override ) {
+       if( $self->permit_override or $self->is_renewal ) {
                $U->update_patron_penalties(
                        authtoken => $self->editor->authtoken,
                        patron    => $self->patron,