Version bump, fixes for queue:work on setup. (#3603)

* Fixes for scheduler and queues

* Version Bump
This commit is contained in:
David Bomba 2020-04-08 20:55:28 +10:00 committed by GitHub
parent 2fd3229efd
commit 7d41759468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 17 deletions

View File

@ -43,6 +43,7 @@ class Kernel extends ConsoleKernel
/* Run queue's in shared hosting with this*/
if (Ninja::isSelfHost()) {
$schedule->command('queue:work')->everyMinute()->withoutOverlapping();
$schedule->command('queue:restart')->everyFiveMinutes(); //we need to add this as we are seeing cached queues mess up the system on first load.
}
}

View File

@ -64,29 +64,33 @@ class HandleReversal extends AbstractService
});
/* Generate a credit for the $total_paid amount */
$credit = CreditFactory::create($this->invoice->company_id, $this->invoice->user_id);
$credit->client_id = $this->invoice->client_id;
$notes = "Credit for reversal of ".$this->invoice->number;
$item = InvoiceItemFactory::create();
$item->quantity = 1;
$item->cost = (float)$total_paid;
$item->notes = "Credit for reversal of ".$this->invoice->number;
if($total_paid > 0)
{
$credit = CreditFactory::create($this->invoice->company_id, $this->invoice->user_id);
$credit->client_id = $this->invoice->client_id;
$line_items[] = $item;
$item = InvoiceItemFactory::create();
$item->quantity = 1;
$item->cost = (float)$total_paid;
$item->notes = $notes;
$credit->line_items = $line_items;
$line_items[] = $item;
$credit->save();
$credit->line_items = $line_items;
$credit_calc = new InvoiceSum($credit);
$credit_calc->build();
$credit->save();
$credit = $credit_calc->getCredit();
$credit_calc = new InvoiceSum($credit);
$credit_calc->build();
$credit->service()->markSent()->save();
$credit = $credit_calc->getCredit();
$credit->service()->markSent()->save();
}
/* Set invoice balance to 0 */
$this->invoice->ledger()->updateInvoiceBalance($balance_remaining, $item->notes)->save();
$this->invoice->ledger()->updateInvoiceBalance($balance_remaining, $notes)->save();
$this->invoice->balance= 0;

View File

@ -11,8 +11,8 @@ return [
'app_env' => env('APP_ENV', 'local'),
'app_url' => env('APP_URL', ''),
'app_domain' => env('APP_DOMAIN', ''),
'app_version' => '0.0.2',
'api_version' => '0.0.1',
'app_version' => '0.0.3',
'api_version' => '0.0.3',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),
'google_maps_api_key' => env('GOOGLE_MAPS_API_KEY'),

View File

@ -28,7 +28,7 @@ class InvoiceActionsTest extends TestCase
public function testInvoiceIsDeletable()
{
$this->assertTrue($this->invoiceDeletable($this->invoice));
$this->assertFalse($this->invoiceReversable($this->invoice));
$this->assertTrue($this->invoiceReversable($this->invoice));
$this->assertFalse($this->invoiceCancellable($this->invoice));
}