[Koha-patches] [PATCH] Fix for Bug 3722 - Branch deletion results in incorrect message

Owen Leonard oleonard at myacpl.org
Thu Jun 3 19:37:33 CEST 2010


A fix was submitted by Nahuel on 23 Nov 2009 and pushed, but
it combined messages for existing patrons and existing items.
This patch defines separate messages for the various cases and
corrects a typo in the original fix which left existing patrons
unreported.
---
 admin/branches.pl                                  |   12 ++++++++++--
 .../prog/en/modules/admin/branches.tmpl            |    4 +++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/admin/branches.pl b/admin/branches.pl
index d579490..27d374e 100755
--- a/admin/branches.pl
+++ b/admin/branches.pl
@@ -131,8 +131,16 @@ elsif ( $op eq 'delete' ) {
     $sthitems->execute( $branchcode, $branchcode );
     $sthborrowers->execute( $branchcode );
     my ($totalitems)     = $sthitems->fetchrow_array;
-    my ($totalborrowers) = $sthitems->fetchrow_array;
-    if ($totalitems or $totalborrowers) {
+    my ($totalborrowers) = $sthborrowers->fetchrow_array;
+    if ($totalitems && !$totalborrowers) {
+        $template->param( else => 1 );
+        default("MESSAGE10", $template);
+    }
+    elsif (!$totalitems && $totalborrowers){
+        $template->param( else => 1 );
+        default("MESSAGE11", $template);
+    }
+    elsif ($totalitems && $totalborrowers){
         $template->param( else => 1 );
         default("MESSAGE7", $template);
     }
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl
index ccd147d..aaa869c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl
@@ -156,9 +156,11 @@
     <!-- TMPL_IF name="MESSAGE4" --><div class="dialog message">Library category added</div><!-- /TMPL_IF -->
     <!-- TMPL_IF name="MESSAGE5" --><div class="dialog message">Library category modified</div><!-- /TMPL_IF -->
     <!-- TMPL_IF name="MESSAGE6" --><div class="dialog message">Library category deleted</div><!-- /TMPL_IF -->
-    <!-- TMPL_IF name="MESSAGE7" --><div class="dialog message">Library cannot be deleted because there are patrons or items using that library</div><!-- /TMPL_IF -->
+    <!-- TMPL_IF name="MESSAGE7" --><div class="dialog message">Library cannot be deleted because there are patrons and items using that library</div><!-- /TMPL_IF -->
     <!-- TMPL_IF name="MESSAGE8" --><div class="dialog message">Category cannot be deleted because there are libraries using that category</div><!-- /TMPL_IF -->
     <!-- TMPL_IF name="MESSAGE9" --><div class="dialog message">Category cannot be added, categorycode already exists</div><!-- /TMPL_IF -->
+    <!-- TMPL_IF name="MESSAGE10" --><div class="dialog message">Library cannot be deleted because there are items held by that library</div><!-- /TMPL_IF -->
+    <!-- TMPL_IF name="MESSAGE11" --><div class="dialog message">Library cannot be deleted because there are patrons registered at that library</div><!-- /TMPL_IF -->
 <!-- TMPL_IF NAME="branches" -->
     <table id="branchest">
 <thead><tr>
-- 
1.7.0.4



More information about the Koha-patches mailing list