patch from Brandon Uhlman (with slight alteration discussed and 1 added sanity check...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 19 Jun 2008 02:25:38 +0000 (02:25 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 19 Jun 2008 02:25:38 +0000 (02:25 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@9862 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/oils_sip.xml.example
Open-ILS/src/perlmods/OpenILS/SIP/Patron.pm

index 27b4c55..295666d 100644 (file)
                                        <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>
index a780b7e..ab47d70 100644 (file)
@@ -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) ?