Bugzilla – Attachment 161280 Details for
Bug 35329
Move patron searches to a modal
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35329: Move patron search to modal - edit-batch
Bug-35329-Move-patron-search-to-modal---edit-batch.patch (text/plain), 8.14 KB, created by
Martin Renvoize (ashimema)
on 2024-01-23 11:45:16 UTC
(
hide
)
Description:
Bug 35329: Move patron search to modal - edit-batch
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-01-23 11:45:16 UTC
Size:
8.14 KB
patch
obsolete
>From 709d614fff149f80d5d54c214254f1cb6a4a6e26 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 5 Jan 2024 12:01:55 +0100 >Subject: [PATCH] Bug 35329: Move patron search to modal - edit-batch > >Test plan: >Create new patron card batch >Keep the textarea empty and click "Add patron(s)" to open the modal >There is a special feature here, the "checkbox" column is displayed and >you can select several patrons and click "Add selected patrons". > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/includes/patron-search.inc | 45 ++++++++++++++++--- > .../prog/en/modules/patroncards/edit-batch.tt | 21 +++++---- > 2 files changed, 50 insertions(+), 16 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index bdb906b4152..102a445ba0b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -427,7 +427,7 @@ > "searchable": false, > "orderable": false, > "render": function( data, type, row, meta ) { >- return "<label for='check" + data + "' class='content_hidden'>" + _("Select patron") + "</label><input type='checkbox' class='check" + data + "' class='selection' name='borrowernumber' value='" + data + "' />"; >+ return "<label for='check" + data + "' class='content_hidden'>" + _("Select patron") + "</label><input type='checkbox' class='check" + data + " selection' name='borrowernumber' value='" + data + "' />"; > } > } > [% CASE 'cardnumber' %] >@@ -658,6 +658,10 @@ > > patron_search_form.on('submit', filter); > patron_search_form.on('submit', update_search_type); >+ patron_search_form.on('submit', function(){ >+ parent_block.find(".searchheader").show(); >+ }); >+ > > $(".filterByLetter").on("click",function(e){ > e.preventDefault(); >@@ -914,14 +918,12 @@ > > <div id="[% search_results_block_id | html %]"> <!-- FIXME removed style from #searchresults, is that bad? --> > [% IF columns.grep('checkbox').size %] >- <div class="searchheader fh-fixedHeader" id="searchheader" style="display:none;"> >+ <div class="searchheader fh-fixedHeader" style="display:none;"> > <div> >- <a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a> >+ <a href="#" class="btn btn-link select_all"><i class="fa fa-check"></i> Select all</a> > | >- <a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a> >- [% IF selection_type == 'add' %] >- <button id="add-selected" class="btn btn-sm btn-default" type="submit">Add selected patrons</button> >- [% END %] >+ <a href="#" class="btn btn-link clear_all"><i class="fa fa-remove"></i> Clear all</a> >+ <button class="add-selected" class="btn btn-sm btn-default" type="submit">Add selected patrons</button> > </div> > </div> > [% END %] >@@ -935,4 +937,33 @@ > </div> > </div> > <div id="patron_preview_modal" class="basicModal"></div> >+ >+ <script> >+ $(document).ready(function() { >+ let parent_block = $("#[% search_results_block_id | html %]"); >+ parent_block.find(".select_all").on("click",function(e){ >+ e.preventDefault(); >+ parent_block.find(".selection").prop("checked", true).change(); >+ }); >+ parent_block.find(".clear_all").on("click",function(e){ >+ e.preventDefault(); >+ parent_block.find(".selection").prop("checked", false).change(); >+ }); >+ parent_block.find(".searchheader").hide(); >+ parent_block.find(".clear_search").on("click",function(e){$("#searchheader").hide();}); >+ >+ parent_block.find('.add-selected').on('click', function(e) { >+ e.preventDefault(); >+ var counter = 0; >+ parent_block.find('tr:has(.selection:checked) .add_user').each(function(){ >+ var borrowernumber = $(this).data('borrowernumber'); >+ var firstname = $(this).data('firstname'); >+ var surname = $(this).data('surname'); >+ add_user( borrowernumber, firstname + ' ' + surname ); >+ counter++; >+ }); >+ parent_block.find('.info').html(_("%s Patrons added.").format(counter)).show(); >+ }); >+ }); >+ </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt >index 524f5a13011..a22953937b7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt >@@ -2,6 +2,7 @@ > [% USE Asset %] > [% PROCESS 'i18n.inc' %] > [% SET footerjs = 1 %] >+[% PROCESS 'patron-search.inc' %] > [% INCLUDE 'doc-head-open.inc' %] > <title>[% FILTER collapse %] > [% IF ( batch_id ) %] >@@ -83,7 +84,7 @@ > </div> > </form> > <div id="batch-manage" class="action"> >- <a class="btn btn-default" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %] >+ <a class="btn btn-default" id="additems" href="#patron_search_modal" data-toggle="modal"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %] > <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a> > <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash-can"></i> Remove selected patrons</a> > <a class="btn btn-default" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a> >@@ -199,13 +200,11 @@ > function Add() { > var bor_nums = document.getElementById("bor_num_list"); > if (bor_nums.value == '') { >- window.open("/cgi-bin/koha/members/search.pl?columns=checkbox,cardnumber,name,category,branch,dateexpiry,borrowernotes,action&selection_type=add", >- 'PatronPopup', >- 'width=1024,height=768,location=yes,toolbar=no,' >- + 'scrollbars=yes,resize=yes'); >- } else { >- document.forms["add_by_bor_num"].submit(); >+ return true; > } >+ >+ document.forms["add_by_bor_num"].submit(); >+ return false > }; > > function add_user(borrowernumber) { >@@ -290,8 +289,7 @@ > "autoWidth": false > })); > $("#additems").click(function(){ >- Add(); >- return false; >+ return Add(); > }); > $("#removeitems").click(function(){ > Remove(); >@@ -376,6 +374,11 @@ > }); > }); > </script> >+ >+ [% INCLUDE 'select2.inc' %] >+ [% SET columns = ['checkbox','cardnumber','name','category','branch','dateexpiry','borrowernotes','action'] %] >+ [% PROCESS patron_search_modal columns => columns, modal_title => t("Add patrons") %] >+ [% PROCESS patron_search_js columns => columns, actions => ["add"], preview_on_name_click => 1 %] > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >-- >2.43.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 35329
:
160698
|
160699
|
160700
|
160701
|
160702
|
160703
|
160704
|
160705
|
160706
|
160728
|
160729
|
160733
|
160734
|
160735
|
160736
|
160737
|
160738
|
160739
|
160740
|
160741
|
160742
|
160743
|
160759
|
160760
|
160761
|
160762
|
160763
|
160768
|
160769
|
160770
|
160771
|
160773
|
160774
|
160940
|
160941
|
160943
|
160944
|
160945
|
160946
|
160947
|
160948
|
160949
|
160950
|
160951
|
160952
|
160953
|
160954
|
160955
|
160956
|
160957
|
160958
|
160959
|
161165
|
161166
|
161183
|
161184
|
161185
|
161186
|
161187
|
161188
|
161189
|
161190
|
161191
|
161192
|
161193
|
161194
|
161195
|
161196
|
161197
|
161198
|
161199
|
161259
|
161260
|
161274
|
161275
|
161276
|
161277
|
161278
|
161279
|
161280
|
161281
|
161282
|
161283
|
161284
|
161285
|
161286
|
161287
|
161288
|
161289
|
161290
|
161291
|
161292
|
161293
|
161294
|
161295
|
161398
|
161399
|
161400
|
161401
|
161402
|
161403
|
161404
|
161405
|
161406
|
161407
|
161408
|
161409
|
161410
|
161411
|
161412
|
161413
|
161414
|
161415
|
161416
|
161417
|
162436
|
162437
|
162438
|
162439
|
162440
|
162441
|
162442
|
162443
|
162444
|
162445
|
162446
|
162447
|
162448
|
162449
|
162450
|
162451
|
162452
|
162453
|
162454
|
162455
|
162456
|
162457
|
162670
|
162671
|
162713
|
162714