Bugzilla – Attachment 150212 Details for
Bug 33607
Show framework on record details page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33607: Add framework display to staff details page
Bug-33607-Add-framework-display-to-staff-details-p.patch (text/plain), 5.26 KB, created by
Nick Clemens (kidclamp)
on 2023-04-25 15:21:30 UTC
(
hide
)
Description:
Bug 33607: Add framework display to staff details page
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-04-25 15:21:30 UTC
Size:
5.26 KB
patch
obsolete
>From 01b855d14f15c27fc44584b7cce00d4eb5797386 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 25 Apr 2023 14:14:19 +0000 >Subject: [PATCH] Bug 33607: Add framework display to staff details page > >This patch adds a Frameworks pluing to allow fetching the framework text >and displays this on the intranet details page > >To test: >1 - Apply patch >2 - View a record details page in staff >3 - Confirm you see the framework name >4 - prove -v t/db_dependent/Template/Plugin/Frameworks.t >--- > Koha/Template/Plugin/Frameworks.pm | 38 ++++++++++++++ > .../prog/en/modules/catalogue/detail.tt | 5 ++ > t/db_dependent/Template/Plugin/Frameworks.t | 52 +++++++++++++++++++ > 3 files changed, 95 insertions(+) > create mode 100644 Koha/Template/Plugin/Frameworks.pm > create mode 100644 t/db_dependent/Template/Plugin/Frameworks.t > >diff --git a/Koha/Template/Plugin/Frameworks.pm b/Koha/Template/Plugin/Frameworks.pm >new file mode 100644 >index 0000000000..a13a225feb >--- /dev/null >+++ b/Koha/Template/Plugin/Frameworks.pm >@@ -0,0 +1,38 @@ >+package Koha::Template::Plugin::Frameworks; >+ >+# Copyright ByWater Solutions 2023 >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Template::Plugin; >+use base qw( Template::Plugin ); >+ >+use Koha::BiblioFrameworks; >+ >+sub GetName { >+ my ( $self, $frameworkcode ) = @_; >+ return q{} unless defined $frameworkcode; >+ return q{} if $frameworkcode eq q{}; >+ >+ my $f = Koha::BiblioFrameworks->find($frameworkcode); >+ >+ my $frameworktext = $f ? $f->frameworktext : $frameworkcode; >+ return $frameworktext; >+} >+ >+1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 1fdb6fe7eb..0442d069c7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -6,6 +6,7 @@ > [% USE AuthorisedValues %] > [% USE Branches %] > [% USE Biblio %] >+[% USE Frameworks %] > [% USE Price %] > [% USE TablesSettings %] > [% PROCESS 'i18n.inc' %] >@@ -135,6 +136,10 @@ > </span> > [% END %] > <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber | uri %]&viewas=html" title="MARC" class="previewMARC">Show</a></span> >+ <span id="catalogue_detail_framework" class="results_summary"> >+ <span class="label">MARC framework:</span> >+ <span class="frameworkcode">[% Frameworks.GetName(biblio.frameworkcode) | html %]</span> >+ </span> > [% IF !item_level_itypes || Koha.Preference("BiblioItemtypeInfo") %] > <span class="results_summary itemtype"><span class="label">Itemtype:</span> > [% IF ( !noItemTypeImages && imageurl ) %] >diff --git a/t/db_dependent/Template/Plugin/Frameworks.t b/t/db_dependent/Template/Plugin/Frameworks.t >new file mode 100644 >index 0000000000..15a9a0e948 >--- /dev/null >+++ b/t/db_dependent/Template/Plugin/Frameworks.t >@@ -0,0 +1,52 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 2; >+use Test::MockModule; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+BEGIN { >+ use_ok('Koha::Template::Plugin::Frameworks'); >+} >+ >+my $schema = Koha::Database->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+$schema->storage->txn_begin; >+ >+subtest 'GetName tests' => sub { >+ plan tests => 3; >+ >+ my $framework = $builder->build_object({ class => 'Koha::BiblioFrameworks' })->store; >+ >+ my $plugin = Koha::Template::Plugin::Frameworks->new(); >+ >+ my $name = $plugin->GetName( $framework->frameworkcode ); >+ is( $name, $framework->frameworktext, "Name correctly fetched" ); >+ >+ $name = $plugin->GetName(); >+ is( $name, q{}, "Nothing returned if nothing passed" ); >+ >+ $framework->delete; >+ $name = $plugin->GetName( $framework->frameworkcode ); >+ is( $name, $framework->frameworkcode, "When framework not found, we get the code back" ); >+}; >+ >+$schema->storage->txn_rollback; >-- >2.30.2
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 33607
:
150212
|
150238
|
150574
|
150578
|
150579
|
150836
|
150860
|
150861