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

(-)a/tools/batchMod.pl (-30 / +33 lines)
Lines 115-146 if ($op eq "action") { Link Here
115
    my $values_to_blank  = scalar(@disabled);
115
    my $values_to_blank  = scalar(@disabled);
116
    my $marcitem;
116
    my $marcitem;
117
117
118
    # Once the job is done
118
    if ( !$completedJobID || !$runinbackground ) {
119
    if ($completedJobID) {
120
	# If we have a reasonable amount of items, we display them
121
    if (scalar(@itemnumbers) <= ( C4::Context->preference("MaxItemsToDisplayForBatchDel") // 1000 ) ) {
122
	    $items_display_hashref=BuildItemsData(@itemnumbers);
123
	} else {
124
	    # Else, we only display the barcode
125
        my @simple_items_display = map {
126
            my $itemnumber = $_;
127
            my $item = Koha::Items->find($itemnumber);
128
            {
129
                itemnumber   => $itemnumber,
130
                barcode      => $item ? ( $item->barcode // q{} ) : q{},
131
                biblionumber => $item ? $item->biblio->biblionumber : q{},
132
            };
133
        } @itemnumbers;
134
	    $template->param("simple_items_display" => \@simple_items_display);
135
	}
136
137
	# Setting the job as done
138
	my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID);
139
140
	# Calling the template
141
        add_saved_job_results_to_template($template, $completedJobID);
142
143
    } else {
144
    # While the job is getting done
119
    # While the job is getting done
145
120
146
	# Job size is the number of items we have to process
121
	# Job size is the number of items we have to process
Lines 211-219 if ($op eq "action") { Link Here
211
                        }
186
                        }
212
                    };
187
                    };
213
                }
188
                }
189
                $modified_items++ if $modified;
190
                $modified_fields += $modified;
214
                if ( $runinbackground ) {
191
                if ( $runinbackground ) {
215
                    $modified_items++ if $modified;
216
                    $modified_fields += $modified;
217
                    $job->set({
192
                    $job->set({
218
                        modified_items  => $modified_items,
193
                        modified_items  => $modified_items,
219
                        modified_fields => $modified_fields,
194
                        modified_fields => $modified_fields,
Lines 224-229 if ($op eq "action") { Link Here
224
		$i++;
199
		$i++;
225
	}
200
	}
226
    }
201
    }
202
    if ( $completedJobID || !$runinbackground ) {
203
        # Once the job is done
204
        # If we have a reasonable amount of items, we display them
205
        if (scalar(@itemnumbers) <= ( C4::Context->preference("MaxItemsToDisplayForBatchDel") // 1000 ) ) {
206
            $items_display_hashref=BuildItemsData(@itemnumbers);
207
        } else {
208
            # Else, we only display the barcode
209
            my @simple_items_display = map {
210
                my $itemnumber = $_;
211
                my $item = Koha::Items->find($itemnumber);
212
                {
213
                    itemnumber   => $itemnumber,
214
                    barcode      => $item ? ( $item->barcode // q{} ) : q{},
215
                    biblionumber => $item ? $item->biblio->biblionumber : q{},
216
                };
217
            } @itemnumbers;
218
            $template->param("simple_items_display" => \@simple_items_display);
219
        }
220
221
        if ($runinbackground) {
222
            # Setting the job as done
223
            my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID);
224
225
            # Calling the template
226
            add_saved_job_results_to_template($template, $completedJobID);
227
        }
228
    }
227
}
229
}
228
#
230
#
229
#-------------------------------------------------------------------------------
231
#-------------------------------------------------------------------------------
Lines 519-525 if ($op eq "action") { Link Here
519
	deleted_items => $deleted_items,
521
	deleted_items => $deleted_items,
520
	delete_records => $del_records,
522
	delete_records => $del_records,
521
	deleted_records => $deleted_records,
523
	deleted_records => $deleted_records,
522
	not_deleted_loop => \@not_deleted 
524
	not_deleted_loop => \@not_deleted,
525
        modified_items => $modified_items,
526
        modified_fields => $modified_fields,
523
    );
527
    );
524
}
528
}
525
529
526
- 

Return to bug 17240