show_history.js in header eingebunden
[kivitendo-erp.git] / bin / mozilla / oe.pl
index 3b9e3b3..1e105aa 100644 (file)
@@ -698,7 +698,9 @@ sub form_header {
   }
 
   $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
-
+  # show history button js
+  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+  #/show history button js
   $form->header;
 
   print qq|
@@ -892,7 +894,7 @@ sub form_footer {
         $tax .= qq|
              <tr>
                <th align=right>$form->{"${item}_description"}&nbsp;|
-                               . $form->{"${item}_rate"} * 100 .qq|%</th>
+                                   . $form->{"${item}_rate"} * 100 .qq|%</th>
                <td align=right>$form->{"${item}_total"}</td>
              </tr>
 |;
@@ -932,7 +934,7 @@ sub form_footer {
         $tax .= qq|
              <tr>
                <th align=right>Enthaltene $form->{"${item}_description"}&nbsp;|
-                               . $form->{"${item}_rate"} * 100 .qq|%</th>
+                                   . $form->{"${item}_rate"} * 100 .qq|%</th>
                <td align=right>$form->{"${item}_total"}</td>
              </tr>
              <tr>
@@ -1050,6 +1052,12 @@ sub form_footer {
 
   if (($form->{id})) {
     print qq|
+       <input type="button" class="submit" onclick="set_history_window(|
+       . Q($form->{id})
+       . qq|);" name="history" id="history" value="|
+       . $locale->text('history')
+       . qq|">
+
 <br>| . $locale->text("Workflow $form->{type}") . qq|<br>
 <input class=submit type=submit name=action value="|
       . $locale->text('Save as new') . qq|">
@@ -1116,17 +1124,7 @@ sub form_footer {
 <input type=hidden name=path value=$form->{path}>
 <input type=hidden name=login value=$form->{login}>
 <input type=hidden name=password value=$form->{password}>
-|;
-# button for saving history
-print qq|
-       <input type=button class=submit onclick=set_history_window(|
-       . $form->{id} 
-       . qq|); name=history id=history value=|
-       . $locale->text('history') 
-       . qq|>|;
-# /button for saving history
-
-qq|
+
 </form>
 
 </body>
@@ -1937,17 +1935,18 @@ sub save_and_close {
   }
 
   relink_accounts();
+
+  $form->error($err) if (!OE->save(\%myconfig, \%$form));
+
   # saving the history
   if(!exists $form->{addition}) {
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
-  # /saving the history 
+  # /saving the history
 
-  $form->redirect(
-            $form->{label} . " $form->{$ordnumber} " . $locale->text('saved!'))
-    if (OE->save(\%myconfig, \%$form));
-  $form->error($err);
+  $form->redirect($form->{label} . " $form->{$ordnumber} " .
+                  $locale->text('saved!'));
 
   $lxdebug->leave_sub();
 }
@@ -2017,6 +2016,9 @@ sub save {
     unless $form->{$ordnumber};
 
   relink_accounts();
+
+  OE->save(\%myconfig, \%$form);
+
   # saving the history
   if(!exists $form->{addition}) {
        $form->{addition} = "SAVED";
@@ -2024,7 +2026,6 @@ sub save {
   }
   # /saving the history 
 
-  OE->save(\%myconfig, \%$form);
   $form->{simple_save} = 1;
   if(!$form->{print_and_save}) {
     set_headings("edit");