[open-ils-commits] [GIT] Evergreen ILS branch master updated. 9eb947d7266e01c3eb9c42ef001bb76b2c85282e
Evergreen Git
git at git.evergreen-ils.org
Fri Jun 7 12:27:29 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 9eb947d7266e01c3eb9c42ef001bb76b2c85282e (commit)
via 2c964ef481c4613a187268ec8b5800a2dac889dd (commit)
from 3a0dd23027cf94d0149ae637eef765f736205f75 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9eb947d7266e01c3eb9c42ef001bb76b2c85282e
Author: Bill Erickson <berick at esilibrary.com>
Date: Mon Jan 7 09:35:55 2013 -0500
SIP renew-all; reset renewal statuses
Reset the list of renewed and unrenewed items for each instance of the
RenewAll transactions. Otherwise, items from previous transactions will
bleed into the current transaction.
While we're in there, fix a couple of tabs.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/RenewAll.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/RenewAll.pm
index 663be7d..675d6ad 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/RenewAll.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/RenewAll.pm
@@ -16,13 +16,15 @@ my %fields = (
);
sub new {
- my $class = shift;;
- my $self = $class->SUPER::new(@_);
+ my $class = shift;;
+ my $self = $class->SUPER::new(@_);
- $self->{_permitted}->{$_} = $fields{$_} for keys %fields;
- @{$self}{keys %fields} = values %fields;
+ $self->{_permitted}->{$_} = $fields{$_} for keys %fields;
+ @{$self}{keys %fields} = values %fields;
+ $self->renewed([]);
+ $self->unrenewed([]);
- return bless $self, $class;
+ return bless $self, $class;
}
sub do_renew_all {
commit 2c964ef481c4613a187268ec8b5800a2dac889dd
Author: Bill Erickson <berick at esilibrary.com>
Date: Mon Nov 26 14:51:27 2012 -0500
SIP RenewAll
Adds SIP plugin support for SIP message types 65/66 (Renew All). When
requested, the plugin performs a renewal on all items currently checked
out for the user.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/examples/oils_sip.xml.example b/Open-ILS/examples/oils_sip.xml.example
index d6c5d88..c986ca1 100644
--- a/Open-ILS/examples/oils_sip.xml.example
+++ b/Open-ILS/examples/oils_sip.xml.example
@@ -87,7 +87,7 @@
<item name='patron enable' value='false'/>
<item name='hold' value='false'/>
<item name='renew' value='true'/>
- <item name='renew all' value='false'/>
+ <item name='renew all' value='true'/>
</supports>
<options>
<!-- msg64, the patron information request can be
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
index da2528c..2e5f3f1 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
@@ -14,6 +14,7 @@ use OpenILS::SIP::Transaction;
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;
@@ -709,7 +710,29 @@ sub renew {
}
+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;
+}
#
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
index 71a823d..69787e6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
@@ -104,8 +104,11 @@ sub new {
my $circ = $e->search_action_circulation([
{
target_copy => $copy->id,
- stop_fines_time => undef,
- checkin_time => undef
+ checkin_time => undef,
+ '-or' => [
+ {stop_fines => undef},
+ {stop_fines => ["MAXFINES","LONGOVERDUE"]},
+ ]
},
{
flesh => 2,
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index 5ce70e9..d40be97 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -593,8 +593,9 @@ sub __circ_to_title {
$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();
@@ -612,7 +613,7 @@ sub charged_items {
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)));
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Renew.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Renew.pm
index fb2681e..d4d7f49 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Renew.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Renew.pm
@@ -52,6 +52,4 @@ sub do_renew {
}
-
-
1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/RenewAll.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/RenewAll.pm
new file mode 100644
index 0000000..663be7d
--- /dev/null
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/RenewAll.pm
@@ -0,0 +1,69 @@
+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;
+}
+
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/examples/oils_sip.xml.example | 2 +-
Open-ILS/src/perlmods/lib/OpenILS/SIP.pm | 23 ++++++
Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm | 7 ++-
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm | 5 +-
.../perlmods/lib/OpenILS/SIP/Transaction/Renew.pm | 2 -
.../lib/OpenILS/SIP/Transaction/RenewAll.pm | 71 ++++++++++++++++++++
6 files changed, 103 insertions(+), 7 deletions(-)
create mode 100644 Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/RenewAll.pm
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list