Bug 21345: Patron records with attached files not obvious from patron details view

This patch adds a section to the patron details page for listing files
which have been attached to the patron record.

To test, apply the patch and enable the EnableBorrowerFiles system
preference.

- If necessary, attach some files to a patron record by viewing a patron
  record and choosing "Files" from the sidebar menu.
- View the detail page (moremember.pl) for a patron who has files
  attached.
- You should see a new section under "Alternative contact" with the
  heading "Files."
  - Test the "Manage" button to make sure it takes you to that patron's
    files.
  - Confirm that all the attached files are listed.
  - Confirm that the links to each file work correctly.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch: replace a html filter with uri

Bug 21345: (follow-up) Hide files information if EnableBorrowerFiles is disabled

This patch wraps the new patron file information in a check for the
EnableBorrowerFiles system preference.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2020-07-27 15:57:40 +00:00 committed by Jonathan Druart
parent 0629d4082f
commit 75e25c9d38
2 changed files with 28 additions and 0 deletions

View file

@ -700,6 +700,32 @@
</div>
[% END %]
</div> [% # /div#patron-alternative-contact %]
[% IF Koha.Preference('EnableBorrowerFiles') %]
<div id="patron-files" class="patroninfo-section">
<div class="patroninfo-heading">
<h3>Files</h3>
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/members/files.pl?borrowernumber=[% patron.borrowernumber | uri %]"><i class="fa fa-list"></i> Manage</a>
[% IF ( files ) %]
<div class="rows">
<ol>
[% FOREACH f IN files %]
<li>
<a href="/cgi-bin/koha/members/files.pl?borrowernumber=[% patron.borrowernumber | uri %]&amp;op=download&amp;file_id=[% f.file_id | uri %]">[% f.file_name | html %]</a>
[% IF ( f.file_description ) %]
- [% f.file_description | html %]
[% END %]
</li>
[% END # /FOREACH f %]
</ol>
</div>
[% END # /IF files %]
</div> <!-- /.patroninfo-heading -->
</div> <!-- /#patron-files -->
[% END # /IF EnableBorrowerFiles %]
</div> <!-- /div.col-sm-6 -->
</div> <!-- /div.row -->

View file

@ -40,6 +40,7 @@ use Koha::Patron::Messages;
use Koha::DateUtils;
use Koha::CsvProfiles;
use Koha::Patrons;
use Koha::Patron::Files;
use Koha::Token;
use Koha::Checkouts;
@ -209,6 +210,7 @@ $template->param(
relatives_issues_count => $relatives_issues_count,
relatives_borrowernumbers => \@relatives,
logged_in_user => $logged_in_user,
files => Koha::Patron::Files->new( borrowernumber => $borrowernumber ) ->GetFilesInfo(),
);
output_html_with_http_headers $input, $cookie, $template->output;