Bugzilla – Attachment 100035 Details for
Bug 24754
UserEnv not set for ISLDI requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24754: Set userenv for ilsdi requests
Bug-24754-Set-userenv-for-ilsdi-requests.patch (text/plain), 2.88 KB, created by
Nick Clemens (kidclamp)
on 2020-03-03 14:52:27 UTC
(
hide
)
Description:
Bug 24754: Set userenv for ilsdi requests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-03-03 14:52:27 UTC
Size:
2.88 KB
patch
obsolete
>From 220793a9ab75d355092339fe88e0e0832575edc3 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 28 Feb 2020 14:46:37 +0000 >Subject: [PATCH] Bug 24754: Set userenv for ilsdi requests > >Currently ILSDI scripts do not have a userenv set. This affects both >action_logs and statistics. > >For action_logs we either get no user or, if there is an active session, we use that one. This can have unintended consequences and we should explicitly set the env so that system user (0) is recorded > >For statistics we need to speify a branch to record for actions like renewals. With bug 24759 we add an items method for this. We should take advantage of this method and use the 'opac' interface as the ilsdi scripts live there. > >To test: >1 - Enable ILSDI in systempreferences >2 - Checkout an item to a patron >3 - Enable Renewal logs >4 - Ensure you will be able to renew the item several times >5 - Open an incognito/private browser >6 - Renew item via ilsdi: > http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=RenewLoan&patron_id=5&item_id=1128 >7 - Check action logs, interface may be random, user should be 0, if not make sure the user in step 9 is a different one >8 - In private browser open a new tab >9 - Sign in to staff client >10 - Return to other tab >11 - Refresh page to repeat renewal >12 - Check action_logs >13 - The second renewal indicates it was renewed via intranet by logged in staff member >14 - Apply patch >15 - restart_all >16 - Ensure staff client still signed in >17 - Repeate renewal again >18 - Check logs, renewal now indicates opac again (as it should), user is 0 even if logged in on other tab >--- > C4/ILSDI/Services.pm | 2 +- > opac/ilsdi.pl | 8 ++++++++ > 2 files changed, 9 insertions(+), 1 deletion(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index 1ed424e18a..1d9d10f7e5 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -644,7 +644,7 @@ sub RenewLoan { > > # Add renewal if possible > my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber ); >- if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); } >+ if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber, $item->checkout->branchcode ); } > > my $issue = $item->checkout; > return unless $issue; # FIXME should be handled >diff --git a/opac/ilsdi.pl b/opac/ilsdi.pl >index 346f23e4ed..97f27c9256 100755 >--- a/opac/ilsdi.pl >+++ b/opac/ilsdi.pl >@@ -127,6 +127,14 @@ unless ( $cgi->param('service') ) { > exit 0; > } > >+# Set the userenv >+C4::Context->_new_userenv(1); >+C4::Context->set_userenv( >+ undef, undef, undef, 'ILSDI', 'ILSDI', undef, >+ undef, undef, undef, undef, undef >+); >+C4::Context->interface('opac'); >+ > # If user requested a service description, then display it > if ( scalar $cgi->param('service') eq "Describe" and any { scalar $cgi->param('verb') eq $_ } @services ) { > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >-- >2.11.0
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 24754
:
99768
|
99772
|
99773
|
99778
|
100000
|
100001
|
100006
|
100035
|
100269
|
100305
|
101094
|
101584
|
101585