Revision d74d1045
Von Jan Büren vor 4 Monaten hinzugefügt
- ID d74d104508cf98f48250f3b2234ea0594dace29c
- Vorgänger fd0c9d0b
SL/DB/Helper/ZUGFeRD.pm | ||
---|---|---|
version => '1.0',
|
||
};
|
||
}
|
||
|
||
# TODO simplify and less incorrect magic. This is only used for automatic imports.
|
||
# => if no template is found die and don't guess values which the user will never verify visually!
|
||
sub import_zugferd_data {
|
||
my ($self, $zugferd_parser) = @_;
|
||
validate_pos(@_,
|
||
... | ... | |
|
||
# Check IBAN specified on bill matches the one we've got in
|
||
# the database for this vendor.
|
||
# TODO normalize
|
||
if ($iban) {
|
||
$intnotes .= "\nIBAN: ";
|
||
$intnotes .= $iban ne $vendor->iban ?
|
||
... | ... | |
}
|
||
|
||
# Use invoice creation date as due date if there's no due date
|
||
# NO, check payment settings in template
|
||
$metadata{'duedate'} = $metadata{'transdate'} unless defined $metadata{'duedate'};
|
||
|
||
# parse dates to kivi if set/valid
|
||
... | ... | |
day => $3)->to_kivitendo;
|
||
}
|
||
}
|
||
|
||
# indention?
|
||
my $currency = SL::DB::Manager::Currency->find_by(
|
||
name => $metadata{'currency'},
|
||
);
|
||
|
||
# no pls use template settings
|
||
my $default_ap_amount_chart = SL::DB::Manager::Chart->find_by(
|
||
id => $::instance_conf->get_expense_accno_id
|
||
);
|
||
# Fallback if there's no default AP amount chart configured
|
||
# evil fallback will be executed fully automatic. pls don't do this at home
|
||
$default_ap_amount_chart ||= SL::DB::Manager::Chart->find_by(charttype => 'A');
|
||
|
||
my $active_taxkey = $default_ap_amount_chart->get_active_taxkey;
|
||
... | ... | |
die t8(
|
||
"No tax found for chart #1", $default_ap_amount_chart->displayable_name
|
||
) unless scalar @{$taxes};
|
||
|
||
# before wrongly guessing stuff, just load template or die .. move upwards!
|
||
my %template_params;
|
||
my $template_ap = SL::DB::Manager::RecordTemplate->get_first(where => [vendor_id => $vendor->id]);
|
||
if ($template_ap) {
|
||
... | ... | |
}
|
||
|
||
my $today = DateTime->today_local;
|
||
# good idea, but duedate will always be metadata{duedate} see above
|
||
my $duedate =
|
||
$metadata{duedate} ?
|
||
$metadata{duedate}
|
Auch abrufbar als: Unified diff
zugferd-import-mail: TODOS etwas zuviel copy vom Controller Code ...
Ferner gibt es auch null Unit-Tests, welche die ZUGFeRD Datenstruktur checken