From b9c868d3ffa4b210a2e49af38af41dc54b58aff1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 9 Sep 2020 07:33:21 +1000 Subject: [PATCH] Sort recurring / invoices transformers for comparison --- app/Transformers/InvoiceTransformer.php | 8 ++--- .../RecurringInvoiceTransformer.php | 31 +++++++++++++------ ...40557_add_is_public_to_documents_table.php | 2 ++ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/app/Transformers/InvoiceTransformer.php b/app/Transformers/InvoiceTransformer.php index 27c531ec61..980e1a2acf 100644 --- a/app/Transformers/InvoiceTransformer.php +++ b/app/Transformers/InvoiceTransformer.php @@ -105,10 +105,6 @@ class InvoiceTransformer extends EntityTransformer 'date' => $invoice->date ?: '', 'last_sent_date' => $invoice->last_sent_date ?: '', 'next_send_date' => $invoice->date ?: '', - 'reminder1_sent' => $invoice->reminder1_sent ?: '', - 'reminder2_sent' => $invoice->reminder2_sent ?: '', - 'reminder3_sent' => $invoice->reminder3_sent ?: '', - 'reminder_last_sent' => $invoice->reminder_last_sent ?: '', 'due_date' => $invoice->due_date ?: '', 'terms' => $invoice->terms ?: '', 'public_notes' => $invoice->public_notes ?: '', @@ -142,6 +138,10 @@ class InvoiceTransformer extends EntityTransformer 'custom_surcharge_tax4' => (bool) $invoice->custom_surcharge_tax4, 'line_items' => $invoice->line_items ?: (array) [], 'entity_type' => 'invoice', + 'reminder1_sent' => $invoice->reminder1_sent ?: '', + 'reminder2_sent' => $invoice->reminder2_sent ?: '', + 'reminder3_sent' => $invoice->reminder3_sent ?: '', + 'reminder_last_sent' => $invoice->reminder_last_sent ?: '', ]; } } diff --git a/app/Transformers/RecurringInvoiceTransformer.php b/app/Transformers/RecurringInvoiceTransformer.php index a3151b4370..51c01e458e 100644 --- a/app/Transformers/RecurringInvoiceTransformer.php +++ b/app/Transformers/RecurringInvoiceTransformer.php @@ -86,41 +86,54 @@ class RecurringInvoiceTransformer extends EntityTransformer 'amount' => (float) $invoice->amount ?: '', 'balance' => (float) $invoice->balance ?: '', 'client_id' => (string) $invoice->client_id, + 'vendor_id' => (string) $this->encodePrimaryKey($invoice->vendor_id), 'status_id' => (string) ($invoice->status_id ?: 1), + 'design_id' => (string) $this->encodePrimaryKey($invoice->design_id), 'created_at' => (int) $invoice->created_at, 'updated_at' => (int) $invoice->updated_at, 'archived_at' => (int) $invoice->deleted_at, + 'is_deleted' => (bool) $invoice->is_deleted, + 'number' => $invoice->number ?: '', 'discount' => (float) $invoice->discount ?: '', 'po_number' => $invoice->po_number ?: '', 'date' => $invoice->date ?: '', + 'last_sent_date' => $invoice->last_sent_date ?: '', + 'next_send_date' => $invoice->next_send_date ?: '', 'due_date' => $invoice->due_date ?: '', 'terms' => $invoice->terms ?: '', 'public_notes' => $invoice->public_notes ?: '', 'private_notes' => $invoice->private_notes ?: '', - 'is_deleted' => (bool) $invoice->is_deleted, + 'uses_inclusive_taxes' => (bool) $invoice->uses_inclusive_taxes, 'tax_name1' => $invoice->tax_name1 ? $invoice->tax_name1 : '', 'tax_rate1' => (float) $invoice->tax_rate1 ?: '', 'tax_name2' => $invoice->tax_name2 ? $invoice->tax_name2 : '', 'tax_rate2' => (float) $invoice->tax_rate2 ?: '', 'tax_name3' => $invoice->tax_name3 ? $invoice->tax_name3 : '', 'tax_rate3' => (float) $invoice->tax_rate3 ?: '', + 'total_taxes' => (float) $invoice->total_taxes, 'is_amount_discount' => (bool) ($invoice->is_amount_discount ?: false), - 'invoice_footer' => $invoice->invoice_footer ?: '', + 'footer' => $invoice->footer ?: '', 'partial' => (float) ($invoice->partial ?: 0.0), 'partial_due_date' => $invoice->partial_due_date ?: '', 'custom_value1' => (float) $invoice->custom_value1 ?: '', 'custom_value2' => (float) $invoice->custom_value2 ?: '', - 'custom_taxes1' => (bool) $invoice->custom_taxes1 ?: '', - 'custom_taxes2' => (bool) $invoice->custom_taxes2 ?: '', + 'custom_value3' => (bool) $invoice->custom_value3 ?: '', + 'custom_value4' => (bool) $invoice->custom_value4 ?: '', 'has_tasks' => (bool) $invoice->has_tasks, 'has_expenses' => (bool) $invoice->has_expenses, - 'custom_text_value1' => $invoice->custom_text_value1 ?: '', - 'custom_text_value2' => $invoice->custom_text_value2 ?: '', - 'settings' => $invoice->settings ?: '', + 'custom_surcharge1' => (float) $invoice->custom_surcharge1, + 'custom_surcharge2' => (float) $invoice->custom_surcharge2, + 'custom_surcharge3' => (float) $invoice->custom_surcharge3, + 'custom_surcharge4' => (float) $invoice->custom_surcharge4, + 'exchange_rate' => (float) $invoice->exchange_rate, + 'custom_surcharge_tax1' => (bool) $invoice->custom_surcharge_tax1, + 'custom_surcharge_tax2' => (bool) $invoice->custom_surcharge_tax2, + 'custom_surcharge_tax3' => (bool) $invoice->custom_surcharge_tax3, + 'custom_surcharge_tax4' => (bool) $invoice->custom_surcharge_tax4, + 'line_items' => $invoice->line_items ?: (array) [], + 'entity_type' => 'recurring_invoice', 'frequency_id' => (string) $invoice->frequency_id, 'start_date' => $invoice->start_date ?: '', - 'last_sent_date' => $invoice->last_sent_date ?: '', - 'next_send_date' => $invoice->next_send_date ?: '', 'remaining_cycles' => (int) $invoice->remaining_cycles, ]; } diff --git a/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php b/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php index 5f10098b9f..6b35ce49b0 100644 --- a/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php +++ b/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php @@ -45,6 +45,8 @@ class AddIsPublicToDocumentsTable extends Migration Schema::table('recurring_invoices', function ($table) { $table->boolean('auto_bill')->default(0); + $table->unsignedInteger('design_id')->nullable(); + $table->boolean('uses_inclusive_taxes')->default(0); }); Schema::table('companies', function ($table) {