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

(-)a/C4/Biblio.pm (-2 / +1 lines)
Lines 307-314 sub ModBiblio { Link Here
307
    }
307
    }
308
308
309
    if ( C4::Context->preference("CataloguingLog") ) {
309
    if ( C4::Context->preference("CataloguingLog") ) {
310
        my $newrecord = GetMarcBiblio($biblionumber);
310
        logaction( "CATALOGUING", "MODIFY", $biblionumber, "biblio BEFORE=>" . $record->as_formatted );
311
        logaction( "CATALOGUING", "MODIFY", $biblionumber, "biblio BEFORE=>" . $newrecord->as_formatted );
312
    }
311
    }
313
312
314
    # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to
313
    # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to
(-)a/tools/batch_record_modification.pl (-20 / +19 lines)
Lines 153-162 if ( $op eq 'form' ) { Link Here
153
    # We want to modify selected records!
153
    # We want to modify selected records!
154
    my @record_ids = $input->param('record_id');
154
    my @record_ids = $input->param('record_id');
155
155
156
    my $job_size;
156
    my ( $job );
157
    my ( $job );
157
    if ( $runinbackground ) {
158
    if ( $runinbackground ) {
158
        my $job_size = scalar( @record_ids );
159
        $job_size = scalar( @record_ids );
159
        $job = C4::BackgroundJob->new( $sessionID, "FIXME", '/cgi-bin/koha/tools/batch_record_modification.pl', $job_size );
160
        $job = C4::BackgroundJob->new( $sessionID, "FIXME", $ENV{SCRIPT_NAME}, $job_size );
160
        my $job_id = $job->id;
161
        my $job_id = $job->id;
161
        if (my $pid = fork) {
162
        if (my $pid = fork) {
162
            $dbh->{InactiveDestroy}  = 1;
163
            $dbh->{InactiveDestroy}  = 1;
Lines 178-186 if ( $op eq 'form' ) { Link Here
178
        total_records => 0,
179
        total_records => 0,
179
        total_success => 0,
180
        total_success => 0,
180
    };
181
    };
182
    my $has_errors;
181
    my $progress = 0;
183
    my $progress = 0;
182
    $dbh->{RaiseError} = 1;
184
    $dbh->{RaiseError} = 1;
183
    RECORD_IDS: for my $record_id ( sort { $a <=> $b } @record_ids ) {
185
    RECORD_IDS: for my $record_id ( sort { $a <=> $b } @record_ids ) {
186
        $progress++;
187
        $has_errors = 0;
184
        $report->{total_records}++;
188
        $report->{total_records}++;
185
        next unless $record_id;
189
        next unless $record_id;
186
190
Lines 201-212 if ( $op eq 'form' ) { Link Here
201
                    biblionumber => $biblionumber,
205
                    biblionumber => $biblionumber,
202
                    error => ($@ ? $@ : $error),
206
                    error => ($@ ? $@ : $error),
203
                };
207
                };
208
                $has_errors++;
204
            } else {
209
            } else {
205
                push @messages, {
206
                    type => 'success',
207
                    code => 'biblio_modified',
208
                    biblionumber => $biblionumber,
209
                };
210
                $report->{total_success}++;
210
                $report->{total_success}++;
211
            }
211
            }
212
        } else {
212
        } else {
Lines 225-246 if ( $op eq 'form' ) { Link Here
225
                    authid => $authid,
225
                    authid => $authid,
226
                    error => ($@ ? $@ : 0),
226
                    error => ($@ ? $@ : 0),
227
                };
227
                };
228
                $has_errors++;
228
            } else {
229
            } else {
229
                push @messages, {
230
                    type => 'success',
231
                    code => 'authority_modified',
232
                    authid => $authid,
233
                };
234
                $report->{total_success}++;
230
                $report->{total_success}++;
235
            }
231
            }
236
        }
232
        }
237
233
        
238
        $job->set({
234
        if ($has_errors){
239
            view => 'report',
235
            $job->set({
240
            report => $report,
236
                view => 'report',
241
            messages => \@messages,
237
                report => $report,
242
        });
238
                messages => \@messages,
243
        $job->progress( ++$progress ) if $runinbackground;
239
            });
240
        }
241
        
242
        $job->progress( ++$progress ) if $runinbackground && (!($progress%10) || ($progress==$job_size));
243
    
244
    }
244
    }
245
245
246
    if ($runinbackground) {
246
    if ($runinbackground) {
247
- 

Return to bug 15104