From b919b9045b269253717e9d58aedb339ea5366ae5 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Fri, 12 Jul 2024 12:50:06 +0200 Subject: [PATCH] Bug 36372: (QA follow-up) perltidy cataloguing/record_source.pl, fix permissions issues, add html filters to new template# Signed-off-by: Janusz Kaczmarek --- cataloguing/record_source.pl | 25 ++++++++++--------- .../en/modules/cataloguing/record_source.tt | 10 +++++--- .../integration/Catalogue/Detail_spec.ts | 6 ++--- 3 files changed, 23 insertions(+), 18 deletions(-) mode change 100644 => 100755 cataloguing/record_source.pl diff --git a/cataloguing/record_source.pl b/cataloguing/record_source.pl old mode 100644 new mode 100755 index 883bf722ee..1005e1aa1f --- a/cataloguing/record_source.pl +++ b/cataloguing/record_source.pl @@ -22,7 +22,7 @@ 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::Auth qw( get_template_and_user haspermission ); use C4::Biblio qw( ModBiblio ); use C4::Context; use Koha::DateUtils qw( dt_from_string ); @@ -35,14 +35,14 @@ use URI::Escape qw( uri_escape_utf8 ); # ======================== # MAIN #========================= -my $input = CGI->new; -my $biblionumber = $input->param('biblionumber'); +my $input = CGI->new; +my $biblionumber = $input->param('biblionumber'); my $record_source_id = $input->param('record_source_id') // ''; -my $save = $input->param('save') // ''; +my $save = $input->param('save') // ''; +my $biblio = Koha::Biblios->find($biblionumber); if ($save) { - my $biblio = Koha::Biblios->find($biblionumber); - $biblio->metadata->set({record_source_id => $record_source_id})->store; + $biblio->metadata->set( { record_source_id => $record_source_id } )->store; my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" ); print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber"); @@ -50,16 +50,17 @@ if ($save) { my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "cataloguing/record_source.tt", - query => $input, - type => "intranet", - flagsrequired => { editcatalogue => 'set_record_sources' }, - }); + 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, + biblio => $biblio, record_sources => $record_sources, ); 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 index 4ddf1b6600..c6651624f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt @@ -44,16 +44,20 @@

Set the record source [% IF ( biblio.title ) %] for [% INCLUDE 'biblio-title.inc' %][% END %]

- +
- + Configure record sources
diff --git a/t/cypress/integration/Catalogue/Detail_spec.ts b/t/cypress/integration/Catalogue/Detail_spec.ts index 8175a4b3d6..b3cd2b9017 100644 --- a/t/cypress/integration/Catalogue/Detail_spec.ts +++ b/t/cypress/integration/Catalogue/Detail_spec.ts @@ -17,9 +17,9 @@ describe("Set record_source button is present", () => { cy.get("select").select("No specified source"); cy.get("input[type=submit]").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(); @@ -34,4 +34,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.2