From 9edf9a599e83a2c00920ed9e061ffaaa510601fa Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 24 Aug 2022 13:43:32 +1000 Subject: [PATCH 1/3] Fixes for logo width for outlook emails --- resources/views/email/template/admin.blade.php | 2 +- resources/views/email/template/client.blade.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/resources/views/email/template/admin.blade.php b/resources/views/email/template/admin.blade.php index b8f76ee348..86e7cde9ed 100644 --- a/resources/views/email/template/admin.blade.php +++ b/resources/views/email/template/admin.blade.php @@ -125,7 +125,7 @@
- + diff --git a/resources/views/email/template/client.blade.php b/resources/views/email/template/client.blade.php index 7265d4a141..eb79157f48 100644 --- a/resources/views/email/template/client.blade.php +++ b/resources/views/email/template/client.blade.php @@ -81,6 +81,15 @@ text-align: left !important; } + +
- + From 496da291d8ffb11b80dbd0501a1054a5f34c5ab8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 24 Aug 2022 16:08:30 +1000 Subject: [PATCH 2/3] Prevent negative credits from being applied as payments to a invoice --- app/Http/ValidationRules/Credit/ValidCreditsRules.php | 9 +++++++++ app/Services/ClientPortal/InstantPayment.php | 2 ++ 2 files changed, 11 insertions(+) diff --git a/app/Http/ValidationRules/Credit/ValidCreditsRules.php b/app/Http/ValidationRules/Credit/ValidCreditsRules.php index f745092fe9..b8d6d2624e 100644 --- a/app/Http/ValidationRules/Credit/ValidCreditsRules.php +++ b/app/Http/ValidationRules/Credit/ValidCreditsRules.php @@ -51,6 +51,15 @@ class ValidCreditsRules implements Rule $unique_array = []; + $total_credit_amount = array_sum(array_column($this->input['credits'], 'amount')); + + if($total_credit_amount <= 0){ + + $this->error_msg = "Total of credits must be more than zero."; + + return false; + } + $cred_collection = Credit::withTrashed()->whereIn('id', array_column($this->input['credits'], 'credit_id'))->get(); foreach ($this->input['credits'] as $credit) { diff --git a/app/Services/ClientPortal/InstantPayment.php b/app/Services/ClientPortal/InstantPayment.php index 9ab3dc581e..9d03393b2e 100644 --- a/app/Services/ClientPortal/InstantPayment.php +++ b/app/Services/ClientPortal/InstantPayment.php @@ -48,6 +48,7 @@ class InstantPayment public function run() { + $is_credit_payment = false; $tokens = []; @@ -107,6 +108,7 @@ class InstantPayment $payable_amount = Number::roundValue(Number::parseFloat($payable_invoice['amount'], $client->currency()->precision)); $invoice_balance = Number::roundValue(($invoice->partial > 0 ? $invoice->partial : $invoice->balance), $client->currency()->precision); + /*If we don't allow under/over payments force the payable amount - prevents inspect element adjustments in JS*/ if ($settings->client_portal_allow_under_payment == false && $settings->client_portal_allow_over_payment == false) { From a2b8d573135feba904e19a2d2c5c8fa611d455c9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 24 Aug 2022 18:28:08 +1000 Subject: [PATCH 3/3] Ensure correct PDF is displayed to the contact --- VERSION.txt | 2 +- app/Http/Controllers/ClientPortal/CreditController.php | 1 + app/Http/Controllers/ClientPortal/InvoiceController.php | 1 + app/Http/Controllers/ClientPortal/QuoteController.php | 1 + .../Controllers/VendorPortal/PurchaseOrderController.php | 1 + app/Http/Livewire/QuotesTable.php | 8 ++++---- config/ninja.php | 4 ++-- .../portal/ninja2020/components/pdf-viewer.blade.php | 4 ++-- resources/views/portal/ninja2020/credits/show.blade.php | 2 +- .../portal/ninja2020/invoices/show-fullscreen.blade.php | 2 +- resources/views/portal/ninja2020/invoices/show.blade.php | 2 +- .../views/portal/ninja2020/purchase_orders/show.blade.php | 2 +- resources/views/portal/ninja2020/quotes/show.blade.php | 2 +- 13 files changed, 18 insertions(+), 14 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index b262615750..62f9457511 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.5.15 \ No newline at end of file +6 \ No newline at end of file diff --git a/app/Http/Controllers/ClientPortal/CreditController.php b/app/Http/Controllers/ClientPortal/CreditController.php index 9b6ee3fefe..c49606ae70 100644 --- a/app/Http/Controllers/ClientPortal/CreditController.php +++ b/app/Http/Controllers/ClientPortal/CreditController.php @@ -35,6 +35,7 @@ class CreditController extends Controller $data = [ 'credit' => $credit, 'key' => $invitation ? $invitation->key : false, + 'invitation' => $invitation ]; if ($invitation && auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) { diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index b5f42beb07..2270a5f835 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -69,6 +69,7 @@ class InvoiceController extends Controller $data = [ 'invoice' => $invoice, + 'invitation' => $invitation, 'key' => $invitation ? $invitation->key : false, ]; diff --git a/app/Http/Controllers/ClientPortal/QuoteController.php b/app/Http/Controllers/ClientPortal/QuoteController.php index 8cf4d3d9a0..ccaa48f98e 100644 --- a/app/Http/Controllers/ClientPortal/QuoteController.php +++ b/app/Http/Controllers/ClientPortal/QuoteController.php @@ -61,6 +61,7 @@ class QuoteController extends Controller $data = [ 'quote' => $quote, 'key' => $invitation ? $invitation->key : false, + 'invitation' => $invitation ]; if ($invitation && auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) { diff --git a/app/Http/Controllers/VendorPortal/PurchaseOrderController.php b/app/Http/Controllers/VendorPortal/PurchaseOrderController.php index a0361a6a09..ba2524bf08 100644 --- a/app/Http/Controllers/VendorPortal/PurchaseOrderController.php +++ b/app/Http/Controllers/VendorPortal/PurchaseOrderController.php @@ -99,6 +99,7 @@ class PurchaseOrderController extends Controller 'settings' => $purchase_order->company->settings, 'sidebar' => $this->sidebarMenu(), 'company' => $purchase_order->company, + 'invitation' => $invitation ]; if ($request->query('mode') === 'fullscreen') { diff --git a/app/Http/Livewire/QuotesTable.php b/app/Http/Livewire/QuotesTable.php index a82f728982..4600a0f7a9 100644 --- a/app/Http/Livewire/QuotesTable.php +++ b/app/Http/Livewire/QuotesTable.php @@ -28,17 +28,17 @@ 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 = '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 === $field ? $this->sort_asc = ! $this->sort_asc : $this->sort_asc = true; - $this->sort_field = $field; + $this->sort = $field; } public function mount() @@ -51,7 +51,7 @@ class QuotesTable extends Component $query = Quote::query() ->with('client.gateway_tokens', 'company', 'client.contacts') - ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc'); + ->orderBy($this->sort, $this->sort_asc ? 'asc' : 'desc'); if (count($this->status) > 0) { diff --git a/config/ninja.php b/config/ninja.php index 6bacd49a47..d0593cbac9 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.15', - 'app_tag' => '5.5.15', + 'app_version' => '5.5.16', + 'app_tag' => '5.5.16', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''), diff --git a/resources/views/portal/ninja2020/components/pdf-viewer.blade.php b/resources/views/portal/ninja2020/components/pdf-viewer.blade.php index ef1bcef4ec..9ef7d22ba5 100644 --- a/resources/views/portal/ninja2020/components/pdf-viewer.blade.php +++ b/resources/views/portal/ninja2020/components/pdf-viewer.blade.php @@ -3,7 +3,7 @@ @endphp @push('head') - + @endpush @@ -86,7 +86,7 @@
@else - + @endif diff --git a/resources/views/portal/ninja2020/credits/show.blade.php b/resources/views/portal/ninja2020/credits/show.blade.php index 0504dce30d..0d802adc7d 100644 --- a/resources/views/portal/ninja2020/credits/show.blade.php +++ b/resources/views/portal/ninja2020/credits/show.blade.php @@ -33,7 +33,7 @@ @include('portal.ninja2020.components.entity-documents', ['entity' => $credit]) - @include('portal.ninja2020.components.pdf-viewer', ['entity' => $credit]) + @include('portal.ninja2020.components.pdf-viewer', ['entity' => $credit, 'invitation' => $invitation]) @endsection diff --git a/resources/views/portal/ninja2020/invoices/show-fullscreen.blade.php b/resources/views/portal/ninja2020/invoices/show-fullscreen.blade.php index f08c3dcff5..d15cebda83 100644 --- a/resources/views/portal/ninja2020/invoices/show-fullscreen.blade.php +++ b/resources/views/portal/ninja2020/invoices/show-fullscreen.blade.php @@ -1,2 +1,2 @@ - diff --git a/resources/views/portal/ninja2020/invoices/show.blade.php b/resources/views/portal/ninja2020/invoices/show.blade.php index 168c6f092a..6fb066a2ee 100644 --- a/resources/views/portal/ninja2020/invoices/show.blade.php +++ b/resources/views/portal/ninja2020/invoices/show.blade.php @@ -96,7 +96,7 @@ @endif @include('portal.ninja2020.components.entity-documents', ['entity' => $invoice]) - @include('portal.ninja2020.components.pdf-viewer', ['entity' => $invoice]) + @include('portal.ninja2020.components.pdf-viewer', ['entity' => $invoice, 'invitation' => $invitation]) @include('portal.ninja2020.invoices.includes.terms', ['entities' => [$invoice], 'entity_type' => ctrans('texts.invoice')]) @include('portal.ninja2020.invoices.includes.signature') @endsection diff --git a/resources/views/portal/ninja2020/purchase_orders/show.blade.php b/resources/views/portal/ninja2020/purchase_orders/show.blade.php index 3f9ad02d97..c95648b5d8 100644 --- a/resources/views/portal/ninja2020/purchase_orders/show.blade.php +++ b/resources/views/portal/ninja2020/purchase_orders/show.blade.php @@ -46,7 +46,7 @@ @endif @include('portal.ninja2020.components.entity-documents', ['entity' => $purchase_order]) - @include('portal.ninja2020.components.pdf-viewer', ['entity' => $purchase_order]) + @include('portal.ninja2020.components.pdf-viewer', ['entity' => $purchase_order, 'invitation' => $invitation]) @include('portal.ninja2020.invoices.includes.terms', ['entities' => [$purchase_order], 'entity_type' => ctrans('texts.purchase_order')]) @include('portal.ninja2020.invoices.includes.signature') @endsection diff --git a/resources/views/portal/ninja2020/quotes/show.blade.php b/resources/views/portal/ninja2020/quotes/show.blade.php index 9e54707f0a..fe80c8c602 100644 --- a/resources/views/portal/ninja2020/quotes/show.blade.php +++ b/resources/views/portal/ninja2020/quotes/show.blade.php @@ -105,7 +105,7 @@ @endif @include('portal.ninja2020.components.entity-documents', ['entity' => $quote]) - @include('portal.ninja2020.components.pdf-viewer', ['entity' => $quote]) + @include('portal.ninja2020.components.pdf-viewer', ['entity' => $quote, 'invitation' => $invitation]) @include('portal.ninja2020.invoices.includes.terms', ['entities' => [$quote], 'entity_type' => ctrans('texts.quote')]) @include('portal.ninja2020.invoices.includes.signature') @endsection