mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:17:32 -05:00 
			
		
		
		
	Merge pull request #6584 from turbo124/v5-develop
Prevent duplicate events firing on save
This commit is contained in:
		
						commit
						1d4d7fff87
					
				@ -44,7 +44,7 @@ class HostedMigrations extends Command
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @var string
 | 
					     * @var string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    protected $signature = 'migrations:hosted-import {--email=}';
 | 
					    protected $signature = 'ninja:import {--email=}';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * The console command description.
 | 
					     * The console command description.
 | 
				
			||||||
 | 
				
			|||||||
@ -43,7 +43,7 @@ class ImportMigrations extends Command
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @var string
 | 
					     * @var string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    protected $signature = 'migrations:import {--path=}';
 | 
					    protected $signature = 'ninja:old-import {--path=}';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * The console command description.
 | 
					     * The console command description.
 | 
				
			||||||
 | 
				
			|||||||
@ -36,7 +36,7 @@ class WebhookHandler implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private $company;
 | 
					    private $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $tries = 1; //number of retries
 | 
					    public $tries = 3; //number of retries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $backoff = 10; //seconds to wait until retry
 | 
					    public $backoff = 10; //seconds to wait until retry
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,7 @@ class InvoiceObserver
 | 
				
			|||||||
     * @return void
 | 
					     * @return void
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Invoice $invoice)
 | 
					    public function updated(Invoice $invoice)
 | 
				
			||||||
    {
 | 
					    {nlog("updated");
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $invoice->company->id)
 | 
					        $subscriptions = Webhook::where('company_id', $invoice->company->id)
 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_UPDATE_INVOICE)
 | 
					                            ->where('event_id', Webhook::EVENT_UPDATE_INVOICE)
 | 
				
			||||||
                            ->exists();
 | 
					                            ->exists();
 | 
				
			||||||
 | 
				
			|||||||
@ -209,7 +209,7 @@ class BaseRepository
 | 
				
			|||||||
        $model->custom_surcharge_tax3 = $client->company->custom_surcharge_taxes3;
 | 
					        $model->custom_surcharge_tax3 = $client->company->custom_surcharge_taxes3;
 | 
				
			||||||
        $model->custom_surcharge_tax4 = $client->company->custom_surcharge_taxes4;
 | 
					        $model->custom_surcharge_tax4 = $client->company->custom_surcharge_taxes4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $model->save();
 | 
					        $model->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Model now persisted, now lets do some child tasks */
 | 
					        /* Model now persisted, now lets do some child tasks */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user