diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index adf0f12fc4b7..43a0e525a5ac 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -558,14 +558,12 @@ class Import implements ShouldQueue { $value = trim($value); - $model_query = (new $model()) - ->query() - ->where($column, $value) - ->where('company_id', $this->company->id) - ->exists(); + $model_query = $model::where($column, $value) + ->where('company_id', $this->company->id) + ->exists(); if($model_query) - return $value.'_'. Str::random(5); + return $value . '_' . Str::random(5); return $value; } @@ -1102,10 +1100,8 @@ class Import implements ShouldQueue $modified['client_id'] = $this->transformId('clients', $resource['client_id']); $modified['user_id'] = $this->processUserId($resource); - //$modified['invoice_id'] = $this->transformId('invoices', $resource['invoice_id']); $modified['company_id'] = $this->company->id; - //unset($modified['invoices']); unset($modified['invoice_id']); if (isset($modified['invoices'])) { @@ -1114,8 +1110,8 @@ class Import implements ShouldQueue $modified['invoices'][$key]['invoice_id'] = $this->transformId('invoices', $invoice['invoice_id']); } else { nlog($modified['invoices']); - // $modified['credits'][$key]['credit_id'] = $this->transformId('credits', $invoice['invoice_id']); - // $modified['credits'][$key]['amount'] = $modified['invoices'][$key]['amount']; + unset($modified['invoices']); + //if the transformation didn't work - you _must_ unset this data as it will be incorrect! } } } diff --git a/app/Models/PaymentType.php b/app/Models/PaymentType.php index 02c99b1cd55b..b6b28cd4c8f1 100644 --- a/app/Models/PaymentType.php +++ b/app/Models/PaymentType.php @@ -29,6 +29,7 @@ class PaymentType extends StaticModel const NOVA = 11; const CREDIT_CARD_OTHER = 12; const PAYPAL = 13; + const CHECK = 15; const CARTE_BLANCHE = 16; const UNIONPAY = 17; const JCB = 18;