1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for expense id encoding in bank transactions

This commit is contained in:
David Bomba 2023-08-03 08:40:08 +10:00
parent 8a3514aa57
commit d00cdd29f7
3 changed files with 4 additions and 5 deletions

View File

@ -59,7 +59,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction onlyTrashed() * @method static \Illuminate\Database\Eloquent\Builder|BankTransaction onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction query() * @method static \Illuminate\Database\Eloquent\Builder|BankTransaction query()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope() * @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
* @method static \Illuminate\Database\Eloquent\Account withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction withoutTrashed() * @method static \Illuminate\Database\Eloquent\Builder|BankTransaction withoutTrashed()
* @property-read \App\Models\Payment|null $payment * @property-read \App\Models\Payment|null $payment
* @mixin \Eloquent * @mixin \Eloquent
@ -137,12 +136,12 @@ class BankTransaction extends BaseModel
public function vendor(): \Illuminate\Database\Eloquent\Relations\BelongsTo public function vendor(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{ {
return $this->belongsTo(Vendor::class); return $this->belongsTo(Vendor::class)->withTrashed();
} }
public function expense(): \Illuminate\Database\Eloquent\Relations\BelongsTo public function expense(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{ {
return $this->belongsTo(Expense::class); return $this->belongsTo(Expense::class)->withTrashed();
} }
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo

View File

@ -63,7 +63,7 @@ class BankTransactionTransformer extends EntityTransformer
'description' => (string) $bank_transaction->description ?: '', 'description' => (string) $bank_transaction->description ?: '',
'base_type' => (string) $bank_transaction->base_type ?: '', 'base_type' => (string) $bank_transaction->base_type ?: '',
'invoice_ids' => (string) $bank_transaction->invoice_ids ?: '', 'invoice_ids' => (string) $bank_transaction->invoice_ids ?: '',
'expense_id'=> (string) $bank_transaction->expense_id ?: '', 'expense_id'=> (string) $this->encodePrimaryKey($bank_transaction->expense_id) ?: '',
'payment_id'=> (string) $this->encodePrimaryKey($bank_transaction->payment_id) ?: '', 'payment_id'=> (string) $this->encodePrimaryKey($bank_transaction->payment_id) ?: '',
'vendor_id'=> (string) $this->encodePrimaryKey($bank_transaction->vendor_id) ?: '', 'vendor_id'=> (string) $this->encodePrimaryKey($bank_transaction->vendor_id) ?: '',
'bank_transaction_rule_id' => (string) $this->encodePrimaryKey($bank_transaction->bank_transaction_rule_id) ?: '', 'bank_transaction_rule_id' => (string) $this->encodePrimaryKey($bank_transaction->bank_transaction_rule_id) ?: '',