Bug 41857 - Suggestions table actions broken Update manager and Delete selected actions)
Summary: Suggestions table actions broken Update manager and Delete selected actions)
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Pedro Amorim
QA Contact: Testopia
URL:
Keywords:
Depends on: 39721
Blocks:
  Show dependency treegraph
 
Reported: 2026-02-16 11:52 UTC by Pedro Amorim
Modified: 2026-02-16 20:10 UTC (History)
6 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes errors that are generated when selecting a suggestion in the staff interface and: - Updating the manager for the suggestion (Update manager > [select manager] > Submit) - Deleting the suggestion (Delete selected > Submit) (Related to changes made by Bug 39721 - Remove GetSuggestion from C4/Suggestions.pm, added in Koha 26.05.)
Version(s) released in:
Circulation function:


Attachments
Bug 41857: Remove suggestion (1.89 KB, patch)
2026-02-16 11:59 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 41857: Use suggesteddate_from and suggesteddate_to (2.49 KB, patch)
2026-02-16 11:59 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 41857: Only find singly suggestion by id if 'edit_form' (1.08 KB, patch)
2026-02-16 15:12 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 41857: Remove suggestion (1.93 KB, patch)
2026-02-16 20:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 41857: Use suggesteddate_from and suggesteddate_to (2.54 KB, patch)
2026-02-16 20:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 41857: Only find singly suggestion by id if 'edit_form' (1.12 KB, patch)
2026-02-16 20:03 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2026-02-16 11:52:30 UTC

    
Comment 1 Pedro Amorim 2026-02-16 11:59:26 UTC
Created attachment 193184 [details] [review]
Bug 41857: Remove suggestion

I don't understand why we need this here, but it seems to be picking up a leftover suggestion from a previous loop.
This code itself is not within a loop, so it doesnt have the hashref containing suggestiontype from suggestion.pl.
It's trying to access suggestiontype from Koha::Suggestion which causes an explosion
Comment 2 Pedro Amorim 2026-02-16 11:59:30 UTC
Created attachment 193185 [details] [review]
Bug 41857: Use suggesteddate_from and suggesteddate_to

From URL params. I believe this was an overupdate from bug 39721.

Test plan:
1) Create a new suggestion:
http://localhost:8081/cgi-bin/koha/suggestion/suggestion.pl?op=add_form&branchcode=
2) Add a title and submit.
3) From the table, select the suggesiton (check the box).
4) Click the 'submit' under 'Update manager' or 'Delete selected'.
5) Error
Comment 3 Pedro Amorim 2026-02-16 12:00:02 UTC
Stumbled upon this while rebasing bug 40504 on top of 39721.
Comment 4 Jonathan Druart 2026-02-16 14:18:29 UTC
update manager with more than one (or none) and you get a 500

DBIx::Class::ResultSet::find(): find() expects either a column/value hashref, or a list of values corresponding to the columns of the specified unique constraint 'primary' at /kohadevbox/koha/Koha/Objects.pm line 
95
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
        DBIx::Class::Exception::throw('DBIx::Class::Exception', 'find() expects either a column/value hashref, or a list of values corresponding to the columns of the specified unique constraint \'primary\'', 0) c
alled at /usr/share/perl5/DBIx/Class/Schema.pm line 1118
        DBIx::Class::Schema::throw_exception('Koha::Schema=HASH(0x63f676efab10)', 'find() expects either a column/value hashref, or a list of values corresponding to the columns of the specified unique constraint 
\'primary\'') called at /usr/share/perl5/DBIx/Class/ResultSource.pm line 2379
        DBIx::Class::ResultSource::throw_exception('DBIx::Class::ResultSource::Table=HASH(0x63f6773b6850)', 'find() expects either a column/value hashref, or a list of values corresponding to the columns of the sp
ecified unique constraint \'primary\'') called at /usr/share/perl5/DBIx/Class/ResultSet.pm line 4011
        DBIx::Class::ResultSet::throw_exception('DBIx::Class::ResultSet=HASH(0x63f6794baee0)', 'find() expects either a column/value hashref, or a list of values corresponding to the columns of the specified uniqu
e constraint \'primary\'') called at /usr/share/perl5/DBIx/Class/ResultSet.pm line 809
        DBIx::Class::ResultSet::find('DBIx::Class::ResultSet=HASH(0x63f6794baee0)', 1, 2) called at /kohadevbox/koha/Koha/Objects.pm line 95
        Koha::Objects::find('Koha::Suggestions', 1, 2) called at /kohadevbox/koha/suggestion/suggestion.pl line 105
Comment 5 Pedro Amorim 2026-02-16 14:55:54 UTC
Yes, caused by:

    $stored_suggestion = Koha::Suggestions->find(1 $input->param('suggestionid') ) if $input->param('suggestionid');

Also added in bug 39721. suggestionid may be multiple. Looking.
Comment 6 Pedro Amorim 2026-02-16 15:12:36 UTC
Created attachment 193256 [details] [review]
Bug 41857: Only find singly suggestion by id if 'edit_form'

All ops that iterate on editsuggestions can potentially have multiple suggestionid and don't need stored_suggestion
cud-update_status
cud-delete
cud-archive
cud-unarchive
cud-update_itemtype
cud-update_manager

I'm unsure if op = 'else' should also be included with edit_form
Comment 7 David Nind 2026-02-16 20:03:50 UTC
Created attachment 193268 [details] [review]
Bug 41857: Remove suggestion

I don't understand why we need this here, but it seems to be picking up a leftover suggestion from a previous loop.
This code itself is not within a loop, so it doesnt have the hashref containing suggestiontype from suggestion.pl.
It's trying to access suggestiontype from Koha::Suggestion which causes an explosion

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2026-02-16 20:03:52 UTC
Created attachment 193269 [details] [review]
Bug 41857: Use suggesteddate_from and suggesteddate_to

From URL params. I believe this was an overupdate from bug 39721.

Test plan:
1) Create a new suggestion:
http://localhost:8081/cgi-bin/koha/suggestion/suggestion.pl?op=add_form&branchcode=
2) Add a title and submit.
3) From the table, select the suggesiton (check the box).
4) Click the 'submit' under 'Update manager' or 'Delete selected'.
5) Error

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2026-02-16 20:03:55 UTC
Created attachment 193270 [details] [review]
Bug 41857: Only find singly suggestion by id if 'edit_form'

All ops that iterate on editsuggestions can potentially have multiple suggestionid and don't need stored_suggestion
cud-update_status
cud-delete
cud-archive
cud-unarchive
cud-update_itemtype
cud-update_manager

I'm unsure if op = 'else' should also be included with edit_form

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 David Nind 2026-02-16 20:10:23 UTC
Updated the assignee.