Bugzilla – Attachment 177468 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.92 KB, created by
Arthur Suzuki
on 2025-02-03 11:53:45 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-03 11:53:45 UTC
Size:
6.92 KB
patch
obsolete
>From 751500f1b8ffe74035044f71cc1ee2b189cee635 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 | 9 +++++ > .../prog/en/includes/cat-toolbar.inc | 9 ++++- > .../prog/en/includes/modals/record_source.inc | 34 +++++++++++++++++++ > .../integration/Catalogue/Detail_spec.ts | 6 ++-- > 4 files changed, 54 insertions(+), 4 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 9a1306cf055..0a1bd963070 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -98,6 +98,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/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index 37a7d05ee00..ff0b71a3b02 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 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"> >@@ -300,3 +306,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..73417fa0bca >--- /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-dismiss="modal">Close</button> >+ </div> >+ </form> >+ </div> >+ </div> >+</div> >diff --git a/t/cypress/integration/Catalogue/Detail_spec.ts b/t/cypress/integration/Catalogue/Detail_spec.ts >index 277f79c14af..918f6aee147 100644 >--- a/t/cypress/integration/Catalogue/Detail_spec.ts >+++ b/t/cypress/integration/Catalogue/Detail_spec.ts >@@ -19,9 +19,9 @@ describe("Set record_source button is present", () => { > cy.get("#record_source_id").select("No specified source"); > cy.get("button").contains("Set record source").click(); > >- cy.intercept("GET", '/api/v1/record_sources*').as('listSources') >+ cy.intercept("GET", "/api/v1/record_sources*").as("listSources"); > cy.visit("/cgi-bin/koha/admin/record_sources"); >- cy.wait('@listSources') >+ cy.wait("@listSources"); > cy.get("tr:last-child a.delete").click(); > cy.contains("Poop"); > cy.get("button.approve").click(); >@@ -36,4 +36,4 @@ describe("Set record_source button is present", () => { > cy.visit("/cgi-bin/koha/catalogue/detail.pl?biblionumber=51"); > cy.get("#catalogue_detail_record_source").contains("Poop"); > }); >-}); >\ No newline at end of file >+}); >-- >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