From 2cc9105cdd343dc3ae182cb850f1221fea53b721 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 19 Jun 2008 02:25:38 +0000 Subject: [PATCH] patch from Brandon Uhlman (with slight alteration discussed and 1 added sanity check) to allow item barcodes to be returned instead of titles in the patron information request. The oils_sip.xml.exmample comments do a good job of explaining it. Thanks, Brandon. git-svn-id: svn://svn.open-ils.org/ILS/trunk@9862 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/oils_sip.xml.example | 12 ++++++++- Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm | 28 +++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/Open-ILS/examples/oils_sip.xml.example b/Open-ILS/examples/oils_sip.xml.example index 27b4c5522d..295666d841 100644 --- a/Open-ILS/examples/oils_sip.xml.example +++ b/Open-ILS/examples/oils_sip.xml.example @@ -78,7 +78,17 @@ - + + + /openils/var/ /openils/var/catalog/ diff --git a/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm index a780b7e69c..ab47d70eac 100644 --- a/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm +++ b/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm @@ -415,9 +415,17 @@ sub overdue_items { my @o; syslog('LOG_DEBUG', "OILS: overdue_items() fleshing circs @overdues"); + + + my @return_datatype = grep { $_->{name} eq 'msg64_summary_datatype' } @{$self->{config}->{implementation_config}->{options}->{option}}; + for my $circid (@overdues) { next unless $circid; - push( @o, __circ_to_title($self->{editor}, $circid) ); + if(@return_datatype and $return_datatype[0]->{value} eq 'barcode') { + push( @o, __circ_to_barcode($self->{editor}, $circid)); + } else { + push( @o, __circ_to_title($self->{editor}, $circid)); + } } @overdues = @o; @@ -425,6 +433,14 @@ sub overdue_items { [ $overdues[($start-1)..($end-1)] ] : \@overdues; } +sub __circ_to_barcode { + my ($e, $circ) = @_; + return unless $circ; + $circ = $e->retrieve_action_circulation($circ); + my $copy = $e->retrieve_asset_copy($circ->target_copy); + return $copy->barcode; +} + sub __circ_to_title { my( $e, $circ ) = @_; return unless $circ; @@ -447,10 +463,18 @@ sub charged_items { my @c; syslog('LOG_DEBUG', "OILS: charged_items() fleshing circs @charges"); + + my @return_datatype = grep { $_->{name} eq 'msg64_summary_datatype' } @{$self->{config}->{implementation_config}->{options}->{option}}; + for my $circid (@charges) { next unless $circid; - push( @c, __circ_to_title($self->{editor}, $circid) ); + if(@return_datatype and $return_datatype[0]->{value} eq 'barcode') { + push( @c, __circ_to_barcode($self->{editor}, $circid)); + } else { + push( @c, __circ_to_title($self->{editor}, $circid)); + } } + @charges = @c; return (defined $start and defined $end) ? -- 2.43.2