Bug 24345

Summary: Fix process of suggesting purchase of existing title for non-logged-in users
Product: Koha Reporter: Owen Leonard <oleonard>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: 1joynelson, jonathan.druart, m.de.rooy, testopia
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00
Circulation function:
Bug Depends on: 14963    
Bug Blocks:    
Attachments: Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users
Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users
Bug 24345: Fix OPACViewOthersSuggestions
Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users
Bug 24345: Fix OPACViewOthersSuggestions

Description Owen Leonard 2020-01-04 23:24:42 UTC
If AnonSuggestions is disabled and a non-logged-in user tries to suggest purchase of an existing title the suggestion form isn't correctly populated with the title information.

To reproduce:

 - View a title in the OPAC as a non-logged-in user
 - Click the link to suggest purchase of an additional copy
 - Log in
 - Instead of a pre-populated suggestion form you'll see either your list of existing suggestions (if any) or nothing.
Comment 1 Jonathan Druart 2020-01-05 21:07:14 UTC
Created attachment 96829 [details] [review]
Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users

The 'op' parameter is removed from the CGI object ($input) before
get_template_and_user is called. When the user is redirected to the
login form (from checkauth, called from get_template_and_user), the
op is lost.

Moving down the deletion fixes the problem.

Test plan:
Logout at the OPAC
Go the detail page of a bibliographic record
Click the "Suggest for purchase" link
Fill the login form
=> Without this patch you will see your suggestion list
=> With this patch applied the new suggestion form will be displayed,
prefilled with the biblio's info
Comment 2 Owen Leonard 2020-01-05 21:14:29 UTC
Created attachment 96830 [details] [review]
Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users

The 'op' parameter is removed from the CGI object ($input) before
get_template_and_user is called. When the user is redirected to the
login form (from checkauth, called from get_template_and_user), the
op is lost.

Moving down the deletion fixes the problem.

Test plan:
Logout at the OPAC
Go the detail page of a bibliographic record
Click the "Suggest for purchase" link
Fill the login form
=> Without this patch you will see your suggestion list
=> With this patch applied the new suggestion form will be displayed,
prefilled with the biblio's info

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Marcel de Rooy 2020-01-17 08:53:21 UTC
This change has side effects.
It seems to break viewing other purchase suggestions anonymously (enable OPACViewOthersSuggestions). Might be possible that we only should add the op=else parameter in the masthead link, but it needs more checking.

The script is a bit messy in the handling of $op..
Comment 4 Jonathan Druart 2020-01-21 09:27:26 UTC
Created attachment 97651 [details] [review]
Bug 24345: Fix OPACViewOthersSuggestions

Default value for $op needs to be set before the get_template_and_user lines as
it's tested for OPACViewOthersSuggestions.
Comment 5 Jonathan Druart 2020-01-21 09:27:46 UTC
(In reply to Marcel de Rooy from comment #3)
> This change has side effects.
> It seems to break viewing other purchase suggestions anonymously (enable
> OPACViewOthersSuggestions). Might be possible that we only should add the
> op=else parameter in the masthead link, but it needs more checking.
> 
> The script is a bit messy in the handling of $op..

Ha! Thanks Marcel!
Comment 6 Marcel de Rooy 2020-01-22 12:47:19 UTC
Created attachment 97717 [details] [review]
Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users

The 'op' parameter is removed from the CGI object ($input) before
get_template_and_user is called. When the user is redirected to the
login form (from checkauth, called from get_template_and_user), the
op is lost.

Moving down the deletion fixes the problem.

Test plan:
Logout at the OPAC
Go the detail page of a bibliographic record
Click the "Suggest for purchase" link
Fill the login form
=> Without this patch you will see your suggestion list
=> With this patch applied the new suggestion form will be displayed,
prefilled with the biblio's info

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Marcel de Rooy 2020-01-22 12:47:24 UTC
Created attachment 97718 [details] [review]
Bug 24345: Fix OPACViewOthersSuggestions

Default value for $op needs to be set before the get_template_and_user lines as
it's tested for OPACViewOthersSuggestions.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Martin Renvoize (ashimema) 2020-01-23 09:10:55 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 9 Joy Nelson 2020-02-06 23:00:27 UTC
Missing dependency,  not backported to 19.11