@@ -, +, @@ --- 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 --- a/admin/preferences.pl +++ a/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'}; --- a/cataloguing/addbiblio.pl +++ a/cataloguing/addbiblio.pl @@ -682,9 +682,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\""; } } --- a/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.pl +++ a/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'"; }, -} + } --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -668,8 +668,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'), -('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'), +('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'), ('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'), ('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo'), ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded