Bugzilla – Attachment 120591 Details for
Bug 14957
Write protecting MARC fields based on source of import
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14957: (QA follow-up) Clarify 'context' param
Bug-14957-QA-follow-up-Clarify-context-param.patch (text/plain), 8.27 KB, created by
Martin Renvoize (ashimema)
on 2021-05-06 07:28:49 UTC
(
hide
)
Description:
Bug 14957: (QA follow-up) Clarify 'context' param
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-05-06 07:28:49 UTC
Size:
8.27 KB
patch
obsolete
>From ac8c5cef3a258577204bd384b92a9330c4f1b913 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 26 Mar 2021 16:48:24 -0300 >Subject: [PATCH] Bug 14957: (QA follow-up) Clarify 'context' param > >This patch renames the (passed through) 'context' param for >'overlay_context'. I propose doing so, because in Koha-land 'context' >has a special meaning, related to C4::Context and it reads ambigous. > >The patch itself is pretty trivial. > >Tests should pass: >1. Run: > $ kshell > k$ prove t/db_dependent/Biblio/MarcOverlayRules.t >=> SUCCESS: Tests pass >2. Apply this patch >3. Repeat 1 >=> SUCCESS: Tests still pass! >4. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Biblio.pm | 16 ++++++++-------- > C4/ImportBatch.pm | 2 +- > Koha/BackgroundJob/BatchUpdateBiblio.pm | 2 +- > cataloguing/addbiblio.pl | 12 ++++++++---- > misc/migration_tools/bulkmarcimport.pl | 2 +- > misc/migration_tools/import_lexile.pl | 2 +- > t/db_dependent/Biblio/MarcOverlayRules.t | 2 +- > tools/batch_record_modification.pl | 10 +++++----- > 8 files changed, 26 insertions(+), 22 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index f1c94d09b7..7d63c210f2 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -325,7 +325,7 @@ The C<$options> argument is a hashref with additional parameters: > > =over 4 > >-=item C<context> >+=item C<overlay_context> > > This parameter is forwarded to L</ApplyMarcOverlayRules> where it is used for > selecting the current rule set if MARCOverlayRules is enabled. >@@ -382,13 +382,13 @@ sub ModBiblio { > if ( C4::Context->preference('MARCOverlayRules') > && $biblionumber > && defined $options >- && exists $options->{'context'} ) >+ && exists $options->{overlay_context} ) > { > $record = ApplyMarcOverlayRules( > { >- biblionumber => $biblionumber, >- record => $record, >- context => $options->{'context'}, >+ biblionumber => $biblionumber, >+ record => $record, >+ overlay_context => $options->{overlay_context}, > } > ); > } >@@ -3262,7 +3262,7 @@ biblionumber of old record > =item C<record> > Incoming record that will be merged with old record > >-=item C<context> >+=item C<overlay_context> > hashref containing at least one context module and filter value on > the form {module => filter, ...}. > >@@ -3300,8 +3300,8 @@ sub ApplyMarcOverlayRules { > my $old_record = GetMarcBiblio({ biblionumber => $biblionumber }); > > # Skip overlay rules if called with no context >- if ($old_record && defined $params->{context}) { >- return Koha::MarcOverlayRules->merge_records($old_record, $incoming_record, $params->{context}); >+ if ($old_record && defined $params->{overlay_context}) { >+ return Koha::MarcOverlayRules->merge_records($old_record, $incoming_record, $params->{overlay_context}); > } > return $incoming_record; > } >diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm >index 79518076ec..81a3765312 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -669,7 +669,7 @@ sub BatchCommitRecords { > $oldxml = $old_marc->as_xml($marc_type); > > ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, { >- context => { >+ overlay_context => { > source => 'batchimport', > categorycode => $logged_in_patron->categorycode, > userid => $logged_in_patron->userid >diff --git a/Koha/BackgroundJob/BatchUpdateBiblio.pm b/Koha/BackgroundJob/BatchUpdateBiblio.pm >index 2fc5ee209a..682fb46eb6 100644 >--- a/Koha/BackgroundJob/BatchUpdateBiblio.pm >+++ b/Koha/BackgroundJob/BatchUpdateBiblio.pm >@@ -89,7 +89,7 @@ sub process { > C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record ); > my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber ); > C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, { >- context => $args->{context}, >+ overlay_context => $args->{context}, > }); > }; > if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index c1f91522a3..f8394d687c 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -852,11 +852,15 @@ if ( $op eq "addbiblio" ) { > my $oldbibitemnum; > if ( $is_a_modif ) { > my $member = Koha::Patrons->find($loggedinuser); >- ModBiblio( $record, $biblionumber, $frameworkcode, { >- context => { >- source => $z3950 ? 'z39.50' : 'intranet', >+ ModBiblio( >+ $record, >+ $biblionumber, >+ $frameworkcode, >+ { >+ overlay_context => { >+ source => $z3950 ? 'z39.50' : 'intranet', > categorycode => $member->categorycode, >- userid => $member->userid >+ userid => $member->userid > } > } > ); >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index 2485594402..797e966a0f 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -446,7 +446,7 @@ RECORD: while ( ) { > $biblioitemnumber = Koha::Biblios->find( $biblionumber )->biblioitem->biblioitemnumber; > }; > if ($update) { >- eval { ModBiblio( $record, $biblionumber, $framework, { context => { source => 'bulkmarcimport' } } ) }; >+ eval { ModBiblio( $record, $biblionumber, $framework, { overlay_context => { source => 'bulkmarcimport' } } ) }; > if ($@) { > warn "ERROR: Edit biblio $biblionumber failed: $@\n"; > printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "ERROR" } ) if ($logfile); >diff --git a/misc/migration_tools/import_lexile.pl b/misc/migration_tools/import_lexile.pl >index eecf2d9eb2..bd65213fee 100755 >--- a/misc/migration_tools/import_lexile.pl >+++ b/misc/migration_tools/import_lexile.pl >@@ -203,7 +203,7 @@ while ( my $row = $csv->getline_hr($fh) ) { > $record->append_fields($field); > } > >- ModBiblio( $record, $biblionumber, undef, { context => { source => 'import_lexile' } } ) unless ( $test ); >+ ModBiblio( $record, $biblionumber, undef, { overlay_context => { source => 'import_lexile' } } ) unless ( $test ); > } > > } >diff --git a/t/db_dependent/Biblio/MarcOverlayRules.t b/t/db_dependent/Biblio/MarcOverlayRules.t >index 0a13426a7d..272bfaa056 100755 >--- a/t/db_dependent/Biblio/MarcOverlayRules.t >+++ b/t/db_dependent/Biblio/MarcOverlayRules.t >@@ -749,7 +749,7 @@ subtest 'context option in ModBiblio is handled correctly' => sub { > MARC::Field->new('500', '', '', 'a' => 'One cold bottle of beer in the fridge'), # Appended > ); > >- ModBiblio($saved_record, $biblionumber, '', { context => { 'source' => 'test' } }); >+ ModBiblio($saved_record, $biblionumber, '', { overlay_context => { 'source' => 'test' } }); > > my $updated_record = GetMarcBiblio({ biblionumber => $biblionumber }); > >diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl >index f2ebe3eff4..b21707bc87 100755 >--- a/tools/batch_record_modification.pl >+++ b/tools/batch_record_modification.pl >@@ -152,12 +152,12 @@ if ( $op eq 'form' ) { > try { > my $patron = Koha::Patrons->find( $loggedinuser ); > my $params = { >- mmtid => $mmtid, >- record_ids => \@record_ids, >- context => { >- source => 'batchmod', >+ mmtid => $mmtid, >+ record_ids => \@record_ids, >+ overlay_context => { >+ source => 'batchmod', > categorycode => $patron->categorycode, >- userid => $patron->userid >+ userid => $patron->userid > } > }; > >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14957
:
44056
|
44057
|
44058
|
51723
|
51724
|
56637
|
56638
|
56643
|
56644
|
56645
|
56646
|
56647
|
56648
|
57114
|
57115
|
57116
|
57117
|
57118
|
57119
|
59811
|
59812
|
59885
|
60711
|
60824
|
60825
|
61065
|
61641
|
61736
|
64792
|
72498
|
74855
|
75118
|
76201
|
76202
|
76203
|
76204
|
76205
|
76206
|
76207
|
76208
|
76209
|
76210
|
78651
|
78652
|
78653
|
79367
|
79368
|
79369
|
79370
|
79890
|
80972
|
80973
|
80974
|
80975
|
81176
|
81177
|
81178
|
81179
|
81621
|
81699
|
81700
|
81705
|
81706
|
81707
|
81708
|
81969
|
81970
|
81971
|
82030
|
82031
|
82775
|
87709
|
87711
|
87771
|
87929
|
88205
|
88206
|
89961
|
90668
|
90669
|
90671
|
90672
|
90722
|
90723
|
90740
|
90741
|
92933
|
92934
|
92935
|
92936
|
92937
|
92938
|
92999
|
93499
|
94909
|
94911
|
99998
|
100052
|
100053
|
100054
|
100055
|
100056
|
100057
|
100058
|
100059
|
100060
|
100061
|
101510
|
109955
|
109956
|
109957
|
109958
|
109959
|
109960
|
109961
|
109962
|
109963
|
116622
|
116623
|
116624
|
116625
|
117844
|
117845
|
117849
|
117850
|
117853
|
117859
|
117964
|
117965
|
117966
|
118918
|
118919
|
118920
|
118921
|
118922
|
118923
|
118924
|
118925
|
118926
|
118927
|
118934
|
118935
|
118936
|
118937
|
118938
|
118939
|
118940
|
118941
|
118942
|
118943
|
118944
|
118945
|
118946
|
118957
|
120533
|
120534
|
120535
|
120536
|
120537
|
120538
|
120539
|
120540
|
120541
|
120542
|
120543
|
120544
|
120545
|
120546
|
120547
|
120548
|
120550
|
120553
|
120554
|
120555
|
120556
|
120557
|
120581
|
120582
|
120583
|
120584
|
120585
|
120586
|
120587
|
120588
|
120589
|
120590
|
120591
|
120592
|
120593
|
120594
|
120595
|
120596
|
120597
|
120598
|
120599
|
120600
|
120601
|
120602
|
120603
|
120604
|
120605
|
120670
|
120671
|
120705
|
125514
|
125515
|
125516
|
125517
|
125518
|
125519
|
125520
|
125521
|
125522
|
125523
|
125524
|
125525
|
125526
|
125527
|
125528
|
125529
|
125530
|
125531
|
125532
|
125533
|
125534
|
125535
|
125536
|
125537
|
125538
|
125539
|
125540
|
125632
|
125633
|
125636
|
126424
|
126425
|
126431
|
126592
|
126666
|
126667
|
126752
|
126753
|
126754
|
126755
|
126756
|
126757
|
126758
|
126759
|
126760
|
126761
|
126762
|
126763
|
126764
|
126765
|
126766
|
126767
|
126768
|
126769
|
126770
|
126771
|
126772
|
126773
|
126774
|
126775
|
126776
|
126777
|
126778
|
126779
|
126780
|
126781
|
126782
|
126783
|
126784
|
126785
|
126786
|
126950
|
126951