Lines 55-68
Process the modification.
Link Here
|
55 |
=cut |
55 |
=cut |
56 |
|
56 |
|
57 |
sub process { |
57 |
sub process { |
58 |
my ( $self, $args ) = @_; |
58 |
my ( $self, $job_id ) = @_; |
59 |
|
59 |
|
60 |
my $job = Koha::BackgroundJobs->find( $args->{job_id} ); |
60 |
my $job = Koha::BackgroundJobs->find( $job_id ); |
61 |
|
61 |
|
62 |
if ( !exists $args->{job_id} || !$job || $job->status eq 'cancelled' ) { |
62 |
if ( !$job || $job->status eq 'cancelled' ) { |
63 |
return; |
63 |
return; |
64 |
} |
64 |
} |
65 |
|
65 |
|
|
|
66 |
my $job_data = decode_json $job->data; |
67 |
|
66 |
# FIXME If the job has already been started, but started again (worker has been restart for instance) |
68 |
# FIXME If the job has already been started, but started again (worker has been restart for instance) |
67 |
# Then we will start from scratch and so double process the same records |
69 |
# Then we will start from scratch and so double process the same records |
68 |
|
70 |
|
Lines 72-79
sub process {
Link Here
|
72 |
->status('started') |
74 |
->status('started') |
73 |
->store; |
75 |
->store; |
74 |
|
76 |
|
75 |
my $mmtid = $args->{mmtid}; |
77 |
my $mmtid = $job_data->{mmtid}; |
76 |
my @record_ids = @{ $args->{record_ids} }; |
78 |
my @record_ids = @{ $job_data->{record_ids} }; |
77 |
|
79 |
|
78 |
my $report = { |
80 |
my $report = { |
79 |
total_records => scalar @record_ids, |
81 |
total_records => scalar @record_ids, |
Lines 92-98
sub process {
Link Here
|
92 |
C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record ); |
94 |
C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record ); |
93 |
my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber ); |
95 |
my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber ); |
94 |
C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, { |
96 |
C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, { |
95 |
overlay_context => $args->{overlay_context}, |
97 |
overlay_context => $job_data->{overlay_context}, |
96 |
}); |
98 |
}); |
97 |
}; |
99 |
}; |
98 |
if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well |
100 |
if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well |
Lines 113-119
sub process {
Link Here
|
113 |
$job->progress( ++$job_progress )->store; |
115 |
$job->progress( ++$job_progress )->store; |
114 |
} |
116 |
} |
115 |
|
117 |
|
116 |
my $job_data = decode_json $job->data; |
|
|
117 |
$job_data->{messages} = \@messages; |
118 |
$job_data->{messages} = \@messages; |
118 |
$job_data->{report} = $report; |
119 |
$job_data->{report} = $report; |
119 |
|
120 |
|