[Koha-patches] [PATCH] bug 2884: followup patch

Galen Charlton galen.charlton at liblime.com
Fri May 29 03:18:57 CEST 2009


[1] Restore behavior of the input field for the library
    code; when adding a new library, it should be a
    a text box; when editing an existing library,
    should be a hidden input.
[2] When user attempts to add a new library with the same
    code as that of an existing library, populate the form
    with what the user entered for the new library, not the
    values from the existing library.

Signed-off-by: Galen Charlton <galen.charlton at liblime.com>
---
 admin/branches.pl                                  |    5 ++++-
 .../prog/en/modules/admin/branches.tmpl            |    8 ++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/admin/branches.pl b/admin/branches.pl
index 9c6b2e9..f2bc827 100755
--- a/admin/branches.pl
+++ b/admin/branches.pl
@@ -117,7 +117,10 @@ elsif ( $op eq 'add_validate' ) {
         my $error = ModBranch($params);
         # if error saving, stay on edit and rise error
         if ($error) {
-            editbranchform($branchcode,$template);
+            # copy input parameters back to form
+            # FIXME - doing this doesn't preserve any branch group selections, but good enough for now
+            $template->param(%$params);
+            $template->param(branch_name => $params->{branchname});
             $template->param( 'heading-branches-add-branch-p' => 1, 'add' => 1, "ERROR$error" => 1 );
         } else {
             $template->param( else => 1);
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 5fbc653..11e4dfe 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl
@@ -70,13 +70,13 @@
             <input type="hidden" name="add" value="0" />
         <!-- /TMPL_IF -->
         <ol><li>
-            <!-- TMPL_IF name="heading-branches-add-p" -->
+            <!-- TMPL_IF name="heading-branches-add-branch-p" -->
+            <label for="branchcode">Library code</label>
+                <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="<!-- TMPL_VAR name="branchcode" escape="HTML" -->" />
+            <!-- TMPL_ELSE -->
 			<span class="label">Library code</span>
                 <input type="hidden" name="branchcode" value="<!-- TMPL_VAR name="branchcode" escape="HTML" -->" />
                 <!-- TMPL_VAR name="branchcode" -->
-            <!-- TMPL_ELSE -->
-            <label for="branchcode">Library code</label>
-                <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="<!-- TMPL_VAR name="branchcode" escape="HTML" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
-- 
1.5.6.5




More information about the Koha-patches mailing list