Minor fixes

This commit is contained in:
David Bomba 2021-10-04 09:36:30 +11:00
parent 665730e29e
commit e09bbfaaea
5 changed files with 12 additions and 3 deletions

View File

@ -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();

View File

@ -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');

View File

@ -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')

View File

@ -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:

View File

@ -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;
}