Merge pull request #7414 from turbo124/v5-develop

v5.3.85
This commit is contained in:
David Bomba 2022-05-04 09:32:34 +10:00 committed by GitHub
commit dcd5e878a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 51 additions and 55 deletions

View File

@ -1 +1 @@
5.3.84
5.3.85

View File

@ -217,6 +217,9 @@ class LoginController extends BaseController
$cu = CompanyUser::query()
->where('user_id', auth()->user()->id);
if($cu->count() == 0)
return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400);
$truth = app()->make(TruthSource::class);
$truth->setCompanyUser($cu->first());
@ -320,6 +323,9 @@ class LoginController extends BaseController
$cu = CompanyUser::query()
->where('user_id', $company_token->user_id);
if($cu->count() == 0)
return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400);
$cu->first()->account->companies->each(function ($company) use($cu, $request){
if($company->tokens()->where('is_system', true)->count() == 0)
@ -390,6 +396,8 @@ class LoginController extends BaseController
$cu = CompanyUser::query()
->where('user_id', auth()->user()->id);
if($cu->count() == 0)
return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400);
$truth = app()->make(TruthSource::class);
$truth->setCompanyUser($cu->first());
@ -441,6 +449,9 @@ class LoginController extends BaseController
$cu = CompanyUser::query()
->where('user_id', auth()->user()->id);
if($cu->count() == 0)
return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400);
$truth = app()->make(TruthSource::class);
$truth->setCompanyUser($cu->first());
$truth->setUser($existing_login_user);
@ -496,6 +507,9 @@ class LoginController extends BaseController
$cu = CompanyUser::query()
->where('user_id', auth()->user()->id);
if($cu->count() == 0)
return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400);
$truth = app()->make(TruthSource::class);
$truth->setCompanyUser($cu->first());
$truth->setUser($existing_login_user);
@ -555,6 +569,8 @@ class LoginController extends BaseController
$cu = CompanyUser::whereUserId(auth()->user()->id);
if($cu->count() == 0)
return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400);
$truth = app()->make(TruthSource::class);
$truth->setCompanyUser($cu->first());

View File

@ -92,7 +92,6 @@ class NinjaPlanController extends Controller
]);
$data['intent'] = $setupIntent;
// $data['account'] = $account;
$data['client'] = Auth::guard('contact')->user()->client;
return $this->render('plan.trial', $data);
@ -139,6 +138,8 @@ class NinjaPlanController extends Controller
$account = Account::where('key', auth()->guard('contact')->user()->client->custom_value2)->first();
$account->trial_started = now();
$account->trial_plan = 'pro';
$account->plan = 'pro';
$account->plan_expires = now()->addDays(14);
$account->save();
}

View File

@ -232,7 +232,7 @@ class CompanyController extends BaseController
'notifications' => CompanySettings::notificationDefaults(),
]);
if(auth()->user()->company()->account->companies()->where('is_large', 1)->exists())
if($company->account->companies()->where('is_large', 1)->exists())
{
$company->account->companies()->update(['is_large' => true]);
}

View File

@ -38,9 +38,9 @@ class CreateAccountRequest extends Request
{
if(Ninja::isHosted())
$email_rules = ['required', 'email:rfc,dns', new NewUniqueUserRule, new BlackListRule, new EmailBlackListRule];
$email_rules = ['bail','required', 'email:rfc,dns', new NewUniqueUserRule, new BlackListRule, new EmailBlackListRule];
else
$email_rules = ['required', 'email:rfc,dns', new NewUniqueUserRule];
$email_rules = ['bail','required', 'email:rfc,dns', new NewUniqueUserRule];
return [

View File

@ -192,7 +192,7 @@ class CompanyExport implements ShouldQueue
})->all();
$this->export_data['company_users'] = $this->company->company_users->map(function ($company_user){
$this->export_data['company_users'] = $this->company->company_users()->without(['user','account'])->cursor()->map(function ($company_user){
$company_user = $this->transformArrayOfKeys($company_user, ['company_id', 'account_id', 'user_id']);

View File

@ -490,7 +490,8 @@ class CompanyImport implements ShouldQueue
foreach($this->company_properties as $value){
$this->company->{$value} = $tmp_company->{$value};
if(property_exists($tmp_company, $value))
$this->company->{$value} = $tmp_company->{$value};
}
@ -1119,11 +1120,17 @@ class CompanyImport implements ShouldQueue
unset($cu_array['id']);
unset($cu_array['company_id']);
unset($cu_array['user_id']);
unset($cu_array['user']);
unset($cu_array['account']);
// $cu_array['settings'] = json_encode($cu_array['settings']);
// $cu_array['notifications'] = json_encode($cu_array['notifications']);
// $cu_array['permissions'] = json_encode($cu_array['permissions']);
$new_cu = CompanyUser::withTrashed()->firstOrNew(
['user_id' => $user_id, 'company_id' => $this->company->id],
$cu_array,
);
['user_id' => $user_id, 'company_id' => $this->company->id],
$cu_array,
);
$new_cu->account_id = $this->account->id;
$new_cu->save(['timestamps' => false]);

View File

@ -111,7 +111,7 @@ class PaymentFailedMailer implements ShouldQueue
//add client payment failures here.
//
if($contact = $this->client->primary_contact()->first() && $this->payment_hash)
if($contact = $this->client->contacts()->first() && $this->payment_hash)
{
$mail_obj = (new ClientPaymentFailureObject($this->client, $this->error, $this->company, $this->payment_hash))->build();

View File

@ -428,10 +428,13 @@ class Account extends BaseModel
public function gmailCredentialNotification() :bool
{
nlog("checking if gmail credential notification has already been sent");
if(is_null(Cache::get($this->key)))
return false;
nlog("Sending notification");
try {
if(is_null(Cache::get("gmail_credentials_notified:{$this->key}"))) {

View File

@ -43,38 +43,6 @@ class InvoiceInvitation extends BaseModel
return self::class;
}
// public function getSignatureDateAttribute($value)
// {
// if (!$value) {
// return (new Carbon($value))->format('Y-m-d');
// }
// return $value;
// }
// public function getSentDateAttribute($value)
// {
// if (!$value) {
// return (new Carbon($value))->format('Y-m-d');
// }
// return $value;
// }
// public function getViewedDateAttribute($value)
// {
// if (!$value) {
// return (new Carbon($value))->format('Y-m-d');
// }
// return $value;
// }
// public function getOpenedDateAttribute($value)
// {
// if (!$value) {
// return (new Carbon($value))->format('Y-m-d');
// }
// return $value;
// }
public function entityType()
{
return Invoice::class;

View File

@ -253,7 +253,7 @@ class AuthorizeCreditCard
$response = $data['response'];
$amount = array_key_exists('amount_with_fee', $data) ? $data['amount_with_fee'] : 0;
$code = "Error";
$code = 1;
$description = "There was an error processing the payment";
if ($response && $response->getErrors() != null) {

View File

@ -185,7 +185,7 @@ class PayPalExpressPaymentDriver extends BaseDriver
'currency' => $this->client->getCurrencyCode(),
'transactionType' => 'Purchase',
'clientIp' => request()->getClientIp(),
'amount' => $data['total']['amount_with_fee'] + $this->fee,
'amount' => round(($data['total']['amount_with_fee'] + $this->fee),2),
'returnUrl' => route('client.payments.response', [
'company_gateway_id' => $this->company_gateway->id,
'payment_hash' => $this->payment_hash->hash,

View File

@ -85,6 +85,7 @@ class AccountTransformer extends EntityTransformer
'is_migrated' => (bool) $account->is_migrated,
'hosted_client_count' => (int) $account->hosted_client_count,
'hosted_company_count' => (int) $account->hosted_company_count,
'is_hosted' => (bool) Ninja::isHosted(),
];
}

View File

@ -631,7 +631,7 @@ trait GeneratesConvertedQuoteCounter
}
$search = ['{$year}'];
$replace = [date('Y')];
$replace = [Carbon::now($entity->company->timezone()->name)->format('Y')];
$search[] = '{$counter}';
$replace[] = $counter;
@ -646,8 +646,8 @@ trait GeneratesConvertedQuoteCounter
$replace[] = $counter;
$search[] = '{$year}';
$replace[] = date('Y');
$replace[] = Carbon::now($entity->company->timezone()->name)->format('Y');
if (strstr($pattern, '{$user_id}') || strstr($pattern, '{$userId}')) {
$user_id = $entity->user_id ? $entity->user_id : 0;
$search[] = '{$user_id}';

View File

@ -642,9 +642,9 @@ trait GeneratesCounter
return $counter;
}
$search = ['{$year}'];
$replace = [date('Y')];
$search = [];
$replace = [];
$search[] = '{$counter}';
$replace[] = $counter;
@ -658,7 +658,7 @@ trait GeneratesCounter
$replace[] = $counter;
$search[] = '{$year}';
$replace[] = date('Y');
$replace[] = Carbon::now($entity->company->timezone()->name)->format('Y');
if (strstr($pattern, '{$user_id}') || strstr($pattern, '{$userId}')) {
$user_id = $entity->user_id ? $entity->user_id : 0;

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.3.84',
'app_tag' => '5.3.84',
'app_version' => '5.3.85',
'app_tag' => '5.3.85',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -888,7 +888,7 @@ $LANG = array(
'custom_invoice_charges_helps' => 'Add a field when creating an invoice and include the charge in the invoice subtotals.',
'token_expired' => 'Validation token was expired. Please try again.',
'invoice_link' => 'Invoice Link',
'button_confirmation_message' => 'Click to confirm your email.',
'button_confirmation_message' => 'Confirm your email.',
'confirm' => 'Confirm',
'email_preferences' => 'Email Preferences',
'created_invoices' => 'Successfully created :count invoice(s)',