X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FIC.pm;h=96e3a94a1be197c33cef5938d4cd4205d816fc5b;hb=feacad49259a8288edefa4c771fc028dd6380ca0;hp=7a52096a07e34d6c57d7f43af59f1bc115507771;hpb=2f6e7625957d22de1008f2c6828835295b468fb7;p=kivitendo-erp.git diff --git a/SL/IC.pm b/SL/IC.pm index 7a52096a0..96e3a94a1 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -1487,8 +1487,22 @@ sub retrieve_accounts { # transdate madness. my $transdate = ""; - if ($form->{type} eq "invoice") { - if (($form->{vc} eq "vendor") || !$form->{deliverydate}) { + if ($form->{type} eq "invoice" or $form->{type} eq "credit_note") { + # use deliverydate for sales and purchase invoice, if it exists + # also use deliverydate for credit notes + if (!$form->{deliverydate}) { + $transdate = $form->{invdate}; + } else { + $transdate = $form->{deliverydate}; + } + } elsif ($form->{script} eq 'ir.pl') { + # when a purchase invoice is opened from the report of purchase invoices + # $form->{type} isn't set, but $form->{script} is, not sure why this is or + # whether this distinction matters in some other scenario. Otherwise one + # could probably take out this elsif and add a + # " or $form->{script} eq 'ir.pl' " + # to the above if-statement + if (!$form->{deliverydate}) { $transdate = $form->{invdate}; } else { $transdate = $form->{deliverydate};