Lines 154-160
if ($op eq "action") {
Link Here
|
154 |
my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID); |
154 |
my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID); |
155 |
|
155 |
|
156 |
# Calling the template |
156 |
# Calling the template |
157 |
add_saved_job_results_to_template($template, $completedJobID); |
157 |
add_saved_job_results_to_template($template, $completedJobID, $items_display_hashref); |
158 |
|
158 |
|
159 |
} else { |
159 |
} else { |
160 |
# While the job is getting done |
160 |
# While the job is getting done |
Lines 186-197
if ($op eq "action") {
Link Here
|
186 |
} |
186 |
} |
187 |
} |
187 |
} |
188 |
|
188 |
|
|
|
189 |
my $yesno = Koha::AuthorisedValues->search({category => 'YES_NO'}); |
190 |
my $ynhash = {}; |
191 |
|
192 |
while(my $yn = $yesno->next) { |
193 |
$ynhash->{'av'.$yn->authorised_value} = $yn->lib; |
194 |
} |
195 |
|
189 |
try { |
196 |
try { |
190 |
my $schema = Koha::Database->new->schema; |
197 |
my $schema = Koha::Database->new->schema; |
191 |
$schema->txn_do( |
198 |
$schema->txn_do( |
192 |
sub { |
199 |
sub { |
193 |
# For each item |
200 |
# For each item |
194 |
my $i = 1; |
201 |
my $i = 1; |
|
|
202 |
my $extra_headers = {}; |
195 |
foreach my $itemnumber (@itemnumbers) { |
203 |
foreach my $itemnumber (@itemnumbers) { |
196 |
$job->progress($i) if $runinbackground; |
204 |
$job->progress($i) if $runinbackground; |
197 |
my $item = Koha::Items->find($itemnumber); |
205 |
my $item = Koha::Items->find($itemnumber); |
Lines 233-241
if ($op eq "action") {
Link Here
|
233 |
} |
241 |
} |
234 |
else { |
242 |
else { |
235 |
my $modified_holds_priority = 0; |
243 |
my $modified_holds_priority = 0; |
236 |
if (defined $exclude_from_local_holds_priority && $item->exclude_from_local_holds_priority != $exclude_from_local_holds_priority) { |
244 |
if (defined $exclude_from_local_holds_priority) { |
|
|
245 |
if($item->exclude_from_local_holds_priority != $exclude_from_local_holds_priority) { |
237 |
$item->exclude_from_local_holds_priority($exclude_from_local_holds_priority)->store; |
246 |
$item->exclude_from_local_holds_priority($exclude_from_local_holds_priority)->store; |
238 |
$modified_holds_priority = 1; |
247 |
$modified_holds_priority = 1; |
|
|
248 |
} |
249 |
$extra_headers->{exclude_from_local_holds_priority} = {name => 'Exclude from local holds priority', items => {}} unless defined $extra_headers->{exclude_from_local_holds_priority}; |
250 |
$extra_headers->{exclude_from_local_holds_priority}->{items}->{$item->itemnumber} = $ynhash->{'av'.$item->exclude_from_local_holds_priority}; |
239 |
} |
251 |
} |
240 |
my $modified = 0; |
252 |
my $modified = 0; |
241 |
if ( $values_to_modify || $values_to_blank ) { |
253 |
if ( $values_to_modify || $values_to_blank ) { |
Lines 305-310
if ($op eq "action") {
Link Here
|
305 |
{ |
317 |
{ |
306 |
modified_items => $modified_items, |
318 |
modified_items => $modified_items, |
307 |
modified_fields => $modified_fields, |
319 |
modified_fields => $modified_fields, |
|
|
320 |
extra_headers => $extra_headers, |
308 |
} |
321 |
} |
309 |
); |
322 |
); |
310 |
} |
323 |
} |
Lines 772-783
sub add_results_to_template {
Link Here
|
772 |
sub add_saved_job_results_to_template { |
785 |
sub add_saved_job_results_to_template { |
773 |
my $template = shift; |
786 |
my $template = shift; |
774 |
my $completedJobID = shift; |
787 |
my $completedJobID = shift; |
|
|
788 |
my $items_display_hashref= shift; |
775 |
my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID); |
789 |
my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID); |
776 |
my $results = $job->results(); |
790 |
my $results = $job->results(); |
777 |
add_results_to_template($template, $results); |
791 |
add_results_to_template($template, $results); |
778 |
|
792 |
|
779 |
my $fields = $job->get("modified_fields"); |
793 |
my $fields = $job->get("modified_fields"); |
780 |
my $items = $job->get("modified_items"); |
794 |
my $items = $job->get("modified_items"); |
|
|
795 |
my $extra_headers = $job->get("extra_headers"); |
796 |
|
797 |
foreach my $header (keys %{$extra_headers}) { |
798 |
push @{$items_display_hashref->{item_header_loop}}, {header_value => $extra_headers->{$header}->{name}}; |
799 |
foreach my $row (@{$items_display_hashref->{item_loop}}) { |
800 |
push @{$row->{item_value}}, {field => $extra_headers->{$header}->{items}->{$row->{itemnumber}}}; |
801 |
} |
802 |
} |
803 |
|
781 |
$template->param( |
804 |
$template->param( |
782 |
modified_items => $items, |
805 |
modified_items => $items, |
783 |
modified_fields => $fields, |
806 |
modified_fields => $fields, |
784 |
- |
|
|