Merge pull request #5000 from turbo124/v5-develop

Fixes for archived invoice not emailing
This commit is contained in:
David Bomba 2021-02-27 11:32:50 +11:00 committed by GitHub
commit c887d81dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 5 deletions

View File

@ -48,6 +48,11 @@ jobs:
run: | run: |
sudo rm -rf bootstrap/cache/* sudo rm -rf bootstrap/cache/*
sudo rm -rf node_modules sudo rm -rf node_modules
- name: Prune Git History
run: |
sudo git gc
sudo git gc --aggressive
sudo git prune
- name: Build project # This would actually build your project, using zip for an example artifact - name: Build project # This would actually build your project, using zip for an example artifact
run: | run: |
zip -r ./invoiceninja.zip .* -x "../*" zip -r ./invoiceninja.zip .* -x "../*"

View File

@ -39,9 +39,9 @@ class StoreUserRequest extends Request
$rules['last_name'] = 'required|string|max:100'; $rules['last_name'] = 'required|string|max:100';
if (config('ninja.db.multi_db_enabled')) { if (config('ninja.db.multi_db_enabled')) {
$rules['email'] = ['email', new ValidUserForCompany(), Rule::unique('users')]; $rules['email'] = ['email', new ValidUserForCompany(), Rule::unique('users')->ignore($this->input('company_user.account.id'), 'account_id')];
} else { } else {
$rules['email'] = ['email',Rule::unique('users')]; $rules['email'] = ['email',Rule::unique('users')->ignore($this->input('company_user.account.id'), 'account_id')];
} }
@ -56,6 +56,10 @@ class StoreUserRequest extends Request
{ {
$input = $this->all(); $input = $this->all();
nlog($this->input('company_user.account'));
// nlog($this->input('company_user.account.id'));
// nlog($this->input('company_user.account.id'));
if (isset($input['company_user'])) { if (isset($input['company_user'])) {
if (! isset($input['company_user']['is_admin'])) { if (! isset($input['company_user']['is_admin'])) {
$input['company_user']['is_admin'] = false; $input['company_user']['is_admin'] = false;

View File

@ -26,7 +26,7 @@ class ValidUserForCompany implements Rule
*/ */
public function passes($attribute, $value) public function passes($attribute, $value)
{ {
return MultiDB::checkUserAndCompanyCoExist($value, auth()->user()->company()->company_key); return MultiDB::checkUserAndCompanyCoExist($value, auth()->user()->company()->company_key, auth()->user()->company()->id);
} }
/** /**

View File

@ -214,7 +214,7 @@ class Import implements ShouldQueue
// if($check_data['status'] == 'errors') // if($check_data['status'] == 'errors')
// throw new ProcessingMigrationArchiveFailed(implode("\n", $check_data)); // throw new ProcessingMigrationArchiveFailed(implode("\n", $check_data));
Mail::to($this->user) Mail::to($this->user->email, $this->user->name())
->send(new MigrationCompleted($this->company, implode("<br>",$check_data))); ->send(new MigrationCompleted($this->company, implode("<br>",$check_data)));
/*After a migration first some basic jobs to ensure the system is up to date*/ /*After a migration first some basic jobs to ensure the system is up to date*/

View File

@ -152,6 +152,11 @@ class Credit extends BaseModel
return $this->hasMany(CreditInvitation::class); return $this->hasMany(CreditInvitation::class);
} }
public function project()
{
return $this->belongsTo(Project::class)->withTrashed();
}
/** /**
* The invoice which the credit has been created from. * The invoice which the credit has been created from.
*/ */

View File

@ -149,6 +149,11 @@ class Quote extends BaseModel
return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed(); return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed();
} }
public function project()
{
return $this->belongsTo(Project::class)->withTrashed();
}
public function invitations() public function invitations()
{ {
return $this->hasMany(QuoteInvitation::class); return $this->hasMany(QuoteInvitation::class);

View File

@ -167,6 +167,11 @@ class RecurringInvoice extends BaseModel
return $this->belongsTo(Client::class)->withTrashed(); return $this->belongsTo(Client::class)->withTrashed();
} }
public function project()
{
return $this->belongsTo(Project::class)->withTrashed();
}
public function user() public function user()
{ {
return $this->belongsTo(User::class)->withTrashed(); return $this->belongsTo(User::class)->withTrashed();

View File

@ -78,7 +78,7 @@ class TemplateEngine
{ {
if (strlen($this->entity) > 1 && strlen($this->entity_id) > 1) { if (strlen($this->entity) > 1 && strlen($this->entity_id) > 1) {
$class = 'App\Models\\'.ucfirst($this->entity); $class = 'App\Models\\'.ucfirst($this->entity);
$this->entity_obj = $class::whereId($this->decodePrimaryKey($this->entity_id))->company()->first(); $this->entity_obj = $class::withTrashed()->where('id', $this->decodePrimaryKey($this->entity_id))->company()->first();
} else { } else {
$this->mockEntity(); $this->mockEntity();
} }