use SL::DB::ShopOrder;
use SL::DB::ShopOrderItem;
use SL::DB::History;
+use SL::DB::PaymentTerm;
use DateTime::Format::Strptime;
use SL::DB::File;
use Data::Dumper;
my $shop_id = $self->config->id;
my $tax_included = $self->config->pricetype;
+ # Mapping Zahlungsmethoden muss an Firmenkonfiguration angepasst werden
+ my %payment_ids_methods = (
+ # shopware_paymentId => kivitendo_payment_id
+ );
+ my $default_payment = SL::DB::Manager::PaymentTerm->get_first();
+ my $default_payment_id = $default_payment ? $default_payment->id : undef;
# Mapping to table shoporders. See http://community.shopware.com/_detail_1690.html#GET_.28Liste.29
my %columns = (
amount => $import->{data}->{invoiceAmount},
netamount => $import->{data}->{invoiceAmountNet},
order_date => $orderdate,
payment_description => $import->{data}->{payment}->{description},
- payment_id => $import->{data}->{paymentId},
+ payment_id => $payment_ids_methods{$import->{data}->{paymentId}} || $default_payment_id,
remote_ip => $import->{data}->{remoteAddress},
sepa_account_holder => $import->{data}->{paymentIntances}->{accountHolder},
sepa_bic => $import->{data}->{paymentIntances}->{bic},
my @daten = @{$import->{data}};
my %categories = map { ($_->{id} => $_) } @daten;
+ my @categories_tree;
for(@daten) {
+ # ignore root with id=1
+ if( $_->{id} == 1) {
+ next;
+ }
my $parent = $categories{$_->{parentId}};
- $parent->{children} ||= [];
- push @{$parent->{children}},$_;
+ if($parent && $parent->{id} != 1) {
+ $parent->{children} ||= [];
+ push @{$parent->{children}},$_;
+ } else {
+ push @categories_tree, $_;
+ }
}
- return \@daten;
+ return \@categories_tree;
}
sub get_version {
=head1 NAME
-SL::Shopconnecter::Shopware - connector for shopware 5
+SL::Shopconnector::Shopware - connector for shopware 5
=head1 SYNOPSIS