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*/ /* Run queue's in shared hosting with this*/
if (Ninja::isSelfHost()) { if (Ninja::isSelfHost()) {
$schedule->command('queue:work')->everyMinute()->withoutOverlapping(); $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,13 +64,17 @@ class HandleReversal extends AbstractService
}); });
/* Generate a credit for the $total_paid amount */ /* Generate a credit for the $total_paid amount */
$notes = "Credit for reversal of ".$this->invoice->number;
if($total_paid > 0)
{
$credit = CreditFactory::create($this->invoice->company_id, $this->invoice->user_id); $credit = CreditFactory::create($this->invoice->company_id, $this->invoice->user_id);
$credit->client_id = $this->invoice->client_id; $credit->client_id = $this->invoice->client_id;
$item = InvoiceItemFactory::create(); $item = InvoiceItemFactory::create();
$item->quantity = 1; $item->quantity = 1;
$item->cost = (float)$total_paid; $item->cost = (float)$total_paid;
$item->notes = "Credit for reversal of ".$this->invoice->number; $item->notes = $notes;
$line_items[] = $item; $line_items[] = $item;
@ -84,9 +88,9 @@ class HandleReversal extends AbstractService
$credit = $credit_calc->getCredit(); $credit = $credit_calc->getCredit();
$credit->service()->markSent()->save(); $credit->service()->markSent()->save();
}
/* Set invoice balance to 0 */ /* 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; $this->invoice->balance= 0;

View File

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

View File

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