Fixes for activity insertions

This commit is contained in:
David Bomba 2023-11-15 10:15:14 +11:00
parent fec38eac8a
commit 1bff207e6c
4 changed files with 7 additions and 4 deletions

View File

@ -451,8 +451,8 @@ class Activity extends StaticModel
':subscription' => $translation = [substr($variable, 1) => [ 'label' => $this?->subscription?->number ?? '', 'hashed_id' => $this->subscription->hashed_id ?? '' ]],
':recurring_invoice' => $translation = [substr($variable, 1) =>[ 'label' => $this?->recurring_invoice?->number ??'', 'hashed_id' => $this->recurring_invoice->hashed_id ?? '']],
':recurring_expense' => $translation = [substr($variable, 1) => [ 'label' => $this?->recurring_expense?->number ??'', 'hashed_id' => $this->recurring_expense->hashed_id ?? '']],
':payment_amount' => $translation = [substr($variable, 1) =>[ 'label' => Number::formatMoney($this?->payment?->amount, $this?->payment?->client) ?? '', 'hashed_id' => '']],
':adjustment' => $translation = [substr($variable, 1) =>[ 'label' => Number::formatMoney($this?->payment?->refunded, $this?->payment?->client) ?? '', 'hashed_id' => '']],
':payment_amount' => $translation = [substr($variable, 1) =>[ 'label' => Number::formatMoney($this?->payment?->amount, $this?->payment?->client ?? $this->company) ?? '', 'hashed_id' => '']],
':adjustment' => $translation = [substr($variable, 1) =>[ 'label' => Number::formatMoney($this?->payment?->refunded, $this?->payment?->client ?? $this->company) ?? '', 'hashed_id' => '']],
':ip' => $translation = [ 'ip' => $this->ip ?? ''],
':contact' => $translation = $this->resolveContact(),
default => $translation = [],

View File

@ -149,7 +149,8 @@ class RefundPayment
$fields->user_id = $this->payment->user_id;
$fields->company_id = $this->payment->company_id;
$fields->activity_type_id = Activity::REFUNDED_PAYMENT;
// $fields->credit_id = $this->credit_note->id; // TODO
$fields->client_id = $this->payment->client_id;
// $fields->credit_id // TODO
$fields->notes = $notes;
if (isset($this->refund_data['invoices'])) {

View File

@ -843,8 +843,9 @@ class PdfBuilder
*/
public function processTaxColumns(string $type): void
{
$column_type = 'product';
if ($type == 'product') {
$column_type = 'product';
$type_id = 1;
}

View File

@ -208,6 +208,7 @@ trait Refundable
$fields->company_id = $this->company_id;
$fields->activity_type_id = Activity::REFUNDED_PAYMENT;
$fields->credit_id = $credit_id;
$fields->client_id = $this->client_id;
if (isset($data['invoices'])) {
foreach ($data['invoices'] as $invoice) {