Bugzilla – Attachment 146427 Details for
Bug 32924
Filter agreements by logged in librarian
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32924: Add the ability to filter agreement by logged in user
Bug-32924-Add-the-ability-to-filter-agreement-by-l.patch (text/plain), 4.70 KB, created by
Jonathan Druart
on 2023-02-09 13:04:09 UTC
(
hide
)
Description:
Bug 32924: Add the ability to filter agreement by logged in user
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-02-09 13:04:09 UTC
Size:
4.70 KB
patch
obsolete
>From 97ca4db5d1d3e236274ea30df627ae3ad9bfaaf7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 9 Feb 2023 14:00:56 +0100 >Subject: [PATCH] Bug 32924: Add the ability to filter agreement by logged in > user > >This patch adds a new filter checkbox at the top of the agreement list >"Show only mine" that will display agreements linked with the logged in >user. > >Test plan: >Create several agreements, add your current logged in user to some of >them >On the agreement list view us the new checkbox to filter the agreements >and see those where you are involved in. >--- > Koha/Schema/Result/ErmAgreement.pm | 7 +++++++ > .../intranet-tmpl/prog/en/modules/erm/erm.tt | 2 ++ > .../js/vue/components/ERM/AgreementsList.vue | 21 ++++++++++++++++++- > 3 files changed, 29 insertions(+), 1 deletion(-) > >diff --git a/Koha/Schema/Result/ErmAgreement.pm b/Koha/Schema/Result/ErmAgreement.pm >index 643f6189c16..b2b97e4f3ee 100644 >--- a/Koha/Schema/Result/ErmAgreement.pm >+++ b/Koha/Schema/Result/ErmAgreement.pm >@@ -270,6 +270,13 @@ __PACKAGE__->many_to_many("packages", "erm_eholdings_packages_agreements", "pack > # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-11 11:52:09 > # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:N93LnvdKirtuV6BSrTGzVg > >+__PACKAGE__->has_many( >+ "user_roles", >+ "Koha::Schema::Result::ErmUserRole", >+ { "foreign.agreement_id" => "self.agreement_id" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > __PACKAGE__->add_columns( > '+is_perpetual' => { is_boolean => 1 } > ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt >index 8171ea6a8a7..5d72c8ed3cb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt >@@ -60,6 +60,8 @@ > > const logged_in_user_lists = [% To.json(logged_in_user.virtualshelves.unblessed) | $raw %]; > >+ const logged_in_user = [% To.json(logged_in_user.unblessed) | $raw %]; >+ > </script> > > [% Asset.js("js/vue/dist/main.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >index e376b3c3198..b9e0168468e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >@@ -17,6 +17,14 @@ > :config="fp_config" > /> > >+ <label for="by_mine_filter">{{ $__("Show mine only") }}:</label> >+ <input >+ type="checkbox" >+ id="by_mine_filter" >+ v-model="filters.by_mine" >+ @keyup.enter="filter_table" >+ /> >+ > <input > @click="filter_table" > id="filter_table" >@@ -57,6 +65,7 @@ export default { > get_lib_from_av, > map_av_dt_filter, > table_id, >+ logged_in_user, > } > }, > data: function () { >@@ -68,6 +77,7 @@ export default { > by_expired: this.$route.query.by_expired || false, > max_expiration_date: > this.$route.query.max_expiration_date || "", >+ by_mine: this.$route.query.by_mine || false, > }, > before_route_entered: false, > building_table: false, >@@ -144,7 +154,9 @@ export default { > let datatable_url = this.datatable_url > let default_search = this.$route.query.q > let actions = this.before_route_entered ? "edit_delete" : "select" >+ let filters = this.filters > let table_id = this.table_id >+ let logged_in_user = this.logged_in_user > > window["vendors"] = this.vendors.map(e => { > e["_id"] = e["id"] >@@ -169,11 +181,17 @@ export default { > { _id: 1, _str: _("Yes") }, > ] > >+ let additional_filters = { >+ "user_roles.user_id": function () { >+ return filters.by_mine ? logged_in_user.borrowernumber : "" >+ }, >+ } > const table = $("#" + table_id).kohaTable( > { > ajax: { > url: datatable_url, > }, >+ embed: ["user_roles"], > order: [[0, "asc"]], > autoWidth: false, > search: { search: default_search }, >@@ -417,7 +435,8 @@ export default { > }, > }, > agreement_table_settings, >- 1 >+ 1, >+ additional_filters > ) > }, > }, >-- >2.25.1
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 32924
:
146427
|
146433
|
146434
|
146435
|
147812
|
147813