Bugzilla – Attachment 169735 Details for
Bug 35287
Add additional fields support to ERM licenses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35287: Vue preparation - Extend KohaTable to consider searchable additional fields
Bug-35287-Vue-preparation---Extend-KohaTable-to-co.patch (text/plain), 4.12 KB, created by
Pedro Amorim
on 2024-07-26 14:31:02 UTC
(
hide
)
Description:
Bug 35287: Vue preparation - Extend KohaTable to consider searchable additional fields
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-07-26 14:31:02 UTC
Size:
4.12 KB
patch
obsolete
>From b918dc645b9d3b1a5b572656906c6b1a935b27a4 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Wed, 8 Nov 2023 11:34:43 -0100 >Subject: [PATCH] Bug 35287: Vue preparation - Extend KohaTable to consider > searchable additional fields > >This follows the same pattern as in subscription serials searchable additional fields, i.e. if an additional field is searchable, it is added to the list table - with the corresponding search inputs and functionality > >Signed-off-by: Edith Speller <edith.speller@ukhsa.gov.uk> >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> >--- > .../prog/js/vue/components/KohaTable.vue | 62 +++++++++++++++++++ > 1 file changed, 62 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >index b988a2c7df..144fc29c10 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >@@ -16,6 +16,7 @@ import "datatables.net-buttons" > import "datatables.net-buttons/js/buttons.html5" > import "datatables.net-buttons/js/buttons.print" > import "datatables.net-buttons/js/buttons.colVis" >+ > DataTable.use(DataTablesLib) > > export default { >@@ -81,6 +82,57 @@ export default { > }, > beforeMount() { > if (this.actions.hasOwnProperty("-1")) { >+ if (this.searchable_additional_fields.length) { >+ this.searchable_additional_fields.forEach(searchable_field => { >+ var _customRender = (function (searchable_field) { >+ var _render = function (data, type, row, meta) { >+ return row._strings.additional_field_values >+ .filter( >+ field => >+ field.field_id == >+ searchable_field.extended_attribute_type_id >+ ) >+ .map(el => el.value_str) >+ } >+ return _render >+ })(searchable_field) >+ >+ this.tableColumns.push({ >+ name: searchable_field.name, >+ data: "extended_attributes", >+ datatype: "related-object", >+ related: "extended_attributes", >+ relatedKey: "field_id", >+ relatedValue: >+ searchable_field.extended_attribute_type_id, >+ relatedSearchOn: "value", >+ className: >+ "searchable-additional-column-" + >+ searchable_field.extended_attribute_type_id, >+ title: searchable_field.name, >+ searchable: true, >+ sortable: false, >+ render: _customRender, >+ }) >+ >+ if (searchable_field.authorised_value_category_name) { >+ let options = >+ this.searchable_av_options[ >+ searchable_field.authorised_value_category_name >+ ] >+ >+ options.map(e => { >+ e["_id"] = e["value"] >+ e["_str"] = e["label"] >+ return e >+ }) >+ >+ this.filters_options[this.tableColumns.length - 1] = >+ options >+ } >+ }) >+ } >+ > this.tableColumns = [ > ...this.tableColumns, > { >@@ -234,6 +286,16 @@ export default { > type: Object, > required: false, > }, >+ searchable_additional_fields: { >+ type: Array, >+ required: false, >+ default: [], >+ }, >+ searchable_av_options: { >+ type: Array, >+ required: false, >+ default: [], >+ }, > }, > } > </script> >-- >2.39.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 35287
:
158725
|
158726
|
158727
|
158728
|
158729
|
158730
|
158731
|
158732
|
158733
|
158734
|
159634
|
159635
|
159636
|
159637
|
159638
|
159639
|
159640
|
159641
|
159642
|
159643
|
165451
|
165637
|
165638
|
165639
|
165640
|
165641
|
165642
|
165643
|
165644
|
165645
|
165646
|
165647
|
167681
|
169728
|
169729
|
169730
|
169731
|
169732
|
169733
|
169734
|
169735
|
169736
|
169737
|
170448
|
170753
|
172850
|
172851
|
172852
|
172853
|
172854
|
172855
|
172856
|
172857
|
172858
|
172860
|
172861
|
173022
|
173102
|
173103
|
173104
|
173105
|
173106
|
173107
|
173108
|
173109
|
173110
|
173111
|
173112
|
173113
|
173290