Bugzilla – Attachment 183164 Details for
Bug 40118
Regression - 'Holds to pull' library filters don't work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40118: Prevent adding another empty value option
Bug-40118-Prevent-adding-another-empty-value-optio.patch (text/plain), 3.32 KB, created by
Pedro Amorim
on 2025-06-11 14:17:37 UTC
(
hide
)
Description:
Bug 40118: Prevent adding another empty value option
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-06-11 14:17:37 UTC
Size:
3.32 KB
patch
obsolete
>From e52d6d50d586c36eae1ef80e264e13d5d304ef38 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 11 Jun 2025 14:17:05 +0000 >Subject: [PATCH] Bug 40118: Prevent adding another empty value option > >This is already done for all select dropdowns by default. If a particular table provides an empty value it should be skipped or 2 empty options may show >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 44 ++++++++++--------- > 1 file changed, 24 insertions(+), 20 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 58dc8567ea1..8149806db99 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -1057,27 +1057,31 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) { > } else if (typeof filters_options[i] === "function") { > filters_options[i] = filters_options[i](table_dt); > } >- $(filters_options[i]).each(function () { >- let optionValue = >- table_dt.settings()[0].ajax !== null >- ? `^${this._id}$` >- : this._id; >- let o = $( >- `<option value="${optionValue}">${this._str}</option>` >- ); >+ $(filters_options[i]) >+ .filter(function () { >+ return this._id && this._str; >+ }) >+ .each(function () { >+ let optionValue = >+ table_dt.settings()[0].ajax !== null >+ ? `^${this._id}$` >+ : this._id; >+ let o = $( >+ `<option value="${optionValue}">${this._str}</option>` >+ ); > >- // Compare with lc, or selfreg won't match ^SELFREG$ for instance, see bug 32517 >- // This is only for category, we might want to apply it only in this case. >- existing_search = existing_search.toLowerCase(); >- if ( >- existing_search === this._id || >- (existing_search && >- this._id.toLowerCase().match(existing_search)) >- ) { >- o.prop("selected", "selected"); >- } >- o.appendTo(select); >- }); >+ // Compare with lc, or selfreg won't match ^SELFREG$ for instance, see bug 32517 >+ // This is only for category, we might want to apply it only in this case. >+ existing_search = existing_search.toLowerCase(); >+ if ( >+ existing_search === this._id || >+ (existing_search && >+ this._id.toLowerCase().match(existing_search)) >+ ) { >+ o.prop("selected", "selected"); >+ } >+ o.appendTo(select); >+ }); > $(th).html(select); > } else { > var title = $(th).text(); >-- >2.39.5
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 40118
:
183161
|
183162
|
183164
|
183169
|
183170
|
183280
|
183281
|
183282
|
183316
|
183317
|
183318