Bug 24345 - Fix process of suggesting purchase of existing title for non-logged-in users
Summary: Fix process of suggesting purchase of existing title for non-logged-in users
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on: 14963
Blocks:
  Show dependency treegraph
 
Reported: 2020-01-04 23:24 UTC by Owen Leonard
Modified: 2020-11-30 21:45 UTC (History)
4 users (show)

See Also:
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:


Attachments
Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users (2.34 KB, patch)
2020-01-05 21:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users (2.39 KB, patch)
2020-01-05 21:14 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 24345: Fix OPACViewOthersSuggestions (1.30 KB, patch)
2020-01-21 09:27 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24345: Fix process of suggesting purchase of existing title for non-logged-in users (2.48 KB, patch)
2020-01-22 12:47 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 24345: Fix OPACViewOthersSuggestions (1.40 KB, patch)
2020-01-22 12:47 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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