You can return items now BUT we need to get the branch to do this properly
authorChris Cormack <crc@liblime.com>
Mon, 5 Nov 2007 23:14:06 +0000 (17:14 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 6 Nov 2007 12:33:11 +0000 (06:33 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/SIP/ILS.pm
C4/SIP/ILS/Transaction/Checkin.pm

index 3902c9b..479b27e 100644 (file)
@@ -135,7 +135,6 @@ sub checkout {
     my ($patron, $item, $circ);
 
     $circ = new ILS::Transaction::Checkout;
-warn "checking out";
     # BEGIN TRANSACTION
     $circ->patron($patron = new ILS::Patron $patron_id);
     $circ->item($item = new ILS::Item $item_id);
@@ -160,9 +159,9 @@ warn "checking out";
                        $circ->renew_ok($item->{patron} && ($item->{patron} eq $patron_id));
                
                        $item->{patron} = $patron_id;
-               $item->{due_date} = time + (14*24*60*60); # two weeks
-#                      $item->{due_date} = $circ->{due};
-                       warn "$item->{due_date}";
+#              $item->{due_date} = time + (14*24*60*60); # two weeks
+                       $item->{due_date} = $circ->{due};
+#                      warn "$item->{due_date}";
                        push(@{$patron->{items}}, $item_id);
                        $circ->desensitize(!$item->magnetic);
 
@@ -191,12 +190,13 @@ sub checkin {
 
     # It's ok to check it in if it exists, and if it was checked out
     $circ->ok($item && $item->{patron});
-
+    $circ->do_checkin();    
     if ($circ->ok) {
-       $circ->patron($patron = new ILS::Patron $item->{patron});
-       delete $item->{patron};
-       delete $item->{due_date};
-       $patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
+               $circ->patron($patron = new ILS::Patron $item->{patron});
+               delete $item->{patron};
+               delete $item->{due_date};
+               $patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
+               
     }
     # END TRANSACTION
 
index 3f231d8..6b461d2 100644 (file)
@@ -12,6 +12,8 @@ use POSIX qw(strftime);
 use ILS;
 use ILS::Transaction;
 
+use C4::Circulation;
+
 our @ISA = qw(ILS::Transaction);
 
 my %fields = (
@@ -33,6 +35,16 @@ sub new {
     return bless $self, $class;
 }
 
+sub do_checkin {
+       my $self = shift;
+       my $barcode = $self->{item}->{id};
+       my $branch='ALB'; # gotta set this
+       my $return = AddReturn($barcode,$branch);
+       $self->ok($return);
+       return $self;
+}
+
+
 sub resensitize {
     my $self = shift;