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

(-)a/C4/Biblio.pm (-8 / +8 lines)
Lines 325-331 The C<$options> argument is a hashref with additional parameters: Link Here
325
325
326
=over 4
326
=over 4
327
327
328
=item C<context>
328
=item C<overlay_context>
329
329
330
This parameter is forwarded to L</ApplyMarcOverlayRules> where it is used for
330
This parameter is forwarded to L</ApplyMarcOverlayRules> where it is used for
331
selecting the current rule set if MARCOverlayRules is enabled.
331
selecting the current rule set if MARCOverlayRules is enabled.
Lines 382-394 sub ModBiblio { Link Here
382
    if (   C4::Context->preference('MARCOverlayRules')
382
    if (   C4::Context->preference('MARCOverlayRules')
383
        && $biblionumber
383
        && $biblionumber
384
        && defined $options
384
        && defined $options
385
        && exists $options->{'context'} )
385
        && exists $options->{overlay_context} )
386
    {
386
    {
387
        $record = ApplyMarcOverlayRules(
387
        $record = ApplyMarcOverlayRules(
388
            {
388
            {
389
                biblionumber => $biblionumber,
389
                biblionumber    => $biblionumber,
390
                record       => $record,
390
                record          => $record,
391
                context      => $options->{'context'},
391
                overlay_context => $options->{overlay_context},
392
            }
392
            }
393
        );
393
        );
394
    }
394
    }
Lines 3264-3270 biblionumber of old record Link Here
3264
=item C<record>
3264
=item C<record>
3265
Incoming record that will be merged with old record
3265
Incoming record that will be merged with old record
3266
3266
3267
=item C<context>
3267
=item C<overlay_context>
3268
hashref containing at least one context module and filter value on
3268
hashref containing at least one context module and filter value on
3269
the form {module => filter, ...}.
3269
the form {module => filter, ...}.
3270
3270
Lines 3302-3309 sub ApplyMarcOverlayRules { Link Here
3302
    my $old_record = GetMarcBiblio({ biblionumber => $biblionumber });
3302
    my $old_record = GetMarcBiblio({ biblionumber => $biblionumber });
3303
3303
3304
    # Skip overlay rules if called with no context
3304
    # Skip overlay rules if called with no context
3305
    if ($old_record && defined $params->{context}) {
3305
    if ($old_record && defined $params->{overlay_context}) {
3306
        return Koha::MarcOverlayRules->merge_records($old_record, $incoming_record, $params->{context});
3306
        return Koha::MarcOverlayRules->merge_records($old_record, $incoming_record, $params->{overlay_context});
3307
    }
3307
    }
3308
    return $incoming_record;
3308
    return $incoming_record;
3309
}
3309
}
(-)a/C4/ImportBatch.pm (-1 / +1 lines)
Lines 669-675 sub BatchCommitRecords { Link Here
669
                $oldxml = $old_marc->as_xml($marc_type);
669
                $oldxml = $old_marc->as_xml($marc_type);
670
670
671
                ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, {
671
                ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, {
672
                    context => {
672
                    overlay_context => {
673
                        source => 'batchimport',
673
                        source => 'batchimport',
674
                        categorycode => $logged_in_patron->categorycode,
674
                        categorycode => $logged_in_patron->categorycode,
675
                        userid => $logged_in_patron->userid
675
                        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 852-862 if ( $op eq "addbiblio" ) { Link Here
852
        my $oldbibitemnum;
852
        my $oldbibitemnum;
853
        if ( $is_a_modif ) {
853
        if ( $is_a_modif ) {
854
            my $member = Koha::Patrons->find($loggedinuser);
854
            my $member = Koha::Patrons->find($loggedinuser);
855
            ModBiblio( $record, $biblionumber, $frameworkcode, {
855
            ModBiblio(
856
                    context => {
856
                $record,
857
                        source => $z3950 ? 'z39.50' : 'intranet',
857
                $biblionumber,
858
                $frameworkcode,
859
                {
860
                    overlay_context => {
861
                        source       => $z3950 ? 'z39.50' : 'intranet',
858
                        categorycode => $member->categorycode,
862
                        categorycode => $member->categorycode,
859
                        userid => $member->userid
863
                        userid       => $member->userid
860
                    }
864
                    }
861
                }
865
                }
862
            );
866
            );
(-)a/misc/migration_tools/bulkmarcimport.pl (-1 / +1 lines)
Lines 446-452 RECORD: while ( ) { Link Here
446
                    $biblioitemnumber = Koha::Biblios->find( $biblionumber )->biblioitem->biblioitemnumber;
446
                    $biblioitemnumber = Koha::Biblios->find( $biblionumber )->biblioitem->biblioitemnumber;
447
                };
447
                };
448
                if ($update) {
448
                if ($update) {
449
                    eval { ModBiblio( $record, $biblionumber, $framework, { context => { source => 'bulkmarcimport' } } ) };
449
                    eval { ModBiblio( $record, $biblionumber, $framework, { overlay_context => { source => 'bulkmarcimport' } } ) };
450
                    if ($@) {
450
                    if ($@) {
451
                        warn "ERROR: Edit biblio $biblionumber failed: $@\n";
451
                        warn "ERROR: Edit biblio $biblionumber failed: $@\n";
452
                        printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "ERROR" } ) if ($logfile);
452
                        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 152-163 if ( $op eq 'form' ) { Link Here
152
    try {
152
    try {
153
        my $patron = Koha::Patrons->find( $loggedinuser );
153
        my $patron = Koha::Patrons->find( $loggedinuser );
154
        my $params = {
154
        my $params = {
155
            mmtid       => $mmtid,
155
            mmtid           => $mmtid,
156
            record_ids  => \@record_ids,
156
            record_ids      => \@record_ids,
157
            context => {
157
            overlay_context => {
158
                source => 'batchmod',
158
                source       => 'batchmod',
159
                categorycode => $patron->categorycode,
159
                categorycode => $patron->categorycode,
160
                userid => $patron->userid
160
                userid       => $patron->userid
161
            }
161
            }
162
        };
162
        };
163
163
164
- 

Return to bug 14957