Minor fixes

This commit is contained in:
David Bomba 2022-02-01 10:03:51 +11:00
parent dbbd86063d
commit cea49c43fc
6 changed files with 16 additions and 6 deletions

View File

@ -39,6 +39,10 @@ class Request extends FormRequest
} }
} }
//01-02-2022 needed for CSV Imports
if(!$merge_rules)
return $rules;
return array_merge($merge_rules, $rules); return array_merge($merge_rules, $rules);
} }

View File

@ -11,6 +11,7 @@
namespace App\Http\ValidationRules\Company; namespace App\Http\ValidationRules\Company;
use App\Utils\Ninja;
use Illuminate\Contracts\Validation\Rule; use Illuminate\Contracts\Validation\Rule;
/** /**
@ -25,7 +26,12 @@ class ValidCompanyQuantity implements Rule
*/ */
public function passes($attribute, $value) public function passes($attribute, $value)
{ {
return auth()->user()->company()->account->companies->count() <= 10; if(Ninja::isSelfHost())
return auth()->user()->company()->account->companies->count() < 10;
return auth()->user()->company()->account->companies->count() < auth()->user()->company()->account->hosted_company_count;
} }
/** /**

View File

@ -35,7 +35,7 @@ class CanStoreClientsRule implements Rule
{ {
$company = Company::find($this->company_id); $company = Company::find($this->company_id);
return $company->clients->count() < config('ninja.quotas.free.clients'); return $company->clients->count() < $company->account->hosted_client_count;
} }
/** /**
@ -43,6 +43,6 @@ class CanStoreClientsRule implements Rule
*/ */
public function message() public function message()
{ {
return ctrans('texts.limit_clients', ['count' => config('ninja.quotas.free.clients')]); return ctrans('texts.limit_clients', ['count' => $company->account->hosted_client_count]);
} }
} }

View File

@ -44,7 +44,7 @@ class AuthorizeCreateCustomer
$this->authorize->init(); $this->authorize->init();
// Create the Bill To info for new payment type // Create the Bill To info for new payment type
$contact = $this->client->primary_contact()->first(); $contact = $this->client->primary_contact()->first() ?: $this->client->contacts()->first();
$refId = 'ref'.time(); $refId = 'ref'.time();
// Create a new CustomerProfileType and add the payment profile object // Create a new CustomerProfileType and add the payment profile object

View File

@ -62,7 +62,7 @@ trait Utilities
$data = [ $data = [
'payment_method' => $_payment->source['id'], 'payment_method' => $_payment->source['id'],
'payment_type' => PaymentType::parseCardType(strtolower($_payment->source['scheme'])), 'payment_type' => 12,
'amount' => $this->getParent()->payment_hash->data->raw_value, 'amount' => $this->getParent()->payment_hash->data->raw_value,
'transaction_reference' => $_payment->id, 'transaction_reference' => $_payment->id,
'gateway_type_id' => GatewayType::CREDIT_CARD, 'gateway_type_id' => GatewayType::CREDIT_CARD,

View File

@ -54,7 +54,7 @@ class ActivityRepository extends BaseRepository
$activity->token_id = $token_id; $activity->token_id = $token_id;
} }
$activity->ip = $event_vars['ip']; $activity->ip = $event_vars['ip'] ?: ' ';
$activity->is_system = $event_vars['is_system']; $activity->is_system = $event_vars['is_system'];
$activity->save(); $activity->save();