ef6b767117
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
51 lines
946 B
Perl
51 lines
946 B
Perl
#
|
|
# Status of a Renew Transaction
|
|
#
|
|
|
|
package ILS::Transaction::Renew;
|
|
|
|
use warnings;
|
|
use strict;
|
|
|
|
use ILS;
|
|
use ILS::Transaction;
|
|
|
|
use C4::Circulation;
|
|
use C4::Members;
|
|
|
|
our @ISA = qw(ILS::Transaction);
|
|
|
|
my %fields = (
|
|
renewal_ok => 0,
|
|
);
|
|
|
|
sub new {
|
|
my $class = shift;;
|
|
my $self = $class->SUPER::new();
|
|
my $element;
|
|
|
|
foreach $element (keys %fields) {
|
|
$self->{_permitted}->{$element} = $fields{$element};
|
|
}
|
|
|
|
@{$self}{keys %fields} = values %fields;
|
|
|
|
return bless $self, $class;
|
|
}
|
|
|
|
sub do_renew {
|
|
my $self = shift;
|
|
my $borrower = my $borrower = GetMember( $self->{patron}->id, 'cardnumber');
|
|
my ($renewokay,$renewerror) = CanBookBeRenewed($borrower->{borrowernumber},$self->{item}->{itemnumber});
|
|
if ($renewokay){
|
|
my $datedue = AddIssue( $borrower, $self->{item}->id, undef, 0 );
|
|
$self->{'due'} = $datedue;
|
|
$self->ok(1);
|
|
$self->renewal_ok(1);
|
|
}
|
|
else {
|
|
$self->ok(0);
|
|
}
|
|
return $self;
|
|
}
|
|
1;
|