Bugzilla – Attachment 164530 Details for
Bug 20388
Ability to add search fields from UI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20388: Alert if the search field already exists
Bug-20388-Alert-if-the-search-field-already-exists.patch (text/plain), 2.04 KB, created by
davewood
on 2024-04-09 08:53:52 UTC
(
hide
)
Description:
Bug 20388: Alert if the search field already exists
Filename:
MIME Type:
Creator:
davewood
Created:
2024-04-09 08:53:52 UTC
Size:
2.04 KB
patch
obsolete
>From 81beeca9b8fa2bc8a96cbf14b03cc07f8184be85 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 19 Mar 2024 16:00:04 +0100 >Subject: [PATCH] Bug 20388: Alert if the search field already exists > >Sponsored-by: The Research University in the Helmholtz Association (KIT) >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> >Signed-off-by: David Schmidt <davewood@gmx.at> >--- > .../intranet-tmpl/prog/js/elasticsearch-mappings.js | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js >index 1b3d93fd52..42bd6a5ed4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js >@@ -124,13 +124,18 @@ $(document).ready(function () { > $('.add-search-field').click(function() { > var table = $(this).closest('table'); > let table_id = table.attr('id'); >+ let dt = $('#' + table_id).DataTable(); > var line = $(this).closest('tr'); > var search_field_name = $(line).find('input[data-id="search_field_name"]').val(); >+ let already_exists = dt.data().filter((row, idx) => row[0]['@data-order'] === search_field_name); >+ if ( already_exists.length ) { >+ alert(__("SearchField '%s' already exist".format(search_field_name))); >+ return; >+ } > if (search_field_name.length > 0) { > var new_line = clone_line(line); > new_line.find('td:first').attr({'data-order': search_field_name}); > new_line.appendTo($('table#' + table_id + '>tbody')); >- let dt = $('#' + table_id).DataTable(); > dt.row.add(new_line).draw(); > > $(table).on( 'click', '.delete', function () { >@@ -140,8 +145,6 @@ $(document).ready(function () { > } ); > > clean_line(line); >- } else { >- alert("SearchField "+ name + " already exist"); > } > }); > }); >-- >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 20388
:
73158
|
73165
|
73167
|
73476
|
73626
|
73627
|
73629
|
73681
|
73682
|
73918
|
73919
|
73940
|
73943
|
73944
|
73945
|
73946
|
74261
|
74718
|
74719
|
78658
|
78659
|
80709
|
86912
|
87196
|
87197
|
87198
|
87199
|
87201
|
87202
|
87203
|
87204
|
88075
|
88079
|
88080
|
88081
|
88082
|
88083
|
89117
|
89118
|
89121
|
89733
|
89894
|
90517
|
90518
|
90519
|
90520
|
90521
|
90522
|
90523
|
90524
|
98011
|
98012
|
98013
|
98014
|
98015
|
98016
|
98017
|
98018
|
99960
|
99961
|
99962
|
99963
|
99964
|
99965
|
99966
|
99967
|
119296
|
119317
|
119318
|
120104
|
163449
|
163450
|
163451
|
163452
|
163460
|
163461
|
163462
|
163463
|
164529
|
164530
|
164531
|
164532
|
164533
|
164534
|
164535
|
164789
|
164790
|
164791
|
164792
|
164793