2 # An object to handle checkout status
5 package ILS::Transaction::Checkout;
10 use POSIX qw(strftime);
11 use Sys::Syslog qw(syslog);
19 our @ISA = qw(ILS::Transaction);
21 # Most fields are handled by the Transaction superclass
23 security_inhibit => 0,
30 my $self = $class->SUPER::new();
33 foreach $element (keys %fields) {
34 $self->{_permitted}->{$element} = $fields{$element};
37 @{$self}{keys %fields} = values %fields;
39 # $self->{'due'} = time() + (60*60*24*14); # two weeks hence
42 return bless $self, $class;
47 syslog('LOG_DEBUG', "ILS::Transaction::Checkout performing checkout...");
48 my $barcode = $self->{item}->id;
49 my $patron_barcode = $self->{patron}->id;
51 my $borrower = GetMember( $patron_barcode, 'cardnumber' );
53 # warn Dumper $borrower;
54 my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued ( $borrower, $barcode );
56 foreach my $impossible ( keys %$issuingimpossible ) {
57 # do something here so we pass these errors
58 $self->screen_msg($issuingimpossible->{$impossible});
61 foreach my $confirmation ( keys %$needsconfirmation ) {
62 if ($confirmation eq 'RENEW_ISSUE'){
63 if (!CanBookBeRenewed($borrower->{borrowernumber},$self->{item}->{itemnumber})){
65 warn "cant renew $borrower->{borrowernumber} $self->{item}->{itemnumber}";
69 $self->screen_msg($needsconfirmation->{$confirmation});
78 my $datedue = AddIssue( $borrower, $barcode, undef, 0 );
79 $self->{'due'} = $datedue;
85 warn Dumper $issuingimpossible;
86 warn Dumper $needsconfirmation;