From d48d6defa76b36523e8453168b63a4bdbf4e369f Mon Sep 17 00:00:00 2001 From: Arthur Suzuki 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 @@ [% 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 ) %]
[% 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 @@ + + -- 2.39.5