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

(-)a/C4/Biblio.pm (+7 lines)
Lines 417-422 sub DelBiblio { Link Here
417
        C4::Serials::DelSubscription( $subscription->{subscriptionid} );
417
        C4::Serials::DelSubscription( $subscription->{subscriptionid} );
418
    }
418
    }
419
419
420
    # We delete any existing holds
421
    require C4::Reserves;
422
    my ($count, $reserves) = C4::Reserves::GetReservesFromBiblionumber($biblionumber);
423
    foreach my $res ( @$reserves ) {
424
        C4::Reserves::CancelReserve( $res->{'biblionumber'}, $res->{'itemnumber'}, $res->{'borrowernumber'} );
425
    }
426
420
    # Delete in Zebra. Be careful NOT to move this line after _koha_delete_biblio
427
    # Delete in Zebra. Be careful NOT to move this line after _koha_delete_biblio
421
    # for at least 2 reasons :
428
    # for at least 2 reasons :
422
    # - we need to read the biblio if NoZebra is set (to remove it from the indexes
429
    # - we need to read the biblio if NoZebra is set (to remove it from the indexes
(-)a/C4/Items.pm (+1 lines)
Lines 26-31 use C4::Context; Link Here
26
use C4::Koha;
26
use C4::Koha;
27
use C4::Biblio;
27
use C4::Biblio;
28
use C4::Dates qw/format_date format_date_in_iso/;
28
use C4::Dates qw/format_date format_date_in_iso/;
29
use C4::Search qw/SimpleSearch/;
29
use MARC::Record;
30
use MARC::Record;
30
use C4::ClassSource;
31
use C4::ClassSource;
31
use C4::Log;
32
use C4::Log;
(-)a/C4/Reserves.pm (-3 / +3 lines)
Lines 98-104 BEGIN { Link Here
98
        &GetReservesToBranch
98
        &GetReservesToBranch
99
        &GetReserveCount
99
        &GetReserveCount
100
        &GetReserveFee
100
        &GetReserveFee
101
		&GetReserveInfo
101
        &GetReserveInfo
102
        &GetReserveStatus
102
        &GetReserveStatus
103
        
103
        
104
        &GetOtherReserves
104
        &GetOtherReserves
Lines 901-908 sub CancelExpiredReserves { Link Here
901
Cancels a reserve.
901
Cancels a reserve.
902
902
903
Use either C<$biblionumber> or C<$itemnumber> to specify the item to
903
Use either C<$biblionumber> or C<$itemnumber> to specify the item to
904
cancel, but not both: if both are given, C<&CancelReserve> does
904
cancel, but not both: if both are given, C<&CancelReserve> uses
905
nothing.
905
C<$itemnumber>.
906
906
907
C<$borrowernumber> is the borrower number of the patron on whose
907
C<$borrowernumber> is the borrower number of the patron on whose
908
behalf the book was reserved.
908
behalf the book was reserved.
(-)a/C4/Search.pm (+1 lines)
Lines 71-76 This module provides searching functions for Koha's bibliographic databases Link Here
71
  &AddSearchHistory
71
  &AddSearchHistory
72
  &GetDistinctValues
72
  &GetDistinctValues
73
  &enabled_staff_search_views
73
  &enabled_staff_search_views
74
  &SimpleSearch
74
);
75
);
75
76
76
# make all your functions, whether exported or not;
77
# make all your functions, whether exported or not;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt (-1 / +5 lines)
Lines 133-138 for( x=0; x<allColumns.length; x++ ){ Link Here
133
		    <div id="jobfailed"></div>
133
		    <div id="jobfailed"></div>
134
		</div>
134
		</div>
135
		[% IF ( too_many_items ) %]<input type="submit" name="mainformsubmit" value="Delete ALL submitted items" onclick="return submitBackgroundJob(this.form);" />[% ELSE %]
135
		[% IF ( too_many_items ) %]<input type="submit" name="mainformsubmit" value="Delete ALL submitted items" onclick="return submitBackgroundJob(this.form);" />[% ELSE %]
136
		<input type="checkbox" name="del_records" id="del_records" /> <label for="del_records">Delete records if no items remain.</label><p>
136
		<input type="submit" name="mainformsubmit" value="Delete selected items" onclick="return submitBackgroundJob(this.form);" />[% END %]
137
		<input type="submit" name="mainformsubmit" value="Delete selected items" onclick="return submitBackgroundJob(this.form);" />[% END %]
137
138
138
		<a href="/cgi-bin/koha/tools/batchMod.pl?del=1" class="cancel">Cancel</a>
139
		<a href="/cgi-bin/koha/tools/batchMod.pl?del=1" class="cancel">Cancel</a>
Lines 146-152 for( x=0; x<allColumns.length; x++ ){ Link Here
146
    [% END %]
147
    [% END %]
147
148
148
[% IF ( action ) %]
149
[% IF ( action ) %]
149
	<div class="dialog message"><p>[% deleted_items %] item(s) deleted.</p></div>
150
	<div class="dialog message">
151
            <p>[% deleted_items %] item(s) deleted.</p>
152
            [% IF delete_records %] <p>[% deleted_records %] record(s) deleted.</p> [% END %]
153
        </div>
150
	[% IF ( not_deleted_items ) %]
154
	[% IF ( not_deleted_items ) %]
151
	<div style="width:55%;margin:auto;">
155
	<div style="width:55%;margin:auto;">
152
	    <p>[% not_deleted_items %] item(s) could not be deleted: [% FOREACH not_deleted_itemnumber IN not_deleted_itemnumbers %][% not_deleted_itemnumber.itemnumber %][% END %]</p>
156
	    <p>[% not_deleted_items %] item(s) could not be deleted: [% FOREACH not_deleted_itemnumber IN not_deleted_itemnumbers %][% not_deleted_itemnumber.itemnumber %][% END %]</p>
(-)a/tools/batchMod.pl (-8 / +20 lines)
Lines 41-46 my $error = $input->param('error'); Link Here
41
my @itemnumbers  = $input->param('itemnumber');
41
my @itemnumbers  = $input->param('itemnumber');
42
my $op           = $input->param('op');
42
my $op           = $input->param('op');
43
my $del          = $input->param('del');
43
my $del          = $input->param('del');
44
my $del_records  = $input->param('del_records');
44
my $completedJobID = $input->param('completedJobID');
45
my $completedJobID = $input->param('completedJobID');
45
my $runinbackground = $input->param('runinbackground');
46
my $runinbackground = $input->param('runinbackground');
46
47
Lines 76-83 my $items_display_hashref; Link Here
76
my $frameworkcode="";
77
my $frameworkcode="";
77
my $tagslib = &GetMarcStructure(1,$frameworkcode);
78
my $tagslib = &GetMarcStructure(1,$frameworkcode);
78
79
79
my $deleted_items = 0;     # Numbers of deleted items
80
my $deleted_items = 0;     # Number of deleted items
80
my $not_deleted_items = 0; # Numbers of items that could not be deleted
81
my $deleted_records = 0;   # Number of deleted records ( with no items attached )
82
my $not_deleted_items = 0; # Number of items that could not be deleted
81
my @not_deleted;           # List of the itemnumbers that could not be deleted
83
my @not_deleted;           # List of the itemnumbers that could not be deleted
82
84
83
my %cookies = parse CGI::Cookie($cookie);
85
my %cookies = parse CGI::Cookie($cookie);
Lines 156-162 if ($op eq "action") { Link Here
156
	foreach my $itemnumber(@itemnumbers){
158
	foreach my $itemnumber(@itemnumbers){
157
159
158
		$job->progress($i) if $runinbackground;
160
		$job->progress($i) if $runinbackground;
159
		my $itemdata=GetItem($itemnumber);
161
		my $itemdata = GetItem($itemnumber);
160
		if ($input->param("del")){
162
		if ($input->param("del")){
161
			my $return = DelItemCheck(C4::Context->dbh, $itemdata->{'biblionumber'}, $itemdata->{'itemnumber'});
163
			my $return = DelItemCheck(C4::Context->dbh, $itemdata->{'biblionumber'}, $itemdata->{'itemnumber'});
162
			if ($return == 1) {
164
			if ($return == 1) {
Lines 171-185 if ($op eq "action") { Link Here
171
				  $return => 1
173
				  $return => 1
172
				};
174
				};
173
			}
175
			}
176
177
			# If there are no items left, delete the biblio
178
			if ( $del_records ) {
179
                            my $itemscount = GetItemsCount($itemdata->{'biblionumber'});
180
                            if ( $itemscount == 0 ) {
181
			        my $error = DelBiblio($itemdata->{'biblionumber'});
182
			        $deleted_records++ unless ( $error );
183
                            }
184
                        }
174
		} else {
185
		} else {
175
		    if ($values_to_modify || $values_to_blank) {
186
		    if ($values_to_modify || $values_to_blank) {
176
			my $localmarcitem = Item2Marc($itemdata);
187
			my $localmarcitem = Item2Marc($itemdata);
177
			UpdateMarcWith( $marcitem, $localmarcitem );
188
			UpdateMarcWith( $marcitem, $localmarcitem );
178
			eval{
189
			eval{
179
                if ( my $item = ModItemFromMarc( $localmarcitem, $itemdata->{biblionumber}, $itemnumber ) ) {
190
                            if ( my $item = ModItemFromMarc( $localmarcitem, $itemdata->{biblionumber}, $itemnumber ) ) {
180
                    LostItem($itemnumber, 'MARK RETURNED', 'CHARGE FEE') if $item->{itemlost};
191
                                LostItem($itemnumber, 'MARK RETURNED', 'CHARGE FEE') if $item->{itemlost};
181
                }
192
                            }
182
            };
193
                        };
183
		    }
194
		    }
184
		}
195
		}
185
		$i++;
196
		$i++;
Lines 433-438 if ($op eq "action") { Link Here
433
    $template->param(
444
    $template->param(
434
	not_deleted_items => $not_deleted_items,
445
	not_deleted_items => $not_deleted_items,
435
	deleted_items => $deleted_items,
446
	deleted_items => $deleted_items,
447
	delete_records => $del_records,
448
	deleted_records => $deleted_records,
436
	not_deleted_loop => \@not_deleted 
449
	not_deleted_loop => \@not_deleted 
437
    );
450
    );
438
}
451
}
439
- 

Return to bug 6027