Bugzilla – Attachment 103483 Details for
Bug 25253
Allow to apply modification template when exporting checkouts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25253: Allow to apply modification template when exporting checkouts
Bug-25253-Allow-to-apply-modification-template-whe.patch (text/plain), 5.58 KB, created by
Julian Maurice
on 2020-04-22 14:33:25 UTC
(
hide
)
Description:
Bug 25253: Allow to apply modification template when exporting checkouts
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2020-04-22 14:33:25 UTC
Size:
5.58 KB
patch
obsolete
>From 82cec5445468e733c5067fec3d5042355fa44c1d Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 22 Apr 2020 16:03:01 +0200 >Subject: [PATCH] Bug 25253: Allow to apply modification template when > exporting checkouts > >Test plan: >0. Apply bug 24679 >1. Enable ExportCircHistory syspref >2. Create a MARC modification template >3. Go to 'Check out' or 'Details' tab of a borrower with checkouts >4. Make the checkouts table appear >5. Under the checkouts table, choose a MARC modification template, and >click on 'Export' >6. Verify that the modification template has been applied in the >exported file >--- > .../Plugin/MarcModificationTemplates.pm | 48 +++++++++++++++++++ > .../prog/en/includes/checkouts-table.inc | 13 +++++ > .../Plugin/MarcModificationTemplates.t | 47 ++++++++++++++++++ > 3 files changed, 108 insertions(+) > create mode 100644 Koha/Template/Plugin/MarcModificationTemplates.pm > create mode 100644 t/db_dependent/Template/Plugin/MarcModificationTemplates.t > >diff --git a/Koha/Template/Plugin/MarcModificationTemplates.pm b/Koha/Template/Plugin/MarcModificationTemplates.pm >new file mode 100644 >index 0000000000..72ebf57dfa >--- /dev/null >+++ b/Koha/Template/Plugin/MarcModificationTemplates.pm >@@ -0,0 +1,48 @@ >+package Koha::Template::Plugin::MarcModificationTemplates; >+ >+# Copyright 2020 BibLibre >+# >+# 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 C4::MarcModificationTemplates; >+ >+use base 'Template::Plugin'; >+ >+=head1 NAME >+ >+Koha::Template::Plugin::MarcModificationTemplates >+ >+=head1 SYNOPSIS >+ >+ [% USE MarcModificationTemplates %] >+ >+ [% marc_modification_templates = MarcModificationTemplates.all() %] >+ >+=head1 METHODS >+ >+=head2 all >+ >+Returns all modification templates >+ >+ [% marc_modification_templates = MarcModificationTemplates.all() %] >+ >+=cut >+ >+sub all { >+ return [ C4::MarcModificationTemplates::GetModificationTemplates() ]; >+} >+ >+1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >index 7b967bec89..44d310edeb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >@@ -1,4 +1,5 @@ > [% USE Koha %] >+[% USE MarcModificationTemplates %] > <div id="checkouts"> > [% IF ( issuecount ) %] > <div id="issues-table-loading-message"> >@@ -71,6 +72,18 @@ > [% END %] > </select> > [% END %] >+ >+ [% marc_modification_templates = MarcModificationTemplates.all() %] >+ [% IF marc_modification_templates %] >+ <label>Use modification template:</label> >+ <select name="marc_modification_template_id"> >+ <option value=""></option> >+ [% FOREACH marc_modification_template IN marc_modification_templates %] >+ <option value="[% marc_modification_template.template_id | html %]">[% marc_modification_template.name | html %]</option> >+ [% END %] >+ </select> >+ [% END %] >+ > <label for="export_remove_fields">Don't export fields:</label> <input type="text" id="export_remove_fields" name="export_remove_fields" value="[% Koha.Preference('ExportRemoveFields') | html %]" title="Use for MARC exports" /> > <input type="hidden" name="op" value="export" /> > <input type="hidden" id="output_format" name="output_format" value="iso2709" /> >diff --git a/t/db_dependent/Template/Plugin/MarcModificationTemplates.t b/t/db_dependent/Template/Plugin/MarcModificationTemplates.t >new file mode 100644 >index 0000000000..9e4aa6985c >--- /dev/null >+++ b/t/db_dependent/Template/Plugin/MarcModificationTemplates.t >@@ -0,0 +1,47 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+ >+use Test::More tests => 2; >+ >+use Koha::Database; >+ >+use t::lib::TestBuilder; >+ >+BEGIN { >+ use_ok('Koha::Template::Plugin::MarcModificationTemplates'); >+} >+ >+my $schema = Koha::Database->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'all() tests' => sub { >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ $schema->resultset('MarcModificationTemplate')->delete(); >+ >+ $builder->build({ >+ source => 'MarcModificationTemplate', >+ value => { >+ name => 'template1', >+ } >+ }); >+ $builder->build({ >+ source => 'MarcModificationTemplate', >+ value => { >+ name => 'template2', >+ } >+ }); >+ >+ my $plugin = Koha::Template::Plugin::MarcModificationTemplates->new(); >+ >+ my $templates = $plugin->all(); >+ >+ is(scalar @$templates, 2, 'all() returns all templates'); >+ is($templates->[0]->{name}, 'template1', 'all() returns all templates'); >+ is($templates->[1]->{name}, 'template2', 'all() returns all templates'); >+ >+ $schema->storage->txn_rollback; >+}; >-- >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 25253
: 103483