From 601ea7e58de8606abce5dc8a47c96e71519cc6c5 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 24 Apr 2025 15:07:25 +0100 Subject: [PATCH] Bug 39711: Update call to DelContract --- admin/aqcontract.pl | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/admin/aqcontract.pl b/admin/aqcontract.pl index 5009a022cf3..cf4cdf12025 100755 --- a/admin/aqcontract.pl +++ b/admin/aqcontract.pl @@ -23,11 +23,8 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Context; -use C4::Auth qw( get_template_and_user ); -use C4::Output qw( output_html_with_http_headers ); -use C4::Contract qw( - DelContract -); +use C4::Auth qw( get_template_and_user ); +use C4::Output qw( output_html_with_http_headers ); use Koha::DateUtils qw( dt_from_string ); use Koha::Acquisition::Booksellers; @@ -102,8 +99,7 @@ elsif ( $op eq 'cud-add_validate' ) { } if ($is_a_modif) { - my $contractnumber = $input->param('contractnumber'); - my $contract = Koha::Acquisition::Contracts->find($contractnumber); + my $contract = Koha::Acquisition::Contracts->find($contractnumber); if ( !$contract ) { $template->param( blocking_error => "Contract $contractnumber not found" ); output_html_with_http_headers $input, $cookie, $template->output; @@ -154,7 +150,14 @@ elsif ( $op eq 'delete_confirm' ) { #DELETE_CONFIRMED: called by delete_confirm, used to effectively confirm deletion of data in DB elsif ( $op eq 'cud-delete_confirmed' ) { - my $deleted = DelContract( { contractnumber => $contractnumber } ); + + my $contract = Koha::Acquisition::Contracts->find($contractnumber); + if ( !$contract ) { + $template->param( blocking_error => "Contract $contractnumber not found" ); + output_html_with_http_headers $input, $cookie, $template->output; + } + + my $deleted = $contract->delete; if ($deleted) { print $input->redirect("/cgi-bin/koha/acquisition/vendors/$booksellerid"); -- 2.48.1