[open-ils-commits] r18430 - in branches/rel_2_0/Open-ILS/src/perlmods/OpenILS: . SIP SIP/Transaction (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Oct 20 16:45:37 EDT 2010
Author: erickson
Date: 2010-10-20 16:45:32 -0400 (Wed, 20 Oct 2010)
New Revision: 18430
Modified:
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP.pm
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm
Log:
added some time diagnostics to checkin process; more org unit caching; do less user fleshing on hold user during checkin (only card and name is needed)
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm 2010-10-20 20:45:03 UTC (rev 18429)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm 2010-10-20 20:45:32 UTC (rev 18430)
@@ -97,7 +97,6 @@
syslog("LOG_DEBUG", "OILS: new OpenILS Patron(%s => %s): found patron : barred=%s, card:active=%s",
$key, $patron_id, $user->barred, $user->card->active );
-
bless $self, $type;
return $self;
}
@@ -109,13 +108,16 @@
sub name {
my $self = shift;
- my $u = $self->{user};
+ return format_name($self->{user});
+}
+
+sub format_name {
+ my $u = shift;
return OpenILS::SIP::clean_text(
sprintf('%s %s %s',
($u->first_given_name || ''),
($u->second_given_name || ''),
($u->family_name || '')));
-
}
sub home_library {
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm 2010-10-20 20:45:03 UTC (rev 18429)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm 2010-10-20 20:45:32 UTC (rev 18430)
@@ -1,15 +1,10 @@
-#
-# An object to handle checkin status
-#
-
package OpenILS::SIP::Transaction::Checkin;
+use warnings; use strict;
-use warnings;
-use strict;
-
use POSIX qw(strftime);
use Sys::Syslog qw(syslog);
use Data::Dumper;
+use Time::HiRes q/time/;
use OpenILS::SIP;
use OpenILS::SIP::Transaction;
@@ -110,7 +105,9 @@
my $method = 'open-ils.circ.checkin';
$method .= '.override' if $override;
+ my $start_time = time();
$resp = $U->simplereq('open-ils.circ', $method, $self->{authtoken}, $args);
+ syslog('LOG_INFO', "OILS: Checkin API call took %0.3f seconds", (time() - $start_time));
if ($debug) {
my $s = Dumper($resp);
@@ -170,8 +167,11 @@
if ($self->item->hold) {
my ($pickup_lib_id, $pickup_lib_sn);
- my $holder = OpenILS::SIP->find_patron('usr' => $self->item->hold->usr);
+ my $holder = OpenILS::SIP->editor()->retrieve_actor_user(
+ [$self->item->hold->usr, {flesh => 1, flesh_fields => {au => ['card']}}]);
+ my $holder_name = OpenILS::SIP::Patron::format_name($holder);
+
if (ref $self->item->hold->pickup_lib) {
$pickup_lib_id = $self->item->hold->pickup_lib->id;
$pickup_lib_sn = $self->item->hold->pickup_lib->shortname;
@@ -181,8 +181,8 @@
$pickup_lib_sn = OpenILS::SIP::shortname_from_id($pickup_lib_id);
}
- $self->item->hold_patron_bcode($holder->id);
- $self->item->hold_patron_name($holder->name);
+ $self->item->hold_patron_bcode( ($holder->card) ? $holder->card->barcode : '');
+ $self->item->hold_patron_name($holder_name);
$self->item->destination_loc($pickup_lib_sn);
my $atype = ($pickup_lib_id == $phys_location) ? '01' : '02';
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP.pm 2010-10-20 20:45:03 UTC (rev 18429)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP.pm 2010-10-20 20:45:32 UTC (rev 18430)
@@ -6,6 +6,7 @@
use warnings; use strict;
use Sys::Syslog qw(syslog);
+use Time::HiRes q/time/;
use OpenILS::SIP::Item;
use OpenILS::SIP::Patron;
@@ -149,10 +150,12 @@
return $text;
}
+my %org_sn_cache;
sub shortname_from_id {
my $id = shift or return;
return $id->shortname if ref $id;
- return editor()->retrieve_actor_org_unit($id)->shortname;
+ return $org_sn_cache{$id} if $org_sn_cache{$id};
+ return $org_sn_cache{$id} = editor()->retrieve_actor_org_unit($id)->shortname;
}
sub patron_barcode_from_id {
my $id = shift or return;
@@ -364,6 +367,8 @@
my ($self, $item_id, $inst_id, $trans_date, $return_date,
$current_loc, $item_props, $cancel) = @_;
+ my $start_time = time();
+
$self->verify_session;
syslog('LOG_DEBUG', "OILS: OpenILS::Checkin of item=$item_id (to $inst_id)");
@@ -386,12 +391,11 @@
delete $item->{patron};
delete $item->{due_date};
syslog('LOG_INFO', "OILS: Checkin succeeded");
- #editor()->commit;
} else {
- #editor()->xact_rollback;
syslog('LOG_WARNING', "OILS: Checkin failed");
}
+ syslog('LOG_INFO', "OILS: SIP Checkin request took %0.3f seconds", (time() - $start_time));
return $xact;
}
More information about the open-ils-commits
mailing list