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

(-)a/C4/Biblio.pm (-8 / +8 lines)
Lines 332-338 The C<$options> argument is a hashref with additional parameters: Link Here
332
332
333
=over 4
333
=over 4
334
334
335
=item C<context>
335
=item C<overlay_context>
336
336
337
This parameter is forwarded to L</ApplyMarcOverlayRules> where it is used for
337
This parameter is forwarded to L</ApplyMarcOverlayRules> where it is used for
338
selecting the current rule set if MARCOverlayRules is enabled.
338
selecting the current rule set if MARCOverlayRules is enabled.
Lines 389-401 sub ModBiblio { Link Here
389
    if (   C4::Context->preference('MARCOverlayRules')
389
    if (   C4::Context->preference('MARCOverlayRules')
390
        && $biblionumber
390
        && $biblionumber
391
        && defined $options
391
        && defined $options
392
        && exists $options->{'context'} )
392
        && exists $options->{overlay_context} )
393
    {
393
    {
394
        $record = ApplyMarcOverlayRules(
394
        $record = ApplyMarcOverlayRules(
395
            {
395
            {
396
                biblionumber => $biblionumber,
396
                biblionumber    => $biblionumber,
397
                record       => $record,
397
                record          => $record,
398
                context      => $options->{'context'},
398
                overlay_context => $options->{overlay_context},
399
            }
399
            }
400
        );
400
        );
401
    }
401
    }
Lines 3277-3283 biblionumber of old record Link Here
3277
=item C<record>
3277
=item C<record>
3278
Incoming record that will be merged with old record
3278
Incoming record that will be merged with old record
3279
3279
3280
=item C<context>
3280
=item C<overlay_context>
3281
hashref containing at least one context module and filter value on
3281
hashref containing at least one context module and filter value on
3282
the form {module => filter, ...}.
3282
the form {module => filter, ...}.
3283
3283
Lines 3315-3322 sub ApplyMarcOverlayRules { Link Here
3315
    my $old_record = GetMarcBiblio({ biblionumber => $biblionumber });
3315
    my $old_record = GetMarcBiblio({ biblionumber => $biblionumber });
3316
3316
3317
    # Skip overlay rules if called with no context
3317
    # Skip overlay rules if called with no context
3318
    if ($old_record && defined $params->{context}) {
3318
    if ($old_record && defined $params->{overlay_context}) {
3319
        return Koha::MarcOverlayRules->merge_records($old_record, $incoming_record, $params->{context});
3319
        return Koha::MarcOverlayRules->merge_records($old_record, $incoming_record, $params->{overlay_context});
3320
    }
3320
    }
3321
    return $incoming_record;
3321
    return $incoming_record;
3322
}
3322
}
(-)a/C4/ImportBatch.pm (-1 / +1 lines)
Lines 680-686 sub BatchCommitRecords { Link Here
680
                $oldxml = $old_marc->as_xml($marc_type);
680
                $oldxml = $old_marc->as_xml($marc_type);
681
681
682
                ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, {
682
                ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, {
683
                    context => {
683
                    overlay_context => {
684
                        source => 'batchimport',
684
                        source => 'batchimport',
685
                        categorycode => $logged_in_patron->categorycode,
685
                        categorycode => $logged_in_patron->categorycode,
686
                        userid => $logged_in_patron->userid
686
                        userid => $logged_in_patron->userid
(-)a/Koha/BackgroundJob/BatchUpdateBiblio.pm (-1 / +1 lines)
Lines 89-95 sub process { Link Here
89
            C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
89
            C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
90
            my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
90
            my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
91
            C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, {
91
            C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, {
92
                context => $args->{context},
92
                overlay_context => $args->{context},
93
            });
93
            });
94
        };
94
        };
95
        if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well
95
        if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well
(-)a/cataloguing/addbiblio.pl (-4 / +8 lines)
Lines 866-876 if ( $op eq "addbiblio" ) { Link Here
866
        my $oldbibitemnum;
866
        my $oldbibitemnum;
867
        if ( $is_a_modif ) {
867
        if ( $is_a_modif ) {
868
            my $member = Koha::Patrons->find($loggedinuser);
868
            my $member = Koha::Patrons->find($loggedinuser);
869
            ModBiblio( $record, $biblionumber, $frameworkcode, {
869
            ModBiblio(
870
                    context => {
870
                $record,
871
                        source => $z3950 ? 'z39.50' : 'intranet',
871
                $biblionumber,
872
                $frameworkcode,
873
                {
874
                    overlay_context => {
875
                        source       => $z3950 ? 'z39.50' : 'intranet',
872
                        categorycode => $member->categorycode,
876
                        categorycode => $member->categorycode,
873
                        userid => $member->userid
877
                        userid       => $member->userid
874
                    }
878
                    }
875
                }
879
                }
876
            );
880
            );
(-)a/misc/migration_tools/bulkmarcimport.pl (-1 / +1 lines)
Lines 450-456 RECORD: while ( ) { Link Here
450
                    $biblioitemnumber = Koha::Biblios->find( $biblionumber )->biblioitem->biblioitemnumber;
450
                    $biblioitemnumber = Koha::Biblios->find( $biblionumber )->biblioitem->biblioitemnumber;
451
                };
451
                };
452
                if ($update) {
452
                if ($update) {
453
                    eval { ModBiblio( $record, $biblionumber, $framework, { context => { source => 'bulkmarcimport' } } ) };
453
                    eval { ModBiblio( $record, $biblionumber, $framework, { overlay_context => { source => 'bulkmarcimport' } } ) };
454
                    if ($@) {
454
                    if ($@) {
455
                        warn "ERROR: Edit biblio $biblionumber failed: $@\n";
455
                        warn "ERROR: Edit biblio $biblionumber failed: $@\n";
456
                        printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "ERROR" } ) if ($logfile);
456
                        printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "ERROR" } ) if ($logfile);
(-)a/misc/migration_tools/import_lexile.pl (-1 / +1 lines)
Lines 203-209 while ( my $row = $csv->getline_hr($fh) ) { Link Here
203
            $record->append_fields($field);
203
            $record->append_fields($field);
204
        }
204
        }
205
205
206
        ModBiblio( $record, $biblionumber, undef, { context => { source => 'import_lexile' } } ) unless ( $test );
206
        ModBiblio( $record, $biblionumber, undef, { overlay_context => { source => 'import_lexile' } } ) unless ( $test );
207
    }
207
    }
208
208
209
}
209
}
(-)a/t/db_dependent/Biblio/MarcOverlayRules.t (-1 / +1 lines)
Lines 749-755 subtest 'context option in ModBiblio is handled correctly' => sub { Link Here
749
        MARC::Field->new('500', '', '', 'a' => 'One cold bottle of beer in the fridge'), # Appended
749
        MARC::Field->new('500', '', '', 'a' => 'One cold bottle of beer in the fridge'), # Appended
750
    );
750
    );
751
751
752
    ModBiblio($saved_record, $biblionumber, '', { context => { 'source' => 'test' } });
752
    ModBiblio($saved_record, $biblionumber, '', { overlay_context => { 'source' => 'test' } });
753
753
754
    my $updated_record = GetMarcBiblio({ biblionumber => $biblionumber });
754
    my $updated_record = GetMarcBiblio({ biblionumber => $biblionumber });
755
755
(-)a/tools/batch_record_modification.pl (-6 / +5 lines)
Lines 159-170 if ( $op eq 'form' ) { Link Here
159
    try {
159
    try {
160
        my $patron = Koha::Patrons->find( $loggedinuser );
160
        my $patron = Koha::Patrons->find( $loggedinuser );
161
        my $params = {
161
        my $params = {
162
            mmtid       => $mmtid,
162
            mmtid           => $mmtid,
163
            record_ids  => \@record_ids,
163
            record_ids      => \@record_ids,
164
            context => {
164
            overlay_context => {
165
                source => 'batchmod',
165
                source       => 'batchmod',
166
                categorycode => $patron->categorycode,
166
                categorycode => $patron->categorycode,
167
                userid => $patron->userid
167
                userid       => $patron->userid
168
            }
168
            }
169
        };
169
        };
170
170
171
- 

Return to bug 14957