adding additional fields to bank_transactions

https://github.com/invoiceninja/invoiceninja/issues/8042
This commit is contained in:
paulwer 2023-12-13 16:30:26 +01:00
parent e12fb1f765
commit 7a70eb873f
3 changed files with 16 additions and 6 deletions

View File

@ -105,8 +105,8 @@ class TransactionTransformer implements BankRevenueInterface
'category_type' => array_key_exists('additionalInformation', $transaction) ? $transaction["additionalInformation"] : '', // TODO: institution specific keys like: GUTSCHRIFT, ABSCHLUSS, MONATSABSCHLUSS etc 'category_type' => array_key_exists('additionalInformation', $transaction) ? $transaction["additionalInformation"] : '', // TODO: institution specific keys like: GUTSCHRIFT, ABSCHLUSS, MONATSABSCHLUSS etc
'date' => $transaction["bookingDate"], 'date' => $transaction["bookingDate"],
'description' => $description, 'description' => $description,
// 'description' => `IBAN: ${elem . json["bank_debtorAccount"] && elem . json["bank_debtorAccount"]["iban"] ? elem . json["bank_debtorAccount"]["iban"] : ' -'}\nVerwendungszweck: ${elem . json["bank_remittanceInformationStructured"] || ' -'}\nName: ${elem . json["bank_debtorName"] || ' -'}`, // 2 fields to get data from (structured and structuredArray (have to be joined)) 'debitor' => array_key_exists('debtorAccount', $transaction) && array_key_exists('iban', $transaction["debtorAccount"]) ? $transaction['debtorAccount']['iban'] : null,
// TODO: debitor name & iban & bic 'debitor_name' => array_key_exists('debtorName', $transaction) ? $transaction['debtorName'] : null,
'base_type' => (int) $transaction["transactionAmount"]["amount"] <= 0 ? 'DEBIT' : 'CREDIT', 'base_type' => (int) $transaction["transactionAmount"]["amount"] <= 0 ? 'DEBIT' : 'CREDIT',
]; ];

View File

@ -34,6 +34,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property string|null $date * @property string|null $date
* @property int $bank_account_id * @property int $bank_account_id
* @property string|null $description * @property string|null $description
* @property string|null $debitor
* @property string|null $debitor_name
* @property string $invoice_ids * @property string $invoice_ids
* @property int|null $expense_id * @property int|null $expense_id
* @property int|null $vendor_id * @property int|null $vendor_id
@ -84,7 +86,9 @@ class BankTransaction extends BaseModel
'base_type', 'base_type',
'expense_id', 'expense_id',
'vendor_id', 'vendor_id',
'amount' 'amount',
'debitor',
'debitor_name'
]; ];

View File

@ -31,6 +31,12 @@ return new class extends Migration {
$table->renameColumn('bank_integration_account_id', 'bank_integration_yodlee_account_id'); $table->renameColumn('bank_integration_account_id', 'bank_integration_yodlee_account_id');
}); });
// MAYBE migration of account->bank_account_id etc
Schema::table('bank_transactions', function (Blueprint $table) {
$table->string('debitor')->nullable(); // iban, credit-card info or else
$table->string('debitor_name')->nullable(); // name
});
} }
/** /**