bug 2884: followup patch
authorGalen Charlton <galen.charlton@liblime.com>
Fri, 29 May 2009 01:13:21 +0000 (20:13 -0500)
committerGalen Charlton <galen.charlton@liblime.com>
Fri, 29 May 2009 01:17:44 +0000 (20:17 -0500)
[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@liblime.com>
admin/branches.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl

index 9c6b2e9..f2bc827 100755 (executable)
@@ -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);
index 5fbc653..11e4dfe 100644 (file)
             <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>