Lines 91-131
sub process {
Link Here
|
91 |
|
91 |
|
92 |
$self->start; |
92 |
$self->start; |
93 |
|
93 |
|
94 |
my @record_ids = @{ $args->{record_ids} }; |
94 |
my @record_ids = @{ $args->{record_ids} }; |
95 |
my $regex_mod = $args->{regex_mod}; |
95 |
my $regex_mod = $args->{regex_mod}; |
96 |
my $new_values = $args->{new_values}; |
96 |
my $new_values = $args->{new_values}; |
97 |
my $exclude_from_local_holds_priority = |
97 |
my $exclude_from_local_holds_priority = $args->{exclude_from_local_holds_priority}; |
98 |
$args->{exclude_from_local_holds_priority}; |
98 |
my $mark_items_returned = $args->{mark_items_returned}; |
99 |
my $mark_items_returned = |
99 |
my $sort1 = $args->{sort1}; |
100 |
$args->{mark_items_returned}; |
100 |
my $sort2 = $args->{sort2}; |
101 |
|
101 |
|
102 |
my $report = { |
102 |
my $report = { |
103 |
total_records => scalar @record_ids, |
103 |
total_records => scalar @record_ids, |
104 |
modified_fields => 0, |
104 |
modified_fields => 0, |
105 |
}; |
105 |
}; |
106 |
|
106 |
|
107 |
try { |
107 |
try { |
108 |
my ($results) = Koha::Items->search( { itemnumber => \@record_ids } )->batch_update( |
108 |
my ($results) = Koha::Items->search( { itemnumber => \@record_ids } )->batch_update( |
109 |
{ regex_mod => $regex_mod, |
109 |
{ |
|
|
110 |
regex_mod => $regex_mod, |
110 |
new_values => $new_values, |
111 |
new_values => $new_values, |
111 |
exclude_from_local_holds_priority => $exclude_from_local_holds_priority, |
112 |
exclude_from_local_holds_priority => $exclude_from_local_holds_priority, |
112 |
mark_items_returned => $mark_items_returned, |
113 |
mark_items_returned => $mark_items_returned, |
|
|
114 |
sort1 => $sort1, |
115 |
sort2 => $sort2, |
113 |
callback => sub { $self->step; }, |
116 |
callback => sub { $self->step; }, |
114 |
} |
117 |
} |
115 |
); |
118 |
); |
116 |
$report->{modified_itemnumbers} = $results->{modified_itemnumbers}; |
119 |
$report->{modified_itemnumbers} = $results->{modified_itemnumbers}; |
117 |
$report->{modified_fields} = $results->{modified_fields}; |
120 |
$report->{modified_fields} = $results->{modified_fields}; |
118 |
} |
121 |
} catch { |
119 |
catch { |
|
|
120 |
warn $_; |
122 |
warn $_; |
121 |
die "Something terrible has happened!" |
123 |
die "Something terrible has happened!" |
122 |
if ( $_ =~ /Rollback failed/ ); # Rollback failed |
124 |
if ( $_ =~ /Rollback failed/ ); # Rollback failed |
123 |
}; |
125 |
}; |
124 |
|
126 |
|
125 |
my $data = $self->decoded_data; |
127 |
my $data = $self->decoded_data; |
126 |
$data->{report} = $report; |
128 |
$data->{report} = $report; |
127 |
|
129 |
|
128 |
$self->finish( $data ); |
130 |
$self->finish($data); |
129 |
} |
131 |
} |
130 |
|
132 |
|
131 |
=head3 enqueue |
133 |
=head3 enqueue |
Lines 166-174
sub additional_report {
Link Here
|
166 |
if ( scalar(@$itemnumbers) > C4::Context->preference('MaxItemsToDisplayForBatchMod') ) { |
168 |
if ( scalar(@$itemnumbers) > C4::Context->preference('MaxItemsToDisplayForBatchMod') ) { |
167 |
return { too_many_items_display => 1 }; |
169 |
return { too_many_items_display => 1 }; |
168 |
} else { |
170 |
} else { |
169 |
my $items_table = |
171 |
my $items_table = Koha::UI::Table::Builder::Items->new( { itemnumbers => $itemnumbers } )->build_table; |
170 |
Koha::UI::Table::Builder::Items->new( { itemnumbers => $itemnumbers } ) |
|
|
171 |
->build_table; |
172 |
|
172 |
|
173 |
return { |
173 |
return { |
174 |
items => $items_table->{items}, |
174 |
items => $items_table->{items}, |