One of our partners is seeing the following Software error intermittently on checkout: Undefined subroutine &C4::Circulation::HasOverdues called at /home/koha/kohaclone/C4/Circulation.pm line 1925, <DATA> line 522. Here's the offending code: 1924 # Remove any OVERDUES related debarment if the borrower has no overdues 1925 if ( $borrowernumber 1926 && $borrower->{'debarred'} 1927 && C4::Context->preference('AutoRemoveOverduesRestrictions') 1928 && !HasOverdues( $borrowernumber ) 1929 && @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) } 1930 ) { 1931 DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); 1932 } I'm not *entirely* sure why this is happening -- HasOverdues is defined in C4/Members.pm: 53 push @EXPORT, qw( 54 &Search 55 &GetMemberDetails 56 &GetMemberRelatives ... 108 HasOverdues 109 ); and C4::Members is being included in C4/Circulation.pm: 30 use C4::Members; ... so !HasOverdues( $borrowernumber ) *shouldn't* be interpreted as a call to &C4::Circulation::HasOverdues ... nonetheless, calling 1928 && !HasOverdues( $borrowernumber ) could be re-written as 1928 && ! C4::Members::HasOverdues( $borrowernumber ) which would be un-ambiguously correct. For the sake of consistency, the call to HasOverdues at C4/Circulation.pm line 2626 should also be changed.
Hi! This issue is plaguing us as well. It manifested as we barred all Borrowers with fines during the new-year. Now our check-in machine is cutting the connection all the time :) I managed to fix the issue and will share a patch ASAP. Since Mr. Chittenden has identified this issue, I wonder why he hasn't shared a patch already?
Created attachment 35037 [details] [review] Bug 13025 - Software error: Undefined subroutine &C4::Circulation::HasOverdues called at /home/koha/kohaclone/C4/Circulation.pm line 1925 This error only appears when using the SIPServer, it doesn't manifest when using the SIP unit tests or when using the staff client. -------------------- ------------------ PREPARE THE TEST ------------------ -------------------- 0a. Find a borrower. 0b. Find an Item (cardnumber 'debar123') and check-out to the borrower 0c. Find a borrower and add a manual debarrment to it, indefinetely in effect. This is the default behaviour. 0d. Configure and start a SIP-server which you can access with telnet. See http://wiki.koha-community.org/wiki/Koha_SIP2_server_setup In this example, the Borrower defined as the Check-out/in machine has the following credentials: username: herkules password: palautathan branchcode: JOE_JOE but you are free to use your own, it doesn't affect this test plan. 0e. access your server with telnet ----------------------- --------------------- REPLICATE THE ISSUE --------------------- ----------------------- 1. Paste the following SIP-command to login: 9300CNherkules|COpalautathan|CPJOE_JOE| 2. Paste the following SIP-command to check-in the Item of the debarred Borrower: 09N20140721 07501620140721 075016AP|AO|ABdebar123|AC|BIN| 3. The connection should die and in the SIP Server's error log you can find the following error: Software error: Undefined subroutine &C4::Circulation::HasOverdues called at /home/koha/kohaclone/C4/Circulation.pm line 1925 -------------------- ------------------ AFTER THIS PATCH ------------------ -------------------- Redo steps 1-2. 3. No error is given and the connection doesn't die. No unit tests included and never will, because setting up the test environment would be very tedious. It is entirely possible but the scaffolding required is beyond the scope of this patch.
I am curious to know why C4::Circulation does not see HasOverdues. The subroutine is exported from C4::Member, which is used in C4::Circ. What I missed?
(In reply to Jonathan Druart from comment #3) > I am curious to know why C4::Circulation does not see HasOverdues. The > subroutine is exported from C4::Member, which is used in C4::Circ. > What I missed? Yeah, must be something strange in C4/SIP/.. ?
I agree. The issue is very strange, but I have a gut feeling finding the root cause is not going to be easy. Regardless using implicit function calls is bad practice (imho) and the Perl manual somewhere says that the Perl compiler/interpreter tries it's best to do-the-right-thing TM but implicit declarations are not always dealt with as is expected to happen. I'll test some more whether breaking the multiline boolean soup will fix anything.
!!!!! This is the original code !!!!! # Remove any OVERDUES related debarment if the borrower has no overdues if ( $borrowernumber&& $borrower->{'debarred'} && C4::Context->preference('AutoRemoveOverduesRestrictions') && !HasOverdues( $borrowernumber ) && @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) } ) { DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); } !!!!! I tried with this one, but got the same error !!!!! # Remove any OVERDUES related debarment if the borrower has no overdues if ( not(HasOverdues( $borrowernumber )) ) { DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); } !!!!! If someone knows what is the root cause, let me know :) !!!!!
Created attachment 35040 [details] [review] [SIGNED-OFF] Bug 13025 - Software error: Undefined subroutine &C4::Circulation::HasOverdues called at /home/koha/kohaclone/C4/Circulation.pm line 1925 This error only appears when using the SIPServer, it doesn't manifest when using the SIP unit tests or when using the staff client. -------------------- ------------------ PREPARE THE TEST ------------------ -------------------- 0a. Find a borrower. 0b. Find an Item (cardnumber 'debar123') and check-out to the borrower 0c. Find a borrower and add a manual debarrment to it, indefinetely in effect. This is the default behaviour. 0d. Configure and start a SIP-server which you can access with telnet. See http://wiki.koha-community.org/wiki/Koha_SIP2_server_setup In this example, the Borrower defined as the Check-out/in machine has the following credentials: username: herkules password: palautathan branchcode: JOE_JOE but you are free to use your own, it doesn't affect this test plan. 0e. access your server with telnet ----------------------- --------------------- REPLICATE THE ISSUE --------------------- ----------------------- 1. Paste the following SIP-command to login: 9300CNherkules|COpalautathan|CPJOE_JOE| 2. Paste the following SIP-command to check-in the Item of the debarred Borrower: 09N20140721 07501620140721 075016AP|AO|ABdebar123|AC|BIN| 3. The connection should die and in the SIP Server's error log you can find the following error: Software error: Undefined subroutine &C4::Circulation::HasOverdues called at /home/koha/kohaclone/C4/Circulation.pm line 1925 -------------------- ------------------ AFTER THIS PATCH ------------------ -------------------- Redo steps 1-2. 3. No error is given and the connection doesn't die. No unit tests included and never will, because setting up the test environment would be very tedious. It is entirely possible but the scaffolding required is beyond the scope of this patch. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(In reply to Olli-Antti Kivilahti from comment #6) > !!!!! I tried with this one, but got the same error !!!!! > # Remove any OVERDUES related debarment if the borrower has no overdues > if ( not(HasOverdues( $borrowernumber )) ) { > DelUniqueDebarment({ borrowernumber => $borrowernumber, type => > 'OVERDUES' }); > } > > > !!!!! If someone knows what is the root cause, let me know :) !!!!! I don't understand the problem here. The error comes from HasOverdues, and it is still called in this code.
Created attachment 35087 [details] [review] Bug 13025 - Software error: Undefined subroutine &C4::Circulation::HasOverdues called at /home/koha/kohaclone/C4/Circulation.pm line 1925 This error only appears when using the SIPServer, it doesn't manifest when using the SIP unit tests or when using the staff client. -------------------- ------------------ PREPARE THE TEST ------------------ -------------------- 0a. Find a borrower. 0b. Find an Item (cardnumber 'debar123') and check-out to the borrower 0c. Find a borrower and add a manual debarrment to it, indefinetely in effect. This is the default behaviour. 0d. Configure and start a SIP-server which you can access with telnet. See http://wiki.koha-community.org/wiki/Koha_SIP2_server_setup In this example, the Borrower defined as the Check-out/in machine has the following credentials: username: herkules password: palautathan branchcode: JOE_JOE but you are free to use your own, it doesn't affect this test plan. 0e. access your server with telnet ----------------------- --------------------- REPLICATE THE ISSUE --------------------- ----------------------- 1. Paste the following SIP-command to login: 9300CNherkules|COpalautathan|CPJOE_JOE| 2. Paste the following SIP-command to check-in the Item of the debarred Borrower: 09N20140721 07501620140721 075016AP|AO|ABdebar123|AC|BIN| 3. The connection should die and in the SIP Server's error log you can find the following error: Software error: Undefined subroutine &C4::Circulation::HasOverdues called at /home/koha/kohaclone/C4/Circulation.pm line 1925 -------------------- ------------------ AFTER THIS PATCH ------------------ -------------------- Redo steps 1-2. 3. No error is given and the connection doesn't die. No unit tests included and never will, because setting up the test environment would be very tedious. It is entirely possible but the scaffolding required is beyond the scope of this patch. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Note: I did not test this patch with SIP, but I did not find any regression on checking or renewing an item.
What Perl version? I have the feeling that it should be fixed on SIP code.
Patch pushed to master. Thanks Olli!
Pushed to 3.18.x will be in 3.18.4
(In reply to Chris Cormack from comment #12) > Pushed to 3.18.x will be in 3.18.4 Pushed to 3.16.x, will be in 3.16.8