Fix for Bug 5433 - Separate state field for cities
[koha.git] / admin / branches.pl
index f4bcf66..d6388f5 100755 (executable)
@@ -189,12 +189,10 @@ elsif ( $op eq 'addcategory_validate' ) {
 elsif ( $op eq 'delete_category' ) {
 
     # if the user has pressed the "delete branch" button.
-    my $message = "MESSAGE8" if CheckBranchCategorycode($categorycode);
-    if ($message) {
+    if ( CheckBranchCategorycode($categorycode) ) {
         $template->param( else => 1 );
-        default($message,$template);
-    }
-    else {
+        default( 'MESSAGE8', $template );
+    } else {
         $template->param( delete_category => 1 );
         $template->param( categorycode    => $categorycode );
     }
@@ -343,7 +341,7 @@ sub branchinfotable {
         for my $field (
             'branchaddress1', 'branchaddress2',
             'branchaddress3', 'branchzip',
-            'branchcity', 'branchcountry',
+            'branchcity', 'branchstate', 'branchcountry',
             'branchphone', 'branchfax',
             'branchemail', 'branchurl',
             'branchip',       'branchprinter', 'branchnotes'
@@ -383,7 +381,7 @@ sub branchinfotable {
                 categorytype    => $cat->{'categorytype'},
             };
        }
-        push @branchcategories, { categorytype => $ctype , $ctype => 1 , catloop => \@categories};
+        push @branchcategories, { categorytype => $ctype , $ctype => 1 , catloop => ( @categories ? \@categories : undef) };
        }
     $innertemplate->param(
         branches         => \@loop_data,
@@ -402,6 +400,7 @@ sub _branch_to_template {
          branchaddress3 => $data->{'branchaddress3'},
          branchzip      => $data->{'branchzip'},
          branchcity     => $data->{'branchcity'},
+         branchstate    => $data->{'branchstate'},
          branchcountry  => $data->{'branchcountry'},
          branchphone    => $data->{'branchphone'},
          branchfax      => $data->{'branchfax'},