From 594adf2190ebfab2efe504ae1e8e43df7f204b79 Mon Sep 17 00:00:00 2001 From: George Veranis Date: Thu, 24 Feb 2022 16:16:19 +0100 Subject: [PATCH] Bug 20615: Add the link of number of times the authority are used in edit mode Currently when show an authority record you can see the count of records linked with that authority, but when edit that authority record the that detail is dissapeared. Applying this patch will have that information also on edit mode of authority. Test plan: 1) Search for an authority that is already connected with at least one record 2) On detail view of an authority you can check that authority is linked with x records. 3) Edit that authority and the information about in how many records that authority is linked is missing. 4) Apply this patch 5) Edit again that authrity and you can find now the count in how many records is used that authority Signed-off-by: Marjorie Barry-Vila Signed-off-by: Fridolin Somers --- authorities/authorities.pl | 5 ++++- .../prog/en/modules/authorities/authorities.tt | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index 3b4a5d64be..1c2b3d068c 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -557,13 +557,16 @@ if(!$authtypecode) { $authtypecode = $authid ? Koha::Authorities->find($authid)->authtypecode : ''; } +my $authobj = Koha::Authorities->find($authid); +my $count = $authobj ? $authobj->get_usage_count : 0; + my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "authorities/authorities.tt", query => $input, type => "intranet", flagsrequired => {editauthorities => 1}, }); -$template->param(nonav => $nonav,index=>$myindex,authtypecode=>$authtypecode,breedingid=>$breedingid); +$template->param(nonav => $nonav,index=>$myindex,authtypecode=>$authtypecode,breedingid=>$breedingid, count=>$count); $tagslib = GetTagsLabels(1,$authtypecode); $mandatory_z3950 = GetMandatoryFieldZ3950($authtypecode); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index b40b8fb358..2954c8d934 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -352,7 +352,13 @@ - +
+ [% IF count %] + Used in [% count | html %] record(s) + [% ELSE %] + This authority is not used in any records. + [% END %] +
    [% FOREACH BIG_LOO IN BIG_LOOP %] -- 2.39.5