From 6d65b8e7ccda6623f4b3568b68634d3e37c04cbe Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 30 Jan 2017 10:15:28 +0200 Subject: [PATCH] Fix for dates --- app/Http/Controllers/InvoiceApiController.php | 2 +- app/Http/Controllers/InvoiceController.php | 2 +- app/Ninja/PaymentDrivers/BasePaymentDriver.php | 2 +- app/Ninja/Repositories/InvoiceRepository.php | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/InvoiceApiController.php b/app/Http/Controllers/InvoiceApiController.php index a408f6e6dfee..793d00926e21 100644 --- a/app/Http/Controllers/InvoiceApiController.php +++ b/app/Http/Controllers/InvoiceApiController.php @@ -231,7 +231,7 @@ class InvoiceApiController extends BaseAPIController } if (!isset($data['invoice_date'])) { - $fields['invoice_date_sql'] = Utils::today(); + $fields['invoice_date_sql'] = Utils::today(false)->format('Y-m-d'); } if (!isset($data['due_date'])) { $fields['due_date_sql'] = false; diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 39b836fdee44..6b276f84e4e6 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -101,7 +101,7 @@ class InvoiceController extends BaseController $invoice->invoice_number = $account->getNextNumber($invoice); $invoice->balance = $invoice->amount; $invoice->invoice_status_id = 0; - $invoice->invoice_date = Utils::today(); + $invoice->invoice_date = Utils::today(false)->format('Y-m-d'); $method = 'POST'; $url = "{$entityType}s"; } else { diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index a11c53f0ad35..f72af507d3fd 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -603,7 +603,7 @@ class BasePaymentDriver $payment->client_id = $invoice->client_id; $payment->contact_id = $invitation->contact_id; $payment->transaction_reference = $ref; - $payment->payment_date = Utils::today(); + $payment->payment_date = Utils::today(false)->format('Y-m-d'); $payment->ip = Request::ip(); $payment = $this->creatingPayment($payment, $paymentMethod); diff --git a/app/Ninja/Repositories/InvoiceRepository.php b/app/Ninja/Repositories/InvoiceRepository.php index c09fbd370359..000a2970e58b 100644 --- a/app/Ninja/Repositories/InvoiceRepository.php +++ b/app/Ninja/Repositories/InvoiceRepository.php @@ -301,7 +301,7 @@ class InvoiceRepository extends BaseRepository $entityType = ENTITY_QUOTE; } $invoice = $account->createInvoice($entityType, $data['client_id']); - $invoice->invoice_date = Utils::today(); + $invoice->invoice_date = Utils::today(false)->format('Y-m-d'); if (isset($data['has_tasks']) && filter_var($data['has_tasks'], FILTER_VALIDATE_BOOLEAN)) { $invoice->has_tasks = true; } @@ -666,7 +666,7 @@ class InvoiceRepository extends BaseRepository } } $clone->invoice_number = $invoiceNumber ?: $account->getNextNumber($clone); - $clone->invoice_date = Utils::today(); + $clone->invoice_date = Utils::today(false)->format('Y-m-d'); foreach ([ 'client_id', @@ -870,7 +870,7 @@ class InvoiceRepository extends BaseRepository $invoice->invoice_number = $recurInvoice->account->getNextNumber($invoice); $invoice->amount = $recurInvoice->amount; $invoice->balance = $recurInvoice->amount; - $invoice->invoice_date = Utils::today(); + $invoice->invoice_date = Utils::today(false)->format('Y-m-d'); $invoice->discount = $recurInvoice->discount; $invoice->po_number = $recurInvoice->po_number; $invoice->public_notes = Utils::processVariables($recurInvoice->public_notes);