From cb0eb6446a864a900da87fafe4f0cff1fedefcc8 Mon Sep 17 00:00:00 2001 From: Benjamin Rokseth Date: Thu, 5 Feb 2015 15:46:50 +0100 Subject: [PATCH] Bug 13666 - Allow SIP2 checkin/checkout to get branch from institution_id field AO This patch adds a policy flag in SIPConfig.xml that allows overriding branch on SIP2 checkout with the AO (institution id) field. Since SIP2 also uses C4::Context this patch has to modify C4::Context->userenv->{'branch'} Test plan: 1) Either use telnet or apply patch from bug #13159 to use sip command line client 2) Checkout book with SIP2 using a modified institution id (field AO) than the one defined in SIPConfig.xml for the account 3) Notice returned AO is still same as in SIPConfig account 4) Also notice checkout history in admin gives same 'checked out from' 5) Apply this patch and add 'allow_branch_override="true" to the policy of your ILS 6) Restart SIP server 7) Repeat 2) 8) Notice that 3) and 4) now reports the modified institution id --- C4/SIP/Sip/MsgType.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 3ae395d3bd1..2fed0ec2c6a 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -562,6 +562,13 @@ sub handle_checkout { $item_id = $fields->{ (FID_ITEM_ID) }; my $fee_ack = $fields->{ (FID_FEE_ACK) }; + # Overriding branch context and institution_id from value in AO + # if allow_branch_override policy is set on institution + if ($server->{policy}->{allow_branch_override}) { + $inst = $fields->{(FID_INST_ID)}; + C4::Context->userenv->{'branch'} = $inst; + } + if ( $no_block eq 'Y' ) { # Off-line transactions need to be recorded, but there's -- 2.39.5