Bloeder Bug: eine zu gefräßige INSERT legt zu allen Konten taxkeys an, was aber nicht...
[kivitendo-erp.git] / bin / mozilla / am.pl
index 4f8f3bc..c286567 100644 (file)
@@ -161,7 +161,7 @@ sub account_header {
         if ($item eq ''){
           $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|<option value="" selected="selected">-\n|;
         } 
-        elsif ( $item == $taxkey_used->{pos_ustva} ) {
+        elsif ( $item eq $taxkey_used->{pos_ustva} ) {
           $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|<option value="$item" selected="selected">$item\n|;
         }
         else {
@@ -413,16 +413,14 @@ sub list_account {
 
   foreach $ca (@{ $form->{CA} }) {
 
-    $ca->{debit}  = "&nbsp;";
-    $ca->{credit} = "&nbsp;";
+    $ca->{debit}  = "";
+    $ca->{credit} = "";
 
     if ($ca->{amount} > 0) {
-      $ca->{credit} =
-        $form->format_amount(\%myconfig, $ca->{amount}, 2, "&nbsp;");
+      $ca->{credit} = $form->format_amount(\%myconfig, $ca->{amount}, 2);
     }
     if ($ca->{amount} < 0) {
-      $ca->{debit} =
-        $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2, "&nbsp;");
+      $ca->{debit} = $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2);
     }
     $ca->{heading}   = ( $ca->{charttype} eq 'H' ) ? 1:''; 
     $ca->{link_edit_account} = 
@@ -437,16 +435,16 @@ sub list_account {
              ."&password=$form->{password}&action=list_account_details&";
   
   
-  my $pjx = new CGI::Ajax( 
-             'list_account_details' => $list_account_details_url 
-  );
+  my $pjx = new CGI::Ajax('list_account_details' => $list_account_details_url);
 
   # Eneable AJAX debuging
   #$pjx->DEBUG(1);
   #$pjx->JSDEBUG(1);
     
   push(@ { $form->{AJAX} }, $pjx);
-  
+
+  $form->{stylesheets} = "list_accounts.css";
+
   $form->header;
   
   
@@ -455,7 +453,7 @@ sub list_account {
   };
   
   # Ausgabe des Templates
-  print($form->parse_html_template('am/list_accounts', $parameters_ref));
+  print($form->parse_html_template2('am/list_accounts', $parameters_ref));
   
   $lxdebug->leave_sub();
 
@@ -2301,8 +2299,12 @@ sub payment_header {
   <li>| . $locale->text("&lt;%skonto_amount%&gt; -- The deductible amount")
 . qq|</li>
   <li>| . $locale->text("&lt;%total%&gt; -- Amount payable")
+. qq|</li>
+  <li>| . $locale->text("&lt;%total_wo_skonto%&gt; -- Amount payable less discount")
 . qq|</li>
   <li>| . $locale->text("&lt;%invtotal%&gt; -- Invoice total")
+. qq|</li>
+  <li>| . $locale->text("&lt;%invtotal_wo_skonto%&gt; -- Invoice total less discount")
 . qq|</li>
   <li>| . $locale->text("&lt;%currency%&gt; -- The selected currency")
 . qq|</li>
@@ -3214,18 +3216,17 @@ sub _get_taxaccount_selection{
 sub save_tax {
   $lxdebug->enter_sub();
 
-  $form->isblank("chart_id", $locale->text('Tax-O-Matic account missing!'));
   $form->isblank("rate", $locale->text('Taxrate missing!'));
   $form->isblank("taxdescription", $locale->text('Taxdescription  missing!'));
   $form->isblank("taxkey", $locale->text('Taxkey  missing!'));
 
   $form->{rate} = $form->parse_amount(\%myconfig, $form->{rate});
 
-  if ( $form->{rate} <= 0 || $form->{rate} >= 100 ) {
+  if ( $form->{rate} < 0 || $form->{rate} >= 100 ) {
     $form->error($locale->text('Tax Percent is a number between 0 and 100'));
   }
 
-  if ( $form->{rate} <= 0.99 && $form->{rate} >= 0 ) {
+  if ( $form->{rate} <= 0.99 && $form->{rate} > 0 ) {
     $form->error($locale->text('Tax Percent is a number between 0 and 100'));
   }