Bugzilla – Attachment 168511 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), 6.98 KB, created by
Janusz Kaczmarek
on 2024-07-04 19:48:37 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-04 19:48:37 UTC
Size:
6.98 KB
patch
obsolete
>From 87d17d1b5dba9fb19989be95ddb4ec1b070f7839 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 | 40 ++++++++++++ > 3 files changed, 109 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..372854d2f6 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt >@@ -0,0 +1,40 @@ >+[% USE raw %] >+[% USE Price %] >+[% USE Asset %] >+[% USE Koha %] >+[% USE Branches %] >+[% USE Price %] >+[% SET footerjs = 1 %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Item details for [% INCLUDE 'biblio-title-head.inc' %] › Catalog › Koha</title> >+[% INCLUDE 'doc-head-close.inc' %] >+<style>.listgroup .rows{margin-left:1em;}</style> >+</head> >+<body id="catalog_moredetail" class="catalog"> >+[% USE KohaDates %] >+[% WRAPPER 'header.inc' %] >+ [% INCLUDE 'cat-search.inc' %] >+[% END %] >+ >+<span>Editing record source for biblio [% biblionumber %]</span> >+ >+[% UNLESS record_sources.count %] >+<div> >+ <span>There is no record sources defined.</span> >+</div> >+[% END %] >+ >+<form method="get" action="/cgi-bin/koha/cataloguing/record_source.pl"> >+ <input type="hidden" name="biblionumber" value="[% 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 %]>[% source.name %]</option> >+ [% 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> >+[% 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