create new if import has no currency code
This commit is contained in:
@@ -20,6 +20,7 @@ class Transactions extends Import
|
||||
$row['account_id'] = $this->getAccountId($row);
|
||||
$row['category_id'] = $this->getCategoryId($row);
|
||||
$row['contact_id'] = $this->getContactId($row);
|
||||
$row['currency_code'] = $this->getCurrencyCode($row);
|
||||
$row['document_id'] = $this->getDocumentId($row);
|
||||
|
||||
return $row;
|
||||
|
||||
@@ -27,9 +27,11 @@ class Transfers extends Import
|
||||
$row['transferred_at'] = Date::parse($row['transferred_at'])->format('Y-m-d');
|
||||
$row['from_account_id'] = $this->getFromAccountId($row);
|
||||
$row['to_account_id'] = $this->getToAccountId($row);
|
||||
$row['from_currency_code'] = $this->getFromCurrencyCode($row);
|
||||
$row['to_currency_code'] = $this->getToCurrencyCode($row);
|
||||
$row['expense_transaction_id'] = $this->getExpenseTransactionId($row);
|
||||
$row['income_transaction_id'] = $this->getIncomeTransactionId($row);
|
||||
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
@@ -124,4 +126,20 @@ class Transfers extends Import
|
||||
|
||||
return $this->getAccountId($row);
|
||||
}
|
||||
|
||||
private function getFromCurrencyCode($row)
|
||||
{
|
||||
$row['currency_code'] = $row['from_currency_code'] ?? null;
|
||||
$row['currency_rate'] = $row['from_currency_rate'] ?? null;
|
||||
|
||||
return $this->getCurrencyCode($row);
|
||||
}
|
||||
|
||||
private function getToCurrencyCode($row)
|
||||
{
|
||||
$row['currency_code'] = $row['to_currency_code'] ?? null;
|
||||
$row['currency_rate'] = $row['to_currency_rate'] ?? null;
|
||||
|
||||
return $this->getCurrencyCode($row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class BillTransactions extends Import
|
||||
$row['account_id'] = $this->getAccountId($row);
|
||||
$row['category_id'] = $this->getCategoryId($row, 'expense');
|
||||
$row['contact_id'] = $this->getContactId($row, 'vendor');
|
||||
$row['currency_code'] = $this->getCurrencyCode($row);
|
||||
$row['document_id'] = $this->getDocumentId($row);
|
||||
$row['number'] = $row['transaction_number'];
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class Bills extends Import
|
||||
$row['issued_at'] = $row['billed_at'];
|
||||
$row['category_id'] = $this->getCategoryId($row, 'expense');
|
||||
$row['contact_id'] = $this->getContactId($row, 'vendor');
|
||||
$row['currency_code'] = $this->getCurrencyCode($row);
|
||||
$row['type'] = Model::BILL_TYPE;
|
||||
$row['contact_country'] = !empty($country) ? $country : null;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class Vendors extends Import
|
||||
|
||||
$row['type'] = 'vendor';
|
||||
$row['country'] = !empty($country) ? $country : null;
|
||||
$row['currency_code'] = $this->getCurrencyCode($row);
|
||||
$row['user_id'] = null;
|
||||
|
||||
return $row;
|
||||
|
||||
@@ -21,6 +21,7 @@ class Customers extends Import
|
||||
|
||||
$row['type'] = 'customer';
|
||||
$row['country'] = !empty($country) ? $country : null;
|
||||
$row['currency_code'] = $this->getCurrencyCode($row);
|
||||
$row['user_id'] = null;
|
||||
|
||||
return $row;
|
||||
|
||||
@@ -25,6 +25,7 @@ class InvoiceTransactions extends Import
|
||||
$row['account_id'] = $this->getAccountId($row);
|
||||
$row['category_id'] = $this->getCategoryId($row, 'income');
|
||||
$row['contact_id'] = $this->getContactId($row, 'customer');
|
||||
$row['currency_code'] = $this->getCurrencyCode($row);
|
||||
$row['document_id'] = $this->getDocumentId($row);
|
||||
$row['number'] = $row['transaction_number'];
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class Invoices extends Import
|
||||
$row['issued_at'] = $row['invoiced_at'];
|
||||
$row['category_id'] = $this->getCategoryId($row, 'income');
|
||||
$row['contact_id'] = $this->getContactId($row, 'customer');
|
||||
$row['currency_code'] = $this->getCurrencyCode($row);
|
||||
$row['type'] = Model::INVOICE_TYPE;
|
||||
$row['contact_country'] = !empty($country) ? $country : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user