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

(-)a/Koha/BackgroundJob/BatchDeleteItem.pm (-7 / +10 lines)
Lines 81-88 sub process { Link Here
81
81
82
    $self->start;
82
    $self->start;
83
83
84
    my @record_ids     = @{ $args->{record_ids} };
84
    my @record_ids           = @{ $args->{record_ids} };
85
    my $delete_biblios = $args->{delete_biblios};
85
    my $delete_biblios       = $args->{delete_biblios};
86
    my $delete_serial_issues = $args->{delete_serial_issues};
86
87
87
    my $report = {
88
    my $report = {
88
        total_records => scalar @record_ids,
89
        total_records => scalar @record_ids,
Lines 104-110 sub process { Link Here
104
105
105
                    my $item = Koha::Items->find($record_id) || next;
106
                    my $item = Koha::Items->find($record_id) || next;
106
107
107
                    my $return = $item->safe_delete({ skip_record_index => 1, skip_holds_queue => 1 });
108
                    my $return = $item->safe_delete({ skip_record_index => 1, skip_holds_queue => 1, delete_serial_issues => $delete_serial_issues });
108
                    unless ( $return ) {
109
                    unless ( $return ) {
109
110
110
                        # FIXME Do we need to rollback the whole transaction if a deletion failed?
111
                        # FIXME Do we need to rollback the whole transaction if a deletion failed?
Lines 221-235 sub enqueue { Link Here
221
    # TODO Raise exception instead
222
    # TODO Raise exception instead
222
    return unless exists $args->{record_ids};
223
    return unless exists $args->{record_ids};
223
224
224
    my @record_ids = @{ $args->{record_ids} };
225
    my @record_ids           = @{ $args->{record_ids} };
225
    my $delete_biblios = $args->{delete_biblios} || 0;
226
    my $delete_biblios       = $args->{delete_biblios}       || 0;
227
    my $delete_serial_issues = $args->{delete_serial_issues} || 0;
226
228
227
    $self->SUPER::enqueue(
229
    $self->SUPER::enqueue(
228
        {
230
        {
229
            job_size => scalar @record_ids,
231
            job_size => scalar @record_ids,
230
            job_args => {
232
            job_args => {
231
                record_ids     => \@record_ids,
233
                record_ids           => \@record_ids,
232
                delete_biblios => $delete_biblios,
234
                delete_biblios       => $delete_biblios,
235
                delete_serial_issues => $delete_serial_issues,
233
            },
236
            },
234
            job_queue => 'long_tasks',
237
            job_queue => 'long_tasks',
235
        }
238
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt (-5 / +14 lines)
Lines 167-178 Link Here
167
167
168
    [% IF ( itemresults ) %]
168
    [% IF ( itemresults ) %]
169
        <div id="cataloguing_additem_newitem" class="item_edit_form">
169
        <div id="cataloguing_additem_newitem" class="item_edit_form">
170
         <input type="hidden" name="op" value="[% op | html %]" />
170
            <input type="hidden" name="op" value="[% op | html %]" />
171
         <p>This will delete [% IF ( too_many_items_display ) %]all the[% ELSE %]the selected[% END %] items.</p>
171
            <p>This will delete [% IF ( too_many_items_display ) %]all the[% ELSE %]the selected[% END %] items.</p>
172
         <input type="hidden" name="del" value="1" />
172
            <input type="hidden" name="del" value="1" />
173
         <input type="checkbox" name="del_records" id="del_records" /> <label for="del_records">Delete records if no items remain.</label>
173
            <div style="display: flex; flex-direction: column; gap: 5px;">
174
                <div>
175
                    <input type="checkbox" name="del_records" id="del_records" />
176
                    <label for="del_records">Delete records if no items remain.</label>
177
                </div>
178
                <div>
179
                    <input type="checkbox" name="del_serial_issues" id="del_serial_issues" />
180
                    <label for="del_serial_issues">Delete serial issues linked to items.</label>
181
                </div>
182
            </div>
174
183
175
         <fieldset class="action">
184
        <fieldset class="action">
176
        [% IF too_many_items_display %]
185
        [% IF too_many_items_display %]
177
            <input type="submit" name="mainformsubmit" class="btn btn-primary" value="Delete ALL submitted items" />
186
            <input type="submit" name="mainformsubmit" class="btn btn-primary" value="Delete ALL submitted items" />
178
        [% ELSE %]
187
        [% ELSE %]
(-)a/tools/batchMod.pl (-14 / +15 lines)
Lines 41-58 use Koha::BackgroundJob::BatchUpdateItem; Link Here
41
use Koha::UI::Form::Builder::Item;
41
use Koha::UI::Form::Builder::Item;
42
use Koha::UI::Table::Builder::Items;
42
use Koha::UI::Table::Builder::Items;
43
43
44
my $input = CGI->new;
44
my $input                             = CGI->new;
45
my $dbh = C4::Context->dbh;
45
my $dbh                               = C4::Context->dbh;
46
my $error        = $input->param('error');
46
my $error                             = $input->param('error');
47
my @itemnumbers  = $input->multi_param('itemnumber');
47
my @itemnumbers                       = $input->multi_param('itemnumber');
48
my $biblionumber = $input->param('biblionumber');
48
my $biblionumber                      = $input->param('biblionumber');
49
my $op           = $input->param('op');
49
my $op                                = $input->param('op');
50
my $del          = $input->param('del');
50
my $del                               = $input->param('del');
51
my $del_records  = $input->param('del_records');
51
my $del_records                       = $input->param('del_records');
52
my $src          = $input->param('src');
52
my $del_serial_issues                 = $input->param('del_serial_issues');
53
my $use_default_values = $input->param('use_default_values');
53
my $src                               = $input->param('src');
54
my $use_default_values                = $input->param('use_default_values');
54
my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority');
55
my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority');
55
my $mark_items_returned = $input->param('mark_items_returned');
56
my $mark_items_returned               = $input->param('mark_items_returned');
56
57
57
my $template_name;
58
my $template_name;
58
my $template_flag;
59
my $template_flag;
Lines 91-98 if ( $op eq "cud-action" ) { Link Here
91
    if ($del) {
92
    if ($del) {
92
        try {
93
        try {
93
            my $params = {
94
            my $params = {
94
                record_ids     => \@itemnumbers,
95
                record_ids           => \@itemnumbers,
95
                delete_biblios => $del_records,
96
                delete_biblios       => $del_records,
97
                delete_serial_issues => $del_serial_issues,
96
            };
98
            };
97
            my $job_id =
99
            my $job_id =
98
              Koha::BackgroundJob::BatchDeleteItem->new->enqueue($params);
100
              Koha::BackgroundJob::BatchDeleteItem->new->enqueue($params);
99
- 

Return to bug 37115