From a61588ee549d6566af8e40180b38b607452e6497 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sun, 5 Nov 2023 00:13:39 +0000 Subject: [PATCH] Bug 18138: (QA follow-up) Perltidy and 'staff client' * Perltidies files * Fix atomic update (description and success message) * Fix atomic update file permissions * Update 'staff client' to 'staff interface' Signed-off-by: Katrin Fischer --- admin/preferences.pl | 3 +- cataloguing/addbiblio.pl | 5 +- ...blio-marc-modification-template-syspref.pl | 18 ++-- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../admin/preferences/cataloguing.pref | 4 +- svc/bib | 5 +- .../Koha/MarcModificationTemplates.t | 22 ++-- ...BiblioMarcModificationTemplatePreference.t | 100 ++++++++++-------- 8 files changed, 90 insertions(+), 69 deletions(-) mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.pl diff --git a/admin/preferences.pl b/admin/preferences.pl index 3d6b64eb3d..1d0f995ca6 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -115,7 +115,8 @@ sub _get_chunk { $add_blank = 1; } } elsif ( $options{choices} eq 'marcModTemplates' ) { - $options{choices} = { map { $_->template_id => $_->name } Koha::MarcModificationTemplates->search->as_list }; + $options{choices} = + { map { $_->template_id => $_->name } Koha::MarcModificationTemplates->search->as_list }; $add_blank = 1; } else { die 'Unrecognized source of preference values: ' . $options{'choices'}; diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index f74d64634a..bfe9ef5f47 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -673,9 +673,8 @@ if ( $op eq "addbiblio" ) { if ($template_id) { my $template = Koha::MarcModificationTemplates->find($template_id); if ($template) { - ModifyRecordWithTemplate($template_id, $record); - } - else { + ModifyRecordWithTemplate( $template_id, $record ); + } else { croak "No MARC modification template exists with id \"$template_id\""; } } diff --git a/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.pl b/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.pl old mode 100644 new mode 100755 index 6fd8b901d7..f9a810f267 --- a/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.pl +++ b/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.pl @@ -1,14 +1,18 @@ use Modern::Perl; return { - bug_number => "18138", - description => "Add system preference", - up => sub { + bug_number => "18138", + description => "Use MARC modification template when adding/updating bibliographic records", + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + # Do you stuffs here - $dbh->do(q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES ('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'marcModTemplates')}); + $dbh->do( + q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES ('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff interface or HTTP API', 'marcModTemplates')} + ); + # Print useful stuff here - say $out "System preference added"; + say $out "Added new system preference 'SaveBiblioMarcModificationTemplate'"; }, -} + } diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 7736c416dc..8659a90994 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -651,8 +651,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('RoutingListAddReserves','0','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'), ('RoutingListNote','To change this note edit RoutingListNote system preference.','70|10','Define a note to be shown on all routing lists','Textarea'), ('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'), +('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff interface or HTTP API', 'marcModTemplates'), ('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'), -('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'marcModTemplates'), ('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'), ('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'), ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded