# transdate madness.
my $transdate = "";
- if (($form->{type} eq "invoice") or ($form->{type} eq "credit_note") or ($form->{script} eq 'ir.pl')) {
+ if ( (any {$form->{type} eq $_} qw(invoice credit_note invoice_for_advance_payment)) or ($form->{script} eq 'ir.pl') ) {
# use deliverydate for sales and purchase invoice, if it exists
# also use deliverydate for credit notes
$transdate = $form->{tax_point} || $form->{deliverydate} || $form->{invdate};