From 78c57bf500a31f56f813313fcfd2f4d683891c50 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 15 Apr 2022 21:22:59 +0000 Subject: [PATCH] Bug 30553: Add file count to patron circ-menu To test: 1. Apply patch 2. Enable the system preference 'EnableBorrowerFiles' 3. Go to a patron account and noticet the Files tab on left nav bar. 4. It should read "Files (0)" 5. Begin uploading some files to the borrower. The tab should reflect the number of files uploaded. 6. Go to other pages on the borrower account ( Checkout, Details, etc. ) 7. The number of files should display from all borrower pages Signed-off-by: Barbara Johnson --- Koha/Patron.pm | 12 ++++++++++++ .../intranet-tmpl/prog/en/includes/circ-menu.inc | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index e88e72551c..e9d5fba881 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -45,6 +45,7 @@ use Koha::Patron::Debarments; use Koha::Patron::HouseboundProfile; use Koha::Patron::HouseboundRole; use Koha::Patron::Images; +use Koha::Patron::Files; use Koha::Patron::Messages; use Koha::Patron::Modifications; use Koha::Patron::Relationships; @@ -436,6 +437,17 @@ sub image { return Koha::Patron::Images->find( $self->borrowernumber ); } +=head3 filecount + +=cut + +sub filecount { + my ( $self ) = @_; + + my $files = Koha::Patron::Files->new( borrowernumber => $self->borrowernumber )->GetFilesInfo(); + return $files; +} + =head3 library Returns a Koha::Library object representing the patron's home library. diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 926008ed94..dfb976f70d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -159,7 +159,7 @@ [% END %] [% IF CAN_user_borrowers_edit_borrowers %] [% IF ( EnableBorrowerFiles ) %] - [% IF ( borrower_files ) %]
  • [% ELSE %]
  • [% END %]Files
  • + [% IF ( borrower_files ) %]
  • [% ELSE %]
  • [% END %]Files ([% patron.filecount.size | html%])
  • [% END %] [% END %] -- 2.30.2