mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fix for tests
This commit is contained in:
parent
1eb334f3b4
commit
5489ade5ff
@ -36,10 +36,10 @@ class UserMailer extends Mailer
|
||||
|
||||
public function sendNotification(User $user, Invoice $invoice, $notificationType, Payment $payment = null)
|
||||
{
|
||||
if (!$user->email) {
|
||||
if (! $user->email || $user->cannot('view', $invoice)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$entityType = $invoice->getEntityType();
|
||||
$view = ($notificationType == 'approved' ? ENTITY_QUOTE : ENTITY_INVOICE) . "_{$notificationType}";
|
||||
$account = $user->account;
|
||||
@ -64,7 +64,7 @@ class UserMailer extends Mailer
|
||||
'invoice' => $invoice->invoice_number,
|
||||
'client' => $client->getDisplayName()
|
||||
]);
|
||||
|
||||
|
||||
$this->sendTo($user->email, CONTACT_EMAIL, CONTACT_NAME, $subject, $view, $data);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ class UserMailer extends Mailer
|
||||
'contactName' => $invitation->contact->getDisplayName(),
|
||||
'invoiceNumber' => $invoice->invoice_number,
|
||||
];
|
||||
|
||||
|
||||
$this->sendTo($user->email, CONTACT_EMAIL, CONTACT_NAME, $subject, $view, $data);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class UserTableSeeder extends Seeder
|
||||
|
||||
$faker = Faker\Factory::create();
|
||||
$company = Company::create();
|
||||
|
||||
|
||||
$account = Account::create([
|
||||
'name' => $faker->name,
|
||||
'address1' => $faker->streetAddress,
|
||||
@ -28,7 +28,7 @@ class UserTableSeeder extends Seeder
|
||||
'city' => $faker->city,
|
||||
'state' => $faker->state,
|
||||
'postal_code' => $faker->postcode,
|
||||
'country_id' => Country::all()->random()->id,
|
||||
'country_id' => Country::all()->random()->id,
|
||||
'account_key' => str_random(RANDOM_KEY_LENGTH),
|
||||
'invoice_terms' => $faker->text($faker->numberBetween(50, 300)),
|
||||
'work_phone' => $faker->phoneNumber,
|
||||
@ -50,12 +50,13 @@ class UserTableSeeder extends Seeder
|
||||
'confirmed' => true,
|
||||
'notify_sent' => false,
|
||||
'notify_paid' => false,
|
||||
'is_admin' => 1,
|
||||
]);
|
||||
|
||||
Affiliate::create([
|
||||
'affiliate_key' => SELF_HOST_AFFILIATE_KEY
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user