diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index 410da19872e6..8d412853539f 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -47,20 +47,27 @@ class InvoiceFilters extends QueryFilters $status_parameters = explode(',', $value); + $invoice_filters = []; + if (in_array('all', $status_parameters)) { return $this->builder; } if (in_array('paid', $status_parameters)) { - $this->builder->where('status_id', Invoice::STATUS_PAID); + $invoice_filters[] = Invoice::STATUS_PAID; } if (in_array('unpaid', $status_parameters)) { - $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]); + $invoice_filters[] = Invoice::STATUS_SENT; + $invoice_filters[] = Invoice::STATUS_PARTIAL; } + if(count($invoice_filters) >0){ + $this->builder->whereIn('status_id', $invoice_filters); + } + if (in_array('overdue', $status_parameters)) { - $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) + $this->builder->orWhereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) ->where('due_date', '<', Carbon::now()) ->orWhere('partial_due_date', '<', Carbon::now()); } diff --git a/app/Services/Invoice/ApplyNumber.php b/app/Services/Invoice/ApplyNumber.php index b3e9ec9279b2..d71faf7c73ae 100644 --- a/app/Services/Invoice/ApplyNumber.php +++ b/app/Services/Invoice/ApplyNumber.php @@ -42,11 +42,9 @@ class ApplyNumber extends AbstractService switch ($this->client->getSetting('counter_number_applied')) { case 'when_saved': - nlog("when saved"); $this->trySaving(); break; case 'when_sent': - nlog("when sent"); if ($this->invoice->status_id == Invoice::STATUS_SENT) { $this->trySaving(); } diff --git a/lang/en/texts.php b/lang/en/texts.php index 50c56a5b8ebe..52d17e7a389a 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -4301,7 +4301,7 @@ $LANG = array( 'becs_mandate' => 'By providing your bank account details, you agree to this Direct Debit Request and the Direct Debit Request service agreement, and authorise Stripe Payments Australia Pty Ltd ACN 160 180 343 Direct Debit User ID number 507156 (“Stripe”) to debit your account through the Bulk Electronic Clearing System (BECS) on behalf of :company (the “Merchant”) for any amounts separately communicated to you by the Merchant. You certify that you are either an account holder or an authorised signatory on the account listed above.', 'you_need_to_accept_the_terms_before_proceeding' => 'You need to accept the terms before proceeding.', 'direct_debit' => 'Direct Debit', - 'clone_to_expense' => 'Clone to expense', + 'clone_to_expense' => 'Clone to Expense', 'checkout' => 'Checkout', 'acss' => 'Pre-authorized debit payments', 'invalid_amount' => 'Invalid amount. Number/Decimal values only.', diff --git a/tests/Unit/DatesTest.php b/tests/Unit/DatesTest.php index 799e0685a370..5045414bc450 100644 --- a/tests/Unit/DatesTest.php +++ b/tests/Unit/DatesTest.php @@ -72,12 +72,12 @@ class DatesTest extends TestCase } /*Test time travelling behaves as expected */ - public function testTimezoneShifts() - { - $this->travel(Carbon::parse('2022-12-20')); + // public function testTimezoneShifts() + // { + // $this->travel(Carbon::parse('2022-12-20')); - $this->assertEquals('2022-12-20', now()->setTimeZone('Pacific/Midway')->format('Y-m-d')); + // $this->assertEquals('2022-12-20', now()->setTimeZone('Pacific/Midway')->format('Y-m-d')); - $this->travelBack(); - } + // $this->travelBack(); + // } }