@@ -, +, @@ --- C4/Bookseller.pm | 5 +++++ acqui/supplier.pl | 7 ++++++- .../prog/en/includes/acquisitions-toolbar.inc | 11 +++++++++++ 3 files changed, 22 insertions(+), 1 deletions(-) --- a/C4/Bookseller.pm +++ a/C4/Bookseller.pm @@ -85,6 +85,11 @@ sub GetBookSellerFromId { 'SELECT count(*) FROM aqbasket where booksellerid = ?', {}, $id ); } + if ($vendor) { + ( $vendor->{subscriptioncount} ) = $dbh->selectrow_array( + 'SELECT count(*) FROM subscription WHERE aqbooksellerid = ?', + {}, $id ); + } return $vendor; } --- a/acqui/supplier.pl +++ a/acqui/supplier.pl @@ -114,10 +114,15 @@ if ( $op eq 'display' ) { GST => $tax_rate, default_tax => defined($seller_gstrate), basketcount => $supplier->{'basketcount'}, + subscriptioncount => $supplier->{'subscriptioncount'}, contracts => $contracts, ); } elsif ( $op eq 'delete' ) { - DelBookseller($id); + # no further message needed for the user + # the DELETE button only appears in the template if basketcount == 0 + if ( $supplier->{'basketcount'} == 0 ) { + DelBookseller($id); + } print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl'); exit; } else { --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc @@ -1,6 +1,13 @@