diff --git a/app/Ninja/Transformers/InvoiceTransformer.php b/app/Ninja/Transformers/InvoiceTransformer.php index 48ad019428d5..4d10995bb2a5 100644 --- a/app/Ninja/Transformers/InvoiceTransformer.php +++ b/app/Ninja/Transformers/InvoiceTransformer.php @@ -127,9 +127,9 @@ class InvoiceTransformer extends EntityTransformer 'custom_taxes1' => (bool) $invoice->custom_taxes1, 'custom_taxes2' => (bool) $invoice->custom_taxes2, 'has_expenses' => (bool) $invoice->has_expenses, - 'quote_invoice_id' => (int) $invoice->quote_invoice_id, - 'custom_text_value1' => $invoice->custom_text_value1, - 'custom_text_value2' => $invoice->custom_text_value2, + 'quote_invoice_id' => (int) ($invoice->quote_invoice_id ?: 0), + 'custom_text_value1' => $invoice->custom_text_value1 ?: '', + 'custom_text_value2' => $invoice->custom_text_value2 ?: '', 'is_quote' => (bool) $invoice->isType(INVOICE_TYPE_QUOTE), // Temp to support mobile app 'is_public' => (bool) $invoice->is_public, 'filename' => $invoice->getFileName(), diff --git a/app/Ninja/Transformers/PaymentTransformer.php b/app/Ninja/Transformers/PaymentTransformer.php index 23906c3029ea..1ce690b1600c 100644 --- a/app/Ninja/Transformers/PaymentTransformer.php +++ b/app/Ninja/Transformers/PaymentTransformer.php @@ -51,15 +51,15 @@ class PaymentTransformer extends EntityTransformer return array_merge($this->getDefaults($payment), [ 'id' => (int) $payment->public_id, 'amount' => (float) $payment->amount, - 'transaction_reference' => $payment->transaction_reference, - 'payment_date' => $payment->payment_date, + 'transaction_reference' => $payment->transaction_reference ?: '', + 'payment_date' => $payment->payment_date ?: '', 'updated_at' => $this->getTimestamp($payment->updated_at), 'archived_at' => $this->getTimestamp($payment->deleted_at), 'is_deleted' => (bool) $payment->is_deleted, - 'payment_type_id' => (int) $payment->payment_type_id, + 'payment_type_id' => (int) ($payment->payment_type_id ?: 0), 'invoice_id' => (int) ($this->invoice ? $this->invoice->public_id : $payment->invoice->public_id), 'invoice_number' => $this->invoice ? $this->invoice->invoice_number : $payment->invoice->invoice_number, - 'private_notes' => $payment->private_notes, + 'private_notes' => $payment->private_notes ?: '', 'exchange_rate' => (float) $payment->exchange_rate, 'exchange_currency_id' => (int) $payment->exchange_currency_id, ]);