From bba92adf7b56b11a485948098c82d3ab0e33888b Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 27 Sep 2022 11:21:16 +0000 Subject: [PATCH] Bug 31632: Add ability to link orders to suggestions when adding to basket from a file This patch adds a new include for suggestions searching, and adds JS on the addorderiso2907 page to allow linking new orders to suggestions while importing into a basket To test: 1 - Export or find a file of bibs 2 - Stage the file using Tools->Stage MARC for Import 3 - Find or create an open basket in acquisitions 4 - Add to basket from the staged file 5 - Select/check a record 6 - Note new 'Suggestions' area 7 - Click 'Link suggestions' 8 - Search for suggestions - click 'Select' 9 - Select button is gone 10 - Dismiss modal 11 - Suggestion is listed for this record 12 - Click 'Link suggestions' 13 - Confirm the suggestion cannot be chosen again 14 - Add another 15 - Dismiss the modal 16 - Click 'Remove' on the first suggestion 17 - Confirm it is removed 18 - Confirm you can now link it again 19 - Select budget etc and submit 20 - Confirm record linked to suggestions --- acqui/addorderiso2709.pl | 5 + .../prog/en/includes/suggestions-search.inc | 105 ++++++++++++++++++ .../prog/en/modules/acqui/addorderiso2709.tt | 16 +++ .../intranet-tmpl/prog/js/addorderiso2709.js | 26 +++++ 4 files changed, 152 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/suggestions-search.inc diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index aecb0ef8eb..91e2b7047b 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -202,6 +202,11 @@ if ($op eq ""){ SetMatchedBiblionumber( $biblio->{import_record_id}, $biblionumber ); + # Update suggestions + my @suggestions_selected = $input->multi_param('attach_suggestion_record_' . $biblio->{import_record_id}); + my $suggestions = Koha::Suggestions->search({ suggestionid => { -in => \@suggestions_selected } }); + $suggestions->update({ biblionumber => $biblionumber }); + # Add items from MarcItemFieldsToOrder my @homebranches = $input->multi_param('homebranch_' . $biblio_count); my $count = scalar @homebranches; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/suggestions-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/suggestions-search.inc new file mode 100644 index 0000000000..748b37ef3d --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/suggestions-search.inc @@ -0,0 +1,105 @@ + + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index 3cb1ee24ea..427734a3de 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -25,6 +25,7 @@ [% INCLUDE 'header.inc' %] [% INCLUDE 'acquisitions-search.inc' %] + [% INCLUDE 'suggestions-search.inc' %]