mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-22 14:40:56 -04:00
Fixes for tests
This commit is contained in:
parent
ba672f6fdd
commit
7618666c4b
@ -65,7 +65,7 @@ class CheckData extends Command
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $name = 'ninja:check-data';
|
protected $signature = 'ninja:check-data {--database=} {--fix=}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -46,7 +46,7 @@ class Kernel extends ConsoleKernel
|
|||||||
|
|
||||||
$schedule->job(new VersionCheck)->daily();
|
$schedule->job(new VersionCheck)->daily();
|
||||||
|
|
||||||
$schedule->command('ninja:check-data')->daily()->withoutOverlapping();
|
$schedule->command('ninja:check-data --database=db-ninja-01')->daily()->withoutOverlapping();
|
||||||
|
|
||||||
$schedule->job(new ReminderJob)->daily()->withoutOverlapping();
|
$schedule->job(new ReminderJob)->daily()->withoutOverlapping();
|
||||||
|
|
||||||
@ -65,6 +65,7 @@ class Kernel extends ConsoleKernel
|
|||||||
|
|
||||||
$schedule->job(new AdjustEmailQuota)->daily()->withoutOverlapping();
|
$schedule->job(new AdjustEmailQuota)->daily()->withoutOverlapping();
|
||||||
$schedule->job(new SendFailedEmails)->daily()->withoutOverlapping();
|
$schedule->job(new SendFailedEmails)->daily()->withoutOverlapping();
|
||||||
|
$schedule->command('ninja:check-data --database=db-ninja-02')->daily()->withoutOverlapping();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,10 +39,6 @@ class CompanyObserver
|
|||||||
|
|
||||||
if(Ninja::isHosted() && $company->portal_mode == 'domain' && $company->isDirty('portal_domain'))
|
if(Ninja::isHosted() && $company->portal_mode == 'domain' && $company->isDirty('portal_domain'))
|
||||||
{
|
{
|
||||||
nlog('company observer - updated');
|
|
||||||
nlog($company->portal_domain);
|
|
||||||
nlog($company->getOriginal('portal_domain'));
|
|
||||||
|
|
||||||
//fire event to build new custom portal domain
|
//fire event to build new custom portal domain
|
||||||
\Modules\Admin\Jobs\Domain\CustomDomain::dispatch($company->getOriginal('portal_domain'), $company)->onQueue('domain');
|
\Modules\Admin\Jobs\Domain\CustomDomain::dispatch($company->getOriginal('portal_domain'), $company)->onQueue('domain');
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ class InvoiceObserver
|
|||||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company);
|
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($invoice->isDirty('date') || $invoice->isDirty('due_date'))
|
// if($invoice->isDirty('date') || $invoice->isDirty('due_date'))
|
||||||
$invoice->service()->setReminder()->save();
|
// $invoice->service()->setReminder()->save();
|
||||||
|
|
||||||
// UnlinkFile::dispatchNow(config('filesystems.default'), $invoice->client->invoice_filepath() . $invoice->numberFormatter().'.pdf');
|
// UnlinkFile::dispatchNow(config('filesystems.default'), $invoice->client->invoice_filepath() . $invoice->numberFormatter().'.pdf');
|
||||||
|
|
||||||
|
@ -169,10 +169,14 @@ class BaseRepository
|
|||||||
*/
|
*/
|
||||||
protected function alternativeSave($data, $model)
|
protected function alternativeSave($data, $model)
|
||||||
{
|
{
|
||||||
|
//forces the client_id if it doesn't exist
|
||||||
if (array_key_exists('client_id', $data)) //forces the client_id if it doesn't exist
|
if(array_key_exists('client_id', $data))
|
||||||
$model->client_id = $data['client_id'];
|
$model->client_id = $data['client_id'];
|
||||||
|
|
||||||
|
//pickup changes here to recalculate reminders
|
||||||
|
if($model instanceof Invoice && ($model->isDirty('date') || $model->isDirty('due_date')))
|
||||||
|
$model->service()->setReminder()->save();
|
||||||
|
|
||||||
$client = Client::where('id', $model->client_id)->withTrashed()->first();
|
$client = Client::where('id', $model->client_id)->withTrashed()->first();
|
||||||
|
|
||||||
$state = [];
|
$state = [];
|
||||||
@ -189,7 +193,7 @@ class BaseRepository
|
|||||||
$data = array_merge($company_defaults, $data);
|
$data = array_merge($company_defaults, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp_data = $data; //preserves the $data arrayss
|
$tmp_data = $data; //preserves the $data array
|
||||||
|
|
||||||
/* We need to unset some variable as we sometimes unguard the model */
|
/* We need to unset some variable as we sometimes unguard the model */
|
||||||
if (isset($tmp_data['invitations']))
|
if (isset($tmp_data['invitations']))
|
||||||
|
@ -246,6 +246,13 @@ class InvoiceService
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setReminder($settings = null)
|
||||||
|
{
|
||||||
|
$this->invoice = (new UpdateReminder($this->invoice, $settings))->run();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setStatus($status)
|
public function setStatus($status)
|
||||||
{
|
{
|
||||||
$this->invoice->status_id = $status;
|
$this->invoice->status_id = $status;
|
||||||
@ -426,13 +433,6 @@ class InvoiceService
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setReminder($settings = null)
|
|
||||||
{
|
|
||||||
$this->invoice = (new UpdateReminder($this->invoice, $settings))->run();
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the invoice.
|
* Saves the invoice.
|
||||||
* @return Invoice object
|
* @return Invoice object
|
||||||
|
@ -21,7 +21,7 @@ class UpdateReminder extends AbstractService
|
|||||||
|
|
||||||
public $settings;
|
public $settings;
|
||||||
|
|
||||||
public function __construct($invoice, $settings = null)
|
public function __construct(Invoice $invoice, $settings = null)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
|
@ -7,7 +7,11 @@
|
|||||||
<p>Looks like your migration failed. Here's the error message:</p>
|
<p>Looks like your migration failed. Here's the error message:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
|
@if(Ninja::isHosted())
|
||||||
|
There was a problem with your migration, please send us an email contact@invoiceninja.com
|
||||||
|
@else
|
||||||
{!! $exception->getMessage() !!}
|
{!! $exception->getMessage() !!}
|
||||||
{!! $content !!}
|
{!! $content !!}
|
||||||
|
@endif
|
||||||
</pre>
|
</pre>
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
@ -19,7 +19,6 @@ use Tests\TestCase;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @covers App\Utils\Traits\MakesReminders
|
|
||||||
*/
|
*/
|
||||||
class CheckRemindersTest extends TestCase
|
class CheckRemindersTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -50,6 +49,8 @@ class CheckRemindersTest extends TestCase
|
|||||||
$settings->num_days_reminder3 = 1;
|
$settings->num_days_reminder3 = 1;
|
||||||
|
|
||||||
$this->company->settings = $settings;
|
$this->company->settings = $settings;
|
||||||
|
$this->company->save();
|
||||||
|
|
||||||
$this->invoice->service()->markSent();
|
$this->invoice->service()->markSent();
|
||||||
$this->invoice->service()->setReminder($settings)->save();
|
$this->invoice->service()->setReminder($settings)->save();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user