Bugzilla – Attachment 190990 Details for
Bug 41237
OPAC created requests ignore library selection, always default to patron's library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41237: (QA follow-up): Utilize available logged in user object
Bug-41237-QA-follow-up-Utilize-available-logged-in.patch (text/plain), 4.50 KB, created by
Pedro Amorim
on 2026-01-07 14:27:31 UTC
(
hide
)
Description:
Bug 41237: (QA follow-up): Utilize available logged in user object
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2026-01-07 14:27:31 UTC
Size:
4.50 KB
patch
obsolete
>From 96e8070b1fa2162c2cf578ed170a660dcc8105cf Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 7 Jan 2026 14:23:55 +0000 >Subject: [PATCH] Bug 41237: (QA follow-up): Utilize available logged in user > object > >Instead of re-fetching the patron object. > >This also adjusts tests: >prove t/db_dependent/Koha/ILL/Requests.t >--- > Koha/ILL/Request.pm | 5 ++--- > opac/opac-illrequests.pl | 2 +- > t/db_dependent/Koha/ILL/Requests.t | 11 +++++------ > 3 files changed, 8 insertions(+), 10 deletions(-) > >diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm >index b71fc6db427..4a1c45d2555 100644 >--- a/Koha/ILL/Request.pm >+++ b/Koha/ILL/Request.pm >@@ -1075,13 +1075,12 @@ pass it $params, as it does not yet have any other data associated with it. > =cut > > sub backend_create { >- my ( $self, $params ) = @_; >+ my ( $self, $params, $loggedin_patron ) = @_; > > # Establish whether we need to do a generic copyright clearance. > if ( $params->{opac} ) { > >- my $patron = $params->{cardnumber} ? Koha::Patrons->find( { cardnumber => $params->{cardnumber} } ) : undef; >- my $patron_branchcode = $patron ? $patron->branchcode : undef; >+ my $patron_branchcode = $loggedin_patron ? $loggedin_patron->branchcode : undef; > my $copyright_content = Koha::AdditionalContents->search_for_display( > { > category => 'html_customizations', >diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl >index 13bece2c5a6..cc97f51c9d0 100755 >--- a/opac/opac-illrequests.pl >+++ b/opac/opac-illrequests.pl >@@ -186,7 +186,7 @@ if ( $op eq 'list' ) { > $params->{cardnumber} = $patron->cardnumber if $patron; > $params->{opac} = 1; > $params->{lang} = C4::Languages::getlanguage($query); >- my $backend_result = $request->backend_create($params); >+ my $backend_result = $request->backend_create( $params, $patron ); > > if ( $backend_result->{stage} eq 'copyrightclearance' ) { > $template->param( >diff --git a/t/db_dependent/Koha/ILL/Requests.t b/t/db_dependent/Koha/ILL/Requests.t >index 1dfef654737..d31ffb04d48 100755 >--- a/t/db_dependent/Koha/ILL/Requests.t >+++ b/t/db_dependent/Koha/ILL/Requests.t >@@ -1055,24 +1055,23 @@ subtest 'Backend core methods' => sub { > is( $copyright_content->count, 1 ); > > $backend_create_result = >- $illrq->backend_create( >- { opac => 1, branchcode => $illrq->patron->branchcode, cardnumber => $illrq->patron->cardnumber } ); >+ $illrq->backend_create( { opac => 1, branchcode => $illrq->patron->branchcode }, $illrq->patron ); > is( > $backend_create_result->{stage}, 'copyrightclearance', >- 'Additional contents found for provided cardnumber\'s library, should be copyrightclearance stage' >+ 'Additional contents found for logged in user\'s library, should be copyrightclearance stage' > ); > > $backend_create_result = $illrq->backend_create( { opac => 1, branchcode => $illrq->patron->branchcode } ); > is( > $backend_create_result->{stage}, 'commit', >- 'Cardnumber not supplied and couldnt find additional_contents for all libraries. Dont show copyrightclearance' >+ 'Logged in patron not supplied and could not find additional_contents for all libraries. Dont show copyrightclearance' > ); > > my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } ); > $backend_create_result = $illrq->backend_create( { opac => 1, branchcode => $patron_1->branchcode } ); > is( > $backend_create_result->{stage}, 'commit', >- 'Supplied cardnumber\'s branchcode doesnt match any additional_contents of same branchcode. Dont show copyrightclearance' >+ 'Logged in user\'s branchcode does not match any additional_contents of same branchcode. Dont show copyrightclearance' > ); > > my $all_libraries_copyright_content = Koha::AdditionalContents->search_for_display( >@@ -1109,7 +1108,7 @@ subtest 'Backend core methods' => sub { > $backend_create_result = $illrq->backend_create( { opac => 1, branchcode => $illrq->patron->branchcode } ); > is( > $backend_create_result->{stage}, 'copyrightclearance', >- 'Cardnumber not supplied, found additional_contents for all libraries. Should show copyrightclearance' >+ 'Logged in user not supplied, found additional_contents for all libraries. Should show copyrightclearance' > ); > > $all_libraries_copyright_content = Koha::AdditionalContents->search_for_display( >-- >2.39.5
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 41237
:
189491
|
189492
|
189493
|
189494
|
189514
|
190990
|
191691
|
191692
|
191693