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

(-)a/cataloguing/addbiblio.pl (-1 / +13 lines)
Lines 34-39 use C4::Koha; Link Here
34
use C4::ClassSource;
34
use C4::ClassSource;
35
use C4::ImportBatch;
35
use C4::ImportBatch;
36
use C4::Charset;
36
use C4::Charset;
37
use C4::MarcModificationTemplates;
37
use Koha::BiblioFrameworks;
38
use Koha::BiblioFrameworks;
38
use Koha::DateUtils;
39
use Koha::DateUtils;
39
40
Lines 45-50 use Date::Calc qw(Today); Link Here
45
use MARC::File::USMARC;
46
use MARC::File::USMARC;
46
use MARC::File::XML;
47
use MARC::File::XML;
47
use URI::Escape;
48
use URI::Escape;
49
use List::MoreUtils qw(firstval);
48
50
49
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
51
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
50
    MARC::File::XML->default_record_format('UNIMARC');
52
    MARC::File::XML->default_record_format('UNIMARC');
Lines 835-841 if ( $op eq "addbiblio" ) { Link Here
835
        my $oldbibitemnum;
837
        my $oldbibitemnum;
836
        if (C4::Context->preference("BiblioAddsAuthorities")){
838
        if (C4::Context->preference("BiblioAddsAuthorities")){
837
            BiblioAutoLink( $record, $frameworkcode );
839
            BiblioAutoLink( $record, $frameworkcode );
838
        } 
840
        }
841
        my $marc_modification_template_name = C4::Context->preference("EditBiblioMarcModificationTemplate");
842
        if ($marc_modification_template_name) {
843
            my $template = firstval { $_->{'name'} eq $marc_modification_template_name } GetModificationTemplates();
844
            if ($template) {
845
                ModifyRecordWithTemplate($template->{'template_id'}, $record);
846
            }
847
            else {
848
                warn "No MARC modification template exists with name \"$marc_modification_template_name\"";
849
            }
850
        }
839
        if ( $is_a_modif ) {
851
        if ( $is_a_modif ) {
840
            ModBiblio( $record, $biblionumber, $frameworkcode );
852
            ModBiblio( $record, $biblionumber, $frameworkcode );
841
        }
853
        }
(-)a/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.sql (+1 lines)
Line 0 Link Here
1
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES ('EditBiblioMarcModificationTemplate', '', '', 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'Free');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (+5 lines)
Lines 125-130 Cataloging: Link Here
125
            - 'MARC21: "952$a 952$b 952$c"'
125
            - 'MARC21: "952$a 952$b 952$c"'
126
            - Note that the FA framework is excluded from the permission.
126
            - Note that the FA framework is excluded from the permission.
127
            - If the pref is empty, no fields are restricted.
127
            - If the pref is empty, no fields are restricted.
128
        -
129
            - Apply the MARC modification template with name
130
            - pref: EditBiblioMarcModificationTemplate
131
              class: short
132
            - on records saved using the staff client simple MARC editor, advanced editor or HTTP API.
128
    Display:
133
    Display:
129
        -
134
        -
130
            - 'Separate multiple displayed authors, series or subjects with '
135
            - 'Separate multiple displayed authors, series or subjects with '
(-)a/svc/bib (-1 / +13 lines)
Lines 26-32 use CGI qw ( -utf8 ); Link Here
26
use C4::Auth qw/check_api_auth/;
26
use C4::Auth qw/check_api_auth/;
27
use C4::Biblio;
27
use C4::Biblio;
28
use C4::Items;
28
use C4::Items;
29
use C4::MarcModificationTemplates;
29
use XML::Simple;
30
use XML::Simple;
31
use List::MoreUtils qw(firstval);
30
32
31
my $query = new CGI;
33
my $query = new CGI;
32
binmode STDOUT, ':encoding(UTF-8)';
34
binmode STDOUT, ':encoding(UTF-8)';
Lines 112-117 sub update_bib { Link Here
112
            }
114
            }
113
        }
115
        }
114
116
117
        my $marc_modification_template_name = C4::Context->preference("EditBiblioMarcModificationTemplate");
118
        if ($marc_modification_template_name) {
119
            my $template = firstval { $_->{'name'} eq $marc_modification_template_name } GetModificationTemplates();
120
            if ($template) {
121
                ModifyRecordWithTemplate($template->{'template_id'}, $record);
122
            }
123
            else {
124
                warn "No MARC modification template exists with name \"$marc_modification_template_name\"";
125
            }
126
        }
127
115
        ModBiblio( $record, $biblionumber, '' );
128
        ModBiblio( $record, $biblionumber, '' );
116
        my $new_record =
129
        my $new_record =
117
          GetMarcBiblio( $biblionumber, $query->url_param('items') );
130
          GetMarcBiblio( $biblionumber, $query->url_param('items') );
118
- 

Return to bug 18138