From ddec2dcd58e019a3386dce322985da9bec0c9501 Mon Sep 17 00:00:00 2001 From: Werner Hahn Date: Thu, 24 Jun 2021 16:40:40 +0200 Subject: [PATCH] WebshopApi: Standardzahlungsbedingung korrigiert Syntax --- SL/DB/ShopOrder.pm | 3 ++- SL/ShopConnector/Shopware.pm | 3 ++- SL/ShopConnector/WooCommerce.pm | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/SL/DB/ShopOrder.pm b/SL/DB/ShopOrder.pm index eef7b6ce5..ae5d8568f 100644 --- a/SL/DB/ShopOrder.pm +++ b/SL/DB/ShopOrder.pm @@ -188,7 +188,8 @@ sub get_customer{ my $customer_proposals = $self->check_for_existing_customers; my $name = $self->billing_firstname . " " . $self->billing_lastname; my $customer = 0; - my $payment_id = SL::DB::Manager::PaymentTerm->get_first()->id || undef; + my $default_payment = SL::DB::Manager::PaymentTerm->get_first(); + my $payment_id = $default_payment ? $default_payment->id : undef; if(!scalar(@{$customer_proposals})){ my %address = ( 'name' => $name, 'department_1' => $self->billing_company, diff --git a/SL/ShopConnector/Shopware.pm b/SL/ShopConnector/Shopware.pm index 7e879bfef..a777ddfb2 100644 --- a/SL/ShopConnector/Shopware.pm +++ b/SL/ShopConnector/Shopware.pm @@ -190,7 +190,8 @@ sub map_data_to_shoporder { my %payment_ids_methods = ( # shopware_paymentId => kivitendo_payment_id ); - my $default_payment_id = SL::DB::Manager::PaymentTerm->get_first()->id || undef; + 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}, diff --git a/SL/ShopConnector/WooCommerce.pm b/SL/ShopConnector/WooCommerce.pm index 210170781..c2e7c6fd4 100644 --- a/SL/ShopConnector/WooCommerce.pm +++ b/SL/ShopConnector/WooCommerce.pm @@ -206,7 +206,8 @@ sub map_data_to_shoporder { my %payment_ids_methods = ( # woocommerce_payment_method_title => kivitendo_payment_id ); - my $default_payment_id = SL::DB::Manager::PaymentTerm->get_first()->id || undef; + my $default_payment = SL::DB::Manager::PaymentTerm->get_first(); + my $default_payment_id = $default_payment ? $default_payment->id : undef; my %columns = ( #billing Shop can have different billing addresses, and may have 1 customer_address billing_firstname => $import->{billing}->{first_name}, -- 2.20.1