adding
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 4 Sep 2006 15:07:48 +0000 (15:07 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 4 Sep 2006 15:07:48 +0000 (15:07 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5917 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Renew.pm [new file with mode: 0644]

diff --git a/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Renew.pm b/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Renew.pm
new file mode 100644 (file)
index 0000000..1dfb350
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Status of a Renew Transaction
+#
+
+package OpenILS::SIP::Transaction::Renew;
+use warnings; use strict;
+
+use Sys::Syslog qw(syslog);
+use OpenILS::SIP;
+use OpenILS::SIP::Transaction;
+use OpenILS::Application::AppUtils;
+my $U = 'OpenILS::Application::AppUtils';
+
+our @ISA = qw(OpenILS::SIP::Transaction);
+
+my %fields = (
+             renewal_ok => 0,
+             );
+
+sub new {
+       my $class = shift;;
+       my $self = $class->SUPER::new(@_);
+
+       $self->{_permitted}->{$_} = $fields{$_} for keys %fields;
+       @{$self}{keys %fields} = values %fields;
+
+       return bless $self, $class;
+}
+
+sub do_renew {
+       my $self = shift;
+
+       my $resp = $U->simplereq(
+               'open-ils.circ',
+               'open-ils.circ.renew', $self->{authtoken},
+               { barcode => $self->item->id, patron_barcode => $self->patron->id });
+
+       if( my $code = $U->event_code($resp) ) {
+               my $txt = $resp->{textcode};
+               syslog('LOG_INFO', "OILS: Renewal failed with event $code : $txt");
+               $self->renewal_ok(0);
+               $self->ok(0);
+               return 0;
+       }
+
+       $self->item->{due_date} = $resp->{payload}->{circ}->due_date;
+       syslog('LOG_INFO', "OILS: Renewal succeeded with due_date = " . $self->item->{due_date});
+
+       $self->renewal_ok(1);
+       $self->ok(1);
+
+       return $self;
+}
+
+
+
+
+1;