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

(-)a/Koha/BackgroundJob/BatchUpdateItem.pm (+3 lines)
Lines 98-103 sub process { Link Here
98
    my $new_values = $args->{new_values};
98
    my $new_values = $args->{new_values};
99
    my $exclude_from_local_holds_priority =
99
    my $exclude_from_local_holds_priority =
100
      $args->{exclude_from_local_holds_priority};
100
      $args->{exclude_from_local_holds_priority};
101
    my $mark_items_returned =
102
      $args->{mark_items_returned};
101
103
102
    my $report = {
104
    my $report = {
103
        total_records            => scalar @record_ids,
105
        total_records            => scalar @record_ids,
Lines 113-118 sub process { Link Here
113
                new_values => $new_values,
115
                new_values => $new_values,
114
                exclude_from_local_holds_priority =>
116
                exclude_from_local_holds_priority =>
115
                  $exclude_from_local_holds_priority,
117
                  $exclude_from_local_holds_priority,
118
                mark_items_returned => $mark_items_returned,
116
                callback => sub {
119
                callback => sub {
117
                    my ($progress) = @_;
120
                    my ($progress) = @_;
118
                    $self->progress($progress)->store;
121
                    $self->progress($progress)->store;
(-)a/Koha/Items.pm (-2 / +24 lines)
Lines 227-232 Allows to modify existing subfield's values using a regular expression Link Here
227
227
228
Set the passed boolean value to items.exclude_from_local_holds_priority
228
Set the passed boolean value to items.exclude_from_local_holds_priority
229
229
230
=item mark_items_returned
231
232
Move issues on these items to the old issues table, do not mark items found or adjust statuses or fines
233
230
=item callback
234
=item callback
231
235
232
Callback function to call after an item has been modified
236
Callback function to call after an item has been modified
Lines 241-246 sub batch_update { Link Here
241
    my $regex_mod = $params->{regex_mod} || {};
245
    my $regex_mod = $params->{regex_mod} || {};
242
    my $new_values = $params->{new_values} || {};
246
    my $new_values = $params->{new_values} || {};
243
    my $exclude_from_local_holds_priority = $params->{exclude_from_local_holds_priority};
247
    my $exclude_from_local_holds_priority = $params->{exclude_from_local_holds_priority};
248
    my $mark_items_returned = $params->{mark_items_returned};
244
    my $callback = $params->{callback};
249
    my $callback = $params->{callback};
245
250
246
    my (@modified_itemnumbers, $modified_fields);
251
    my (@modified_itemnumbers, $modified_fields);
Lines 250-255 sub batch_update { Link Here
250
255
251
        try {$schema->txn_do(sub {
256
        try {$schema->txn_do(sub {
252
            my $modified_holds_priority = 0;
257
            my $modified_holds_priority = 0;
258
            my $item_returned = 0;
253
            if ( defined $exclude_from_local_holds_priority ) {
259
            if ( defined $exclude_from_local_holds_priority ) {
254
                if(!defined $item->exclude_from_local_holds_priority || $item->exclude_from_local_holds_priority != $exclude_from_local_holds_priority) {
260
                if(!defined $item->exclude_from_local_holds_priority || $item->exclude_from_local_holds_priority != $exclude_from_local_holds_priority) {
255
                    $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority)->store;
261
                    $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority)->store;
Lines 336-344 sub batch_update { Link Here
336
                ) if $item->itemlost
342
                ) if $item->itemlost
337
                      and not $itemlost_pre;
343
                      and not $itemlost_pre;
338
            }
344
            }
345
            if ( $mark_items_returned ){
346
                my $issue = $item->checkout;
347
                if( $issue ){
348
                        $item_returned = 1;
349
                        C4::Circulation::MarkIssueReturned(
350
                        $issue->borrowernumber,
351
                        $item->itemnumber,
352
                        undef,
353
                        $issue->patron->privacy,
354
                        {
355
                            skip_record_index => 1,
356
                            skip_holds_queue  => 1,
357
                        }
358
                    );
359
                }
360
            }
339
361
340
            push @modified_itemnumbers, $item->itemnumber if $modified || $modified_holds_priority;
362
            push @modified_itemnumbers, $item->itemnumber if $modified || $modified_holds_priority || $item_returned;
341
            $modified_fields += $modified + $modified_holds_priority;
363
            $modified_fields += $modified + $modified_holds_priority + $item_returned;
342
        })}
364
        })}
343
        catch {
365
        catch {
344
            warn $_
366
            warn $_
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt (+16 lines)
Lines 196-201 Link Here
196
                                </li>
196
                                </li>
197
                            </ol>
197
                            </ol>
198
                        </fieldset>
198
                        </fieldset>
199
                        <fieldset class="rows">
200
                            <legend>Options</legend>
201
                            <ol>
202
                                <li>
203
                                    <div class="subfield_line">
204
                                        <p>This option allows returning items to remove them from patron accounts</br>Items are not marked found nor do statuses prevent this return. This feature is intended to allow removal and deletion of items without affecting fines or other statuses</p></br>
205
                                        <label for="mark_items_returned">Mark items returned:</label>
206
                                        <select id="mark_items_returned" name="mark_items_returned" class="input_marceditor select2" style="width: 50px">
207
                                            <option selected></option>
208
                                            <option value="1">Yes</option>
209
                                            <option value="0">No</option>
210
                                        </select>
211
                                    </div>
212
                                </li>
213
                            </ol>
214
                        </fieldset>
199
215
200
                        <fieldset class="action">
216
                        <fieldset class="action">
201
                            <input type="submit" id="mainformsubmit" value="Save" />
217
                            <input type="submit" id="mainformsubmit" value="Save" />
(-)a/tools/batchMod.pl (-1 / +6 lines)
Lines 52-57 my $del_records = $input->param('del_records'); Link Here
52
my $src          = $input->param('src');
52
my $src          = $input->param('src');
53
my $use_default_values = $input->param('use_default_values');
53
my $use_default_values = $input->param('use_default_values');
54
my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority');
54
my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority');
55
my $mark_items_returned = $input->param('mark_items_returned');
55
56
56
my $template_name;
57
my $template_name;
57
my $template_flag;
58
my $template_flag;
Lines 170-175 if ( $op eq "action" ) { Link Here
170
              )
171
              )
171
            ? $exclude_from_local_holds_priority
172
            ? $exclude_from_local_holds_priority
172
            : undef,
173
            : undef,
174
            mark_items_returned => (
175
                defined $mark_items_returned
176
                  && $mark_items_returned ne ""
177
                )
178
            ? $mark_items_returned : undef,
173
179
174
        };
180
        };
175
        try {
181
        try {
176
- 

Return to bug 32019