Merge pull request #8503 from turbo124/v5-develop

v5.5.115
This commit is contained in:
David Bomba 2023-05-07 08:23:47 +10:00 committed by GitHub
commit ee8391d651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 54 additions and 66 deletions

View File

@ -1 +1 @@
5.5.114 5.5.115

View File

@ -24,9 +24,6 @@ class AccountCreated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* @var
*/
public $user; public $user;
public $company; public $company;

View File

@ -25,9 +25,6 @@ class ContactLoggedIn
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* @var
*/
public $client_contact; public $client_contact;
public $company; public $company;

View File

@ -32,7 +32,7 @@ class CreditWasEmailed
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Credit $credit * @param CreditInvitation $invitation
* @param Company $company * @param Company $company
* @param array $event_vars * @param array $event_vars
*/ */

View File

@ -23,7 +23,7 @@ class CreditWasRestored
use SerializesModels; use SerializesModels;
/** /**
* @var Client * @var Credit
*/ */
public $credit; public $credit;

View File

@ -23,7 +23,7 @@ class InvoiceWasEmailed
use SerializesModels; use SerializesModels;
/** /**
* @var Invoice * @var InvoiceInvitation
*/ */
public $invitation; public $invitation;

View File

@ -30,7 +30,7 @@ class InvoiceWasViewed
* @param Company $company * @param Company $company
* @param array $event_vars * @param array $event_vars
*/ */
public function __construct(public InvoiceInvitation $invitation, Company $company, array $event_vars) public function __construct(public InvoiceInvitation $invitation, public Company $company, public array $event_vars)
{ {
} }
} }

View File

@ -26,7 +26,7 @@ class MethodDeleted
/** /**
* @var ClientGatewayToken * @var ClientGatewayToken
*/ */
private $payment_method; public $payment_method;
public $company; public $company;

View File

@ -23,7 +23,7 @@ class RecurringQuoteWasArchived
use SerializesModels; use SerializesModels;
/** /**
* @var Invoice * @var RecurringQuote
*/ */
public $recurring_quote; public $recurring_quote;
@ -34,7 +34,7 @@ class RecurringQuoteWasArchived
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Invoice $recurring_quote * @param RecurringQuote $recurring_quote
* @param Company $company * @param Company $company
* @param array $event_vars * @param array $event_vars
*/ */

View File

@ -26,9 +26,6 @@ class UserWasDeleted
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* @var
*/
public $user; public $user;
public $creating_user; public $creating_user;

View File

@ -26,9 +26,6 @@ class UserWasRestored
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* @var
*/
public $user; public $user;
public $company; public $company;

View File

@ -26,9 +26,6 @@ class UserWasUpdated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* @var
*/
public $user; public $user;
public $creating_user; public $creating_user;

View File

@ -79,7 +79,7 @@ class Handler extends ExceptionHandler
/** /**
* A list of the inputs that are never flashed for validation exceptions. * A list of the inputs that are never flashed for validation exceptions.
* *
* @var array * @var array<1, string>
*/ */
protected $dontFlash = [ protected $dontFlash = [
'current_password', 'current_password',
@ -102,6 +102,11 @@ class Handler extends ExceptionHandler
} }
if (Ninja::isHosted()) { if (Ninja::isHosted()) {
if($exception instanceof ThrottleRequestsException && class_exists(\Modules\Admin\Events\ThrottledExceptionRaised::class)) {
event(new \Modules\Admin\Events\ThrottledExceptionRaised(auth()->user()->account->key));
}
Integration::configureScope(function (Scope $scope): void { Integration::configureScope(function (Scope $scope): void {
$name = 'hosted@invoiceninja.com'; $name = 'hosted@invoiceninja.com';
@ -202,7 +207,6 @@ class Handler extends ExceptionHandler
* *
* @param Request $request * @param Request $request
* @param Throwable $exception * @param Throwable $exception
* @return Response
* @throws Throwable * @throws Throwable
*/ */
public function render($request, Throwable $exception) public function render($request, Throwable $exception)

View File

@ -36,6 +36,7 @@ class HostedMigrationController extends Controller
$account = (new CreateAccount($request->all(), $request->getClientIp()))->handle(); $account = (new CreateAccount($request->all(), $request->getClientIp()))->handle();
$account->hosted_client_count = 100; $account->hosted_client_count = 100;
$account->hosted_company_count = 10; $account->hosted_company_count = 10;
$account->created_at = now()->subYears(2);
$account->save(); $account->save();
MultiDB::findAndSetDbByAccountKey($account->key); MultiDB::findAndSetDbByAccountKey($account->key);

View File

@ -518,12 +518,6 @@ class NinjaMailerJob implements ShouldQueue
/* If the account is verified, we allow emails to flow */ /* If the account is verified, we allow emails to flow */
if (Ninja::isHosted() && $this->company->account && $this->company->account->is_verified_account) { if (Ninja::isHosted() && $this->company->account && $this->company->account->is_verified_account) {
//11-01-2022
/* Continue to analyse verified accounts in case they later start sending poor quality emails*/
// if(class_exists(\Modules\Admin\Jobs\Account\EmailQuality::class))
// (new \Modules\Admin\Jobs\Account\EmailQuality($this->nmo, $this->company))->run();
return false; return false;
} }

View File

@ -21,7 +21,7 @@ class DeleteCompanyDocuments
/** /**
* Handle the event. * Handle the event.
* *
* @param CompanyWasDeleted $event * @param $event
* @return void * @return void
*/ */
public function handle($event) public function handle($event)

View File

@ -36,7 +36,7 @@ class MailSentListener implements ShouldQueue
/** /**
* Handle the event. * Handle the event.
* *
* @param object $event * @param MessageSent $event
* @return void * @return void
*/ */
public function handle(MessageSent $event) public function handle(MessageSent $event)

View File

@ -32,7 +32,7 @@ class PaymentEmailFailureActivity implements ShouldQueue
* Handle the event. * Handle the event.
* *
* @param object $event * @param object $event
* @return bool * @return void
*/ */
public function handle($event) public function handle($event)
{ {
@ -41,6 +41,6 @@ class PaymentEmailFailureActivity implements ShouldQueue
$payment = $event->payment; $payment = $event->payment;
nlog("i failed emailing {$payment->number}"); nlog("i failed emailing {$payment->number}");
// nlog(print_r($event->errors,1));
} }
} }

View File

@ -34,7 +34,7 @@ class PurchaseOrderCreatedListener implements ShouldQueue
/** /**
* Handle the event. * Handle the event.
* *
* @param object $event * @param PurchaseOrderWasCreated $event
* @return void * @return void
*/ */
public function handle(PurchaseOrderWasCreated $event) public function handle(PurchaseOrderWasCreated $event)

View File

@ -64,7 +64,7 @@ use Laracasts\Presenter\PresentableTrait;
* @property int|null $hosted_company_count * @property int|null $hosted_company_count
* @property string|null $inapp_transaction_id * @property string|null $inapp_transaction_id
* @property bool $set_react_as_default_ap * @property bool $set_react_as_default_ap
* @property int $is_flagged * @property bool $is_flagged
* @property int $is_verified_account * @property int $is_verified_account
* @property string|null $account_sms_verification_code * @property string|null $account_sms_verification_code
* @property string|null $account_sms_verification_number * @property string|null $account_sms_verification_number
@ -262,6 +262,11 @@ class Account extends BaseModel
return $this->hasMany(CompanyUser::class)->where('is_owner', true)->first() ? $this->hasMany(CompanyUser::class)->where('is_owner', true)->first()->user : false; return $this->hasMany(CompanyUser::class)->where('is_owner', true)->first() ? $this->hasMany(CompanyUser::class)->where('is_owner', true)->first()->user : false;
} }
public function tokens()
{
return $this->hasMany(CompanyToken::class)->withTrashed();
}
public function getPlan() public function getPlan()
{ {
if (Carbon::parse($this->plan_expires)->lt(now())) { if (Carbon::parse($this->plan_expires)->lt(now())) {

View File

@ -415,9 +415,6 @@ class ClientContact extends Authenticatable implements HasLocalePreference
*/ */
public function getLoginLink() public function getLoginLink()
{ {
// $domain = isset($this->company->portal_domain) ? $this->company->portal_domain : $this->company->domain();
// return $domain.'/client/key_login/'.$this->contact_key;
if (Ninja::isHosted()) { if (Ninja::isHosted()) {
$domain = $this->company->domain(); $domain = $this->company->domain();
@ -428,18 +425,13 @@ class ClientContact extends Authenticatable implements HasLocalePreference
switch ($this->company->portal_mode) { switch ($this->company->portal_mode) {
case 'subdomain': case 'subdomain':
return $domain.'/client/key_login/'.$this->contact_key; return $domain.'/client/key_login/'.$this->contact_key;
break;
case 'iframe': case 'iframe':
return $domain.'/client/key_login/'.$this->contact_key; return $domain.'/client/key_login/'.$this->contact_key;
//return $domain . $entity_type .'/'. $this->contact->client->client_hash .'/'. $this->key;
break;
case 'domain': case 'domain':
return $domain.'/client/key_login/'.$this->contact_key; return $domain.'/client/key_login/'.$this->contact_key;
break;
default: default:
return ''; return '';
break;
} }
} }
} }

View File

@ -153,17 +153,13 @@ class PurchaseOrderInvitation extends BaseModel
switch ($this->company->portal_mode) { switch ($this->company->portal_mode) {
case 'subdomain': case 'subdomain':
return $domain.'/vendor/'; return $domain.'/vendor/';
break;
case 'iframe': case 'iframe':
return $domain.'/vendor/'; return $domain.'/vendor/';
break;
case 'domain': case 'domain':
return $domain.'/vendor/'; return $domain.'/vendor/';
break;
default: default:
return ''; return '';
break;
} }
} }
@ -180,17 +176,13 @@ class PurchaseOrderInvitation extends BaseModel
switch ($this->company->portal_mode) { switch ($this->company->portal_mode) {
case 'subdomain': case 'subdomain':
return $domain.'/vendor/'.$entity_type.'/'.$this->key; return $domain.'/vendor/'.$entity_type.'/'.$this->key;
break;
case 'iframe': case 'iframe':
return $domain.'/vendor/'.$entity_type.'/'.$this->key; return $domain.'/vendor/'.$entity_type.'/'.$this->key;
break;
case 'domain': case 'domain':
return $domain.'/vendor/'.$entity_type.'/'.$this->key; return $domain.'/vendor/'.$entity_type.'/'.$this->key;
break;
default: default:
return ''; return '';
break;
} }
} }

View File

@ -11,25 +11,25 @@
namespace App\Providers; namespace App\Providers;
use App\Helpers\Mail\GmailTransport; use App\Utils\Ninja;
use App\Helpers\Mail\Office365MailTransport; use Livewire\Livewire;
use App\Http\Middleware\SetDomainNameDb;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Proposal; use App\Models\Proposal;
use App\Utils\Ninja;
use App\Utils\TruthSource; use App\Utils\TruthSource;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Mail\Mailer; use Illuminate\Mail\Mailer;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Artisan; use App\Helpers\Mail\GmailTransport;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\ParallelTesting; use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Queue; use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Livewire\Livewire; use App\Http\Middleware\SetDomainNameDb;
use Illuminate\Queue\Events\JobProcessing;
use App\Helpers\Mail\Office365MailTransport;
use Illuminate\Support\Facades\ParallelTesting;
use Illuminate\Database\Eloquent\Relations\Relation;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {

View File

@ -179,8 +179,23 @@ class ClientService
*/ */
public function buildStatementMailableData($pdf) :EmailObject public function buildStatementMailableData($pdf) :EmailObject
{ {
$email = $this->client->present()->email();
$email_object = new EmailObject; $email_object = new EmailObject;
$email_object->to = [new Address($this->client->present()->email(), $this->client->present()->name())]; $email_object->to = [new Address($email, $this->client->present()->name())];
$cc_contacts = $this->client
->contacts()
->where('send_email', true)
->where('email', '!=', $email)
->get();
foreach ($cc_contacts as $contact) {
$email_object->cc[] = new Address($contact->email, $contact->present()->name());
}
$email_object->attachments = [['file' => base64_encode($pdf), 'name' => ctrans('texts.statement') . ".pdf"]]; $email_object->attachments = [['file' => base64_encode($pdf), 'name' => ctrans('texts.statement') . ".pdf"]];
$email_object->client_id = $this->client->id; $email_object->client_id = $this->client->id;
$email_object->email_template_subject = 'email_subject_statement'; $email_object->email_template_subject = 'email_subject_statement';

View File

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