Bug 26992: Fix serial issue and related items deletion on serial collection page

serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolete.

Test plan:

1. Create a subscription with items created when receiving.
2. Receive several issues, and create corresponding items.
3. On Serial collection page (serial-collection.pl), select several issues.
4. Click on button Delete selected issues
5. A confirmation page is displayed. Enable "Delete associated items?".
   Then click on "Yes, delete" button.

   You get this error: Undefined subroutine &C4::Items::DelItemCheck

6. Apply the patch an repeat steps 3-5.
   Check that issues and related items are deleted.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit dff16710ae)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Frédéric Demians 2020-11-10 17:00:09 +01:00 committed by Andrew Fuerste-Henry
parent 7013f71889
commit 9ab7d03769
1 changed files with 9 additions and 5 deletions

View File

@ -119,12 +119,16 @@ if($op eq 'delete_confirm'){
}
}elsif($op eq 'delete_confirmed'){
if($query->param('delitems') eq "Yes"){
my @itemnumbers;
foreach my $serialid (@serialsid){
my @itemnumbers = Koha::Serial::Items->search({serialid => $serialid})->get_column('itemnumber');
foreach my $itemnumber (@itemnumbers){
my $delcheck = C4::Items::DelItemCheck($biblionumber, $itemnumber);
$template->param(error_delitem => 1) if $delcheck != 1;
}
my @ids = Koha::Serial::Items->search({serialid => $serialid})->get_column('itemnumber');
push(@itemnumbers, @ids);
}
my $items = Koha::Items->search({ itemnumber => \@itemnumbers });
while ( my $item = $items->next ) {
my $error = $item->safe_delete;
$template->param(error_delitem => 1)
if $error eq '1';
}
}
for my $serialid (@serialsid){