From 117f261571d7b4a72bc26fab3534f16a7f0a3404 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 5 Nov 2007 17:14:06 -0600 Subject: [PATCH] You can return items now BUT we need to get the branch to do this properly Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/SIP/ILS.pm | 18 +++++++++--------- C4/SIP/ILS/Transaction/Checkin.pm | 12 ++++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 3902c9b3de..479b27e9af 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -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 diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index 3f231d81c0..6b461d2077 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -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; -- 2.39.5