View | Details | Raw Unified | Return to bug 18138
Collapse All | Expand All

(-)a/admin/preferences.pl (+4 lines)
Lines 29-34 use C4::Output qw( output_html_with_http_headers output_and_exit_if_error ); Link Here
29
use C4::Templates;
29
use C4::Templates;
30
use Koha::Acquisition::Currencies;
30
use Koha::Acquisition::Currencies;
31
use Koha::Database::Columns;
31
use Koha::Database::Columns;
32
use Koha::MarcModificationTemplates;
32
use IO::File;
33
use IO::File;
33
use YAML::XS;
34
use YAML::XS;
34
use Encode;
35
use Encode;
Lines 113-118 sub _get_chunk { Link Here
113
                    $options{'choices'} = { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search( { category => $options{'source'} } )->as_list };
114
                    $options{'choices'} = { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search( { category => $options{'source'} } )->as_list };
114
                    $add_blank = 1;
115
                    $add_blank = 1;
115
                }
116
                }
117
            } elsif ( $options{choices} eq 'modification-templates' ) {
118
                $options{choices} = { map { $_->template_id => $_->name } Koha::MarcModificationTemplates->search };
119
                $add_blank = 1;
116
            } else {
120
            } else {
117
                die 'Unrecognized source of preference values: ' . $options{'choices'};
121
                die 'Unrecognized source of preference values: ' . $options{'choices'};
118
            }
122
            }
(-)a/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.sql (-1 / +1 lines)
Line 1 Link Here
1
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', 'Free');
1
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', 'modification-templates');
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 649-655 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
649
('RoutingListNote','To change this note edit <a href=\"/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped\">RoutingListNote</a> system preference.','70|10','Define a note to be shown on all routing lists','Textarea'),
649
('RoutingListNote','To change this note edit <a href=\"/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped\">RoutingListNote</a> system preference.','70|10','Define a note to be shown on all routing lists','Textarea'),
650
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
650
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
651
('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'),
651
('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'),
652
('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'Free'),
652
('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'modification-templates'),
653
('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
653
('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
654
('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'),
654
('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'),
655
('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
655
('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (-1 / +1 lines)
Lines 220-226 Cataloging: Link Here
220
        -
220
        -
221
            - Apply the MARC modification template with name
221
            - Apply the MARC modification template with name
222
            - pref: SaveBiblioMarcModificationTemplate
222
            - pref: SaveBiblioMarcModificationTemplate
223
              class: short
223
              class: modification-templates
224
            - on records saved using the staff client simple MARC editor, advanced editor or HTTP API.
224
            - on records saved using the staff client simple MARC editor, advanced editor or HTTP API.
225
    Display:
225
    Display:
226
        -
226
        -
(-)a/t/db_dependent/www/EditBiblioMarcModificationTemplatePreference.t (-4 / +3 lines)
Lines 23-29 require HTTP::Request; Link Here
23
use MARC::Record;
23
use MARC::Record;
24
use XML::Simple;
24
use XML::Simple;
25
use C4::MarcModificationTemplates;
25
use C4::MarcModificationTemplates;
26
use C4::Biblio;
26
use C4::Biblio qw(AddBiblio ModBiblioMarc GetMarcBiblio);
27
27
28
eval{
28
eval{
29
    use C4::Context;
29
    use C4::Context;
Lines 82-88 subtest 'Templates applied using simple and advanced MARC Editor' => sub { Link Here
82
    );
82
    );
83
    my ($biblionumber) = AddBiblio($record, '');
83
    my ($biblionumber) = AddBiblio($record, '');
84
84
85
    my $saved_record = GetMarcBiblio({ biblio => $biblionumber, embed_items => 0 });
85
    my $saved_record = GetMarcBiblio({ biblionumber => $biblionumber, embed_items => 0 });
86
    my $saved_record_250_field = $saved_record->field('250');
86
    my $saved_record_250_field = $saved_record->field('250');
87
    isa_ok($saved_record_250_field, 'MARC::Field', 'Field with tag 250 has been saved');
87
    isa_ok($saved_record_250_field, 'MARC::Field', 'Field with tag 250 has been saved');
88
    is($saved_record_250_field->subfield('a'), '250 bottles of beer on the wall', 'Field 250a has the same value passed to AddBiblio');
88
    is($saved_record_250_field->subfield('a'), '250 bottles of beer on the wall', 'Field 250a has the same value passed to AddBiblio');
Lines 109-115 subtest 'Templates applied using simple and advanced MARC Editor' => sub { Link Here
109
        'Save bibliographic record using simple MARC editor'
109
        'Save bibliographic record using simple MARC editor'
110
    );
110
    );
111
111
112
    $saved_record = GetMarcBiblio({ biblio => $biblionumber, embed_items => 0 });
112
    $saved_record = GetMarcBiblio({ biblionumber => $biblionumber, embed_items => 0 });
113
    $saved_record_250_field = $saved_record->field('250');
113
    $saved_record_250_field = $saved_record->field('250');
114
    is($saved_record_250_field->subfield('a'), '251 bottles of beer on the wall', 'Field with tag 250 has been modified by MARC modification template');
114
    is($saved_record_250_field->subfield('a'), '251 bottles of beer on the wall', 'Field with tag 250 has been modified by MARC modification template');
115
115
116
- 

Return to bug 18138