From d31daac4efdced753fd238123c22a8c581408ca3 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 26 Apr 2016 01:38:37 +0200 Subject: [PATCH] Improved error handling. --- app/models/transaction/clearbit_enrichment.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/transaction/clearbit_enrichment.rb b/app/models/transaction/clearbit_enrichment.rb index 78e49608d..8f45a8c31 100644 --- a/app/models/transaction/clearbit_enrichment.rb +++ b/app/models/transaction/clearbit_enrichment.rb @@ -48,7 +48,7 @@ class Transaction::ClearbitEnrichment def self.sync_user(user) - return if !user.email + return if user.email.empty? data = fetch(user.email) #p 'OO: ' + data.inspect return if !data @@ -131,8 +131,8 @@ class Transaction::ClearbitEnrichment end end - # if no company record exists - if !data['company'] + # if no company record exists or no organization should be created + if !data['company'] || config['organization_autocreate'] != true if user_has_changed user.save end