diff --git a/app/Http/ValidationRules/Account/BlackListRule.php b/app/Http/ValidationRules/Account/BlackListRule.php index 7d353c429b53..f78942edc7a3 100644 --- a/app/Http/ValidationRules/Account/BlackListRule.php +++ b/app/Http/ValidationRules/Account/BlackListRule.php @@ -19,6 +19,7 @@ use Illuminate\Contracts\Validation\Rule; class BlackListRule implements Rule { private array $blacklist = [ + 'ckptr.com', 'pretreer.com', 'candassociates.com', 'vusra.com', diff --git a/app/Jobs/Inventory/AdjustProductInventory.php b/app/Jobs/Inventory/AdjustProductInventory.php index 8ee86b0cbda2..e5f3bba28217 100644 --- a/app/Jobs/Inventory/AdjustProductInventory.php +++ b/app/Jobs/Inventory/AdjustProductInventory.php @@ -31,6 +31,8 @@ class AdjustProductInventory implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, UserNotifies; + private array $notified_products = []; + public function __construct(public Company $company, public Invoice $invoice, public $old_invoice = []) { } @@ -56,18 +58,6 @@ class AdjustProductInventory implements ShouldQueue { MultiDB::setDb($this->company->db); - // foreach ($this->invoice->line_items as $item) { - // $p = Product::where('product_key', $item->product_key)->where('company_id', $this->company->id)->first(); - - // if (! $p) { - // continue; - // } - - // $p->in_stock_quantity += $item->quantity; - - // $p->saveQuietly(); - // } - collect($this->invoice->line_items)->filter(function ($item) { return $item->type_id == '1'; })->each(function ($i) { @@ -147,11 +137,13 @@ class AdjustProductInventory implements ShouldQueue $nmo->company = $this->company; $nmo->settings = $this->company->settings; + /** @var \App\Models\CompanyUser $cu */ $this->company->company_users->each(function ($cu) use ($product, $nmo, $notification_level) { - if ($this->checkNotificationExists($cu, $product, ['inventory_all', 'inventory_user', 'inventory_threshold_all', 'inventory_threshold_user'])) { + if ($this->checkNotificationExists($cu, $product, ['inventory_all', 'inventory_user', 'inventory_threshold_all', 'inventory_threshold_user']) && (! in_array($product->id, $this->notified_products))) { $nmo->mailable = new NinjaMailer((new InventoryNotificationObject($product, $notification_level, $cu->portalType()))->build()); $nmo->to_user = $cu->user; NinjaMailerJob::dispatch($nmo); + $this->notified_products[] = $product->id; } }); } diff --git a/app/Jobs/Ninja/SystemMaintenance.php b/app/Jobs/Ninja/SystemMaintenance.php index 1959af92e5fc..c1cb51e204cb 100644 --- a/app/Jobs/Ninja/SystemMaintenance.php +++ b/app/Jobs/Ninja/SystemMaintenance.php @@ -157,4 +157,4 @@ class SystemMaintenance implements ShouldQueue } -} +} \ No newline at end of file diff --git a/app/Mail/Admin/InventoryNotificationObject.php b/app/Mail/Admin/InventoryNotificationObject.php index 2bdbc9ef916b..496c39902e61 100644 --- a/app/Mail/Admin/InventoryNotificationObject.php +++ b/app/Mail/Admin/InventoryNotificationObject.php @@ -69,7 +69,7 @@ class InventoryNotificationObject ] ), 'url' => $this->product->portalUrl($this->use_react_url), - 'button' => $this->use_react_url ? ctrans('texts.product_library') : ctrans('ninja.app_url'), + 'button' => ctrans('texts.view'), 'signature' => $this->product->company->settings->email_signature, 'logo' => $this->product->company->present()->logo(), 'settings' => $this->product->company->settings, diff --git a/app/Services/Email/EmailDefaults.php b/app/Services/Email/EmailDefaults.php index 45ae94ed7a7f..0484b5228aa2 100644 --- a/app/Services/Email/EmailDefaults.php +++ b/app/Services/Email/EmailDefaults.php @@ -273,7 +273,6 @@ class EmailDefaults return $this; // return $this->email->email_object->cc; // return [ - // ]; }