Fix handling of the "renewal ok" status field in the ILS
authordjfiander <djfiander>
Fri, 19 May 2006 02:30:21 +0000 (02:30 +0000)
committerdjfiander <djfiander>
Fri, 19 May 2006 02:30:21 +0000 (02:30 +0000)
ILS.pm
ILS/Transaction/Checkout.pm

diff --git a/ILS.pm b/ILS.pm
index 8138b89..2ee1ded 100644 (file)
--- a/ILS.pm
+++ b/ILS.pm
@@ -93,6 +93,9 @@ sub checkout {
     $circ->ok($circ->patron && $circ->item);
 
     if ($circ->ok) {
+       # If the item is already associated with this patron, then
+       # we're renewing it.
+       $circ->renew_ok($item->{patron} eq $patron_id);
        $item->{patron} = $patron_id;
        $item->{due_date} = time + (14*24*60*60); # two weeks
        push(@{$patron->{items}}, $item_id);
index d46aa30..d445df7 100644 (file)
@@ -18,6 +18,7 @@ our @ISA = qw(ILS::Transaction);
 my %fields = (
              security_inhibit => 0,
              due              => undef,
+             renew_ok         => 0,
              );
 
 sub new {
@@ -35,12 +36,4 @@ sub new {
     return bless $self, $class;
 }
 
-sub renew_ok {
-    my $self = shift;
-    my $patron = $self->{patron};
-    my $item = $self->{item};
-
-    return ($item->{patron} eq $patron->{id});
-}
-
 1;