[open-ils-commits] r9861 - in branches/rel_1_2/Open-ILS: examples src/perlmods/OpenILS/SIP

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jun 18 22:25:27 EDT 2008


Author: erickson
Date: 2008-06-18 22:25:25 -0400 (Wed, 18 Jun 2008)
New Revision: 9861

Modified:
   branches/rel_1_2/Open-ILS/examples/oils_sip.xml.example
   branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm
Log:
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.

Modified: branches/rel_1_2/Open-ILS/examples/oils_sip.xml.example
===================================================================
--- branches/rel_1_2/Open-ILS/examples/oils_sip.xml.example	2008-06-19 02:23:54 UTC (rev 9860)
+++ branches/rel_1_2/Open-ILS/examples/oils_sip.xml.example	2008-06-19 02:25:25 UTC (rev 9861)
@@ -78,7 +78,17 @@
 					<item name='renew' value='true'/>
 					<item name='renew all' value='false'/>
 				</supports>
-
+				<options>
+					<!-- msg64, the patron information request can be
+					  made to return item barcodes by setting
+					  the option 'msg64_summary_datatype' to 'barcode'
+					  as below. Any other value, or no value at all
+					  will cause OpenILS::SIP to return the title
+					  in response to a message 64 request, which was the
+					  default behaviour in previous versions of Evergreen.
+					-->
+					<option name='msg64_summary_datatype' value='barcode' />
+				</option>
 				<scripts>
 					<path>/openils/var/</path>
                     <path>/openils/var/catalog/</path>

Modified: branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm
===================================================================
--- branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm	2008-06-19 02:23:54 UTC (rev 9860)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm	2008-06-19 02:25:25 UTC (rev 9861)
@@ -415,9 +415,17 @@
 
 	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 @@
 		[ $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 @@
 
 	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) ? 



More information about the open-ils-commits mailing list