Probleme bei Mwst-Wechsel
[kivitendo-erp.git] / SL / Form.pm
index 3e9704f..b34458e 100644 (file)
@@ -1970,7 +1970,7 @@ sub get_duedate {
   $reference_date = $reference_date ? conv_dateq($reference_date) . '::DATE' : 'current_date';
 
   my $dbh         = $self->get_standard_dbh($myconfig);
-  my $payment_id;
+  my ($payment_id, $duedate);
 
   if($self->{payment_id}) {
     $payment_id = $self->{payment_id};
@@ -1979,8 +1979,10 @@ sub get_duedate {
     ($payment_id) = selectrow_query($self, $dbh, $query, $self->{vendor_id});
   }
 
-  my $query       = qq|SELECT ${reference_date} + terms_netto FROM payment_terms WHERE id = ?|;
-  my ($duedate)   = selectrow_query($self, $dbh, $query, $payment_id);
+  if ($payment_id) {
+    my $query  = qq|SELECT ${reference_date} + terms_netto FROM payment_terms WHERE id = ?|;
+    ($duedate) = selectrow_query($self, $dbh, $query, $payment_id);
+  }
 
   $main::lxdebug->leave_sub();
 
@@ -2807,14 +2809,7 @@ sub create_links {
          FROM acc_trans a
          LEFT JOIN chart c ON (c.id = a.chart_id)
          LEFT JOIN project p ON (p.id = a.project_id)
-         LEFT JOIN tax t ON (t.id= (SELECT tk.tax_id FROM taxkeys tk
-                                    WHERE (tk.taxkey_id=a.taxkey) AND
-                                      ((CASE WHEN a.chart_id IN (SELECT chart_id FROM taxkeys WHERE taxkey_id = a.taxkey)
-                                        THEN tk.chart_id = a.chart_id
-                                        ELSE 1 = 1
-                                        END)
-                                       OR (c.link='%tax%')) AND
-                                      (startdate <= a.transdate) ORDER BY startdate DESC LIMIT 1))
+         LEFT JOIN tax t ON (t.id= a.tax_id)
          WHERE a.trans_id = ?
          AND a.fx_transaction = '0'
          ORDER BY a.acc_trans_id, a.transdate|;
@@ -3581,7 +3576,6 @@ sub layout {
   my %style_to_script_map = (
     v3  => 'v3',
     neu => 'new',
-    v4  => 'v4',
   );
 
   my $menu_script = $style_to_script_map{$::myconfig{menustyle}} || '';
@@ -3608,7 +3602,7 @@ SL::Form.pm - main data object.
 
 =head1 SYNOPSIS
 
-This is the main data object of Lx-Office.
+This is the main data object of kivitendo.
 Unfortunately it also acts as a god object for certain data retrieval procedures used in the entry points.
 Points of interest for a beginner are:
 
@@ -3633,7 +3627,7 @@ will in this case not increase the value, and return undef.
 
 Generates a HTTP redirection header for the new C<$url>. Constructs an
 absolute URL including scheme, host name and port. If C<$url> is a
-relative URL then it is considered relative to Lx-Office base URL.
+relative URL then it is considered relative to kivitendo base URL.
 
 This function C<die>s if headers have already been created with
 C<$::form-E<gt>header>.