1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Ensure multidb set in PdfConfiguration

This commit is contained in:
David Bomba 2023-11-13 12:16:15 +11:00
parent 7964069e5b
commit c4a0a8ee14
2 changed files with 8 additions and 3 deletions

View File

@ -137,8 +137,10 @@ 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) {
/** @var \App\Models\CompanyUser $cu */
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;

View File

@ -12,6 +12,7 @@
namespace App\Services\Pdf;
use App\DataMapper\CompanySettings;
use App\Libraries\MultiDB;
use App\Models\Client;
use App\Models\ClientContact;
use App\Models\Country;
@ -94,6 +95,8 @@ class PdfConfiguration
*/
public function init(): self
{
MultiDB::setDb($this->service->company->db);
$this->setEntityType()
->setDateFormat()
->setPdfVariables()
@ -271,7 +274,7 @@ class PdfConfiguration
*/
private function setDesign(): self
{
$design_id = $this->entity->design_id ? : $this->decodePrimaryKey($this->settings_object->getSetting($this->entity_design_id));
$design_id = $this->entity->design_id ?: $this->decodePrimaryKey($this->settings_object->getSetting($this->entity_design_id));
$this->design = Design::withTrashed()->find($design_id ?? 2);