Minor fixes for bank services, executing matching after imports

This commit is contained in:
David Bomba 2022-11-20 17:00:22 +11:00
parent 4c72663940
commit d046989e84
3 changed files with 6 additions and 11 deletions

View File

@ -46,6 +46,7 @@ use App\Repositories\PaymentRepository;
use App\Repositories\ProductRepository;
use App\Repositories\QuoteRepository;
use App\Repositories\VendorRepository;
use App\Services\Bank\BankMatchingService;
use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\Validator;
use Symfony\Component\HttpFoundation\ParameterBag;
@ -107,6 +108,8 @@ class Csv extends BaseImport implements ImportInterface
$bank_transaction_count = $this->ingest($data, $entity_type);
$this->entity_count['bank_transactions'] = $bank_transaction_count;
BankMatchingService::dispatchSync($this->company->id, $this->company->db);
}
public function client()

View File

@ -33,21 +33,13 @@ class BankMatchingService implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, GeneratesCounter;
private $company_id;
private Company $company;
private $db;
private $invoices;
public $deleteWhenMissingModels = true;
public function __construct($company_id, $db)
{
$this->company_id = $company_id;
$this->db = $db;
}
public function __construct(private int $company_id, private string $db){}
public function handle()
{
@ -77,6 +69,6 @@ class BankMatchingService implements ShouldQueue
public function middleware()
{
return [new WithoutOverlapping($this->company->company_key)];
return [new WithoutOverlapping($this->company_id)];
}
}

View File

@ -13,7 +13,7 @@ namespace App\Services\Bank;
use App\Models\BankTransaction;
use App\Models\Invoice;
use App\Services\Bank\ProcessBankRule;
use App\Services\Bank\ProcessBankRules;
class BankService
{