mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 14:24:29 -04:00
Fixes for static analysis
This commit is contained in:
parent
cb7c87e053
commit
52adc55c9c
@ -13,10 +13,11 @@
|
||||
namespace App\PaymentDrivers\CBAPowerBoard;
|
||||
|
||||
|
||||
use App\PaymentDrivers\CBAPowerBoard\Models\Gateways;
|
||||
use App\Models\GatewayType;
|
||||
|
||||
use App\PaymentDrivers\CBAPowerBoard\Models\Gateway;
|
||||
use App\PaymentDrivers\CBAPowerBoardPaymentDriver;
|
||||
use App\PaymentDrivers\CBAPowerBoard\Models\Gateway;
|
||||
use App\PaymentDrivers\CBAPowerBoard\Models\Gateways;
|
||||
|
||||
class Settings
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ class QuickbooksImport implements ShouldQueue
|
||||
$contact->fill($ninja_data[1]);
|
||||
$contact->saveQuietly();
|
||||
}
|
||||
elseif($this->qbs->syncable('vendor', (\App\Enum\SyncDirection::PULL)->value)){
|
||||
elseif($this->qbs->syncable('vendor', \App\Enum\SyncDirection::PULL)){
|
||||
$contact->fill($ninja_data[1]);
|
||||
$contact->saveQuietly();
|
||||
}
|
||||
@ -194,7 +194,7 @@ class QuickbooksImport implements ShouldQueue
|
||||
return ExpenseFactory::create($this->company->id, $this->company->owner()->id);
|
||||
}
|
||||
elseif($search->count() == 1) {
|
||||
return $this->service->syncable('expense', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
return $this->qbs->syncable('expense', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -225,49 +225,12 @@ class QuickbooksImport implements ShouldQueue
|
||||
}
|
||||
elseif($search->count() == 1) {
|
||||
|
||||
return $this->service->syncable('vendor', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
return $this->qbs->syncable('vendor', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function findClient(array $qb_data) :?Client
|
||||
{
|
||||
$client = $qb_data[0];
|
||||
$contact = $qb_data[1];
|
||||
$client_meta = $qb_data[2];
|
||||
|
||||
$search = Client::query()
|
||||
->withTrashed()
|
||||
->where('company_id', $this->company->id)
|
||||
->where(function ($q) use ($client, $client_meta, $contact){
|
||||
|
||||
$q->where('client_hash', $client_meta['client_hash'])
|
||||
->orWhere('number', $client['number'])
|
||||
->orWhereHas('contacts', function ($q) use ($contact){
|
||||
$q->where('email', $contact['email']);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
if($search->count() == 0) {
|
||||
//new client
|
||||
$client = ClientFactory::create($this->company->id, $this->company->owner()->id);
|
||||
$client->client_hash = $client_meta['client_hash'];
|
||||
$client->settings = $client_meta['settings'];
|
||||
|
||||
return $client;
|
||||
}
|
||||
elseif($search->count() == 1) {
|
||||
|
||||
return $this->service->syncable('client', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function middleware()
|
||||
{
|
||||
return [new WithoutOverlapping("qbs-{$this->company_id}-{$this->db}")];
|
||||
|
@ -101,8 +101,7 @@ class QbClient implements SyncInterface
|
||||
return $client;
|
||||
|
||||
} elseif ($search->count() == 1) {
|
||||
|
||||
return $this->service->syncable('client', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
return $this->service->syncable('client', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -81,7 +81,7 @@ class QbInvoice implements SyncInterface
|
||||
|
||||
if($search->count() == 0) {
|
||||
$invoice = InvoiceFactory::create($this->service->company->id, $this->service->company->owner()->id);
|
||||
$invoice->client_id = $client_id;
|
||||
$invoice->client_id = (int)$client_id;
|
||||
|
||||
$sync = new InvoiceSync();
|
||||
$sync->qb_id = $id;
|
||||
@ -89,8 +89,7 @@ class QbInvoice implements SyncInterface
|
||||
|
||||
return $invoice;
|
||||
} elseif($search->count() == 1) {
|
||||
|
||||
return $this->service->syncable('invoice', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
return $this->service->syncable('invoice', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -102,6 +101,8 @@ return $this->service->syncable('invoice', \App\Enum\SyncDirection::PULL) ? $sea
|
||||
|
||||
$qb_record = $this->find($id);
|
||||
|
||||
nlog($qb_record);
|
||||
|
||||
if($this->service->syncable('invoice', \App\Enum\SyncDirection::PULL))
|
||||
{
|
||||
|
||||
@ -119,6 +120,8 @@ return $this->service->syncable('invoice', \App\Enum\SyncDirection::PULL) ? $sea
|
||||
elseif(Carbon::parse($last_updated)->gt(Carbon::parse($invoice->updated_at)))
|
||||
{
|
||||
$ninja_invoice_data = $this->invoice_transformer->qbToNinja($qb_record);
|
||||
nlog($ninja_invoice_data);
|
||||
|
||||
$this->invoice_repository->save($ninja_invoice_data, $invoice);
|
||||
|
||||
}
|
||||
@ -182,7 +185,7 @@ return $this->service->syncable('invoice', \App\Enum\SyncDirection::PULL) ? $sea
|
||||
|
||||
}
|
||||
|
||||
if ($record instanceof IPPSalesReceipt) {
|
||||
if ($record instanceof \QuickBooksOnline\API\Data\IPPSalesReceipt) {
|
||||
$invoice->service()->markPaid()->save();
|
||||
}
|
||||
|
||||
|
@ -73,8 +73,7 @@ class QbProduct implements SyncInterface
|
||||
return $product;
|
||||
|
||||
} elseif($search->count() == 1) {
|
||||
|
||||
return $this->service->syncable('product', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
return $this->service->syncable('product', \App\Enum\SyncDirection::PULL) ? $search->first() : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -144,7 +144,7 @@ class QuickbooksService
|
||||
* Flag to determine if a sync is allowed in either direction
|
||||
*
|
||||
* @param string $entity
|
||||
* @param mixed $direction
|
||||
* @param \App\Enum\SyncDirection $direction
|
||||
* @return bool
|
||||
*/
|
||||
public function syncable(string $entity, \App\Enum\SyncDirection $direction): bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user