Bug 34080 - Updating suggestion status can result in 500 error
Summary: Updating suggestion status can result in 500 error
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Lucas Gass
QA Contact: Testopia
URL:
Keywords: rel_22_11_candidate, rel_23_05_candidate
Depends on: 33322
Blocks:
  Show dependency treegraph
 
Reported: 2023-06-21 14:49 UTC by Kyle M Hall
Modified: 2023-12-28 20:47 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.02,22.11.08


Attachments
Bug 34080 - Updating suggestion status can result in 500 error (1.20 KB, patch)
2023-06-21 14:51 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 34080: Make suggestions_batch_ops a class (2.03 KB, patch)
2023-06-23 15:14 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 34080: Make suggestions_batch_ops a class (2.08 KB, patch)
2023-06-23 15:21 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 34080: Make suggestions_batch_ops a class (2.14 KB, patch)
2023-06-23 15:27 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2023-06-21 14:49:57 UTC
Sometimes using "Mark selection as" to update a suggestions can result in a 500 error with the logged error:

DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'suggestion_itemtype' in 'where clause' at /usr/share/koha/lib/Koha/Objects.pm line 394

It appears that the search params are built from *all* the form fields and then some form fields are removed from the hashref, but not all ( hence the error ).
Comment 1 Kyle M Hall 2023-06-21 14:51:37 UTC
Created attachment 152524 [details] [review]
Bug 34080 - Updating suggestion status can result in 500 error

Sometimes using "Mark selection as" to update a suggestions can result in a 500 error with the logged error:

DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'suggestion_itemtype' in 'where clause' at /usr/share/koha/lib/Koha/Objects.pm line 394

It appears that the search params are built from *all* the form fields and then some form fields are removed from the hashref, but not all ( hence the error ).
Comment 2 Lucas Gass 2023-06-22 21:27:29 UTC
This patch stops the 500 error from occurring. However, with it applied I am unable to switch the status of suggestions.
Comment 3 Lucas Gass 2023-06-23 15:11:33 UTC
To recreate:

1. Make some suggestions with different statuses. 
2. Try moving some suggestion to different statuses. 
3. Going from PENDING to another status works fine.
4. Moving from other status (REJECTED, ORDERED, etc ) will cause a 500 error.
Comment 4 Lucas Gass 2023-06-23 15:13:08 UTC
The suggestions_batch_ops div is repeated and therefore should be a class not and an ID.
Comment 5 Lucas Gass 2023-06-23 15:14:53 UTC
Created attachment 152643 [details] [review]
Bug 34080: Make suggestions_batch_ops a class

To test:
1. Make some suggestions with different statuses.
2. Try moving some suggestion to different statuses.
3. Going from PENDING to another status works fine.
4. Moving from other status (REJECTED, ORDERED, etc ) will cause a 500 error.
5. Apply patch
6. Try 2 - 4 again, no more 500 errors, yay!
Comment 6 Lucas Gass 2023-06-23 15:15:44 UTC
Marked as major because this effects libraries ability to manage purchase suggestions.
Comment 7 Sam Lau 2023-06-23 15:21:18 UTC
Created attachment 152644 [details] [review]
Bug 34080: Make suggestions_batch_ops a class

To test:
1. Make some suggestions with different statuses.
2. Try moving some suggestion to different statuses.
3. Going from PENDING to another status works fine.
4. Moving from other status (REJECTED, ORDERED, etc ) will cause a 500 error.
5. Apply patch
6. Try 2 - 4 again, no more 500 errors, yay!

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 8 Martin Renvoize 2023-06-23 15:27:47 UTC
Created attachment 152645 [details] [review]
Bug 34080: Make suggestions_batch_ops a class

To test:
1. Make some suggestions with different statuses.
2. Try moving some suggestion to different statuses.
3. Going from PENDING to another status works fine.
4. Moving from other status (REJECTED, ORDERED, etc ) will cause a 500 error.
5. Apply patch
6. Try 2 - 4 again, no more 500 errors, yay!

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2023-06-23 15:28:20 UTC
Trivial fix works as expected.. Passing QA
Comment 10 Tomás Cohen Arazi 2023-06-26 14:41:33 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 11 Patrick 2023-07-12 13:04:18 UTC
Is this bug going to be backported to 22.11?
Comment 12 Martin Renvoize 2023-07-17 14:41:41 UTC
Thanks for all the hard work!

Pushed to 23.05.x for the next release
Comment 13 Pedro Amorim 2023-07-18 11:55:20 UTC
Nice work everyone!

Pushed to 22.11.x for next release