Bugzilla – Attachment 103190 Details for
Bug 23349
Add batch operations to staff interface catalog search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23349: Add batch operations to staff interface catalog search results
Bug-23349-Add-batch-operations-to-staff-interface-.patch (text/plain), 6.86 KB, created by
Katrin Fischer
on 2020-04-18 02:18:18 UTC
(
hide
)
Description:
Bug 23349: Add batch operations to staff interface catalog search results
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-04-18 02:18:18 UTC
Size:
6.86 KB
patch
obsolete
>From 73d191c54bf1c30c8d0ec79e81b596d4e3214616 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 6 Apr 2020 20:39:35 +0000 >Subject: [PATCH] Bug 23349: Add batch operations to staff interface catalog > search results > >This patch adds three new options to the staff interface catalog search >results for users with cataloging permission: batch edit, batch delete, >and merge. The choices are found in an "Edit" menu which is disabled by >default. Checking any boxes in the search results table enables the >button. > >To test, apply the patch and log in to Koha as a user with >edit_catalogue permission. > > - Perform a search in the catalog > - You should see a disabled "Edit" button in the toolbar at the top of > the search results table. > - Check a single checkbox. The button should become enabled. > - Test the "Batch edit" and "Batch delete" menu items. They should > work correctly. > - Test the "Merge records" item. It should warn you that you must > select at least two records. > - Check more than one checkbox and test each menu item again. All > should work as expected. > - Log in to the staff client as a user who does not have edit_catalogue > permission. The "Edit" menu should no longer appear on the search > results page. > >Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/catalogue/results.tt | 10 ++++ > koha-tmpl/intranet-tmpl/prog/js/pages/results.js | 68 +++++++++++++++++++++- > 2 files changed, 77 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index c24843edcc..220d7de5ea 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -165,6 +165,16 @@ > <div class="btn-group"> > <a class="btn btn-default btn-xs" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50/SRU search</a> > </div> >+ <div class="btn-group"> >+ <button type="button" id="results_batch_ops" class="btn btn-default btn-xs dropdown-toggle disabled" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> >+ <i class="fa fa-pencil"></i> Edit <span class="caret"></span> >+ </button> >+ <ul class="dropdown-menu"> >+ <li><a class="results_batch_op" data-op="edit" href="#">Batch edit</a></li> >+ <li><a class="results_batch_op" data-op="delete" href="#">Batch delete</a></li> >+ <li><a class="results_batch_op" data-op="merge" href="#">Merge records</a></li> >+ </ul> >+ </div> > [% END %] > > [% IF ( searchdesc ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js >index 0887f4ae8c..4eaf172125 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js >@@ -1,4 +1,4 @@ >-/* global KOHA biblionumber new_results_browser addMultiple vShelfAdd openWindow search_result SEARCH_RESULTS PREF_AmazonCoverImages PREF_LocalCoverImages PREF_IntranetCoce PREF_CoceProviders CoceHost CoceProviders addRecord delSingleRecord PREF_BrowseResultSelection resetSearchContext addBibToContext delBibToContext getContextBiblioNumbers MSG_NO_ITEM_SELECTED MSG_NO_ITEM_SELECTED holdfor_cardnumber holdforclub strQuery MSG_NON_RESERVES_SELECTED PREF_NotHighlightedWords PLACE_HOLD */ >+/* global KOHA biblionumber new_results_browser addMultiple vShelfAdd openWindow search_result SEARCH_RESULTS PREF_AmazonCoverImages PREF_LocalCoverImages PREF_IntranetCoce PREF_CoceProviders CoceHost CoceProviders addRecord delSingleRecord PREF_BrowseResultSelection resetSearchContext addBibToContext delBibToContext getContextBiblioNumbers MSG_NO_ITEM_SELECTED MSG_NO_ITEM_SELECTED holdfor_cardnumber holdforclub strQuery MSG_NON_RESERVES_SELECTED PREF_NotHighlightedWords PLACE_HOLD _ */ > > if( PREF_AmazonCoverImages ){ > $(window).load(function() { >@@ -152,6 +152,11 @@ $(document).ready(function() { > } > > $(".selection").change(function(){ >+ if( $(".selection:checked").length > 0 ){ >+ toggleBatchOp( true ); >+ } else { >+ toggleBatchOp( false ); >+ } > if ( $(this).is(':checked') == true ) { > addBibToContext( $(this).val() ); > } else { >@@ -170,6 +175,16 @@ $(document).ready(function() { > } > } > }); >+ >+ if( $(".selection:checked") > 0 ){ >+ toggleBatchOp( true ); >+ } >+ >+ $(".results_batch_op").on("click", function(e){ >+ e.preventDefault(); >+ var op = $(this).data("op"); >+ resultsBatchProcess( op ); >+ }); > }); > > >@@ -306,3 +321,54 @@ function verify_images() { > } > }); > } >+ >+function toggleBatchOp( b ){ >+ var results_batch_ops = $("#results_batch_ops"); >+ if( b ){ >+ results_batch_ops.removeClass("disabled"); >+ } else { >+ results_batch_ops.addClass("disabled"); >+ } >+} >+ >+function resultsBatchProcess( op ){ >+ var selected = $(".selection:checked"); >+ var params = []; >+ var url = ""; >+ if( op == "edit" ){ >+ // batch edit selected records >+ if ( selected.length < 1 ){ >+ alert( _("You must select at least one record") ); >+ } else { >+ selected.each(function() { >+ params.push( $(this).val() ); >+ }); >+ url = "/cgi-bin/koha/tools/batch_record_modification.pl?op=list&bib_list=" + params.join("/"); >+ location.href = url; >+ } >+ } else if( op == "delete" ){ >+ // batch delete selected records >+ if ( selected.length < 1) { >+ alert( _("You must select at least one record") ); >+ } else { >+ selected.each(function() { >+ params.push( $(this).val() ); >+ }); >+ url = "/cgi-bin/koha/tools/batch_delete_records.pl?op=list&type=biblio&bib_list=" + params.join("/"); >+ location.href = url; >+ } >+ } else if( op == "merge" ){ >+ // merge selected records >+ if ( selected.length < 2) { >+ alert( _("At least two records must be selected for merging") ); >+ } else { >+ selected.each(function() { >+ params.push('biblionumber=' + $(this).val()); >+ }); >+ url = "/cgi-bin/koha/cataloguing/merge.pl?" + params.join("&"); >+ location.href = url; >+ } >+ } else { >+ return false; >+ } >+} >-- >2.11.0
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 23349
:
102468
|
102620
|
102621
|
103171
| 103190 |
103191