mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Wind back Middleware for Bank Service Matching
This commit is contained in:
parent
b138630d39
commit
8b3c579f7b
@ -31,32 +31,16 @@ use Illuminate\Support\Facades\Cache;
|
|||||||
|
|
||||||
class BankMatchingService implements ShouldQueue
|
class BankMatchingService implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, GeneratesCounter;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
private Company $company;
|
|
||||||
|
|
||||||
private $invoices;
|
|
||||||
|
|
||||||
public $deleteWhenMissingModels = true;
|
|
||||||
|
|
||||||
public function __construct(private int $company_id, private string $db){}
|
public function __construct(private int $company_id, private string $db){}
|
||||||
|
|
||||||
public function handle()
|
public function handle() :void
|
||||||
{
|
{
|
||||||
|
|
||||||
MultiDB::setDb($this->db);
|
MultiDB::setDb($this->db);
|
||||||
|
|
||||||
$this->company = Company::find($this->company_id);
|
BankTransaction::where('company_id', $this->company_id)
|
||||||
|
|
||||||
$this->matchTransactions();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private function matchTransactions()
|
|
||||||
{
|
|
||||||
|
|
||||||
BankTransaction::where('company_id', $this->company->id)
|
|
||||||
->where('status_id', BankTransaction::STATUS_UNMATCHED)
|
->where('status_id', BankTransaction::STATUS_UNMATCHED)
|
||||||
->cursor()
|
->cursor()
|
||||||
->each(function ($bt){
|
->each(function ($bt){
|
||||||
@ -64,11 +48,11 @@ class BankMatchingService implements ShouldQueue
|
|||||||
(new BankService($bt))->processRules();
|
(new BankService($bt))->processRules();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function middleware()
|
// public function middleware()
|
||||||
{
|
// {
|
||||||
return [new WithoutOverlapping($this->company_id)];
|
// return [new WithoutOverlapping($this->company_id)];
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user