Bugzilla – Attachment 126754 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: fix context for batchmod and batchimport
Bug-14957-fix-context-for-batchmod-and-batchimport.patch (text/plain), 4.54 KB, created by
Martin Renvoize (ashimema)
on 2021-10-22 12:31:32 UTC
(
hide
)
Description:
Bug 14957: fix context for batchmod and batchimport
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-10-22 12:31:32 UTC
Size:
4.54 KB
patch
obsolete
>From 55a715abfdc5bed8067c5eccbf542c508d423bac Mon Sep 17 00:00:00 2001 >From: David Gustafsson <glasklas@gmail.com> >Date: Fri, 5 Mar 2021 14:35:32 +0100 >Subject: [PATCH] Bug 14957: fix context for batchmod and batchimport > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/ImportBatch.pm | 12 +++++++++++- > Koha/BackgroundJob/BatchUpdateBiblio.pm | 17 +++++------------ > tools/batch_record_modification.pl | 9 +++++++-- > 3 files changed, 23 insertions(+), 15 deletions(-) > >diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm >index daa6b7ba74..b6735c697d 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -602,6 +602,10 @@ sub BatchCommitRecords { > WHERE import_batch_id = ?"); > $sth->execute($batch_id); > my $marcflavour = C4::Context->preference('marcflavour'); >+ >+ my $userenv = C4::Context->userenv; >+ my $logged_in_patron = Koha::Patrons->find( $userenv->{number} ); >+ > my $rec_num = 0; > while (my $rowref = $sth->fetchrow_hashref) { > $record_type = $rowref->{'record_type'}; >@@ -675,7 +679,13 @@ sub BatchCommitRecords { > } > $oldxml = $old_marc->as_xml($marc_type); > >- ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, {context => {source => 'batchimport'}}); >+ ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, { >+ context => { >+ source => 'batchimport', >+ categorycode => $logged_in_patron->categorycode, >+ userid => $logged_in_patron->userid >+ }, >+ }); > $query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead > > if ($item_result eq 'create_new' || $item_result eq 'replace') { >diff --git a/Koha/BackgroundJob/BatchUpdateBiblio.pm b/Koha/BackgroundJob/BatchUpdateBiblio.pm >index 028f269a0f..dae46682c1 100644 >--- a/Koha/BackgroundJob/BatchUpdateBiblio.pm >+++ b/Koha/BackgroundJob/BatchUpdateBiblio.pm >@@ -91,13 +91,9 @@ sub process { > my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); > C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record ); > my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber ); >- C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, >- { >- source => $args->{source}, >- categorycode => $args->{categorycode}, >- userid => $args->{userid}, >- } >- ); >+ C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, { >+ context => $args->{context}, >+ }); > }; > if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well > push @messages, { >@@ -140,12 +136,9 @@ sub enqueue { > return unless exists $args->{mmtid}; > return unless exists $args->{record_ids}; > >- my $mmtid = $args->{mmtid}; >- my @record_ids = @{ $args->{record_ids} }; >- > $self->SUPER::enqueue({ >- job_size => scalar @record_ids, >- job_args => {mmtid => $mmtid, record_ids => \@record_ids,} >+ job_size => scalar @{$args->{record_ids}}, >+ job_args => $args, > }); > } > >diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl >index 6c0b225885..7a939a1c98 100755 >--- a/tools/batch_record_modification.pl >+++ b/tools/batch_record_modification.pl >@@ -157,15 +157,20 @@ if ( $op eq 'form' ) { > my @record_ids = $input->multi_param('record_id'); > > try { >+ my $patron = Koha::Patrons->find( $loggedinuser ); > my $params = { > mmtid => $mmtid, > record_ids => \@record_ids, >+ context => { >+ source => 'batchmod', >+ categorycode => $patron->categorycode, >+ userid => $patron->userid >+ } > }; > >- my $patron = Koha::Patrons->find( $loggedinuser ); > my $job_id = > $recordtype eq 'biblio' >- ? Koha::BackgroundJob::BatchUpdateBiblio->new->enqueue($params, { source => 'batchmod', categorycode => $patron->categorycode, userid => $patron->userid }) >+ ? Koha::BackgroundJob::BatchUpdateBiblio->new->enqueue($params) > : Koha::BackgroundJob::BatchUpdateAuthority->new->enqueue($params); > > $template->param( >-- >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