Bugzilla – Attachment 117961 Details for
Bug 24957
OpenLibrarySearch shouldnt display if nothing is returned
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
on 2021-03-09 09:26:44 UTC
(
hide
)
Description:
Bug 14957: fix context for batchmod and batchimport
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2021-03-09 09:26:44 UTC
Size:
4.54 KB
patch
obsolete
>From a21bc0ffade3879c5031be7030409ffe8314dfcb 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> > >https://bugs.koha-community.org/show_bug.cgi?id=24957 >--- > 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 3b401f2f42..79518076ec 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -591,6 +591,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'}; >@@ -664,7 +668,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 f981930b4c..2fc5ee209a 100644 >--- a/Koha/BackgroundJob/BatchUpdateBiblio.pm >+++ b/Koha/BackgroundJob/BatchUpdateBiblio.pm >@@ -88,13 +88,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, { >@@ -137,12 +133,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 60ab68595f..f2ebe3eff4 100755 >--- a/tools/batch_record_modification.pl >+++ b/tools/batch_record_modification.pl >@@ -150,15 +150,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 24957
:
103417
|
103419
|
103518
|
117959
|
117960
|
117961