Revision 6ac133a5
Von Tamino Steinert vor 9 Monaten hinzugefügt
SL/DB/Helper/ZUGFeRD.pm | ||
---|---|---|
762 | 762 |
} |
763 | 763 |
} |
764 | 764 |
|
765 |
# Try to fill in AP account to book against |
|
766 |
my $ap_chart_id = $::instance_conf->get_ap_chart_id; |
|
767 |
my $ap_chart; |
|
768 |
unless ( defined $ap_chart_id ) { |
|
769 |
# If no default account is configured, just use the first AP account found. |
|
770 |
($ap_chart) = @{SL::DB::Manager::Chart->get_all( |
|
771 |
where => [ link => 'AP' ], |
|
772 |
sort_by => [ 'accno' ], |
|
773 |
)}; |
|
774 |
} else { |
|
775 |
$ap_chart = SL::DB::Manager::Chart->find_by(id => $ap_chart_id); |
|
776 |
} |
|
777 |
|
|
778 | 765 |
my $currency = SL::DB::Manager::Currency->find_by( |
779 | 766 |
name => $metadata{'currency'}, |
780 | 767 |
); |
... | ... | |
804 | 791 |
$template_params{department_id} = $template_ap->department_id; |
805 | 792 |
$template_params{ordnumber} = $template_ap->ordnumber; |
806 | 793 |
$template_params{transaction_description} = $template_ap->transaction_description; |
794 |
$template_params{notes} = $template_ap->notes; |
|
795 |
} |
|
796 |
|
|
797 |
# Try to fill in AP account to book against |
|
798 |
my $ap_chart_id = $template_ap ? $template_ap->ar_ap_chart_id |
|
799 |
: $::instance_conf->get_ap_chart_id; |
|
800 |
my $ap_chart; |
|
801 |
if ( $ap_chart_id ne '' ) { |
|
802 |
$ap_chart = SL::DB::Manager::Chart->find_by(id => $ap_chart_id); |
|
803 |
} else { |
|
804 |
# If no default account is configured, just use the first AP account found. |
|
805 |
($ap_chart) = @{SL::DB::Manager::Chart->get_all( |
|
806 |
where => [ link => 'AP' ], |
|
807 |
sort_by => [ 'accno' ], |
|
808 |
)}; |
|
807 | 809 |
} |
808 | 810 |
|
809 | 811 |
my $today = DateTime->today_local; |
812 |
my $duedate = |
|
813 |
$metadata{duedate} ? |
|
814 |
$metadata{duedate} |
|
815 |
: $vendor->payment ? |
|
816 |
$vendor->payment->calc_date(reference_date => $today)->to_kivitendo |
|
817 |
: $today->to_kivitendo; |
|
818 |
|
|
810 | 819 |
my %params = ( |
811 | 820 |
invoice => 0, |
812 | 821 |
vendor_id => $vendor->id, |
... | ... | |
827 | 836 |
# parse items |
828 | 837 |
my $template_item; |
829 | 838 |
if ($template_ap && scalar @{$template_ap->items}) { |
830 |
my $template_item = $template_ap->items->[0];
|
|
839 |
$template_item = $template_ap->items->[0]; |
|
831 | 840 |
} |
832 | 841 |
foreach my $i (@items) { |
833 | 842 |
my %item = %{$i}; |
Auch abrufbar als: Unified diff
S:D:H:ZUGFeRD::import_zugferd_data: FIX: übernehme Daten aus Template