From 930ec418aa2d6a8272ffac30366bc3ab1382f185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Thu, 17 Mar 2016 15:01:48 +0100 Subject: [PATCH] [SIGNED-OFF]Bug 16091: Can not delete branch category not used by any library Test plan Without patch: - Go to Home > Administration > Libraries and groups - Create a new group (make sure that you give it a Category code, see Bug 16047) - Do not assign any library to this group - Try to delete the group Result: "This library category cannot be deleted. 0 libraries are still using it." With patch: - Try to delete the group Result OK: Confirmation dialog for deletion. - Try to delete a group that is assigned to a library Result OK: "This library category cannot be deleted. 1 libraries are still using it." Signed-off-by: Hector Castro Works as advertised --- admin/branches.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/branches.pl b/admin/branches.pl index e5b2f52..ebaa0ef 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -194,7 +194,8 @@ if ( $op eq 'add_form' ) { $op = 'list'; } elsif ( $op eq 'delete_confirm_category' ) { my $category = Koha::LibraryCategories->find($categorycode); - if ( my $libraries_count = scalar( $category->libraries ) ) { + my $libraries_count = scalar( $category->libraries ); + if ( $libraries_count > 0 ) { push @messages, { type => 'error', code => 'cannot_delete_category', -- 1.7.10.4