Bugzilla – Attachment 176743 Details for
Bug 36372
Allow privileged users to set the 'record source' on cataloguing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36372: (QA follow-up) moving specific .pl and .tt to a modal.
Bug-36372-QA-follow-up-moving-specific-pl-and-tt-t.patch (text/plain), 10.45 KB, created by
Arthur Suzuki
on 2025-01-17 15:33:21 UTC
(
hide
)
Description:
Bug 36372: (QA follow-up) moving specific .pl and .tt to a modal.
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2025-01-17 15:33:21 UTC
Size:
10.45 KB
patch
obsolete
>From ca5cdb97368e50e0f00c15290e3db97dcedb1cc2 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >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 <http://www.gnu.org/licenses>. >- >-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 %] >- <li><a class="dropdown-item" id="setrecordsource" href="/cgi-bin/koha/cataloguing/record_source.pl?biblionumber=[% biblionumber | html %]">Set record source</a></li> >+ <li><a class="dropdown-item" id="setrecordsource" href="#" data-bs-toggle="modal" data-bs-target="#setRecordSourceModal">Set record source</a></li> > [% ELSE %] > <li data-bs-toggle="tooltip" data-bs-placement="left" title="This record is locked"><a class="dropdown-item disabled" aria-disabled="true" id="setrecordsource" href="#">Set record source</a></li> > [% END %] >@@ -335,3 +335,4 @@ > </div> > > [% 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 @@ >+<!-- Set record source --> >+<div class="modal" id="setRecordSourceModal" tabindex="-1" role="dialog" aria-labelledby="setRecordSourceLabel"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ >+ <h1 class="modal-title" id="setRecordSourceModal_">Set the record source [% IF ( biblio.title ) %] for [% INCLUDE 'biblio-title.inc' %][% END %]</h1> >+ >+ </div> >+ <form method="post" action="/cgi-bin/koha/catalogue/detail.pl"> >+ <div class="modal-body"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html_entity %]" /> >+ <input type="hidden" name="set_record_source" value="1" /> >+ <select id="record_source_id" name="record_source_id"> >+ <option value=''>No specified source</option> >+ [% FOREACH source IN record_sources %] >+ [% IF ( source.record_source_id == current_source.record_source_id ) %] >+ <option value="[% source.record_source_id | html_entity %]" selected="selected">[% source.name | html_entity %]</option> >+ [% ELSE %] >+ <option value="[% source.record_source_id | html_entity %]">[% source.name | html_entity %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ <a class="btn btn-secondary" href="/cgi-bin/koha/admin/record_sources">Configure record sources</a> >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-primary">Set record source</button> >+ <button type="button" class="btn btn-default" data-bs-dismiss="modal">Close</button> >+ </div> >+ </form> >+ </div> >+ </div> >+</div> >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' %] >-<title>[% FILTER collapse %] >- [% t("Set record sources for") | html %] [% INCLUDE 'biblio-title-head.inc' %] › >- [% t("Cataloging") | html %] › >- [% t("Koha") | html %] >-[% END %]</title> >-[% INCLUDE 'doc-head-close.inc' %] >-</head> >-<body id="catalog_set_record_source" class="catalog"> >-[% WRAPPER 'header.inc' %] >- [% INCLUDE 'cat-search.inc' %] >-[% END %] >- >-[% WRAPPER 'sub-header.inc' %] >- [% WRAPPER breadcrumbs %] >- [% WRAPPER breadcrumb_item %] >- <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> >- [% END %] >- [% WRAPPER breadcrumb_item %] >- [% INCLUDE 'biblio-title.inc' link = 1 %] >- [% END %] >- [% WRAPPER breadcrumb_item bc_active= 1 %] >- <span>Set record's source</span> >- [% 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 %] >- >-<div class="main container-fluid"> >- <div class="row"> >- <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> >- [% INCLUDE 'messages.inc' %] >- >- <h1>Set the record source [% IF ( biblio.title ) %] for [% INCLUDE 'biblio-title.inc' %][% END %]</h1> >- >- <form method="get" action="/cgi-bin/koha/cataloguing/record_source.pl"> >- <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html_entity %]" /> >- <select id="record_source_id" name="record_source_id"> >- <option value=''>No specified source</option> >- [% FOREACH source IN record_sources %] >- [% IF ( source.record_source_id == current_source.record_source_id ) %] >- <option value="[% source.record_source_id | html_entity %]" selected="selected">[% source.name | html_entity %]</option> >- [% ELSE %] >- <option value="[% source.record_source_id | html_entity %]">[% source.name | html_entity %]</option> >- [% END %] >- [% END %] >- </select> >- <div class="btn-group"> >- <input type="submit" name="save" class="btn btn-primary" value="Set record source" /> >- <a class="btn btn-secondary" href="/cgi-bin/koha/admin/record_sources">Configure record sources</a> >- </div> >- </form> >- </div> >-</div> >-[% INCLUDE 'intranet-bottom.inc' %] >-- >2.39.5
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 36372
:
166161
|
168054
|
168195
|
168338
|
168339
|
168340
|
168430
|
168510
|
168511
|
168512
|
168897
|
168898
|
168899
|
168900
|
168902
|
169268
|
169269
|
169270
|
169271
|
169542
|
169831
|
172369
|
172370
|
172371
| 176743 |
176744