Bugzilla – Attachment 169269 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: provide an interface to set the source of a record from the staff interface
Bug-36372-provide-an-interface-to-set-the-source-o.patch (text/plain), 8.32 KB, created by
Janusz Kaczmarek
on 2024-07-22 09:57:51 UTC
(
hide
)
Description:
Bug 36372: provide an interface to set the source of a record from the staff interface
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2024-07-22 09:57:51 UTC
Size:
8.32 KB
patch
obsolete
>From 0de1506e3b1512a63c01f56cdaf96236898e9f09 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Wed, 1 May 2024 23:33:47 +0200 >Subject: [PATCH] Bug 36372: provide an interface to set the source of a record > from the staff interface > >Test plan : >- apply Cypress patch >- running cypress patch in ktd will fail >- apply both code patches, cypress tests will pass >- open any record in the staff interface >- with superlibrarian user, click on the "Edit" button group. >- you should be able to click on the "Set record source" below the "Edit record button". >- you will be given a form to choose between any defined record source. If none defined there would be a link to configure the record sources. >- change a users permissions to have cataloguing permissions but without the "set_record_source" permissions. >- login as this forementionned user and go to any record view. >- the "Set record source" button should now be greyed out and not possible to click.# > >Signed-off-by: Janusz Kaczmarek <januszop@gmail.com> >--- > cataloguing/record_source.pl | 62 +++++++++++++++++++ > .../prog/en/includes/cat-toolbar.inc | 8 ++- > .../en/modules/cataloguing/record_source.tt | 61 ++++++++++++++++++ > 3 files changed, 130 insertions(+), 1 deletion(-) > create mode 100644 cataloguing/record_source.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt > >diff --git a/cataloguing/record_source.pl b/cataloguing/record_source.pl >new file mode 100644 >index 0000000000..ffd141321b >--- /dev/null >+++ b/cataloguing/record_source.pl >@@ -0,0 +1,62 @@ >+#!/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 URI::Escape qw( uri_escape_utf8 ); >+ >+# ======================== >+# MAIN >+#========================= >+my $input = CGI->new; >+my $biblionumber = $input->param('biblionumber'); # if biblionumber exists, it's a modif, not a new biblio. >+my $record_source_id = $input->param('record_source_id') // ''; >+my $save = $input->param('save') // ''; >+ >+if ($save ne '') { >+ my $biblio = Koha::Biblios->find($biblionumber); >+ $biblio->metadata->set({record_source_id => $record_source_id})->store; >+ 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( >+ biblionumber => $biblionumber, >+ record_sources => $record_sources, >+); >+ >+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 37a7d05ee0..0456dfacbe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -35,7 +35,7 @@ > </div> > [% END %] > >-[% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items || CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel ) or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >+[% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items || CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel || CAN_user_editcatalogue_set_record_sources ) or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] > <div class="btn-group"> > <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit <span class="caret"></span></button> > <ul class="dropdown-menu"> >@@ -47,6 +47,12 @@ > [% END %] > [% END %] > >+ [% IF CAN_user_editcatalogue_set_record_sources %] >+ <li><a id="setrecordsource" href="/cgi-bin/koha/cataloguing/record_source.pl?biblionumber=[% biblionumber | html %]">Set record source</a></li> >+ [% ELSE %] >+ <li class="disabled"><a id="setrecordsource" href="#">Set record source</a></li> >+ [% END %] >+ > [% IF CAN_user_tools_records_batchmod %] > <li> > <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post"> >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 >new file mode 100644 >index 0000000000..4ddf1b6600 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt >@@ -0,0 +1,61 @@ >+[% 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 %]" /> >+ <select id="record_source_id" name="record_source_id"> >+ <option value=''>No specified source</option> >+ [% FOREACH source IN record_sources %] >+ <option value=[% source.record_source_id %] [% IF ( source.record_source_id == current_source.record_source_id ) %] selected="selected" [% END %]>[% source.name %]</option> >+ [% END %] >+ </select> >+ <div class="btn-group"> >+ <input type="submit" name="save" class="btn btn-primary" value="Set record source" /> >+ <button class="btn" href="/cgi-bin/koha/admin/record_sources" target="_blank">Configure record sources</button> >+ </div> >+ </form> >+ </div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >-- >2.39.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 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