Revert "Dialogbuchen: automatisches Kopieren des Betrags entfernt"
authorJan Büren <jan@kivitendo.de>
Wed, 11 Nov 2020 12:16:16 +0000 (13:16 +0100)
committerJan Büren <jan@kivitendo.de>
Wed, 11 Nov 2020 12:16:16 +0000 (13:16 +0100)
Aufgrund von vielfachen Kundenwunsch ...
This reverts commit 6755770b9e487756da69b7e0dcc6efb88513170e.

bin/mozilla/gl.pl
templates/webpages/gl/form_header.html

index 6f49848..256fe11 100644 (file)
@@ -922,18 +922,20 @@ sub display_rows {
     my $projectnumber_hidden = qq|
     <input type="hidden" name="project_id_$i" value="$form->{"project_id_$i"}">|;
 
-    my $balance = $form->format_amount(\%::myconfig, $balances{$accno_id} // 0, 2, 'DRCR');
+    my $copy2credit = $i == 1 ? 'onkeyup="copy_debit_to_credit()"' : '';
+    my $balance     = $form->format_amount(\%::myconfig, $balances{$accno_id} // 0, 2, 'DRCR');
 
     # if we have a bt_chart_id we disallow changing the amount of the bank account
     if ($form->{bt_chart_id}) {
       $debitreadonly = $creditreadonly = "readonly" if ($form->{"accno_id_$i"} eq $form->{bt_chart_id});
+      $copy2credit   = '' if $i == 1;   # and disallow copy2credit
     }
 
     print qq|<tr valign=top>
     $accno
     <td id="chart_balance_$i" align="right">${balance}</td>
     $fx_transaction
-    <td><input name="debit_$i" size="8" value="$form->{"debit_$i"}" accesskey=$i $debitreadonly></td>
+    <td><input name="debit_$i" size="8" value="$form->{"debit_$i"}" accesskey=$i $copy2credit $debitreadonly></td>
     <td><input name="credit_$i" size=8 value="$form->{"credit_$i"}" $creditreadonly></td>
     <td><input type="hidden" name="tax_$i" value="$form->{"tax_$i"}">$form->{"tax_$i"}</td>
     $tax_ddbox|;
index 8a53cab..b021909 100644 (file)
@@ -6,7 +6,15 @@
 
 [%- INCLUDE 'common/flash.html' %]
 
-<script type="text/javascript" src="js/show_form_details.js"></script>
+<script type="text/javascript">
+  <!--
+  function copy_debit_to_credit() {
+    var txt = document.getElementsByName('debit_1')[0].value;
+    document.getElementsByName('credit_2')[0].value = txt;
+  };
+  //-->
+  </script>
+  <script type="text/javascript" src="js/show_form_details.js"></script>
 <script type="text/javascript" src="js/follow_up.js"></script>
 <script type="text/javascript" src="js/kivi.Draft.js"></script>