diff --git a/app/Http/Controllers/ClientPortal/InvitationController.php b/app/Http/Controllers/ClientPortal/InvitationController.php index 4a8f1fe4eeca..97e57262112d 100644 --- a/app/Http/Controllers/ClientPortal/InvitationController.php +++ b/app/Http/Controllers/ClientPortal/InvitationController.php @@ -137,7 +137,11 @@ class InvitationController extends Controller $entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation'; - $invitation = $entity_obj::whereRaw('BINARY `key`= ?', [$invitation_key]) + // $invitation = $entity_obj::whereRaw('BINARY `key`= ?', [$invitation_key]) + // ->with('contact.client') + // ->firstOrFail(); + + $invitation = $entity_obj::where('key', $invitation_key) ->with('contact.client') ->firstOrFail(); diff --git a/app/Http/Livewire/CreditsTable.php b/app/Http/Livewire/CreditsTable.php index 4b889870bda3..2cee74e9f843 100644 --- a/app/Http/Livewire/CreditsTable.php +++ b/app/Http/Livewire/CreditsTable.php @@ -39,6 +39,7 @@ class CreditsTable extends Component ->where('client_id', auth('contact')->user()->client->id) ->where('company_id', $this->company->id) ->where('status_id', '<>', Credit::STATUS_DRAFT) + ->where('is_deleted', 0) ->where(function ($query){ $query->whereDate('due_date', '<=', now()) ->orWhereNull('due_date'); diff --git a/app/Http/Livewire/PaymentsTable.php b/app/Http/Livewire/PaymentsTable.php index 66ae9fa06f1f..1493f37ef191 100644 --- a/app/Http/Livewire/PaymentsTable.php +++ b/app/Http/Livewire/PaymentsTable.php @@ -41,6 +41,7 @@ class PaymentsTable extends Component { $query = Payment::query() ->with('type', 'client') + ->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_REFUNDED, Payment::STATUS_PARTIALLY_REFUNDED]) ->where('company_id', $this->company->id) ->where('client_id', auth('contact')->user()->client->id) ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc') diff --git a/app/Models/RecurringExpense.php b/app/Models/RecurringExpense.php index ef9f48790794..b886fac71349 100644 --- a/app/Models/RecurringExpense.php +++ b/app/Models/RecurringExpense.php @@ -204,7 +204,10 @@ class RecurringExpense extends BaseModel public function nextDateByFrequency($date) { - $offset = $this->client->timezone_offset(); + $offset = 0; + + if($this->client) + $offset = $this->client->timezone_offset(); switch ($this->frequency_id) { case RecurringInvoice::FREQUENCY_DAILY: diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index df35431f42ea..96e72f487058 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -84,7 +84,7 @@ class AutoBillInvoice extends AbstractService $gateway_token = $this->getGateway($amount); /* Bail out if no payment methods available */ - if (! $gateway_token || ! $gateway_token->gateway->driver($this->client)->token_billing){ + if (! $gateway_token || ! $gateway_token->gateway || ! $gateway_token->gateway->driver($this->client)->token_billing){ nlog("Bailing out - no suitable gateway token found."); return $this->invoice; }