}
my $transdate_obj;
- if (ref($params{transdate} eq 'DateTime')) {
+ if (ref($params{transdate}) eq 'DateTime') {
$transdate_obj = $params{transdate};
} else {
- $transdate_obj = $::locale->parse_date_to_object($params{transdate});
+ $transdate_obj = $::locale->parse_date_to_object($params{transdate});
};
croak t8('Illegal date') unless ref $transdate_obj;
foreach my $transaction (@{ $self->transactions }) {
# find all transactions with an AR_amount or AP_amount link
my $tax = SL::DB::Manager::Tax->get_first( where => [taxkey => $transaction->taxkey, id => $transaction->tax_id ]);
+
+ # acc_trans entries for the taxes (chart_link == A[RP]_tax) often
+ # have combinations of taxkey & tax_id that don't exist in
+ # tax. Those must be skipped.
+ next if !$tax && ($transaction->chart_link !~ m{A[RP]_amount});
+
croak "no tax for taxkey " . $transaction->{taxkey} unless ref $tax;
$transaction->{chartlinks} = { map { $_ => 1 } split(m/:/, $transaction->chart_link) };
If successful the return value will be 1 in scalar context or in list context
the two ids (acc_trans_id) of the newly created bookings.
+
=item C<reference_account>
Returns a chart object which is the chart of the invoice with link AR or AP.