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

(-)a/Koha/BackgroundJob.pm (-2 / +5 lines)
Lines 479-492 sub plugin_types_to_classes { Link Here
479
            my $namespace = $metadata->{namespace};
479
            my $namespace = $metadata->{namespace};
480
480
481
            foreach my $type ( keys %{$tasks} ) {
481
            foreach my $type ( keys %{$tasks} ) {
482
                my $class = $tasks->{$type};
482
                my $class =
483
                    ( ref $tasks->{$type} eq 'HASH' )
484
                    ? $tasks->{$type}{class}
485
                    : $tasks->{$type};
483
486
484
                # skip if conditions not met
487
                # skip if conditions not met
485
                next unless $type and $class;
488
                next unless $type and $class;
486
489
487
                my $key = "plugin_$namespace" . "_$type";
490
                my $key = "plugin_$namespace" . "_$type";
488
491
489
                $self->{_plugin_mapping}->{$key} = $tasks->{$type};
492
                $self->{_plugin_mapping}->{$key} = $class;
490
            }
493
            }
491
        }
494
        }
492
    }
495
    }
(-)a/admin/background_jobs.pl (-1 / +4 lines)
Lines 88-96 my @plugin_job_types; Link Here
88
for my $plugin (@plugins) {
88
for my $plugin (@plugins) {
89
    my $tasks = $plugin->background_tasks;
89
    my $tasks = $plugin->background_tasks;
90
    for my $id ( keys %$tasks ) {
90
    for my $id ( keys %$tasks ) {
91
92
        # fallback to package name if no human-readable name is available
93
        my $name = ( ref $tasks->{$id} eq 'HASH' ) ? $tasks->{$id}{name} : $tasks->{$id};
91
        push @plugin_job_types, {
94
        push @plugin_job_types, {
92
            id  => 'plugin_' . $plugin->get_metadata->{namespace} . "_$id",
95
            id  => 'plugin_' . $plugin->get_metadata->{namespace} . "_$id",
93
            str => $tasks->{$id},
96
            str => $name,
94
        };
97
        };
95
    }
98
    }
96
}
99
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt (-19 / +19 lines)
Lines 165-236 Link Here
165
        const job_types = [
165
        const job_types = [
166
            {
166
            {
167
                '_id': 'batch_biblio_record_modification',
167
                '_id': 'batch_biblio_record_modification',
168
                '_str': _("Batch bibliographic record modification")
168
                '_str': _("Batch bibliographic record modification").escapeHtml()
169
            },
169
            },
170
            {
170
            {
171
                '_id': 'batch_biblio_record_deletion',
171
                '_id': 'batch_biblio_record_deletion',
172
                '_str': _("Batch bibliographic record deletion")
172
                '_str': _("Batch bibliographic record deletion").escapeHtml()
173
            },
173
            },
174
            {
174
            {
175
                '_id': 'batch_authority_record_modification',
175
                '_id': 'batch_authority_record_modification',
176
                '_str': _("Batch authority record modification")
176
                '_str': _("Batch authority record modification").escapeHtml()
177
            },
177
            },
178
            {
178
            {
179
                '_id': 'batch_authority_record_deletion',
179
                '_id': 'batch_authority_record_deletion',
180
                '_str': _("Batch authority record deletion")
180
                '_str': _("Batch authority record deletion").escapeHtml()
181
            },
181
            },
182
            {
182
            {
183
                '_id': 'batch_item_record_modification',
183
                '_id': 'batch_item_record_modification',
184
                '_str': _("Batch item record modification")
184
                '_str': _("Batch item record modification").escapeHtml()
185
            },
185
            },
186
            {
186
            {
187
                '_id': 'batch_item_record_deletion',
187
                '_id': 'batch_item_record_deletion',
188
                '_str': _("Batch item record deletion")
188
                '_str': _("Batch item record deletion").escapeHtml()
189
            },
189
            },
190
            {
190
            {
191
                '_id': 'erm_sushi_harvester',
191
                '_id': 'erm_sushi_harvester',
192
                '_str': _("ERM Usage Statistics SUSHI Harvester")
192
                '_str': _("ERM Usage Statistics SUSHI Harvester").escapeHtml()
193
            },
193
            },
194
            {
194
            {
195
                '_id': 'batch_hold_cancel',
195
                '_id': 'batch_hold_cancel',
196
                '_str': _("Batch hold cancellation")
196
                '_str': _("Batch hold cancellation").escapeHtml()
197
            },
197
            },
198
            {
198
            {
199
                '_id': 'pseudonymize_statistic',
199
                '_id': 'pseudonymize_statistic',
200
                '_str': _("Pseudonymize statistic")
200
                '_str': _("Pseudonymize statistic").escapeHtml()
201
            },
201
            },
202
            {
202
            {
203
                '_id': 'create_eholdings_from_biblios',
203
                '_id': 'create_eholdings_from_biblios',
204
                '_str': _("Create eHolding titles")
204
                '_str': _("Create eHolding titles").escapeHtml()
205
            },
205
            },
206
            {
206
            {
207
                '_id': 'update_elastic_index',
207
                '_id': 'update_elastic_index',
208
                '_str': _("Update Elasticsearch index")
208
                '_str': _("Update Elasticsearch index").escapeHtml()
209
            },
209
            },
210
            {
210
            {
211
                '_id': 'update_holds_queue_for_biblios',
211
                '_id': 'update_holds_queue_for_biblios',
212
                '_str': _("Holds queue update")
212
                '_str': _("Holds queue update").escapeHtml()
213
            },
213
            },
214
            {
214
            {
215
                '_id': 'stage_marc_for_import',
215
                '_id': 'stage_marc_for_import',
216
                '_str': _("Staged MARC records for import")
216
                '_str': _("Staged MARC records for import").escapeHtml()
217
            },
217
            },
218
            {
218
            {
219
                '_id': 'marc_import_commit_batch',
219
                '_id': 'marc_import_commit_batch',
220
                '_str': _("Import MARC records")
220
                '_str': _("Import MARC records").escapeHtml()
221
            },
221
            },
222
            {
222
            {
223
                '_id': 'marc_import_revert_batch',
223
                '_id': 'marc_import_revert_batch',
224
                '_str': _("Revert import MARC records")
224
                '_str': _("Revert import MARC records").escapeHtml()
225
            },
225
            },
226
            {
226
            {
227
                '_id': 'import_from_kbart_file',
227
                '_id': 'import_from_kbart_file',
228
                '_str': _("Import titles from a KBART file")
228
                '_str': _("Import titles from a KBART file").escapeHtml()
229
            },
229
            },
230
            [% FOR job_type IN plugin_job_types %]
230
            [% FOR job_type IN plugin_job_types %]
231
            {
231
            {
232
                '_id': '[% job_type.id %]',
232
                '_id': '[% job_type.id | html %]',
233
                '_str': '[% job_type.str %]'
233
                '_str': '[% job_type.str | html_entity %]'
234
            },
234
            },
235
            [% END %]
235
            [% END %]
236
        ];
236
        ];
Lines 290-296 Link Here
290
                        "searchable": true,
290
                        "searchable": true,
291
                        "orderable": true,
291
                        "orderable": true,
292
                        "render": function(data, type, row, meta) {
292
                        "render": function(data, type, row, meta) {
293
                            return get_job_type(row.type).escapeHtml();
293
                            return get_job_type(row.type);
294
                        }
294
                        }
295
                    },
295
                    },
296
                    {
296
                    {
(-)a/t/lib/plugins/Koha/Plugin/Test.pm (-2 / +4 lines)
Lines 366-372 sub intranet_catalog_biblio_tab { Link Here
366
sub background_tasks {
366
sub background_tasks {
367
    return {
367
    return {
368
        foo => 'MyPlugin::Class::Foo',
368
        foo => 'MyPlugin::Class::Foo',
369
        bar => 'MyPlugin::Class::Bar',
369
        bar => {
370
            class => 'MyPlugin::Class::Bar',
371
            name  => "Bar task",
372
        },
370
    };
373
    };
371
}
374
}
372
375
373
- 

Return to bug 39772