Bugzilla – Attachment 125626 Details for
Bug 29149
Background job detail view needs more flexibility
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29149: (QA follow-up) Reorganize mapping
Bug-29149-QA-follow-up-Reorganize-mapping.patch (text/plain), 2.15 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-10-01 13:04:04 UTC
(
hide
)
Description:
Bug 29149: (QA follow-up) Reorganize mapping
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-10-01 13:04:04 UTC
Size:
2.15 KB
patch
obsolete
>From 4ee5afaeca038ae6a3e34160a1c384882a979b20 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 1 Oct 2021 09:22:58 -0300 >Subject: [PATCH] Bug 29149: (QA follow-up) Reorganize mapping > >This patch changes the mapping so it is more readable, and also allows >adding things there more easily, like allowing to add code => class >mappings from plugins, when time comes. > >To test: >1. Just verify things still work >--- > Koha/BackgroundJob.pm | 39 ++++++++++++++++++++++++++++++--------- > 1 file changed, 30 insertions(+), 9 deletions(-) > >diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm >index 553d7ce6e6..f67809d014 100644 >--- a/Koha/BackgroundJob.pm >+++ b/Koha/BackgroundJob.pm >@@ -228,20 +228,41 @@ sub cancel { > $self->status('cancelled')->store; > } > >+=head2 Internal methods >+ >+=head3 _derived_class >+ >+=cut >+ > sub _derived_class { > my ( $self ) = @_; > my $job_type = $self->type; >- return $job_type eq 'batch_biblio_record_modification' >- ? Koha::BackgroundJob::BatchUpdateBiblio->new >- : $job_type eq 'batch_authority_record_modification' >- ? Koha::BackgroundJob::BatchUpdateAuthority->new >- : $job_type eq 'batch_biblio_record_deletion' >- ? Koha::BackgroundJob::BatchDeleteBiblio->new >- : $job_type eq 'batch_authority_record_deletion' >- ? Koha::BackgroundJob::BatchDeleteAuthority->new >- : Koha::Exceptions::Exception->throw($job_type . ' is not a valid job_type') >+ >+ my $class = $self->type_to_class_mapping->{$job_type}; >+ >+ Koha::Exceptions::Exception->throw($job_type . ' is not a valid job_type') >+ unless $class; >+ >+ return $class->new; >+} >+ >+=head3 type_to_class_mapping >+ >+=cut >+ >+sub type_to_class_mapping { >+ return { >+ batch_authority_record_deletion => 'Koha::BackgroundJob::BatchDeleteAuthority', >+ batch_authority_record_modification => 'Koha::BackgroundJob::BatchUpdateAuthority', >+ batch_biblio_record_deletion => 'Koha::BackgroundJob::BatchDeleteBiblio', >+ batch_biblio_record_modification => 'Koha::BackgroundJob::BatchUpdateBiblio', >+ }; > } > >+=head3 _type >+ >+=cut >+ > sub _type { > return 'BackgroundJob'; > } >-- >2.33.0
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 29149
:
125581
|
125625
| 125626