X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/51504ef44a8f49be8baa983e8a37c301acb9a937..187c4ee192da9281f42800e6ac8ae08f23d9a9d6:/SL/DB/ShopOrder.pm diff --git a/SL/DB/ShopOrder.pm b/SL/DB/ShopOrder.pm index 4e125fbc9..2752de627 100644 --- a/SL/DB/ShopOrder.pm +++ b/SL/DB/ShopOrder.pm @@ -122,7 +122,7 @@ sub check_for_existing_customers { my $zipcode = $self->billing_street ne '' ? $self->billing_zipcode : ''; my $email = $self->billing_street ne '' ? $self->billing_email : ''; - if($self->check_trgm) { + if(check_trgm($::form->get_standard_dbh())) { # Fuzzysearch for street to find e.g. "Dorfstrasse - Dorfstr. - Dorfstraße" my $fs_query = <get_all_count( + query => [customer_id => $self->{kivi_customer_id}, + paid => {lt_sql => 'amount'}, + ], + ); + return $open_invoices; +} + sub get_customer{ my ($self, %params) = @_; my $shop = SL::DB::Manager::Shop->find_by(id => $self->shop_id); @@ -235,17 +245,6 @@ sub compare_to { return $result || ($self->id <=> $other->id); } -sub check_trgm { - my ( $self ) = @_; - - my $dbh = $::form->get_standard_dbh(); - my $sql = "SELECT installed_version FROM pg_available_extensions WHERE name = 'pg_trgm'"; - my @version = selectall_hashref_query($::form, $dbh, $sql); - - return 1 if($version[0]->{installed_version}); - return 0; -} - sub has_differing_delivery_address { my ($self) = @_; ($self->billing_firstname // '') ne ($self->delivery_firstname // '') || @@ -294,10 +293,6 @@ When it is 0 get customer creates a new customer object of the shop order billin =item C -=item C - -Checks if the postgresextension pg_trgm is installed and return 0 or 1. - =back =head1 TODO