@@ -, +, @@ removed --- admin/aqcontract.pl | 19 +++++++++++-------- .../intranet-tmpl/prog/en/modules/admin/aqcontract.tt | 5 +++++ 2 files changed, 16 insertions(+), 8 deletions(-) --- a/admin/aqcontract.pl +++ a/admin/aqcontract.pl @@ -33,7 +33,7 @@ use C4::Contract; my $input = new CGI; my $contractnumber = $input->param('contractnumber'); my $booksellerid = $input->param('booksellerid'); -my $op = $input->param('op') || ''; +my $op = $input->param('op') || 'list'; my $bookseller = GetBookSellerFromId($booksellerid); @@ -133,17 +133,20 @@ elsif ( $op eq 'delete_confirm' ) { } #DELETE_CONFIRMED: called by delete_confirm, used to effectively confirm deletion of data in DB elsif ( $op eq 'delete_confirmed' ) { - $template->param( delete_confirmed => 1 ); + my $deleted = DelContract( { contractnumber => $contractnumber } ); - DelContract( { contractnumber => $contractnumber } ); - - print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?booksellerid=$booksellerid"); - exit; + if ( $deleted ) { + print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?booksellerid=$booksellerid"); + exit; + } else { + $template->param( error => 'not_deleted' ); + $op = 'list'; + } - # END $OP eq DELETE_CONFIRMED + # END $OP eq LIST } # DEFAULT: Builds a list of contracts and displays them -else { +if ( $op eq 'list' ) { $template->param(else => 1); # get contracts --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt @@ -90,6 +90,11 @@ function Check(ff) {
[% INCLUDE 'acquisitions-toolbar.inc' %] + +[% IF error == 'not_deleted' %] +
Contract has not been deleted. Maybe a basket linked to this contract exists.
+[% END %] + [% IF ( add_form ) %]
--