From: erickson Date: Mon, 4 Sep 2006 15:07:48 +0000 (+0000) Subject: adding X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c2ea41398f12ef27f2d9cbe82a54429efbe7ca25;p=Evergreen.git adding git-svn-id: svn://svn.open-ils.org/ILS/trunk@5917 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- 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 index 0000000000..1dfb35071a --- /dev/null +++ b/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Renew.pm @@ -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;