mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:47:32 -05: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
 | 
			
		||||
{
 | 
			
		||||
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, GeneratesCounter;
 | 
			
		||||
 | 
			
		||||
    private Company $company;
 | 
			
		||||
 | 
			
		||||
    private $invoices;
 | 
			
		||||
 | 
			
		||||
    public $deleteWhenMissingModels = true;
 | 
			
		||||
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 | 
			
		||||
 | 
			
		||||
    public function __construct(private int $company_id, private string $db){}
 | 
			
		||||
 | 
			
		||||
    public function handle()
 | 
			
		||||
    public function handle() :void
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        MultiDB::setDb($this->db);
 | 
			
		||||
 | 
			
		||||
        $this->company = Company::find($this->company_id);
 | 
			
		||||
 | 
			
		||||
        $this->matchTransactions();
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function matchTransactions()
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
        BankTransaction::where('company_id', $this->company->id)
 | 
			
		||||
        BankTransaction::where('company_id', $this->company_id)
 | 
			
		||||
           ->where('status_id', BankTransaction::STATUS_UNMATCHED)
 | 
			
		||||
           ->cursor()
 | 
			
		||||
           ->each(function ($bt){
 | 
			
		||||
@ -67,8 +51,8 @@ class BankMatchingService implements ShouldQueue
 | 
			
		||||
    
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function middleware()
 | 
			
		||||
    {
 | 
			
		||||
        return [new WithoutOverlapping($this->company_id)];
 | 
			
		||||
    }
 | 
			
		||||
    // public function middleware()
 | 
			
		||||
    // {
 | 
			
		||||
    //     return [new WithoutOverlapping($this->company_id)];
 | 
			
		||||
    // }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user