Bugzilla – Attachment 141029 Details for
Bug 31632
Add ability to manually link orders to suggestions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31632: Add ability to link orders to suggestions when adding to basket from a file
Bug-31632-Add-ability-to-link-orders-to-suggestion.patch (text/plain), 10.72 KB, created by
Nick Clemens (kidclamp)
on 2022-09-27 13:09:43 UTC
(
hide
)
Description:
Bug 31632: Add ability to link orders to suggestions when adding to basket from a file
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-09-27 13:09:43 UTC
Size:
10.72 KB
patch
obsolete
>From bba92adf7b56b11a485948098c82d3ab0e33888b Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >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 @@ >+<div id="suggestion_search_modal" class="modal" role="dialog" aria-hidden="true"> >+ <div class="modal-dialog modal-lg" style="width: 80%"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">x</button> >+ <h3 id="search_suggestions_label"> >+ Search suggestions for order: >+ <span id="search_suggestion_modal_title"></span> >+ </h3> >+ >+ </div> >+ <div class="modal-body"> >+ <div class="suggestions_search"> >+ <table id="suggestions_search_table" class="wrap"> >+ <thead><tr> >+ <th>Title</th> >+ <th>Author</th> >+ <th>ISBN</th> >+ <th>Note</th> >+ <th>Publication info</th> >+ <th>Suggested by</th> >+ <th>Additional info</th> >+ <th> </th> >+ </tr></thead> >+ </table> >+ </div> >+ </div> >+ <div class="modal-footer"> >+ <a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Close</a> >+ </div> >+ </div> >+ </div> >+</div> >+ >+<script> >+$(document).ready(function(){ >+ >+ suggestions_table = $("#suggestions_search_table").kohaTable({ >+ "ajax": { >+ "url": "/api/v1/suggestions" >+ }, >+ "stateSave": true, >+ "columns": [ >+ { >+ "data": "title", >+ "searchable": true, >+ "orderable": true, >+ "max-width": "20%", >+ }, >+ { >+ "data": "author", >+ "searchable": true, >+ "orderable": true, >+ }, >+ { >+ "data": "isbn", >+ "searchable": true, >+ "orderable": true, >+ }, >+ { >+ "data": "note", >+ "searchable": true, >+ "orderable": true, >+ }, >+ { >+ "data": "publisher_code", >+ "searchable": true, >+ "orderable": true, >+ }, >+ { >+ "data": "suggested_by", >+ "searchable": true, >+ "orderable": true, >+ }, >+ { >+ "data": "status", >+ "searchable": true, >+ "orderable": true, >+ }, >+ { >+ "data": "suggestionid", >+ "searchable": false, >+ "orderable": false, >+ "render": function( data, type, row, meta ) { >+ let modal_title = $("#search_suggestion_modal_title"); >+ let import_id = modal_title.data('import_record_id'); >+ console.log(row); >+ if( $("input[name^='attach_suggestion_'][value='"+row.suggestion_id+"'").length == 0 ){ >+ let add_button = '<a class="btn btn-default btn-xs select_suggestion"'; >+ add_button += ' data-suggestionid="' + row.suggestion_id; >+ add_button += '" data-title="' + row.title + ' (' + row.suggestion_id + ')' + '">'; >+ add_button += 'Select</a>'; >+ return add_button; >+ } else { >+ return ''; >+ } >+ }, >+ }, >+ ], >+ "autoWidth": false, >+ }, null, 1); >+ >+ console.log(suggestions_table); >+}); >+</script> >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 @@ > <body id="acq_addorderiso2709" class="acq"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'acquisitions-search.inc' %] >+ [% INCLUDE 'suggestions-search.inc' %] > > <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> > <ol> >@@ -189,6 +190,21 @@ > <label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label> > <input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2" value="[% biblio.sort2 | html %]" /> > </li> >+ <li class="suggestions"> >+ <fieldset> >+ <legend>Suggestions</legend> >+ <ul id="link_suggestions_[% biblio.import_record_id | html %]"> >+ [% FOREACH suggestion IN biblio.suggestions %] >+ <li> >+ <label for="attach_suggestion_record_[% biblio.import_record_id | html %]">Link suggestion: </label> >+ <input name="attach_suggestion_record_[% biblio.import_record_id | html %]" value="[% suggestion.suggestionid %]" type="checkbox"> >+ <span>[% suggestion.title | html %] <em>[% suggestion.author | html %]</em> [% IF suggestion.isbn %]([% suggestion.isbn | html %])[% END %]</span> >+ </li> >+ [% END %] >+ </ul> >+ <button type="button" class="add_suggestions btn btn-sm" data-title="[% biblio.citation | html %]" data-biblionumber="[% biblio.import_record_id | html %]">Link suggestions</button> >+ </fieldset> >+ </li> > </ol> > </div> > <div style="float:right"> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js >index 34785cda2c..58c50e7752 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js >@@ -11,6 +11,32 @@ $(document).ready(function() { > "aaSorting": [] > }) ); > >+ $(".add_suggestions").click(function(){ >+ let the_button = $(this); >+ let modal_title = $("#search_suggestion_modal_title"); >+ modal_title.text( the_button.data('title') ); >+ modal_title.data('import_record_id',the_button.data('biblionumber') ); >+ let the_table = $("#suggestions_search_table").DataTable(); >+ the_table.draw(); >+ $("#suggestion_search_modal").modal().show(); >+ }); >+ $("body").on("click", ".select_suggestion", function(){ >+ let suggestion_id = $(this).data('suggestionid'); >+ let import_record_id = $("#search_suggestion_modal_title").data('import_record_id'); >+ $("ul#link_suggestions_"+import_record_id).append(` >+ <li> >+ <input name="attach_suggestion_record_`+import_record_id+`" type="hidden" value="`+suggestion_id+`" > >+ <label for="attach_suggestion_record_`+import_record_id+`">Attach suggestion: </label> >+ <span>`+$(this).data('title')+`</span> >+ <a class="remove_suggestion">Remove</a> >+ </li> >+ `); >+ $(this).remove(); >+ }); >+ $("body").on("click", ".remove_suggestion", function(){ >+ $(this).parent('li').remove(); >+ }); >+ > checkOrderBudgets(); > var all_budget_id = $("#all_budget_id"); > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31632
:
141028
|
141029
|
141030
|
169391
|
170147
|
170148
|
170953
|
174393
|
174394
|
174395
|
174415
|
174416
|
174417