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

(-)a/C4/Circulation.pm (-1 / +7 lines)
Lines 565-571 sub TooMany { Link Here
565
565
566
=head2 CanBookBeIssued
566
=head2 CanBookBeIssued
567
567
568
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
568
  ( $issuingimpossible, $needsconfirmation, [ $alerts ] ) =  CanBookBeIssued( $borrower,
569
                      $barcode, $duedate, $inprocess, $ignore_reserves, $params );
569
                      $barcode, $duedate, $inprocess, $ignore_reserves, $params );
570
570
571
Check if a book can be issued.
571
Check if a book can be issued.
Lines 662-667 sticky due date is invalid or due date in the past Link Here
662
662
663
if the borrower borrows to much things
663
if the borrower borrows to much things
664
664
665
=head3 NB
666
667
The assumption by users of the routine is that causes blocking
668
the issue are keyed by uppercase labels and other returned
669
data is keyed in lower case
670
665
=cut
671
=cut
666
672
667
sub CanBookBeIssued {
673
sub CanBookBeIssued {
(-)a/C4/SIP/ILS/Transaction/Checkout.pm (-12 / +31 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;
81
                    $noerror = 0;
84
                }
82
                }
85
            } elsif ($confirmation eq 'ISSUED_TO_ANOTHER') {
83
            } elsif ($confirmation eq 'ISSUED_TO_ANOTHER') {
86
                $self->screen_msg("Item already checked out to another patron.  Please return item for check-in.");
84
                $self->screen_msg("Item already checked out to another patron.  Please return item for check-in.");
87
                $noerror = 0;
85
                $noerror = 0;
86
                last;
88
            } elsif ($confirmation eq 'DEBT') {
87
            } elsif ($confirmation eq 'DEBT') {
89
                $self->screen_msg('Outstanding Fines block issue');
88
                $self->screen_msg('Outstanding Fines block issue');
90
                $noerror = 0;
89
                $noerror = 0;
90
                last;
91
            } elsif ($confirmation eq 'HIGHHOLDS') {
91
            } elsif ($confirmation eq 'HIGHHOLDS') {
92
                $overridden_duedate = $needsconfirmation->{$confirmation}->{returndate};
92
                $overridden_duedate = $needsconfirmation->{$confirmation}->{returndate};
93
                $self->screen_msg('Loan period reduced for high-demand item');
93
                $self->screen_msg('Loan period reduced for high-demand item');
94
            } elsif ($confirmation eq 'RENTALCHARGE') {
94
            } elsif ($confirmation eq 'RENTALCHARGE') {
95
                if ($self->{fee_ack} ne 'Y') {
95
                if ($self->{fee_ack} ne 'Y') {
96
                    $noerror = 0;
96
                    $noerror = 0;
97
                    last;
97
                }
98
                }
98
            } else {
99
            } else {
99
                $self->screen_msg($needsconfirmation->{$confirmation});
100
                # We've been returned a case other than those above
101
                $self->screen_msg("Item cannot be issued: $confirmation");
100
                $noerror = 0;
102
                $noerror = 0;
101
                syslog('LOG_DEBUG', "Blocking checkout Reason:$confirmation");
103
                syslog('LOG_DEBUG', "Blocking checkout Reason:$confirmation");
104
                last;
102
            }
105
            }
103
        }
106
        }
104
    }
107
    }
Lines 145-149 sub do_checkout { Link Here
145
	return $self;
148
	return $self;
146
}
149
}
147
150
151
sub _can_we_issue {
152
    my ( $borrower, $barcode, $pref ) = @_;
153
154
    my ( $issuingimpossible, $needsconfirmation, $alerts ) =
155
      CanBookBeIssued( $borrower, $barcode, undef, 0, $pref );
156
    for my $href ( $issuingimpossible, $needsconfirmation ) {
157
158
        # some data is returned using lc keys we only
159
        foreach my $key ( keys %{$href} ) {
160
            if ( $key =~ m/[^A-Z_]/ ) {
161
                delete $href->{$key};
162
            }
163
        }
164
    }
165
    return ( $issuingimpossible, $needsconfirmation );
166
}
167
148
1;
168
1;
149
__END__
169
__END__
150
- 

Return to bug 15438