Bugzilla – Attachment 98066 Details for
Bug 21979
Add option to SIP2 config to send arbitrary item field in CR instead of collection code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21979: Add option to SIP2 config to send arbitrary item field in CR instead of collection code
Bug-21979-Add-option-to-SIP2-config-to-send-arbitr.patch (text/plain), 5.80 KB, created by
Kyle M Hall (khall)
on 2020-01-29 12:47:23 UTC
(
hide
)
Description:
Bug 21979: Add option to SIP2 config to send arbitrary item field in CR instead of collection code
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-01-29 12:47:23 UTC
Size:
5.80 KB
patch
obsolete
>From f5e3511b5be230440f3b334ea7cfe118c5acf274 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 7 Dec 2018 14:32:00 -0500 >Subject: [PATCH] Bug 21979: Add option to SIP2 config to send arbitrary item > field in CR instead of collection code > >Some libraries need to send a different field as the collection code, >depending on how the library catalogs items. We should allow any arbitrary >item field to be used as the value for the CR field. > >Test Plan: >1) Apply this patch >2) Set the new option cr_item_field to 'shelving_location' >3) Restart the SIP server >3) Perform a checkin via SIP >4) Note the CR field contains the shelving location code in the response >5) Perform an item information request >6) Note the CR field contains the shelving location code in the response > >Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> >--- > C4/SIP/ILS/Item.pm | 12 ++++++++---- > C4/SIP/Sip/MsgType.pm | 25 ++++++++++++++++++------- > etc/SIPconfig.xml | 1 + > 3 files changed, 27 insertions(+), 11 deletions(-) > >diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm >index 3421bda6e9..2c1f01cde8 100644 >--- a/C4/SIP/ILS/Item.pm >+++ b/C4/SIP/ILS/Item.pm >@@ -82,10 +82,12 @@ sub new { > return; > } > my $self = $item->unblessed; >- $self->{ 'id' } = $item->barcode; # to SIP, the barcode IS the id. >- $self->{permanent_location}= $item->homebranch; >- $self->{'collection_code'} = $item->ccode; >- $self->{ 'call_number' } = $item->itemcallnumber; >+ $self->{'id'} = $item->barcode; # to SIP, the barcode IS the id. >+ $self->{permanent_location} = $item->homebranch; >+ $self->{'collection_code'} = $item->ccode; >+ $self->{'call_number'} = $item->itemcallnumber; >+ $self->{'shelving_location'} = $item->location; >+ $self->{'permanent_shelving_location'} = $item->permanent_location; > > my $it = $item->effective_itemtype; > my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it ); >@@ -130,6 +132,8 @@ my %fields = ( > barcode => 0, > onloan => 0, > collection_code => 0, >+ shelving_location => 0, >+ permanent_shelving_location => 0, > call_number => 0, > enumchron => 0, > location => 0, >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 425ff76552..009d80e009 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -682,13 +682,18 @@ sub handle_checkin { > $resp .= add_field( FID_PATRON_ID, $patron->id, $server ); > } > if ($item) { >-$resp .= maybe_add( FID_MEDIA_TYPE, $item->sip_media_type, $server ); >-$resp .= maybe_add( FID_ITEM_PROPS, $item->sip_item_properties, $server ); >-$resp .= maybe_add( FID_COLLECTION_CODE, $item->collection_code, $server ); >-$resp .= maybe_add( FID_CALL_NUMBER, $item->call_number, $server ); >-$resp .= maybe_add( FID_HOLD_PATRON_ID, $item->hold_patron_bcode, $server ); >-$resp .= add_field( FID_DESTINATION_LOCATION, $item->destination_loc, $server ) if ( $item->destination_loc || $server->{account}->{ct_always_send} ); >-$resp .= maybe_add( FID_HOLD_PATRON_NAME, $item->hold_patron_name( $server->{account}->{da_field_template} ), $server ); >+ $resp .= maybe_add( FID_MEDIA_TYPE, $item->sip_media_type, $server ); >+ $resp .= maybe_add( FID_ITEM_PROPS, $item->sip_item_properties, $server ); >+ $resp .= maybe_add( FID_CALL_NUMBER, $item->call_number, $server ); >+ $resp .= maybe_add( FID_HOLD_PATRON_ID, $item->hold_patron_bcode, $server ); >+ $resp .= add_field( FID_DESTINATION_LOCATION, $item->destination_loc, $server ) if ( $item->destination_loc || $server->{account}->{ct_always_send} ); >+ $resp .= maybe_add( FID_HOLD_PATRON_NAME, $item->hold_patron_name( $server->{account}->{da_field_template} ), $server ); >+ >+ if ( my $CR = $server->{account}->{cr_item_field} ) { >+ $resp .= maybe_add( FID_COLLECTION_CODE, $item->{$CR}, $server ); >+ } else { >+ $resp .= maybe_add( FID_COLLECTION_CODE, $item->collection_code, $server ); >+ } > > if ( $status->hold and $status->hold->{branchcode} ne $item->destination_loc ) { > warn 'SIP hold mismatch: $status->hold->{branchcode}=' . $status->hold->{branchcode} . '; $item->destination_loc=' . $item->destination_loc; >@@ -1160,6 +1165,12 @@ sub handle_item_information { > $resp .= maybe_add( FID_CURRENT_LOCN, $item->current_location, $server ); > $resp .= maybe_add( FID_ITEM_PROPS, $item->sip_item_properties, $server ); > >+ if ( my $CR = $server->{account}->{cr_item_field} ) { >+ $resp .= maybe_add( FID_COLLECTION_CODE, $item->$CR, $server ); >+ } else { >+ $resp .= maybe_add( FID_COLLECTION_CODE, $item->collection_code, $server ); >+ } >+ > if ( ( $i = $item->fee ) != 0 ) { > $resp .= add_field( FID_CURRENCY, $item->fee_currency, $server ); > $resp .= add_field( FID_FEE_AMT, $i, $server ); >diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml >index 1e5c2314a2..28f8b5b92c 100644 >--- a/etc/SIPconfig.xml >+++ b/etc/SIPconfig.xml >@@ -55,6 +55,7 @@ > ct_always_send="1" > cv_triggers_alert="1" > allow_empty_passwords="1" >+ cr_item_field="shelving_location" > ae_field_template="[% patron.surname %][% IF patron.firstname %], [% patron.firstname %][% END %]" > da_field_template="[% patron.surname %][% IF patron.firstname %], [% patron.firstname %][% END %]" > av_field_template="[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]" >-- >2.21.1 (Apple Git-122.3)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21979
:
82998
|
83102
|
93358
|
93535
|
98066
|
101308
|
108502
|
110746
|
110757