Bug 10182: Stay on the same tab after saving a biblio
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 3 May 2013 09:53:10 +0000 (11:53 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 17 Jun 2013 20:05:16 +0000 (13:05 -0700)
When editing a biblio, the bug 7883 introduces the "save and continue
editing" feature.  After saving, the page is loaded with the first
tab selected.  This patch refresh the page with the same tab selected.

Test plan:
1/ Edit a biblio.
2/ Click on the 5th tab.
3/ Click on the "Save and continue editing" button.
4/ You are redirected on the same page with the same tab selected

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
cataloguing/addbiblio.pl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt

index 3a5b7c5..d24972c 100755 (executable)
@@ -909,7 +909,8 @@ if ( $op eq "addbiblio" ) {
 
     }
     elsif ($redirect eq "just_save"){
-        print $input->redirect("/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode");
+        my $tab = $input->param('current_tab');
+        print $input->redirect("/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode&tab=$tab");
     }
     else {
           $template->param(
@@ -990,7 +991,8 @@ $template->param(
     popup => $mode,
     frameworkcode => $frameworkcode,
     itemtype => $frameworkcode,
-    borrowernumber => $loggedinuser, 
+    borrowernumber => $loggedinuser,
+    tab => $input->param('tab')
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
index 26f8fa7..1113856 100644 (file)
                        $("#"+ui.panel.id+" input:eq(0)").focus();
                });
 
+        [% IF tab %]
+          $('#addbibliotabs').tabs('option', 'selected', "#[% tab %]");
+        [% END %]
+
                /* check cookie to hide/show marcdocs*/
                if($.cookie("marcdocs_[% borrowernumber %]") == 'false'){
                        hideMARCdocLinks();
         });
         $("#saveandcontinue").click(function(){
             $(".btn-group").removeClass("open");
-            redirect("just_save");
+            var tab = $("#addbibliotabs li.ui-tabs-selected:first a").attr('href');
+            tab = tab.replace('#', '');
+            $("#current_tab").val(tab);
+            redirect("just_save", tab);
             return false;
         });
 
@@ -352,7 +359,8 @@ function Changefwk(FwkList) {
 [% ELSE %]
     <form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
     <input type="hidden" value="[% IF ( biblionumber ) %]view[% ELSE %]items[% END %]" id="redirect" name="redirect" />
-       <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
+    <input type="hidden" value="" id="current_tab" name="current_tab" />
+    <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
 [% END %]
 
 <div id="toolbar" class="btn-toolbar">