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

(-)a/Koha/BackgroundJob/BatchDeleteBiblio.pm (+8 lines)
Lines 7-12 use C4::Biblio; Link Here
7
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
7
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
8
use Koha::SearchEngine;
8
use Koha::SearchEngine;
9
use Koha::SearchEngine::Indexer;
9
use Koha::SearchEngine::Indexer;
10
use Koha::Acquisition::Orders;
10
11
11
use base 'Koha::BackgroundJob';
12
use base 'Koha::BackgroundJob';
12
13
Lines 123-128 sub process { Link Here
123
            }
124
            }
124
        }
125
        }
125
126
127
        # Cancel acq order lines
128
        my @result = Koha::Acquisition::Orders->search( { biblionumber => $biblionumber } )->cancel;
129
        my $warns  = @{ $result[1] };
130
        if ( $result[0] && $warns ) {    # warnings about order lines not removed
131
            warn sprintf( "%d order lines were deleted, but %d lines gave a warning\n", $result[0], $warns );
132
        }
133
126
        # Finally, delete the biblio
134
        # Finally, delete the biblio
127
        my $error = eval {
135
        my $error = eval {
128
            C4::Biblio::DelBiblio( $biblionumber, { skip_record_index => 1, skip_holds_queue => 1 } );
136
            C4::Biblio::DelBiblio( $biblionumber, { skip_record_index => 1, skip_holds_queue => 1 } );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt (+6 lines)
Lines 89-94 Link Here
89
        <ol>
89
        <ol>
90
          <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
90
          <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
91
          <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
91
          <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
92
          <li class="skip_open_orders">
93
              <input type="checkbox" name="skip_open_orders" checked />
94
              <label for="skip_open_orders">Skip biblio records with open acquisition orders</label>
95
          </li>
92
        </ol>
96
        </ol>
93
      </fieldset>
97
      </fieldset>
94
98
Lines 260-267 Link Here
260
            $("input[type='radio']").click(function() {
264
            $("input[type='radio']").click(function() {
261
                if ($(this).attr('id') == 'authority_type') {
265
                if ($(this).attr('id') == 'authority_type') {
262
                    $("a[href='#shelves_tab_panel']").parent().hide();
266
                    $("a[href='#shelves_tab_panel']").parent().hide();
267
                    $("li.skip_open_orders").hide();
263
                } else if ($(this).attr('id') == 'biblio_type') {
268
                } else if ($(this).attr('id') == 'biblio_type') {
264
                    $("a[href='#shelves_tab_panel']").parent().show();
269
                    $("a[href='#shelves_tab_panel']").parent().show();
270
                    $("li.skip_open_orders").show();
265
                }
271
                }
266
            });
272
            });
267
273
(-)a/tools/batch_delete_records.pl (-4 / +12 lines)
Lines 29-34 use C4::Output qw( output_html_with_http_headers ); Link Here
29
use C4::Auth qw( get_template_and_user );
29
use C4::Auth qw( get_template_and_user );
30
use C4::Biblio;
30
use C4::Biblio;
31
use C4::AuthoritiesMarc;
31
use C4::AuthoritiesMarc;
32
use Koha::Acquisition::Orders;
32
use Koha::Virtualshelves;
33
use Koha::Virtualshelves;
33
34
34
use Koha::Authorities;
35
use Koha::Authorities;
Lines 37-45 use Koha::Items; Link Here
37
use Koha::BackgroundJob::BatchDeleteBiblio;
38
use Koha::BackgroundJob::BatchDeleteBiblio;
38
use Koha::BackgroundJob::BatchDeleteAuthority;
39
use Koha::BackgroundJob::BatchDeleteAuthority;
39
40
40
my $input = CGI->new;
41
my $input            = CGI->new;
41
my $op = $input->param('op') // q|form|;
42
my $op               = $input->param('op') // q|form|;
42
my $recordtype = $input->param('recordtype') // 'biblio';
43
my $recordtype       = $input->param('recordtype') // 'biblio';
44
my $skip_open_orders = $input->param('skip_open_orders') // 0;
43
45
44
my ($template, $loggedinuser, $cookie) = get_template_and_user({
46
my ($template, $loggedinuser, $cookie) = get_template_and_user({
45
        template_name => 'tools/batch_delete_records.tt',
47
        template_name => 'tools/batch_delete_records.tt',
Lines 106-111 if ( $op eq 'form' ) { Link Here
106
            $biblio->{holds_count} = $biblio_object->holds->count;
108
            $biblio->{holds_count} = $biblio_object->holds->count;
107
            $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id );
109
            $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id );
108
            $biblio->{subscriptions_count} = $biblio_object->subscriptions->count;
110
            $biblio->{subscriptions_count} = $biblio_object->subscriptions->count;
111
112
            # Respect skip_open_orders
113
            next
114
                if $skip_open_orders
115
                && Koha::Acquisition::Orders->search(
116
                { biblionumber => $record_id, orderstatus => [ 'new', 'ordered', 'partial' ] } )->count;
117
109
            push @records, $biblio;
118
            push @records, $biblio;
110
        } else {
119
        } else {
111
            # Retrieve authority information
120
            # Retrieve authority information
112
- 

Return to bug 27893