From 2617427e4f3a1b5f65c110c75b8313ee224881fd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 13 Nov 2019 16:34:56 +0100 Subject: [PATCH] Bug 22784: Add the ability to archive/unarchive a purchase suggestions There are performance issues when searching suggestions if there are thousands of suggestions. To prevent that we are going to add the ability to archive purchase suggestions, in order to remove them from the search list (by default). Test plan: 0. Apply all the patches, execute the updatedatabase.pl script, restart all 1. Create some suggestions 2. Search for them 3. Use the "Archive" action button for one of them 4. Restart the search => The archived suggestion does no longer appear in the list 5. Use the filter "Included archived" in the "Suggestion information" filter box => The archived suggestion is now displayed 6. Use other filters => The "archived" filter is kept from one search to another 7. Use one of the action at the bottom of the suggestion list (change the status for instance) => The "archived" filter is still kept Sponsored-by: BULAC - http://www.bulac.fr/ --- .../prog/en/modules/suggestion/suggestion.tt | 15 +++++++++++++-- suggestion/suggestion.pl | 10 ++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 3e6ed544b3..cb45d0b3b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -603,8 +603,19 @@ [% END %] - Edit - Delete +
+
+ Edit + +
+
[% END %] diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index ff39b3daf9..1364c61b50 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -290,6 +290,16 @@ elsif ($op eq "update_status" ) { } redirect_with_params($input); } +elsif ($op eq "archive" ) { + Koha::Suggestions->find($_)->update({ archived => 1 }) for @editsuggestions; + + redirect_with_params($input); +} +elsif ($op eq "unarchive" ) { + Koha::Suggestions->find($_)->update({ archived => 0 }) for @editsuggestions; + + redirect_with_params($input); +} elsif ( $op eq 'update_itemtype' ) { my $new_itemtype = $input->param('suggestion_itemtype'); foreach my $suggestionid (@editsuggestions) { -- 2.11.0