Quickbooks sync

This commit is contained in:
David Bomba 2024-09-23 13:36:12 +10:00
parent 80f34caccf
commit 28775c087e
6 changed files with 13 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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
}
}
}
}

View File

@ -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

View File

@ -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();