Koha/C4/SIP/ILS/Transaction/Renew.pm
Kyle M Hall e96e1126b6 Bug 13315 - Add feedback for last item checked out to circulation.pl
It seems that many librarians find it disconcerting to have no feedback
with the new checkouts table. It seems that many of them wait for it to
fully load, check to verify the item was checked out, and only then
check out the next item.

To help alleviate this issue, we can have the checkouts page give
feedback about the item that was just checked out.

Test Plan:
1) Apply this patch
2) Check an item out
3) Note the message "$title ($barcode) due on $date_due"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

This works well and fixes a very problematic issue with the new AJAX
circ. I will be submitting a follow-up which I think is an improvement
to the display.

Signed-off-by: Jason Burds  <jburds@dubuque.lib.ia.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-13 14:52:26 -03:00

71 lines
1.8 KiB
Perl

#
# Status of a Renew Transaction
#
package C4::SIP::ILS::Transaction::Renew;
use warnings;
use strict;
use C4::Circulation;
use C4::Members;
use Koha::DateUtils;
use parent qw(C4::SIP::ILS::Transaction);
my %fields = (
renewal_ok => 0,
);
sub new {
my $class = shift;
my $self = $class->SUPER::new();
foreach my $element (keys %fields) {
$self->{_permitted}->{$element} = $fields{$element};
}
@{$self}{keys %fields} = values %fields; # overkill?
return bless $self, $class;
}
sub do_renew_for {
my $self = shift;
my $borrower = shift;
my ($renewokay,$renewerror) = CanBookBeRenewed($borrower->{borrowernumber},$self->{item}->{itemnumber});
if ($renewokay) { # ok so far check charges
my ($fee, undef) = GetIssuingCharges($self->{item}->{itemnumber}, $self->{patron}->{borrowernumber});
if ($fee > 0) {
$self->{sip_fee_type} = '06';
$self->{fee_amount} = sprintf '%.2f',$fee;
if ($self->{fee_ack} eq 'N') {
$renewokay = 0;
}
}
}
if ($renewokay){
$self->{due} = undef;
my $issue = AddIssue( $borrower, $self->{item}->id, undef, 0 );
my $due_date = dt_from_string( $issue->date_due() );
if ($due_date) {
$self->{due} = $due_date;
}
$self->renewal_ok(1);
} else {
$renewerror=~s/on_reserve/Item unavailable due to outstanding holds/;
$renewerror=~s/too_many/Item has reached maximum renewals/;
$self->screen_msg($renewerror);
$self->renewal_ok(0);
}
$self->ok(1);
return;
}
sub do_renew {
my $self = shift;
my $borrower = GetMember( cardnumber => $self->{patron}->id );
return $self->do_renew_for($borrower);
}
1;