Bugzilla – Attachment 105267 Details for
Bug 19909
Show attributes in patron search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19909: Show attributes in patron search results
Bug-19909-Show-attributes-in-patron-search-results.patch (text/plain), 6.03 KB, created by
Julian Maurice
on 2020-05-22 13:36:45 UTC
(
hide
)
Description:
Bug 19909: Show attributes in patron search results
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2020-05-22 13:36:45 UTC
Size:
6.03 KB
patch
obsolete
>From c27ba125ea244daba34c02afaf1293fb8c3c2e40 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 3 Jan 2018 11:53:59 +0100 >Subject: [PATCH] Bug 19909: Show attributes in patron search results > >Add a new column (hidden by default) in the results table which >displays all attributes associated to the corresponding patron. > >Test plan: >1. Enable ExtendedPatronAttributes >2. Create some patron attribute types, with and without an associated >authorised value category >3. Choose an existing patron and set a value for each attribute >4. Go to patron search and do a search that will return your patron (and >some others to avoid the redirection) >5. Show column 'Extended attributes' by clicking on 'Column visibility' >button >6. Note that all attributes are displayed correctly >7. prove t/db_dependent/Koha/Patron/Attributes.t >8. Disable syspref ExtendedPatronAttributes and verify that the column > is not displayed > >Signed-off-by: Cab Vinton <bibliwho@gmail.com> >--- > C4/Utils/DataTables/Members.pm | 4 ++++ > admin/columns_settings.yml | 3 +++ > .../intranet-tmpl/prog/en/modules/members/member.tt | 10 ++++++++++ > .../prog/en/modules/members/tables/members_results.tt | 4 ++++ > 4 files changed, 21 insertions(+) > >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index 29efd0bd3c..6fd151999b 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -4,6 +4,7 @@ use Modern::Perl; > use C4::Context; > use C4::Utils::DataTables; > use Koha::DateUtils; >+use Koha::Patron::Attributes; > > sub search { > my ( $params ) = @_; >@@ -213,6 +214,9 @@ sub search { > my $balance = $patron_object->account->balance; > # FIXME Should be formatted from the template > $patron->{fines} = sprintf("%.2f", $balance); >+ if (C4::Context->preference('ExtendedPatronAttributes')) { >+ $patron->{attributes} = Koha::Patron::Attributes->search({ borrowernumber => $patron_object->borrowernumber }); >+ } > > if( $patron->{dateexpiry} ) { > # FIXME We should not format the date here, do it in template-side instead >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index 323c431d6e..7e9c795580 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -705,6 +705,9 @@ modules: > columnname: od_checkouts > - > columnname: fines >+ - >+ columnname: extended_attributes >+ is_hidden: 1 > - > columnname: circ_notes > - >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >index 209932b7a6..e8c94bd6c6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >@@ -103,6 +103,9 @@ > <th>Expires on</th> > <th>OD/Checkouts</th> > <th>Fines</th> >+ [% IF Koha.Preference('ExtendedPatronAttributes') %] >+ <th>Extended attributes</th> >+ [% END %] > <th>Circ note</th> > <th> </th> > </tr> >@@ -369,6 +372,10 @@ > [%# Remove the first column if we do not display the checkbox %] > columns_settings.splice(0, 1); > [% END %] >+ [% UNLESS Koha.Preference('ExtendedPatronAttributes') %] >+ const extendedAttributesColumnIndex = columns_settings.findIndex(column => column.columnname === 'extended_attributes'); >+ columns_settings.splice(extendedAttributesColumnIndex, 1); >+ [% END %] > dtMemberResults = KohaTable("memberresultst", { > 'bServerSide': true, > 'sAjaxSource': "/cgi-bin/koha/svc/members/search", >@@ -438,6 +445,9 @@ > { 'mDataProp': 'dt_dateexpiry' }, > { 'mDataProp': 'dt_od_checkouts', 'bSortable': false }, > { 'mDataProp': 'dt_fines', 'bSortable': false }, >+ [% IF Koha.Preference('ExtendedPatronAttributes') %] >+ { 'mDataProp': 'dt_extended_attributes', 'bSortable': false }, >+ [% END %] > { 'mDataProp': 'dt_borrowernotes' }, > { 'mDataProp': 'dt_action', 'bSortable': false, 'sClass': 'actions' } > ], >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt >index ae6364dedf..f8868ff00c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt >@@ -3,6 +3,7 @@ > [% USE AuthorisedValues %] > [% USE KohaDates %] > [% USE Price %] >+[% USE Koha %] > { > "sEcho": [% sEcho | html %], > "iTotalRecords": [% iTotalRecords | html %], >@@ -30,6 +31,9 @@ > "[% IF data.overdues %]<span class='overdue'><strong>[% data.overdues | html %]</strong></span>[% ELSE %][% data.overdues | html %][% END %] / [% data.issues | html %]", > "dt_fines": > "<span style='text-align: right; display: block;'><a href=\"/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% data.borrowernumber | html %]\">[% IF data.fines < 0 %]<span class='credit'>[% data.fines | $Price %]</span>[% ELSIF data.fines > 0 %]<span class='debit'><strong>[% data.fines | $Price %]</strong></span>[% ELSE %][% data.fines | $Price %][% END %]</a></span>", >+ [% IF Koha.Preference('ExtendedPatronAttributes') %] >+ "dt_extended_attributes": "<ul>[% FOREACH attribute IN data.attributes %]<li>[% attribute.type.description | html %]: [% attribute.description | html | html_line_break | collapse %]</li>[% END %]</ul>", >+ [% END %] > "dt_borrowernotes": > "[% data.borrowernotes | html_line_break | collapse | $To %]", > "dt_action": >-- >2.20.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 19909
:
70243
|
77161
|
77467
|
78213
|
105267
|
105281
|
106528