Bugzilla – Attachment 89749 Details for
Bug 22844
Simplify the process of selecting database columns for system preferences
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22844: POC - Add patron attributes to the list
Bug-22844-POC---Add-patron-attributes-to-the-list.patch (text/plain), 3.75 KB, created by
Jonathan Druart
on 2019-05-14 14:51:27 UTC
(
hide
)
Description:
Bug 22844: POC - Add patron attributes to the list
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-05-14 14:51:27 UTC
Size:
3.75 KB
patch
obsolete
>From 77ee1b78c52cf00d5f5017eea47a78913d8755c3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 14 May 2019 09:50:04 -0500 >Subject: [PATCH] Bug 22844: POC - Add patron attributes to the list > >TODO: >- Handle 'checked' flag >- Update code in memberentry.tt >--- > admin/preferences.pl | 16 ++++++++++++++++ > .../intranet-tmpl/prog/en/modules/admin/preferences.tt | 2 ++ > koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js | 8 ++++++++ > 3 files changed, 26 insertions(+) > >diff --git a/admin/preferences.pl b/admin/preferences.pl >index 2862e69ee1..21e98ac5e9 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -29,6 +29,7 @@ use C4::Log; > use C4::Output; > use C4::Templates; > use Koha::Acquisition::Currencies; >+use Koha::Patron::Attribute::Types; > use File::Spec; > use IO::File; > use YAML::Syck qw(); >@@ -375,6 +376,21 @@ if ( $tab ) { > ); > } > >+$template->param( >+ additional_db_columns => { >+ borrowers => { >+ map { >+ ( >+ key => $_->{code}, >+ val => $_->{code}, >+ description => $_->{description}, >+ checked => 0, >+ ) >+ } @{ Koha::Patron::Attribute::Types->search->unblessed } >+ } >+ } >+); >+ > $template->param( TABS => \@TABS ); > > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >index c9ef8e7290..3ae20c2297 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >@@ -1,4 +1,5 @@ > [% USE raw %] >+[% USE To %] > [% USE Asset %] > [% USE Koha %] > [% SET footerjs = 1 %] >@@ -239,6 +240,7 @@ > var MSG_ALL_VALUE_WARN = _("Note: _ALL_ value will override all other values"); > var MSG_UPD_LOC_FORMAT_WARN = _("The following values are not formatted correctly:"); > var MSG_INVALID = _( "Error: presence of invalid data prevent saving. Please make the corrections and try again." ); >+ var additional_db_columns = [% To.json( additional_db_columns ) %]; > </script> > [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] > [% Asset.js("js/ajax.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >index 9d9599a4d8..bfcf052100 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >@@ -213,6 +213,10 @@ $( document ).ready( function () { > var pref_value = this.value; > var prefs = pref_value.split("|"); > >+ var additional_items = []; >+ if ( additional_db_columns.hasOwnProperty(datasource) ) { >+ additional_items = additional_db_columns[datasource]; >+ } > $.getJSON( themelang + "/modules/admin/preferences/" + datasource + ".json", function( data ){ > var items = []; > var checked = ""; >@@ -224,6 +228,10 @@ $( document ).ready( function () { > } > items.push('<label><input class="dbcolumn_selection" type="checkbox" id="' + key + '"' + checked + ' name="pref" value="' + val + '" /> ' + key + '</label>'); > }); >+ >+ $(additional_items).each(function(){ >+ items.push('<label><input class="dbcolumn_selection" type="checkbox" id="' + this['key'] + '"' + this['checked'] + ' name="pref" value="' + this['val'] + '" /> ' + this['description'] + '</label>'); >+ }); > $("<div/>", { > "class": "columns-2", > html: items.join("") >-- >2.11.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 22844
:
89322
|
89323
|
89389
|
89403
|
89530
|
89531
|
89749
|
89903
|
89904
|
89905
|
90407
|
96007
|
98145
|
98146
|
98147
|
98148
|
98149
|
98150
|
98151
|
98297
|
98298
|
100440
|
100441
|
100442
|
100443
|
100444
|
100445
|
100446
|
100447
|
101198
|
101199
|
101200
|
101201
|
101202
|
101203
|
101204
|
101205
|
101302
|
101480
|
101481
|
101482
|
101483
|
101484
|
101485
|
101486
|
101487
|
101488
|
101617
|
101618
|
101619
|
101620
|
101621
|
101622
|
101623
|
101624
|
103842
|
103843
|
103844
|
103845
|
103846
|
103847
|
103848
|
103849
|
103850
|
103904
|
103960
|
103961
|
103962
|
103963
|
103964
|
103965
|
103966
|
103967
|
103968
|
103969
|
106545
|
106546
|
106547
|
106548
|
106549
|
106550
|
106551
|
106552
|
106553
|
106554
|
107126