From f9de877eab592052648160774c160a83e47eb288 Mon Sep 17 00:00:00 2001 From: djfiander Date: Tue, 21 Mar 2006 00:29:43 +0000 Subject: [PATCH] Checkout transaction stub module. Derived from the Transaction superclass. --- ILS/Transaction/Checkout.pm | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 ILS/Transaction/Checkout.pm diff --git a/ILS/Transaction/Checkout.pm b/ILS/Transaction/Checkout.pm new file mode 100644 index 0000000..58c1a74 --- /dev/null +++ b/ILS/Transaction/Checkout.pm @@ -0,0 +1,47 @@ +# +# An object to handle checkout status +# + +package ILS::Transaction::Checkout; + +use Exporter; +use warnings; +use strict; + +use POSIX qw(strftime); + +use ILS; +use ILS::Transaction; + +our @ISA = qw(Exporter ILS::Transaction); + +# Most fields are handled by the Transaction superclass + +sub new { + my ($class, $obj) = @_; + my $type = ref($class) || $class; + + $obj = {}; + + $obj->{'due'} = time() + (60*60*24*14); # two weeks hence + + return bless $obj, $type; +} + +sub security_inhibit { + return 0; +} + +sub due_date { + my $self = shift; + return(strftime("%F %H:%M:%S", localtime($self->{due}))); +} + +sub renew_ok { + my $self = shift; + my $patron = $self->{patron}; + my $item = $self->{item}; + + return ($item->{patron} eq $patron->{id}); +} +1; -- 2.11.0