mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 14:12:44 +01:00
Add suppressions for user notifications
This commit is contained in:
parent
e41228a115
commit
25ceba275c
@ -67,14 +67,12 @@ class PaymentExport extends BaseExport
|
||||
|
||||
$headerdisplay = $this->buildHeader();
|
||||
|
||||
nlog($headerdisplay);
|
||||
|
||||
$header = collect($this->input['report_keys'])->map(function ($key, $value) use ($headerdisplay) {
|
||||
return ['identifier' => $key, 'display_value' => $headerdisplay[$value]];
|
||||
})->toArray();
|
||||
|
||||
nlog($header);
|
||||
|
||||
|
||||
$report = $query->cursor()
|
||||
->map(function ($resource) {
|
||||
$row = $this->buildRow($resource);
|
||||
|
@ -32,12 +32,12 @@ class NinjaMailerObject
|
||||
/* Variable for cascading notifications */
|
||||
public $entity_string = false;
|
||||
|
||||
/* @var bool | App\Models\InvoiceInvitation | app\Models\QuoteInvitation | app\Models\CreditInvitation | app\Models\RecurringInvoiceInvitation | app\Models\PurchaseOrderInvitation $invitation*/
|
||||
/* @var bool | App\Models\InvoiceInvitation | App\Models\QuoteInvitation | App\Models\CreditInvitation | App\Models\RecurringInvoiceInvitation | App\Models\PurchaseOrderInvitation $invitation*/
|
||||
public $invitation = false;
|
||||
|
||||
public $template = false;
|
||||
|
||||
/* @var bool | App\Models\Invoice | app\Models\Quote | app\Models\Credit | app\Models\RecurringInvoice | app\Models\PurchaseOrder $invitation*/
|
||||
/* @var bool | App\Models\Invoice | App\Models\Quote | App\Models\Credit | App\Models\RecurringInvoice | App\Models\PurchaseOrder | App\Models\Payment $entity*/
|
||||
public $entity = false;
|
||||
|
||||
public $reminder_template = '';
|
||||
|
@ -55,7 +55,7 @@ class UpdateUserLastLogin implements ShouldQueue
|
||||
$key = "user_logged_in_{$user->id}{$event->company->db}";
|
||||
|
||||
|
||||
if ($user->ip != $ip && is_null(Cache::get($key))) {
|
||||
if ($user->ip != $ip && is_null(Cache::get($key)) && $user->user_logged_in_notification) {
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new UserLoggedIn($user, $user->account->companies->first(), $ip);
|
||||
$nmo->company = $user->account->companies->first();
|
||||
@ -69,6 +69,7 @@ class UpdateUserLastLogin implements ShouldQueue
|
||||
|
||||
Cache::put($key, true, 60 * 24);
|
||||
$arr = json_encode(['ip' => $ip]);
|
||||
$arr = ctrans('texts.new_login_detected'). " {$ip}";
|
||||
|
||||
SystemLogger::dispatch(
|
||||
$arr,
|
||||
|
@ -108,12 +108,15 @@ class TemplateEmail extends Mailable
|
||||
|
||||
if (strlen($settings->bcc_email) > 1) {
|
||||
if (Ninja::isHosted()) {
|
||||
$bccs = explode(',', str_replace(' ', '', $settings->bcc_email));
|
||||
$this->bcc(array_slice($bccs, 0, 2));
|
||||
//$this->bcc(reset($bccs)); //remove whitespace if any has been inserted.
|
||||
|
||||
if($company->account->isPaid()) {
|
||||
$bccs = explode(',', str_replace(' ', '', $settings->bcc_email));
|
||||
$this->bcc(array_slice($bccs, 0, 5));
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->bcc(explode(',', str_replace(' ', '', $settings->bcc_email)));
|
||||
}//remove whitespace if any has been inserted.
|
||||
}
|
||||
}
|
||||
|
||||
$this->subject(str_replace("<br>", "", $this->build_email->getSubject()))
|
||||
|
@ -11,10 +11,11 @@
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\VendorContact;
|
||||
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
|
||||
use App\Utils\VendorHtmlEngine;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use App\Utils\VendorHtmlEngine;
|
||||
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
|
||||
|
||||
class VendorTemplateEmail extends Mailable
|
||||
{
|
||||
@ -102,8 +103,19 @@ class VendorTemplateEmail extends Mailable
|
||||
$this->from(config('mail.from.address'), $email_from_name);
|
||||
|
||||
if (strlen($settings->bcc_email) > 1) {
|
||||
$this->bcc(explode(',', str_replace(' ', '', $settings->bcc_email)));
|
||||
}//remove whitespace if any has been inserted.
|
||||
|
||||
if (Ninja::isHosted()) {
|
||||
|
||||
if($this->company->account->isPaid()) {
|
||||
$bccs = explode(',', str_replace(' ', '', $settings->bcc_email));
|
||||
$this->bcc(array_slice($bccs, 0, 5));
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->bcc(explode(',', str_replace(' ', '', $settings->bcc_email)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->subject($this->build_email->getSubject())
|
||||
->text('email.template.text', [
|
||||
|
@ -73,7 +73,8 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
* @property int|null $deleted_at
|
||||
* @property string|null $oauth_user_refresh_token
|
||||
* @property string|null $last_confirmed_email_address
|
||||
* @property int $has_password
|
||||
* @property bool $has_password
|
||||
* @property bool $user_logged_in_notification
|
||||
* @property Carbon|null $oauth_user_token_expiry
|
||||
* @property string|null $sms_verification_code
|
||||
* @property bool $verified_phone_number
|
||||
@ -140,6 +141,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
*
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_logged_in_notification',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'email',
|
||||
|
@ -140,7 +140,7 @@ class Email implements ShouldQueue
|
||||
|
||||
$this->email_object->client_id ? $this->email_object->settings = $this->email_object->client->getMergedSettings() : $this->email_object->settings = $this->company->settings;
|
||||
|
||||
$this->email_object->client_id ? nlog("client settings") : nlog("company settings ");
|
||||
// $this->email_object->client_id ? nlog("client settings") : nlog("company settings ");
|
||||
|
||||
$this->email_object->whitelabel = $this->company->account->isPaid() ? true : false;
|
||||
|
||||
@ -418,6 +418,9 @@ class Email implements ShouldQueue
|
||||
return true;
|
||||
}
|
||||
|
||||
if($address_object->name == " " || $address_object->name == "") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -255,8 +255,8 @@ class EmailDefaults
|
||||
|
||||
if (strlen($this->email->email_object->settings->bcc_email) > 1) {
|
||||
if (Ninja::isHosted() && $this->email->company->account->isPaid()) {
|
||||
$bccs = array_slice(explode(',', str_replace(' ', '', $this->email->email_object->settings->bcc_email)), 0, 2);
|
||||
} elseif (Ninja::isSelfHost()) {
|
||||
$bccs = array_slice(explode(',', str_replace(' ', '', $this->email->email_object->settings->bcc_email)), 0, 5);
|
||||
} else {
|
||||
$bccs = (explode(',', str_replace(' ', '', $this->email->email_object->settings->bcc_email)));
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ class UserTransformer extends EntityTransformer
|
||||
'oauth_user_token' => empty($user->oauth_user_token) ? '' : '***',
|
||||
'verified_phone_number' => (bool) $user->verified_phone_number,
|
||||
'language_id' => (string) $user->language_id ?? '',
|
||||
'user_logged_in_notification' => (bool) $user->user_logged_in_notification,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Currency;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->boolean('user_logged_in_notification')->default(true);
|
||||
});
|
||||
|
||||
|
||||
$cur = Currency::find(120);
|
||||
|
||||
if(!$cur) {
|
||||
$cur = new \App\Models\Currency();
|
||||
$cur->id = 120;
|
||||
$cur->code = 'TOP';
|
||||
$cur->name = "Tongan Pa'anga";
|
||||
$cur->symbol = 'T$';
|
||||
$cur->thousand_separator = ',';
|
||||
$cur->decimal_separator = '.';
|
||||
$cur->precision = 2;
|
||||
$cur->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
@ -142,6 +142,7 @@ class CurrenciesSeeder extends Seeder
|
||||
['id' => 117, 'name' => 'Gold Troy Ounce', 'code' => 'XAU', 'symbol' => 'XAU', 'precision' => '3', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 118, 'name' => 'Nicaraguan Córdoba', 'code' => 'NIO', 'symbol' => 'C$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 119, 'name' => 'Malagasy ariary', 'code' => 'MGA', 'symbol' => 'Ar', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 120, 'name' => "Tongan Pa anga", 'code' => 'TOP', 'symbol' => 'T$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
];
|
||||
|
||||
foreach ($currencies as $currency) {
|
||||
|
@ -2402,7 +2402,10 @@ $LANG = array(
|
||||
'currency_libyan_dinar' => 'Libyan Dinar',
|
||||
'currency_silver_troy_ounce' => 'Silver Troy Ounce',
|
||||
'currency_gold_troy_ounce' => 'Gold Troy Ounce',
|
||||
|
||||
'currency_nicaraguan_córdoba' => 'Nicaraguan Córdoba',
|
||||
'currency_malagasy_ariary' => 'Malagasy ariary',
|
||||
"currency_tongan_pa_anga" => "Tongan Pa'anga",
|
||||
|
||||
'review_app_help' => 'We hope you\'re enjoying using the app.<br/>If you\'d consider :link we\'d greatly appreciate it!',
|
||||
'writing_a_review' => 'writing a review',
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
||||
{{ ctrans('texts.public_notes') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $invoice->public_notes }}
|
||||
{!! html_entity_decode($invoice->public_notes) !!}
|
||||
</dd>
|
||||
@else
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
|
Loading…
Reference in New Issue
Block a user