URI für Hintergrundbild angepaßt
[kivitendo-erp.git] / bin / mozilla / ap.pl
index c4c513a..f5c6609 100644 (file)
@@ -88,6 +88,9 @@ sub add {
 
 sub edit {
   $lxdebug->enter_sub();
+  # show history button
+  $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+  #/show hhistory button
 
   $form->{title} = "Edit";
 
@@ -193,6 +196,7 @@ sub create_links {
         $form->{"forex_$j"} = $form->{"exchangerate_$i"} =
           $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
         $form->{"AP_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
+        $form->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id};
         $form->{paidaccounts}++;
       } else {
 
@@ -637,7 +641,7 @@ $jsscript
     <td>
       <table width=100%>
        <tr class=listheading>
-         <th class=listheading colspan=6>| . $locale->text('Payments') . qq|</th>
+         <th class=listheading colspan=7>| . $locale->text('Payments') . qq|</th>
        </tr>
 |;
 
@@ -787,7 +791,16 @@ sub form_footer {
       <input class=submit type=submit name=action value="|
       . $locale->text('Post') . qq|">|;
   }
-
+  # button for saving history
+  if($form->{id} ne "") {
+    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
   print "
 </form>
 
@@ -987,6 +1000,12 @@ sub post {
   $form->{taxkey}       = $taxkey;
 
   $form->{id} = 0 if $form->{postasnew};
+  # saving the history
+  if(!exists $form->{addition} && $form->{id} ne "") {
+       $form->{addition} = "POSTED";
+       $form->save_history($form->dbconnect(\%myconfig));
+  }
+  # /saving the history 
 
   $form->redirect($locale->text('Transaction posted!'))
     if (AP->post_transaction(\%myconfig, \%$form));
@@ -999,6 +1018,12 @@ sub post_as_new {
   $lxdebug->enter_sub();
 
   $form->{postasnew} = 1;
+  # saving the history
+  if(!exists $form->{addition} && $form->{id} ne "") {
+       $form->{addition} = "POSTED AS NEW";
+       $form->save_history($form->dbconnect(\%myconfig));
+  }
+  # /saving the history 
   &post;
 
   $lxdebug->leave_sub();
@@ -1056,9 +1081,15 @@ sub delete {
 
 sub yes {
   $lxdebug->enter_sub();
-
-  $form->redirect($locale->text('Transaction deleted!'))
-    if (AP->delete_transaction(\%myconfig, \%$form, $spool));
+  if (AP->delete_transaction(\%myconfig, \%$form, $spool)) {
+    # saving the history
+    if(!exists $form->{addition}) {
+         $form->{addition} = "DELETED";
+      $form->save_history($form->dbconnect(\%myconfig));
+    }
+    # /saving the history 
+    $form->redirect($locale->text('Transaction deleted!'));
+  }
   $form->error($locale->text('Cannot delete transaction!'));
 
   $lxdebug->leave_sub();