mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 20:07:31 -05:00 
			
		
		
		
	minor fixes for client portal queries
This commit is contained in:
		
							parent
							
								
									b81851b190
								
							
						
					
					
						commit
						cb63cb8f8f
					
				@ -35,7 +35,7 @@ class CreditsTable extends Component
 | 
			
		||||
    public function render()
 | 
			
		||||
    {
 | 
			
		||||
        $query = Credit::query()
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client->id)
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client_id)
 | 
			
		||||
            ->where('company_id', $this->company->id)
 | 
			
		||||
            ->where('status_id', '<>', Credit::STATUS_DRAFT)
 | 
			
		||||
            ->where('is_deleted', 0)
 | 
			
		||||
 | 
			
		||||
@ -43,10 +43,10 @@ class InvoicesTable extends Component
 | 
			
		||||
        $local_status = [];
 | 
			
		||||
 | 
			
		||||
        $query = Invoice::query()
 | 
			
		||||
            ->with('client.gateway_tokens', 'client.contacts')
 | 
			
		||||
            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
 | 
			
		||||
            ->where('company_id', $this->company->id)
 | 
			
		||||
            ->where('is_deleted', false);
 | 
			
		||||
            ->where('is_deleted', false)
 | 
			
		||||
            ->with('client.gateway_tokens', 'client.contacts')
 | 
			
		||||
            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
 | 
			
		||||
 | 
			
		||||
        if (in_array('paid', $this->status)) {
 | 
			
		||||
            $local_status[] = Invoice::STATUS_PAID;
 | 
			
		||||
@ -76,8 +76,7 @@ class InvoicesTable extends Component
 | 
			
		||||
 | 
			
		||||
        $query = $query
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client_id)
 | 
			
		||||
            ->where('status_id', '<>', Invoice::STATUS_DRAFT)
 | 
			
		||||
            ->where('status_id', '<>', Invoice::STATUS_CANCELLED)
 | 
			
		||||
            ->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL, Invoice::STATUS_PAID, Invoice::STATUS_REVERSED])
 | 
			
		||||
            ->withTrashed()
 | 
			
		||||
            ->paginate($this->per_page);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -40,9 +40,9 @@ class PaymentsTable extends Component
 | 
			
		||||
    {
 | 
			
		||||
        $query = Payment::query()
 | 
			
		||||
            ->with('type', 'client')
 | 
			
		||||
            ->whereIn('status_id', [Payment::STATUS_FAILED, Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_REFUNDED, Payment::STATUS_PARTIALLY_REFUNDED])
 | 
			
		||||
            ->where('company_id', $this->company->id)
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client->id)
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client_id)
 | 
			
		||||
            ->whereIn('status_id', [Payment::STATUS_FAILED, Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_REFUNDED, Payment::STATUS_PARTIALLY_REFUNDED])
 | 
			
		||||
            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
 | 
			
		||||
            ->withTrashed()
 | 
			
		||||
            ->paginate($this->per_page);
 | 
			
		||||
 | 
			
		||||
@ -45,10 +45,10 @@ class PurchaseOrdersTable extends Component
 | 
			
		||||
 | 
			
		||||
        $query = PurchaseOrder::query()
 | 
			
		||||
            ->with('vendor.contacts')
 | 
			
		||||
            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
 | 
			
		||||
            ->whereIn('status_id', [PurchaseOrder::STATUS_SENT, PurchaseOrder::STATUS_ACCEPTED])
 | 
			
		||||
            ->where('company_id', $this->company->id)
 | 
			
		||||
            ->where('is_deleted', false);
 | 
			
		||||
            ->whereIn('status_id', [PurchaseOrder::STATUS_SENT, PurchaseOrder::STATUS_ACCEPTED])
 | 
			
		||||
            ->where('is_deleted', false)
 | 
			
		||||
            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
 | 
			
		||||
 | 
			
		||||
        if (in_array('sent', $this->status)) {
 | 
			
		||||
            $local_status[] = PurchaseOrder::STATUS_SENT;
 | 
			
		||||
 | 
			
		||||
@ -79,9 +79,9 @@ class QuotesTable extends Component
 | 
			
		||||
 | 
			
		||||
        $query = $query
 | 
			
		||||
            ->where('company_id', $this->company->id)
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client->id)
 | 
			
		||||
            ->where('status_id', '<>', Quote::STATUS_DRAFT)
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client_id)
 | 
			
		||||
            ->where('is_deleted', 0)
 | 
			
		||||
            ->where('status_id', '<>', Quote::STATUS_DRAFT)
 | 
			
		||||
            ->withTrashed()
 | 
			
		||||
            ->paginate($this->per_page);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -40,7 +40,7 @@ class RecurringInvoicesTable extends Component
 | 
			
		||||
        $query = RecurringInvoice::query();
 | 
			
		||||
 | 
			
		||||
        $query = $query
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client->id)
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client_id)
 | 
			
		||||
            ->where('company_id', $this->company->id)
 | 
			
		||||
            ->whereIn('status_id', [RecurringInvoice::STATUS_ACTIVE])
 | 
			
		||||
            ->orderBy('status_id', 'asc')
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ class TasksTable extends Component
 | 
			
		||||
        $query = Task::query()
 | 
			
		||||
            ->where('company_id', $this->company->id)
 | 
			
		||||
            ->where('is_deleted', false)
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client->id);
 | 
			
		||||
            ->where('client_id', auth()->guard('contact')->user()->client_id);
 | 
			
		||||
 | 
			
		||||
        if ($this->company->getSetting('show_all_tasks_client_portal') === 'invoiced') {
 | 
			
		||||
            $query = $query->whereNotNull('invoice_id');
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user