Lines 50-61
sub do_checkout {
Link Here
|
50 |
syslog('LOG_DEBUG', "ILS::Transaction::Checkout performing checkout..."); |
50 |
syslog('LOG_DEBUG', "ILS::Transaction::Checkout performing checkout..."); |
51 |
my $shelf = $self->{item}->hold_shelf; |
51 |
my $shelf = $self->{item}->hold_shelf; |
52 |
my $barcode = $self->{item}->id; |
52 |
my $barcode = $self->{item}->id; |
53 |
my $patron_barcode = $self->{patron}->id; |
53 |
my $patron = Koha::Patrons->find($self->{patron}->{borrowernumber}); |
54 |
my $overridden_duedate; # usually passed as undef to AddIssue |
54 |
my $overridden_duedate; # usually passed as undef to AddIssue |
55 |
$debug and warn "do_checkout: patron (" . $patron_barcode . ")"; |
55 |
$debug and warn "do_checkout borrower: . " . $patron->borrowernumber; |
56 |
my $patron = Koha::Patrons->find( { cardnumber => $patron_barcode } ); |
|
|
57 |
my $borrower = $patron->unblessed; |
58 |
$debug and warn "do_checkout borrower: . " . Dumper $borrower; |
59 |
my ($issuingimpossible, $needsconfirmation) = _can_we_issue($patron, $barcode, |
56 |
my ($issuingimpossible, $needsconfirmation) = _can_we_issue($patron, $barcode, |
60 |
C4::Context->preference("AllowItemsOnHoldCheckoutSIP") |
57 |
C4::Context->preference("AllowItemsOnHoldCheckoutSIP") |
61 |
); |
58 |
); |
Lines 73-79
sub do_checkout {
Link Here
|
73 |
if ($confirmation eq 'RENEW_ISSUE'){ |
70 |
if ($confirmation eq 'RENEW_ISSUE'){ |
74 |
$self->screen_msg("Item already checked out to you: renewing item."); |
71 |
$self->screen_msg("Item already checked out to you: renewing item."); |
75 |
} elsif ($confirmation eq 'RESERVED' or $confirmation eq 'RESERVE_WAITING') { |
72 |
} elsif ($confirmation eq 'RESERVED' or $confirmation eq 'RESERVE_WAITING') { |
76 |
my $x = $self->{item}->available($patron_barcode); |
73 |
my $x = $self->{item}->available($patron->borrowernumber); |
77 |
if ($x) { |
74 |
if ($x) { |
78 |
$self->screen_msg("Item was reserved for you."); |
75 |
$self->screen_msg("Item was reserved for you."); |
79 |
} else { |
76 |
} else { |
Lines 110-124
sub do_checkout {
Link Here
|
110 |
} |
107 |
} |
111 |
my $itemnumber = $self->{item}->{itemnumber}; |
108 |
my $itemnumber = $self->{item}->{itemnumber}; |
112 |
foreach (@$shelf) { |
109 |
foreach (@$shelf) { |
113 |
$debug and warn "shelf has ($_->{itemnumber} for $_->{borrowernumber}). this is ($itemnumber, $self->{patron}->{borrowernumber})"; |
110 |
$debug and warn sprintf( "shelf has (%s for %s). this is (%is, %s)", $_->{itemnumber}, $_->{borrowernumber}, $itemnumber, $patron->borrowernumber ); |
114 |
($_->{itemnumber} eq $itemnumber) or next; # skip it if not this item |
111 |
($_->{itemnumber} eq $itemnumber) or next; # skip it if not this item |
115 |
($_->{borrowernumber} == $self->{patron}->{borrowernumber}) and last; |
112 |
($_->{borrowernumber} == $patron->borrowernumber) and last; |
116 |
# if item was waiting for this patron, we're done. AddIssue takes care of the "W" hold. |
113 |
# if item was waiting for this patron, we're done. AddIssue takes care of the "W" hold. |
117 |
$debug and warn "Item is on hold shelf for another patron."; |
114 |
$debug and warn "Item is on hold shelf for another patron."; |
118 |
$self->screen_msg("Item is on hold shelf for another patron."); |
115 |
$self->screen_msg("Item is on hold shelf for another patron."); |
119 |
$noerror = 0; |
116 |
$noerror = 0; |
120 |
} |
117 |
} |
121 |
my ($fee, undef) = GetIssuingCharges($itemnumber, $self->{patron}->{borrowernumber}); |
118 |
my ($fee, undef) = GetIssuingCharges($itemnumber, $patron->borrowernumber); |
122 |
if ( $fee > 0 ) { |
119 |
if ( $fee > 0 ) { |
123 |
$self->{sip_fee_type} = '06'; |
120 |
$self->{sip_fee_type} = '06'; |
124 |
$self->{fee_amount} = sprintf '%.2f', $fee; |
121 |
$self->{fee_amount} = sprintf '%.2f', $fee; |
Lines 132-141
sub do_checkout {
Link Here
|
132 |
return $self; |
129 |
return $self; |
133 |
} |
130 |
} |
134 |
# can issue |
131 |
# can issue |
135 |
$debug and warn "do_checkout: calling AddIssue(\$borrower,$barcode, $overridden_duedate, 0)\n" |
132 |
$debug and warn sprintf("do_checkout: calling AddIssue(%s, %s, %s, 0)\n", $patron->borrowernumber, $barcode, $overridden_duedate) |
136 |
# . "w/ \$borrower: " . Dumper($borrower) |
|
|
137 |
. "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv); |
133 |
. "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv); |
138 |
my $issue = AddIssue( $borrower, $barcode, $overridden_duedate, 0 ); |
134 |
my $issue = AddIssue( $patron->unblessed, $barcode, $overridden_duedate, 0 ); |
139 |
$self->{due} = $self->duedatefromissue($issue, $itemnumber); |
135 |
$self->{due} = $self->duedatefromissue($issue, $itemnumber); |
140 |
|
136 |
|
141 |
$self->ok(1); |
137 |
$self->ok(1); |