Bug 13697: DBRev 3.21.00.20
[koha.git] / C4 / SIP / ILS / Transaction.pm
blob4e74e937880635aaa61fdbc7066aa1dd13e2fa5f
2 # Transaction: Superclass of all the transactional status objects
5 package C4::SIP::ILS::Transaction;
7 use Carp;
8 use strict;
9 use warnings;
10 use C4::Context;
12 my %fields = (
13 ok => 0,
14 patron => undef,
15 item => undef,
16 desensitize => 0,
17 alert => '',
18 transaction_id=> undef,
19 sip_fee_type => '01', # Other/Unknown
20 fee_amount => undef,
21 sip_currency => 'USD', # FIXME: why hardcoded?
22 screen_msg => '',
23 print_line => '',
24 fee_ack => 'N',
27 our $AUTOLOAD;
29 sub new {
30 my $class = shift;
31 my $self = {
32 _permitted => \%fields,
33 %fields,
35 return bless $self, $class;
38 sub DESTROY {
39 # be cool
42 sub AUTOLOAD {
43 my $self = shift;
44 my $class = ref($self) or croak "$self is not an object";
45 my $name = $AUTOLOAD;
47 $name =~ s/.*://;
49 unless (exists $self->{_permitted}->{$name}) {
50 croak "Can't access '$name' field of class '$class'";
53 if (@_) {
54 return $self->{$name} = shift;
55 } else {
56 return $self->{$name};
61 __END__