diff --git a/app/DataMapper/QuickbooksSyncMap.php b/app/DataMapper/QuickbooksSyncMap.php index b4d1e203b18c..ef3da4f34c96 100644 --- a/app/DataMapper/QuickbooksSyncMap.php +++ b/app/DataMapper/QuickbooksSyncMap.php @@ -28,5 +28,12 @@ class QuickbooksSyncMap public bool $update_record = true; public SyncDirection $direction = SyncDirection::BIDIRECTIONAL; + + public function __construct(array $attributes = []) + { + $this->sync = $attributes['sync'] ?? true; + $this->update_record = $attributes['update_record'] ?? true; + $this->direction = $attributes['direction'] ?? SyncDirection::BIDIRECTIONAL; + } } diff --git a/app/Filters/BankTransactionFilters.php b/app/Filters/BankTransactionFilters.php index 2471f98aaa25..1e05a6d03741 100644 --- a/app/Filters/BankTransactionFilters.php +++ b/app/Filters/BankTransactionFilters.php @@ -68,7 +68,7 @@ class BankTransactionFilters extends QueryFilters */ public function client_status(string $value = ''): Builder { - if (strlen($value ?? '') == 0) { + if (strlen($value) == 0) { return $this->builder; } diff --git a/app/Services/EDocument/Imports/ZugferdEDocument.php b/app/Services/EDocument/Imports/ZugferdEDocument.php index cc70e4cd6694..bcc40624eef6 100644 --- a/app/Services/EDocument/Imports/ZugferdEDocument.php +++ b/app/Services/EDocument/Imports/ZugferdEDocument.php @@ -131,6 +131,7 @@ class ZugferdEDocument extends AbstractService $vendor->postal_code = $postcode; $country = app('countries')->first(function ($c) use ($country) { + /** @var \App\Models\Country $c */ return $c->iso_3166_2 == $country || $c->iso_3166_3 == $country; }); if ($country) diff --git a/app/Services/Quickbooks/Models/QbProduct.php b/app/Services/Quickbooks/Models/QbProduct.php index 2e413c52588d..f9fb2a64418c 100644 --- a/app/Services/Quickbooks/Models/QbProduct.php +++ b/app/Services/Quickbooks/Models/QbProduct.php @@ -84,7 +84,7 @@ class QbProduct implements SyncInterface { $qb_record = $this->find($id); - if($ninja_record = $this->findProduct($id)) + if($this->service->updateGate('product') && $ninja_record = $this->findProduct($id)) { if(Carbon::parse($last_updated) > Carbon::parse($ninja_record->updated_at)) @@ -99,4 +99,4 @@ class QbProduct implements SyncInterface } } -} +} \ No newline at end of file diff --git a/app/Services/Quickbooks/QuickbooksService.php b/app/Services/Quickbooks/QuickbooksService.php index 3f9f0302a6da..f4d067256255 100644 --- a/app/Services/Quickbooks/QuickbooksService.php +++ b/app/Services/Quickbooks/QuickbooksService.php @@ -138,7 +138,7 @@ class QuickbooksService } /** - * Tests whether to update a record based on the sync settings. + * Updates the gate for a given entity * * @param string $entity * @return bool diff --git a/app/Services/Quickbooks/Transformers/PaymentTransformer.php b/app/Services/Quickbooks/Transformers/PaymentTransformer.php index e5eb7f38ae28..c29094c25323 100644 --- a/app/Services/Quickbooks/Transformers/PaymentTransformer.php +++ b/app/Services/Quickbooks/Transformers/PaymentTransformer.php @@ -91,7 +91,7 @@ class PaymentTransformer extends BaseTransformer if(!$credit_line) return $payment; - $credit = \App\Factory\CreditFactory::create($this->company->id, $this->company->owner()->id, $payment->client_id); + $credit = \App\Factory\CreditFactory::create($this->company->id, $this->company->owner()->id); $credit->client_id = $payment->client_id; $line = new \App\DataMapper\InvoiceItem();