use OpenILS::SIP::Transaction::Checkout;
use OpenILS::SIP::Transaction::Checkin;
use OpenILS::SIP::Transaction::Renew;
+use OpenILS::SIP::Transaction::RenewAll;
use OpenILS::SIP::Transaction::FeePayment;
use OpenSRF::System;
}
+sub renew_all {
+ my ($self, $patron_id, $patron_pwd, $fee_ack) = @_;
+ $self->verify_session;
+
+ my $trans = OpenILS::SIP::Transaction::RenewAll->new(authtoken => $self->{authtoken});
+ $trans->patron($self->find_patron($patron_id));
+
+ if(!$trans->patron) {
+ $trans->screen_msg("Invalid patron barcode.");
+ $trans->ok(0);
+ return $trans;
+ }
+
+ if(!$trans->patron->renew_ok) {
+ $trans->screen_msg("Renewals not allowed.");
+ $trans->ok(0);
+ return $trans;
+ }
+
+ $trans->do_renew_all($self);
+ return $trans;
+}
#
$e->retrieve_asset_copy($circ->target_copy) );
}
+# force_bc -- return barcode data regardless of msg64_summary_datatype
sub charged_items {
- my ($self, $start, $end) = shift;
+ my ($self, $start, $end, $force_bc) = shift;
$self->__patron_items_info();
for my $circid (@charges) {
next unless $circid;
- if($return_datatype eq 'barcode') {
+ if($return_datatype eq 'barcode' or $force_bc) {
push( @c, __circ_to_barcode($self->{editor}, $circid));
} else {
push( @c, OpenILS::SIP::clean_text(__circ_to_title($self->{editor}, $circid)));
--- /dev/null
+package OpenILS::SIP::Transaction::RenewAll;
+use warnings; use strict;
+
+use Sys::Syslog qw(syslog);
+use OpenILS::SIP;
+use OpenILS::SIP::Transaction;
+use OpenILS::SIP::Transaction::Renew;
+use OpenILS::Application::AppUtils;
+my $U = 'OpenILS::Application::AppUtils';
+
+our @ISA = qw(OpenILS::SIP::Transaction);
+
+my %fields = (
+ renewed => [],
+ unrenewed => []
+);
+
+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_all {
+ my $self = shift;
+ my $sip = shift;
+
+ my $barcodes = $self->patron->charged_items(undef, undef, 1);
+
+ syslog('LOG_INFO', "OILS: RenewalAll for user ".
+ $self->patron->{id} ." and items [@$barcodes]");
+
+ for my $barcode (@$barcodes) {
+ my $item = $sip->find_item($barcode);
+
+ if ($item and $item->{patron} and $item->{patron} eq $self->patron->{id}) {
+
+ my $renew = OpenILS::SIP::Transaction::Renew->new(authtoken => $self->{authtoken});
+ $renew->patron($self->patron);
+ $renew->item($item);
+ $renew->do_renew; # renew this single item
+
+ if ($renew->renewal_ok) {
+ push(@{$self->renewed}, $barcode);
+
+ } else {
+ push(@{$self->unrenewed}, $barcode);
+ }
+
+ } else {
+ syslog('LOG_INFO', "OILS: RenewalAll item " . $item->{id} .
+ " is not checked out to user " . $self->patron->{id} .
+ ". It's checked out to user " . $item->{patron});
+
+ push(@{$self->unrenewed}, $barcode);
+ }
+ }
+
+ syslog('LOG_INFO', "OILS: RenewalAll ".
+ "ok=[@{$self->renewed}]; not-ok=[@{$self->unrenewed}]");
+
+ $self->ok(1);
+ return $self;
+}
+