From ca5cdb97368e50e0f00c15290e3db97dcedb1cc2 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Fri, 17 Jan 2025 11:41:45 +0100 Subject: [PATCH] Bug 36372: (QA follow-up) moving specific .pl and .tt to a modal. --- catalogue/detail.pl | 9 +++ cataloguing/record_source.pl | 68 ------------------- .../prog/en/includes/cat-toolbar.inc | 3 +- .../prog/en/includes/modals/record_source.inc | 34 ++++++++++ .../en/modules/cataloguing/record_source.tt | 65 ------------------ 5 files changed, 45 insertions(+), 134 deletions(-) delete mode 100755 cataloguing/record_source.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/modals/record_source.inc delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 7af8010343c..1bd65e3e2a9 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -104,6 +104,15 @@ unless ( $biblio ) { exit; } + +if ( $query->param('set_record_source') eq '1' ) { + $biblio->metadata->set( { record_source_id => $query->param('record_source_id') } )->store; + my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); + $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" ); +} + +$template->param( record_sources => Koha::RecordSources->search() ); + my $marc_record = eval { $biblio->metadata->record }; my $invalid_marc_record = $@ || !$marc_record; if ($invalid_marc_record) { diff --git a/cataloguing/record_source.pl b/cataloguing/record_source.pl deleted file mode 100755 index d9fbd87242c..00000000000 --- a/cataloguing/record_source.pl +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2000-2002 Katipo Communications -# Copyright 2004-2010 BibLibre -# -# 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 . - -use Modern::Perl; - -use CGI; -use C4::Output qw( output_html_with_http_headers ); -use C4::Auth qw( get_template_and_user haspermission ); -use C4::Biblio qw( ModBiblio ); -use C4::Context; -use Koha::DateUtils qw( dt_from_string ); -use Koha::Biblios; -use Koha::RecordSources; -use Koha::SearchEngine; -use Koha::SearchEngine::Indexer; -use URI::Escape qw( uri_escape_utf8 ); - -# ======================== -# MAIN -#========================= -my $input = CGI->new; -my $biblionumber = $input->param('biblionumber'); -my $record_source_id = $input->param('record_source_id') // ''; -my $save = $input->param('save') // ''; -my $biblio = Koha::Biblios->find($biblionumber); - -if ($save) { - $biblio->metadata->set( { record_source_id => $record_source_id } )->store; - my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); - $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" ); - print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber"); -} - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "cataloguing/record_source.tt", - query => $input, - type => "intranet", - flagsrequired => { editcatalogue => 'set_record_sources' }, - } -); - -my $record_sources = Koha::RecordSources->search(); - -$template->param( - biblio => $biblio, - record_sources => $record_sources, - current_source => { record_source_id => $biblio->metadata->record_source_id }, -); - -output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index 4479a0cbe0e..b88d900477c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -48,7 +48,7 @@ [% END %] [% IF CAN_user_editcatalogue_set_record_sources %] -
  • Set record source
  • +
  • Set record source
  • [% ELSE %]
  • Set record source
  • [% END %] @@ -335,3 +335,4 @@ [% INCLUDE modals/place_booking.inc %] + [% INCLUDE modals/record_source.inc %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/record_source.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/record_source.inc new file mode 100644 index 00000000000..34d40077e06 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/record_source.inc @@ -0,0 +1,34 @@ + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt deleted file mode 100644 index c6651624f6a..00000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt +++ /dev/null @@ -1,65 +0,0 @@ -[% USE raw %] -[% PROCESS 'i18n.inc' %] -[% SET footerjs = 1 %] -[% INCLUDE 'doc-head-open.inc' %] -[% FILTER collapse %] - [% t("Set record sources for") | html %] [% INCLUDE 'biblio-title-head.inc' %] › - [% t("Cataloging") | html %] › - [% t("Koha") | html %] -[% END %] -[% INCLUDE 'doc-head-close.inc' %] - - -[% WRAPPER 'header.inc' %] - [% INCLUDE 'cat-search.inc' %] -[% END %] - -[% WRAPPER 'sub-header.inc' %] - [% WRAPPER breadcrumbs %] - [% WRAPPER breadcrumb_item %] - Catalog - [% END %] - [% WRAPPER breadcrumb_item %] - [% INCLUDE 'biblio-title.inc' link = 1 %] - [% END %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - Set record's source - [% END %] - [% END #/ WRAPPER breadcrumbs %] -[% END #/ WRAPPER sub-header.inc %] - -[% SWITCH Koha.Preference('IntranetBiblioDefaultView') %] -[% CASE 'marc' %] [% action_link = "/cgi-bin/koha/catalogue/MARCdetail.pl" %] -[% CASE 'labeled_marc' %] [% action_link = "/cgi-bin/koha/catalogue/labeledMARCdetail.pl" %] -[% CASE 'isbd' %] [% action_link = "/cgi-bin/koha/catalogue/ISBDdetail.pl" %] -[% CASE %] [% action_link = "/cgi-bin/koha/catalogue/detail.pl" %] -[% END %] -[% action_link = action_link _ '?biblionumber=' _ biblio.biblionumber %] - -
    -
    -
    - [% INCLUDE 'messages.inc' %] - -

    Set the record source [% IF ( biblio.title ) %] for [% INCLUDE 'biblio-title.inc' %][% END %]

    - -
    - - - -
    -
    -
    -[% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5