Bug 38606 - Suggestion title search returns 500 error
Summary: Suggestion title search returns 500 error
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: 23.11
Hardware: All All
: P5 - low minor
Assignee: Matt Blenkinsop
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-03 16:13 UTC by Jonathan Field
Modified: 2024-12-06 21:58 UTC (History)
1 user (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 38606: Fix suggestion title search (1.17 KB, patch)
2024-12-03 17:27 UTC, Matt Blenkinsop
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Field 2024-12-03 16:13:33 UTC
If you create a basket and add an orderline from a suggestion, you get a suggestions search bar at the top which allows you to search by title, author and publisher. 

Author and publisher search fine but title returns a 500 error. 

The logs suggest the title in the SQL query is not unique

DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'title' in where clause is ambiguous at /usr/share/koha/lib/Koha/Objects.pm line 401

title is, of course, in both the suggestions table and the borrowers table, the query doesn't seem to make this distinction.
Comment 1 Matt Blenkinsop 2024-12-03 17:27:29 UTC
Created attachment 175091 [details] [review]
Bug 38606: Fix suggestion title search

Test plan:
1) From a basket, click Add to basket and then From a suggestion
2) In the search bar at the top, type something into the Title field and hit enter
3) There will be 500 error
4) Apply patch and restart_all
5) Repeat steps 1-2, no error
Comment 2 David Nind 2024-12-06 21:58:31 UTC
I had a go at testing, but I think something else is also going on.

After the patch, if I use the search, I no longer get an error message - as expected.

If I don't do a search, and click +Order, everything works as expected - you can carry on adding the suggestion to the order.

However, if I do a search and then click the +Order, it results in a "Basket not found" message:
- The URL doesn't have the basketno: /cgi-bin/koha/acqui/neworderempty.pl?booksellerid=1&basketno=&suggestionid=1
- The breadcrumb is: Acquisitions > > Basket > New order

In addition, if I search for "Something" (the other suggestion created in the steps to replicate), I get:
- "There are no outstanding (accepted) suggestions." (even though it was in the table with all the suggestions listed)
- The URL is: /cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=1&title=something&author=&publishercode=
- The breadcrumb is:  Acquisitions > My Vendor > Basket > Add order from a suggestion

Steps to replicate (using KTD):
1. Add two suggestions, and change their status to accepted - one with the title "Test" and another with the title "Something else".
2. Go to a basket and then select add to basket
3. Select "From a suggestion" from the dialog box
4. Accepted suggestions are listed, and the header search is now "Search suggestions" with fields for Title, Author, Publisher.
5. Entering "test" should adjust the table so that one suggestion is listed
6. Click +Order
7. Get "Basket not found"
8. If I don't use search,