View | Details | Raw Unified | Return to bug 15438
Collapse All | Expand All

(-)a/C4/Circulation.pm (-1 / +7 lines)
Lines 564-570 sub TooMany { Link Here
564
564
565
=head2 CanBookBeIssued
565
=head2 CanBookBeIssued
566
566
567
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
567
  ( $issuingimpossible, $needsconfirmation, [ $alerts ] ) =  CanBookBeIssued( $borrower,
568
                      $barcode, $duedate, $inprocess, $ignore_reserves, $params );
568
                      $barcode, $duedate, $inprocess, $ignore_reserves, $params );
569
569
570
Check if a book can be issued.
570
Check if a book can be issued.
Lines 661-666 sticky due date is invalid or due date in the past Link Here
661
661
662
if the borrower borrows to much things
662
if the borrower borrows to much things
663
663
664
=head3 NB
665
666
The assumption by users of the routine is that causes blocking
667
the issue are keyed by uppercase labels and other returned
668
data is keyed in lower case
669
664
=cut
670
=cut
665
671
666
sub CanBookBeIssued {
672
sub CanBookBeIssued {
(-)a/C4/SIP/ILS/Transaction/Checkout.pm (-12 / +30 lines)
Lines 56-74 sub do_checkout { Link Here
56
	$debug and warn "do_checkout: patron (" . $patron_barcode . ")";
56
	$debug and warn "do_checkout: patron (" . $patron_barcode . ")";
57
	my $borrower = $self->{patron}->getmemberdetails_object();
57
	my $borrower = $self->{patron}->getmemberdetails_object();
58
	$debug and warn "do_checkout borrower: . " . Dumper $borrower;
58
	$debug and warn "do_checkout borrower: . " . Dumper $borrower;
59
	my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued(
59
    my ($issuingimpossible, $needsconfirmation) = _can_we_issue($borrower, $barcode,
60
        $borrower,
61
        $barcode,
62
        undef,
63
        0,
64
        C4::Context->preference("AllowItemsOnHoldCheckout")
60
        C4::Context->preference("AllowItemsOnHoldCheckout")
65
    );
61
    );
66
	my $noerror=1;
62
67
    if (scalar keys %$issuingimpossible) {
63
	my $noerror=1;  # If set to zero we block the issue
68
        foreach (keys %$issuingimpossible) {
64
    if (keys %{$issuingimpossible}) {
65
        foreach (keys %{$issuingimpossible}) {
69
            # do something here so we pass these errors
66
            # do something here so we pass these errors
70
            $self->screen_msg($_ . ': ' . $issuingimpossible->{$_});
67
            $self->screen_msg("Issue failed : $_");
71
            $noerror = 0;
68
            $noerror = 0;
69
            last;
72
        }
70
        }
73
    } else {
71
    } else {
74
        foreach my $confirmation (keys %{$needsconfirmation}) {
72
        foreach my $confirmation (keys %{$needsconfirmation}) {
Lines 80-104 sub do_checkout { Link Here
80
                    $self->screen_msg("Item was reserved for you.");
78
                    $self->screen_msg("Item was reserved for you.");
81
                } else {
79
                } else {
82
                    $self->screen_msg("Item is reserved for another patron upon return.");
80
                    $self->screen_msg("Item is reserved for another patron upon return.");
83
                    # $noerror = 0;
84
                }
81
                }
85
            } elsif ($confirmation eq 'ISSUED_TO_ANOTHER') {
82
            } elsif ($confirmation eq 'ISSUED_TO_ANOTHER') {
86
                $self->screen_msg("Item already checked out to another patron.  Please return item for check-in.");
83
                $self->screen_msg("Item already checked out to another patron.  Please return item for check-in.");
87
                $noerror = 0;
84
                $noerror = 0;
85
                last;
88
            } elsif ($confirmation eq 'DEBT') {
86
            } elsif ($confirmation eq 'DEBT') {
89
                $self->screen_msg('Outstanding Fines block issue');
87
                $self->screen_msg('Outstanding Fines block issue');
90
                $noerror = 0;
88
                $noerror = 0;
89
                last;
91
            } elsif ($confirmation eq 'HIGHHOLDS') {
90
            } elsif ($confirmation eq 'HIGHHOLDS') {
92
                $overridden_duedate = $needsconfirmation->{$confirmation}->{returndate};
91
                $overridden_duedate = $needsconfirmation->{$confirmation}->{returndate};
93
                $self->screen_msg('Loan period reduced for high-demand item');
92
                $self->screen_msg('Loan period reduced for high-demand item');
94
            } elsif ($confirmation eq 'RENTALCHARGE') {
93
            } elsif ($confirmation eq 'RENTALCHARGE') {
95
                if ($self->{fee_ack} ne 'Y') {
94
                if ($self->{fee_ack} ne 'Y') {
96
                    $noerror = 0;
95
                    $noerror = 0;
96
                    last;
97
                }
97
                }
98
            } else {
98
            } else {
99
                $self->screen_msg($needsconfirmation->{$confirmation});
99
                # We've been returned a case other than those above
100
                $self->screen_msg("Item cannot be issued: $confirmation");
100
                $noerror = 0;
101
                $noerror = 0;
101
                syslog('LOG_DEBUG', "Blocking checkout Reason:$confirmation");
102
                syslog('LOG_DEBUG', "Blocking checkout Reason:$confirmation");
103
                last;
102
            }
104
            }
103
        }
105
        }
104
    }
106
    }
Lines 145-149 sub do_checkout { Link Here
145
	return $self;
147
	return $self;
146
}
148
}
147
149
150
sub _can_we_issue {
151
    my ( $borrower, $barcode, $pref ) = @_;
152
153
    my ( $issuingimpossible, $needsconfirmation, $alerts ) =
154
      CanBookBeIssued( $borrower, $barcode, undef, 0, $pref );
155
    for my $href ( $issuingimpossible, $needsconfirmation ) {
156
157
        # some data is returned using lc keys we only
158
        foreach my $key ( keys %{$href} ) {
159
            if ( $key =~ m/[^A-Z_]/ ) {
160
                delete $href->{$key};
161
            }
162
        }
163
    }
164
    return ( $issuingimpossible, $needsconfirmation );
165
}
166
148
1;
167
1;
149
__END__
168
__END__
150
- 

Return to bug 15438