Bugzilla – Attachment 189974 Details for
Bug 41311
Add ability for SIP to send patron home library ( branchcode ) in AO field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41311 - Add ability for SIP to send patron home library ( branchcode ) in AO field
Bug-41311---Add-ability-for-SIP-to-send-patron-hom.patch (text/plain), 8.81 KB, created by
Kyle M Hall (khall)
on 2025-11-26 17:47:16 UTC
(
hide
)
Description:
Bug 41311 - Add ability for SIP to send patron home library ( branchcode ) in AO field
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2025-11-26 17:47:16 UTC
Size:
8.81 KB
patch
obsolete
>From 5640c1c0d85a4c334cb5816a3ee12cf4418d30a2 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 26 Nov 2025 12:40:52 -0500 >Subject: [PATCH] Bug 41311 - Add ability for SIP to send patron home library ( > branchcode ) in AO field > >--- > C4/SIP/ILS/Patron.pm | 1 + > C4/SIP/Sip/MsgType.pm | 9 +++++-- > api/v1/swagger/definitions/sip2_account.yaml | 5 ++++ > .../data/mysql/atomicupdate/bug_41311.pl | 19 +++++++++++++++ > installer/data/mysql/kohastructure.sql | 1 + > .../components/SIP2/SIP2AccountResource.vue | 10 ++++++++ > t/cypress/integration/SIP2/Accounts.ts | 1 + > t/db_dependent/SIP/Message.t | 24 +++++++++++++++---- > 8 files changed, 64 insertions(+), 6 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_41311.pl > >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 1caf2888fe6..ccb7b62919f 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -241,6 +241,7 @@ sub new { > my %fields = ( > id => 0, > borrowernumber => 0, >+ branchcode => 0, > name => 0, > address => 0, > email_addr => 0, >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index d77c8088d16..dbd7f8fa7b0 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -516,6 +516,9 @@ sub build_patron_status { > $resp .= $patron->build_custom_field_string($server); > $resp .= $patron->build_patron_attributes_string($server); > >+ my $branchcode = >+ $server->{account}->{patron_branchcode_in_ao} ? $patron->branchcode : $fields->{ (FID_INST_ID) }; >+ $resp .= add_field( FID_INST_ID, $branchcode, $server ); > } else { > > # Invalid patron (cardnumber) >@@ -533,9 +536,10 @@ sub build_patron_status { > and $resp .= add_field( FID_VALID_PATRON, 'N', $server ); > > $resp .= maybe_add( FID_SCREEN_MSG, INVALID_CARD, $server ); >+ >+ $resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) }, $server ); > } > >- $resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) }, $server ); > return $resp; > } > >@@ -1090,7 +1094,8 @@ sub handle_patron_info { > $resp .= add_count( 'patron_info/recall_items', scalar @{ $patron->recall_items } ); > $resp .= add_count( 'patron_info/unavail_holds', scalar @{ $patron->unavail_holds } ); > >- $resp .= add_field( FID_INST_ID, ( $ils->institution_id || 'SIP2' ), $server ); >+ my $branchcode = $server->{account}->{patron_branchcode_in_ao} ? $patron->branchcode : $ils->institution_id; >+ $resp .= add_field( FID_INST_ID, ( $branchcode || 'SIP2' ), $server ); > > # while the patron ID we got from the SC is valid, let's > # use the one returned from the ILS, just in case... >diff --git a/api/v1/swagger/definitions/sip2_account.yaml b/api/v1/swagger/definitions/sip2_account.yaml >index ca13a4e6ef1..8d18dc76189 100644 >--- a/api/v1/swagger/definitions/sip2_account.yaml >+++ b/api/v1/swagger/definitions/sip2_account.yaml >@@ -58,6 +58,11 @@ properties: > type: > - boolean > - 'null' >+ patron_branchcode_in_ao: >+ description: patron branchcode in ao >+ type: >+ - boolean >+ - 'null' > cv_send_00_on_success: > description: cv send 00 on success > type: >diff --git a/installer/data/mysql/atomicupdate/bug_41311.pl b/installer/data/mysql/atomicupdate/bug_41311.pl >new file mode 100755 >index 00000000000..4fe6c643f6b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_41311.pl >@@ -0,0 +1,19 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "41311", >+ description => "Add patron_branchcode_in_ao to sip_accounts table", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE sip_accounts ADD COLUMN `patron_branchcode_in_ao` tinyint(1) AFTER `send_patron_home_library_in_af`; >+ } >+ ); >+ >+ say_success( $out, "Added column 'sip_accounts.patron_branchcode_in_ao'" ); >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 61032e52bbf..fdacaeeb307 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -6190,6 +6190,7 @@ CREATE TABLE `sip_accounts` ( > `sip_account_id` int(11) NOT NULL AUTO_INCREMENT, > `sip_institution_id` int(11) NOT NULL COMMENT 'Foreign key to sip_institutions.sip_institution_id', > `ae_field_template` varchar(255) DEFAULT NULL, >+ `patron_branchcode_in_ao` tinyint(1) DEFAULT 0, > `allow_additional_materials_checkout` tinyint(1) DEFAULT NULL, > `allow_empty_passwords` tinyint(1) DEFAULT NULL, > `allow_fields` varchar(255) DEFAULT NULL, >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2AccountResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2AccountResource.vue >index 99c7dfea2ac..7738782e66d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2AccountResource.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2AccountResource.vue >@@ -449,6 +449,16 @@ export default { > hideIn: ["List"], > group: "Details", > }, >+ { >+ name: "patron_branchcode_in_ao", >+ type: "boolean", >+ label: __("Send patron home library in AO"), >+ hideIn: ["List"], >+ group: "Details", >+ toolTip: __( >+ "Send patron branchcode in AO field for patron status and patron information responses" >+ ), >+ }, > { > name: "show_checkin_message", > type: "boolean", >diff --git a/t/cypress/integration/SIP2/Accounts.ts b/t/cypress/integration/SIP2/Accounts.ts >index 27feac28cff..ba10e087a22 100644 >--- a/t/cypress/integration/SIP2/Accounts.ts >+++ b/t/cypress/integration/SIP2/Accounts.ts >@@ -12,6 +12,7 @@ function get_account() { > convert_nonprinting_characters: "", > cr_item_field: "collection_code", > ct_always_send: false, >+ patron_branchcode_in_ao: false, > cv_send_00_on_success: false, > cv_triggers_alert: false, > custom_item_fields: [], >diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t >index 71406dbf363..0f94cfc3dd9 100755 >--- a/t/db_dependent/SIP/Message.t >+++ b/t/db_dependent/SIP/Message.t >@@ -64,7 +64,7 @@ subtest 'Testing Patron Status Request V2' => sub { > subtest 'Testing Patron Info Request V2' => sub { > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >- plan tests => 32; >+ plan tests => 35; > $C4::SIP::Sip::protocol_version = 2; > test_request_patron_info_v2(); > $schema->storage->txn_rollback; >@@ -1070,8 +1070,9 @@ sub test_request_patron_status_v2 { > } > > sub test_request_patron_info_v2 { >- my $builder = t::lib::TestBuilder->new(); >- my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; >+ my $builder = t::lib::TestBuilder->new(); >+ my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; >+ my $branchcode2 = $builder->build( { source => 'Branch' } )->{branchcode}; > my ( $response, $findpatron ); > my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); > >@@ -1079,13 +1080,15 @@ sub test_request_patron_info_v2 { > { > source => 'Borrower', > value => { >- password => hash_password(PATRON_PW), >+ password => hash_password(PATRON_PW), >+ branchcode => $branchcode2, > }, > } > ); > my $card = $patron2->{cardnumber}; > my $sip_patron2 = C4::SIP::ILS::Patron->new($card); > $findpatron = $sip_patron2; >+ > my $siprequest = > PATRON_INFO > . 'engYYYYMMDDZZZZHHMMSS' >@@ -1130,6 +1133,19 @@ sub test_request_patron_info_v2 { > 'Check customized patron name' > ); > >+ # Test patron_branchcode_in_ao >+ $server->{account}->{patron_branchcode_in_ao} = "1"; >+ $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); >+ undef $response; >+ is( $patron2->{branchcode}, $branchcode2, "Patron created with correct home library" ); >+ is( $sip_patron2->branchcode, $branchcode2, "SIP Patron created with correct home library" ); >+ $msg->handle_patron_info($server); >+ $respcode = substr( $response, 0, 2 ); >+ check_field( >+ $respcode, $response, FID_INST_ID, $patron2->{branchcode}, >+ "Patron home library is in the AO field( patron = $patron2->{branchcode}, INST = $branchcode" >+ ); >+ > # Test hide_fields > undef $response; > $server->{account}->{hide_fields} = join( ",", FID_HOME_ADDR, FID_EMAIL, FID_HOME_PHONE, FID_PATRON_BIRTHDATE ); >-- >2.50.1 (Apple Git-155)
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 41311
: 189974 |
189975