From 4460e970bd60f8fc90275825a8fa3b8d16973e90 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 19 Aug 2022 15:11:48 +1000 Subject: [PATCH 1/5] Sort by status_id for quotes in client portal --- app/Http/Livewire/QuotesTable.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/Http/Livewire/QuotesTable.php b/app/Http/Livewire/QuotesTable.php index 046ef1e5ba..a82f728982 100644 --- a/app/Http/Livewire/QuotesTable.php +++ b/app/Http/Livewire/QuotesTable.php @@ -20,7 +20,6 @@ use Livewire\WithPagination; class QuotesTable extends Component { - use WithSorting; use WithPagination; public $per_page = 10; @@ -29,6 +28,19 @@ class QuotesTable extends Component public $company; + public $sort_field = 'status_id'; // Default sortBy. Feel free to change or pull from client/company settings. + + public $sort_asc = true; + + public function sortBy($field) + { + $this->sort_field === $field + ? $this->sort_asc = ! $this->sort_asc + : $this->sort_asc = true; + + $this->sort_field = $field; + } + public function mount() { MultiDB::setDb($this->company->db); @@ -36,6 +48,7 @@ class QuotesTable extends Component public function render() { + $query = Quote::query() ->with('client.gateway_tokens', 'company', 'client.contacts') ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc'); @@ -44,7 +57,6 @@ class QuotesTable extends Component /* Special filter for expired*/ if (in_array('-1', $this->status)) { - // $query->whereDate('due_date', '<=', now()->startOfDay()); $query->where(function ($query) { $query->whereDate('due_date', '<=', now()->startOfDay()) @@ -69,10 +81,6 @@ class QuotesTable extends Component ->where('company_id', $this->company->id) ->where('client_id', auth()->guard('contact')->user()->client->id) ->where('status_id', '<>', Quote::STATUS_DRAFT) - // ->where(function ($query){ - // $query->whereDate('due_date', '>=', now()) - // ->orWhereNull('due_date'); - // }) ->where('is_deleted', 0) ->withTrashed() ->paginate($this->per_page); From dfdd5437d54db6bac3a405c4a9de2c02517bcd25 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 19 Aug 2022 17:07:23 +1000 Subject: [PATCH 2/5] Download snappdf for running tests --- .github/workflows/phpunit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index d9f781b417..07721a37c9 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -103,6 +103,7 @@ jobs: - name: Run Testsuite run: | cat .env + vendor/bin/snappdf download vendor/bin/phpunit --testdox env: DB_PORT: ${{ job.services.mysql.ports[3306] }} From 879bca1fd1679403da41849546258fc2ba2b09af Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 19 Aug 2022 19:19:17 +1000 Subject: [PATCH 3/5] Refactor email limits on hosted --- app/Models/Account.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/Account.php b/app/Models/Account.php index b75a7ce327..915a3ac979 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -33,7 +33,7 @@ class Account extends BaseModel use PresentableTrait; use MakesHash; - private $free_plan_email_quota = 50; + private $free_plan_email_quota = 20; private $paid_plan_email_quota = 500; /** @@ -390,11 +390,11 @@ class Account extends BaseModel if($this->isPaid()){ $limit = $this->paid_plan_email_quota; - $limit += Carbon::createFromTimestamp($this->created_at)->diffInMonths() * 100; + $limit += Carbon::createFromTimestamp($this->created_at)->diffInMonths() * 50; } else{ $limit = $this->free_plan_email_quota; - $limit += Carbon::createFromTimestamp($this->created_at)->diffInMonths() * 50; + $limit += Carbon::createFromTimestamp($this->created_at)->diffInMonths() * 10; } return min($limit, 5000); From 761508c436b998342fb9bc1fe3cf20b8c33c1f8b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 20 Aug 2022 07:38:01 +1000 Subject: [PATCH 4/5] Fixes for mail sent listener in self hosted --- app/Listeners/Mail/MailSentListener.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Listeners/Mail/MailSentListener.php b/app/Listeners/Mail/MailSentListener.php index e1a620c0e7..f2cbcd736b 100644 --- a/app/Listeners/Mail/MailSentListener.php +++ b/app/Listeners/Mail/MailSentListener.php @@ -17,6 +17,7 @@ use App\Models\InvoiceInvitation; use App\Models\PurchaseOrderInvitation; use App\Models\QuoteInvitation; use App\Models\RecurringInvoiceInvitation; +use App\Utils\Ninja; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Events\MessageSent; use Illuminate\Support\Facades\Notification; @@ -41,7 +42,9 @@ class MailSentListener implements ShouldQueue */ public function handle(MessageSent $event) { - + if(!Ninja::isHosted()); + return; + $message_id = $event->sent->getMessageId(); $message = MessageConverter::toEmail($event->sent->getOriginalMessage()); From d98c2d4d8f60f453a1a191f25cbbd28a69b4fece Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 20 Aug 2022 08:08:11 +1000 Subject: [PATCH 5/5] v5.5.14 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 3b4176428c..9562ed5038 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.5.13 \ No newline at end of file +5.5.14 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 669d23100c..1f8ce1c6bd 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.5.13', - 'app_tag' => '5.5.13', + 'app_version' => '5.5.14', + 'app_tag' => '5.5.14', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),