X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FShopConnector%2FShopware.pm;h=65c42fd1445151228b1b2a28dd1e1868ab39328b;hb=549f187d3a2b1d15f96c4556714666ed954447bb;hp=04cd69a59c4ea30a1cd54a721d43bf19d073cece;hpb=82034151ec366dadc859bb418bdfa41e780ca62b;p=kivitendo-erp.git diff --git a/SL/ShopConnector/Shopware.pm b/SL/ShopConnector/Shopware.pm index 04cd69a59..65c42fd14 100644 --- a/SL/ShopConnector/Shopware.pm +++ b/SL/ShopConnector/Shopware.pm @@ -11,6 +11,7 @@ use LWP::Authen::Digest; 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; @@ -185,6 +186,12 @@ sub map_data_to_shoporder { 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}, @@ -232,7 +239,7 @@ sub map_data_to_shoporder { 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}, @@ -265,13 +272,22 @@ sub get_categories { 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 { @@ -452,7 +468,7 @@ __END__ =head1 NAME -SL::Shopconnecter::Shopware - connector for shopware 5 +SL::Shopconnector::Shopware - connector for shopware 5 =head1 SYNOPSIS