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

(-)a/Koha/MarcModificationTemplate.pm (-1 / +1 lines)
Lines 25-31 use base qw(Koha::Object); Link Here
25
25
26
=head1 NAME
26
=head1 NAME
27
27
28
Koha::MarcModificationTemplate - Koha Marc Modification Templat Object class
28
Koha::MarcModificationTemplate - Koha Marc Modification Template Object class
29
29
30
=head1 API
30
=head1 API
31
31
(-)a/admin/preferences.pl (-1 / +1 lines)
Lines 115-121 sub _get_chunk { Link Here
115
                    $add_blank = 1;
115
                    $add_blank = 1;
116
                }
116
                }
117
            } elsif ( $options{choices} eq 'marcModTemplates' ) {
117
            } elsif ( $options{choices} eq 'marcModTemplates' ) {
118
                $options{choices} = { map { $_->template_id => $_->name } Koha::MarcModificationTemplates->search };
118
                $options{choices} = { map { $_->template_id => $_->name } Koha::MarcModificationTemplates->search->as_list };
119
                $add_blank = 1;
119
                $add_blank = 1;
120
            } else {
120
            } else {
121
                die 'Unrecognized source of preference values: ' . $options{'choices'};
121
                die 'Unrecognized source of preference values: ' . $options{'choices'};
(-)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: modification-templates
223
              choices: marcModTemplates
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 (-6 / +6 lines)
Lines 24-30 use MARC::Record; Link Here
24
use XML::Simple;
24
use XML::Simple;
25
use C4::MarcModificationTemplates;
25
use C4::MarcModificationTemplates;
26
use Koha::MarcModificationTemplates;
26
use Koha::MarcModificationTemplates;
27
use C4::Biblio qw(AddBiblio ModBiblioMarc GetMarcBiblio);
27
use C4::Biblio qw(AddBiblio ModBiblioMarc DelBiblio);
28
use Koha::Biblios;
28
29
29
eval{
30
eval{
30
    use C4::Context;
31
    use C4::Context;
Lines 85-91 subtest 'Templates applied using simple and advanced MARC Editor' => sub { Link Here
85
    );
86
    );
86
    my ($biblionumber) = AddBiblio($record, '');
87
    my ($biblionumber) = AddBiblio($record, '');
87
88
88
    my $saved_record = GetMarcBiblio({ biblionumber => $biblionumber, embed_items => 0 });
89
    my $saved_record = Koha::Biblios->find($biblionumber)->metadata->record();
89
    my $saved_record_250_field = $saved_record->field('250');
90
    my $saved_record_250_field = $saved_record->field('250');
90
    isa_ok($saved_record_250_field, 'MARC::Field', 'Field with tag 250 has been saved');
91
    isa_ok($saved_record_250_field, 'MARC::Field', 'Field with tag 250 has been saved');
91
    is($saved_record_250_field->subfield('a'), '250 bottles of beer on the wall', 'Field 250a has the same value passed to AddBiblio');
92
    is($saved_record_250_field->subfield('a'), '250 bottles of beer on the wall', 'Field 250a has the same value passed to AddBiblio');
Lines 100-108 subtest 'Templates applied using simple and advanced MARC Editor' => sub { Link Here
100
    $agent->field('password', $password);
101
    $agent->field('password', $password);
101
    $agent->field('userid', $user);
102
    $agent->field('userid', $user);
102
    $agent->field('branch', '');
103
    $agent->field('branch', '');
103
    $agent->click_ok('', 'Login to staff client');
104
    $agent->click_ok('', 'Login to staff interface');
105
    $agent->content_lacks('Invalid username or password', 'Logged in to staff interface');
104
106
105
    $agent->get_ok("$intranet/cgi-bin/koha/mainpage.pl", 'Load main page'); #FIXME: Remove?
106
    $agent->get_ok("$intranet/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber", 'Load bibliographic record in simple MARC editor');
107
    $agent->get_ok("$intranet/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber", 'Load bibliographic record in simple MARC editor');
107
    $agent->submit_form_ok(
108
    $agent->submit_form_ok(
108
        {
109
        {
Lines 112-118 subtest 'Templates applied using simple and advanced MARC Editor' => sub { Link Here
112
        'Save bibliographic record using simple MARC editor'
113
        'Save bibliographic record using simple MARC editor'
113
    );
114
    );
114
115
115
    $saved_record = GetMarcBiblio({ biblionumber => $biblionumber, embed_items => 0 });
116
    $saved_record = Koha::Biblios->find($biblionumber)->metadata->record();
116
    $saved_record_250_field = $saved_record->field('250');
117
    $saved_record_250_field = $saved_record->field('250');
117
    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');
118
    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');
118
119
119
- 

Return to bug 18138