b4967bf0ed
Return from AddIssue used to be due date or undef. Now it is less straightforward returning am issue object if an issue row is created or undef. If the issue is a renewal undef is returned. As that case was not handled properly it caused the server site to crash the listener causing a communications error on the client. Signed-off-by: Frederic Demians <f.demians@tamil.fr> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
82 lines
1.5 KiB
Perl
82 lines
1.5 KiB
Perl
#
|
|
# Transaction: Superclass of all the transactional status objects
|
|
#
|
|
|
|
package C4::SIP::ILS::Transaction;
|
|
|
|
use Carp;
|
|
use strict;
|
|
use warnings;
|
|
use C4::Context;
|
|
use C4::Circulation qw( GetItemIssue );
|
|
use Koha::DateUtils;
|
|
|
|
my %fields = (
|
|
ok => 0,
|
|
patron => undef,
|
|
item => undef,
|
|
desensitize => 0,
|
|
alert => '',
|
|
transaction_id=> undef,
|
|
sip_fee_type => '01', # Other/Unknown
|
|
fee_amount => undef,
|
|
sip_currency => 'USD', # FIXME: why hardcoded?
|
|
screen_msg => '',
|
|
print_line => '',
|
|
fee_ack => 'N',
|
|
);
|
|
|
|
our $AUTOLOAD;
|
|
|
|
sub new {
|
|
my $class = shift;
|
|
my $self = {
|
|
_permitted => \%fields,
|
|
%fields,
|
|
};
|
|
return bless $self, $class;
|
|
}
|
|
|
|
sub duedatefromissue {
|
|
my ($self, $iss, $itemnum) = @_;
|
|
my $due_dt;
|
|
if (defined $iss ) {
|
|
$due_dt = dt_from_string( $iss->date_due() );
|
|
} # renew from AddIssue ??
|
|
else {
|
|
# need to reread the issue to get due date
|
|
$iss = GetItemIssue($itemnum);
|
|
if ($iss && $iss->{date_due} ) {
|
|
$due_dt = dt_from_string( $iss->{date_due} );
|
|
}
|
|
}
|
|
return $due_dt;
|
|
}
|
|
|
|
|
|
|
|
sub DESTROY {
|
|
# be cool
|
|
}
|
|
|
|
sub AUTOLOAD {
|
|
my $self = shift;
|
|
my $class = ref($self) or croak "$self is not an object";
|
|
my $name = $AUTOLOAD;
|
|
|
|
$name =~ s/.*://;
|
|
|
|
unless (exists $self->{_permitted}->{$name}) {
|
|
croak "Can't access '$name' field of class '$class'";
|
|
}
|
|
|
|
if (@_) {
|
|
return $self->{$name} = shift;
|
|
} else {
|
|
return $self->{$name};
|
|
}
|
|
}
|
|
|
|
1;
|
|
__END__
|
|
|