diff --git a/app/Ninja/Repositories/CreditRepository.php b/app/Ninja/Repositories/CreditRepository.php index 0bb28e7b0ae8..00fffd8f42af 100644 --- a/app/Ninja/Repositories/CreditRepository.php +++ b/app/Ninja/Repositories/CreditRepository.php @@ -19,7 +19,6 @@ class CreditRepository extends BaseRepository ->join('clients', 'clients.id', '=', 'credits.client_id') ->join('contacts', 'contacts.client_id', '=', 'clients.id') ->where('clients.account_id', '=', \Auth::user()->account_id) - ->where('clients.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null) ->where('contacts.is_primary', '=', true) ->select( @@ -43,6 +42,8 @@ class CreditRepository extends BaseRepository if ($clientPublicId) { $query->where('clients.public_id', '=', $clientPublicId); + } else { + $query->whereNull('clients.deleted_at'); } $this->applyFilters($query, ENTITY_CREDIT); diff --git a/app/Ninja/Repositories/InvoiceRepository.php b/app/Ninja/Repositories/InvoiceRepository.php index 2254934c13d4..cfe54304e89d 100644 --- a/app/Ninja/Repositories/InvoiceRepository.php +++ b/app/Ninja/Repositories/InvoiceRepository.php @@ -46,7 +46,6 @@ class InvoiceRepository extends BaseRepository ->join('invoice_statuses', 'invoice_statuses.id', '=', 'invoices.invoice_status_id') ->join('contacts', 'contacts.client_id', '=', 'clients.id') ->where('invoices.account_id', '=', $accountId) - ->where('clients.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null) ->where('invoices.is_recurring', '=', false) ->where('contacts.is_primary', '=', true) @@ -101,6 +100,8 @@ class InvoiceRepository extends BaseRepository if ($clientPublicId) { $query->where('clients.public_id', '=', $clientPublicId); + } else { + $query->whereNull('clients.deleted_at'); } if ($filter) { @@ -128,7 +129,6 @@ class InvoiceRepository extends BaseRepository ->where('contacts.deleted_at', '=', null) ->where('invoices.is_recurring', '=', true) ->where('contacts.is_primary', '=', true) - ->where('clients.deleted_at', '=', null) ->select( DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'), DB::raw('COALESCE(clients.country_id, accounts.country_id) country_id'), @@ -149,6 +149,8 @@ class InvoiceRepository extends BaseRepository if ($clientPublicId) { $query->where('clients.public_id', '=', $clientPublicId); + } else { + $query->whereNull('clients.deleted_at'); } $this->applyFilters($query, ENTITY_RECURRING_INVOICE, ENTITY_INVOICE); diff --git a/app/Ninja/Repositories/PaymentRepository.php b/app/Ninja/Repositories/PaymentRepository.php index 01a57ba399e3..0372b0207063 100644 --- a/app/Ninja/Repositories/PaymentRepository.php +++ b/app/Ninja/Repositories/PaymentRepository.php @@ -25,7 +25,6 @@ class PaymentRepository extends BaseRepository ->leftJoin('account_gateways', 'account_gateways.id', '=', 'payments.account_gateway_id') ->leftJoin('gateways', 'gateways.id', '=', 'account_gateways.gateway_id') ->where('payments.account_id', '=', \Auth::user()->account_id) - ->where('clients.deleted_at', '=', null) ->where('contacts.is_primary', '=', true) ->where('contacts.deleted_at', '=', null) ->where('invoices.is_deleted', '=', false) @@ -67,6 +66,8 @@ class PaymentRepository extends BaseRepository if ($clientPublicId) { $query->where('clients.public_id', '=', $clientPublicId); + } else { + $query->whereNull('clients.deleted_at'); } if ($filter) { diff --git a/app/Ninja/Repositories/TaskRepository.php b/app/Ninja/Repositories/TaskRepository.php index a06017bc9a1b..c16bcae9e123 100644 --- a/app/Ninja/Repositories/TaskRepository.php +++ b/app/Ninja/Repositories/TaskRepository.php @@ -24,7 +24,6 @@ class TaskRepository extends BaseRepository ->orWhere('contacts.is_primary', '=', null); }) ->where('contacts.deleted_at', '=', null) - ->where('clients.deleted_at', '=', null) ->select( 'tasks.public_id', \DB::raw("COALESCE(NULLIF(clients.name,''), NULLIF(CONCAT(contacts.first_name, ' ', contacts.last_name),''), NULLIF(contacts.email,'')) client_name"), @@ -52,6 +51,8 @@ class TaskRepository extends BaseRepository if ($clientPublicId) { $query->where('clients.public_id', '=', $clientPublicId); + } else { + $query->whereNull('clients.deleted_at'); } $this->applyFilters($query, ENTITY_TASK); diff --git a/resources/views/list.blade.php b/resources/views/list.blade.php index eb0ff181deaa..8e38652b6413 100644 --- a/resources/views/list.blade.php +++ b/resources/views/list.blade.php @@ -219,8 +219,6 @@ $('#statuses_{{ $entityType }}').select2({ placeholder: "{{ trans('texts.status') }}", templateSelection: function(data, container) { - console.log(data); - console.log(container); if (data.id == 'archived') { $(container).css('color', '#fff'); $(container).css('background-color', '#f0ad4e');