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 ); 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 102-107 sub _get_chunk { Link Here
102
            } elsif ( $options{choices} eq 'patron-categories' ) {
103
            } elsif ( $options{choices} eq 'patron-categories' ) {
103
                $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search->as_list };
104
                $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search->as_list };
104
                $add_blank = 1;
105
                $add_blank = 1;
106
            } elsif ( $options{choices} eq 'modification-templates' ) {
107
                $options{choices} = { map { $_->template_id => $_->name } Koha::MarcModificationTemplates->search };
108
                $add_blank = 1;
105
            } else {
109
            } else {
106
                die 'Unrecognized source of preference values: ' . $options{'choices'};
110
                die 'Unrecognized source of preference values: ' . $options{'choices'};
107
            }
111
            }
(-)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 633-639 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
633
('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'),
633
('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'),
634
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
634
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
635
('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'),
635
('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'),
636
('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'Free'),
636
('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'modification-templates'),
637
('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
637
('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
638
('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'),
638
('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'),
639
('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
639
('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 189-195 Cataloging: Link Here
189
        -
189
        -
190
            - Apply the MARC modification template with name
190
            - Apply the MARC modification template with name
191
            - pref: SaveBiblioMarcModificationTemplate
191
            - pref: SaveBiblioMarcModificationTemplate
192
              class: short
192
              class: modification-templates
193
            - on records saved using the staff client simple MARC editor, advanced editor or HTTP API.
193
            - on records saved using the staff client simple MARC editor, advanced editor or HTTP API.
194
    Display:
194
    Display:
195
        -
195
        -
(-)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