Bugzilla – Attachment 178706 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.42 KB, created by
Arthur Suzuki
on 2025-02-26 09:43:18 UTC
(
hide
)
Description:
Bug 36372: provide an interface to set the source of a record from the staff interface
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2025-02-26 09:43:18 UTC
Size:
6.42 KB
patch
obsolete
>From d48d6defa76b36523e8453168b63a4bdbf4e369f 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 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. >--- > catalogue/detail.pl | 12 +++++-- > .../prog/en/includes/cat-toolbar.inc | 9 +++++- > .../prog/en/includes/modals/record_source.inc | 32 +++++++++++++++++++ > 3 files changed, 50 insertions(+), 3 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/modals/record_source.inc > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index d7d13b2f1dd..d71c4fd8e8b 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -99,13 +99,21 @@ unless ($biblio) { > > # biblionumber invalid -> report and exit > $template->param( >- blocking_error => 'unknown_biblionumber', >- biblionumber => $biblionumber >+ unknownbiblionumber => 1, >+ biblionumber => $biblionumber > ); > output_html_with_http_headers $query, $cookie, $template->output; > 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/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index 2b033e40f6a..0cf1f4c9528 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -34,7 +34,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-bs-toggle="dropdown" aria-expanded="false"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</button> > <ul class="dropdown-menu"> >@@ -46,6 +46,12 @@ > [% END %] > [% END %] > >+ [% IF CAN_user_editcatalogue_set_record_sources %] >+ <li><a class="dropdown-item" id="setrecordsource" href="#" data-toggle="modal" data-target="#setRecordSourceModal">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"> >@@ -345,3 +351,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..8757b9190f9 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/record_source.inc >@@ -0,0 +1,32 @@ >+<!-- 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-dismiss="modal">Close</button> >+ </div> >+ </form> >+ </div> >+ </div> >+</div> >-- >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
|
177467
|
177468
|
178705
| 178706