From e6349b94e3541e363e8c40dcd938d65a272ec51c Mon Sep 17 00:00:00 2001 From: Werner Hahn Date: Fri, 20 May 2022 08:27:05 +0200 Subject: [PATCH] =?utf8?q?ShopOrder:=20billing=5Femail=20zus=C3=A4tzlich?= =?utf8?q?=20als=20invoice=5Fmail=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit beim Kunden übernehmen. Rechnungs und Mahnungsmail werden über diese Adresse verschickt. --- SL/DB/ShopOrder.pm | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/SL/DB/ShopOrder.pm b/SL/DB/ShopOrder.pm index 00399029b..6a53387b5 100644 --- a/SL/DB/ShopOrder.pm +++ b/SL/DB/ShopOrder.pm @@ -138,11 +138,11 @@ WHERE ( OR ( street % ? AND zipcode ILIKE ?) OR - email ILIKE ? + ( email ILIKE ? OR invoice_mail ILIKE ? ) ) AND obsolete = 'F' SQL - my @values = ($lastname, $company, $self->billing_zipcode, $street, $self->billing_zipcode, $self->billing_email); + my @values = ($lastname, $company, $self->billing_zipcode, $street, $self->billing_zipcode, $self->billing_email, $self->billing_email); $customers = SL::DB::Manager::Customer->get_objects_from_sql( sql => $fs_query, @@ -152,20 +152,24 @@ SQL # If trgm extension is not installed $customers = SL::DB::Manager::Customer->get_all( where => [ - or => [ - and => [ - or => [ 'name' => { ilike => $lastname }, - 'name' => { ilike => $company }, - ], - 'zipcode' => { ilike => $zipcode }, + or => [ + and => [ + or => [ 'name' => { ilike => $lastname }, + 'name' => { ilike => $company }, + ], + 'zipcode' => { ilike => $zipcode }, ], - and => [ - and => [ 'street' => { ilike => $street_not_fuzzy }, - 'zipcode' => { ilike => $zipcode }, + and => [ + and => [ 'street' => { ilike => $street_not_fuzzy }, + 'zipcode' => { ilike => $zipcode }, ], ], - or => [ 'email' => { ilike => $email } ], - ], + or => [ + 'email' => { ilike => $email }, + 'invoice_mail' => { ilike => $email }, + ], + ], + and => [ obsolete => 'F' ] ], ); } @@ -199,6 +203,7 @@ sub get_customer{ 'zipcode' => $self->billing_zipcode, 'city' => $self->billing_city, 'email' => $self->billing_email, + 'invoice_mail' => $self->billing_email, 'country' => $self->billing_country, 'greeting' => $self->billing_greeting, 'fax' => $self->billing_fax, @@ -234,6 +239,7 @@ sub get_customer{ obsolete => 'F', ); } + $customer->update_attributes(invoice_mail => $self->billing_email) if $customer->invoice_mail ne $self->billing_email; return $customer; } -- 2.20.1