mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
ea5b950a54
@ -48,46 +48,46 @@ class Kernel extends ConsoleKernel
|
|||||||
$schedule->job(new VersionCheck)->daily();
|
$schedule->job(new VersionCheck)->daily();
|
||||||
|
|
||||||
/* Checks and cleans redundant files */
|
/* Checks and cleans redundant files */
|
||||||
$schedule->job(new DiskCleanup)->dailyAt('02:10')->withoutOverlapping();
|
$schedule->job(new DiskCleanup)->dailyAt('02:10')->withoutOverlapping()->name('disk-cleanup-job')->onOneServer();
|
||||||
|
|
||||||
/* Send reminders */
|
/* Send reminders */
|
||||||
$schedule->job(new ReminderJob)->hourly()->withoutOverlapping();
|
$schedule->job(new ReminderJob)->hourly()->withoutOverlapping()->name('reminder-job')->onOneServer();
|
||||||
|
|
||||||
/* Returns the number of jobs in the queue */
|
/* Returns the number of jobs in the queue */
|
||||||
$schedule->job(new QueueSize)->everyFiveMinutes()->withoutOverlapping();
|
$schedule->job(new QueueSize)->everyFiveMinutes()->withoutOverlapping();
|
||||||
|
|
||||||
/* Checks for large companies and marked them as is_large */
|
/* Checks for large companies and marked them as is_large */
|
||||||
$schedule->job(new CompanySizeCheck)->dailyAt('23:20')->withoutOverlapping();
|
$schedule->job(new CompanySizeCheck)->dailyAt('23:20')->withoutOverlapping()->name('company-size-job')->onOneServer();
|
||||||
|
|
||||||
/* Pulls in the latest exchange rates */
|
/* Pulls in the latest exchange rates */
|
||||||
$schedule->job(new UpdateExchangeRates)->dailyAt('23:30')->withoutOverlapping();
|
$schedule->job(new UpdateExchangeRates)->dailyAt('23:30')->withoutOverlapping();
|
||||||
|
|
||||||
/* Runs cleanup code for subscriptions */
|
/* Runs cleanup code for subscriptions */
|
||||||
$schedule->job(new SubscriptionCron)->dailyAt('00:01')->withoutOverlapping();
|
$schedule->job(new SubscriptionCron)->dailyAt('00:01')->withoutOverlapping()->name('subscription-job')->onOneServer();
|
||||||
|
|
||||||
/* Sends recurring invoices*/
|
/* Sends recurring invoices*/
|
||||||
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping();
|
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping()->name('recurring-invoice-job')->onOneServer();
|
||||||
|
|
||||||
/* Sends recurring invoices*/
|
/* Sends recurring invoices*/
|
||||||
$schedule->job(new RecurringExpensesCron)->dailyAt('00:10')->withoutOverlapping();
|
$schedule->job(new RecurringExpensesCron)->dailyAt('00:10')->withoutOverlapping()->name('recurring-expense-job')->onOneServer();
|
||||||
|
|
||||||
/* Fires notifications for expired Quotes */
|
/* Fires notifications for expired Quotes */
|
||||||
$schedule->job(new QuoteCheckExpired)->dailyAt('05:10')->withoutOverlapping();
|
$schedule->job(new QuoteCheckExpired)->dailyAt('05:10')->withoutOverlapping()->name('quote-expired-job')->onOneServer();
|
||||||
|
|
||||||
/* Performs auto billing */
|
/* Performs auto billing */
|
||||||
$schedule->job(new AutoBillCron)->dailyAt('06:20')->withoutOverlapping();
|
$schedule->job(new AutoBillCron)->dailyAt('06:20')->withoutOverlapping()->name('auto-bill-job')->onOneServer();
|
||||||
|
|
||||||
/* Checks the status of the scheduler */
|
/* Checks the status of the scheduler */
|
||||||
$schedule->job(new SchedulerCheck)->dailyAt('01:10')->withoutOverlapping();
|
$schedule->job(new SchedulerCheck)->dailyAt('01:10')->withoutOverlapping();
|
||||||
|
|
||||||
/* Checks for scheduled tasks */
|
/* Checks for scheduled tasks */
|
||||||
$schedule->job(new TaskScheduler())->dailyAt('06:50')->withoutOverlapping();
|
$schedule->job(new TaskScheduler())->dailyAt('06:50')->withoutOverlapping()->name('task-scheduler-job')->onOneServer();
|
||||||
|
|
||||||
/* Performs system maintenance such as pruning the backup table */
|
/* Performs system maintenance such as pruning the backup table */
|
||||||
$schedule->job(new SystemMaintenance)->weekly()->withoutOverlapping();
|
$schedule->job(new SystemMaintenance)->sundays()->at('02:30')->withoutOverlapping()->name('system-maintenance-job')->onOneServer();
|
||||||
|
|
||||||
/* Pulls in bank transactions from third party services */
|
/* Pulls in bank transactions from third party services */
|
||||||
$schedule->job(new BankTransactionSync)->dailyAt('04:10')->withoutOverlapping();
|
$schedule->job(new BankTransactionSync)->dailyAt('04:10')->withoutOverlapping()->name('bank-trans-sync-job')->onOneServer();
|
||||||
|
|
||||||
if (Ninja::isSelfHost()) {
|
if (Ninja::isSelfHost()) {
|
||||||
|
|
||||||
|
@ -32,8 +32,6 @@ class GenericReportRequest extends Request
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'date_range' => 'bail|required|string',
|
'date_range' => 'bail|required|string',
|
||||||
// 'start_date' => [Rule::requiredIf($this->date_range === 'custom')],
|
|
||||||
// 'end_date' => [Rule::requiredIf($this->date_range === 'custom')],
|
|
||||||
'end_date' => 'bail|required_if:date_range,custom|nullable|date',
|
'end_date' => 'bail|required_if:date_range,custom|nullable|date',
|
||||||
'start_date' => 'bail|required_if:date_range,custom|nullable|date',
|
'start_date' => 'bail|required_if:date_range,custom|nullable|date',
|
||||||
'report_keys' => 'present|array',
|
'report_keys' => 'present|array',
|
||||||
@ -57,6 +55,12 @@ class GenericReportRequest extends Request
|
|||||||
$input['send_email'] = true;
|
$input['send_email'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('date_range', $input) && $input['date_range'] != 'custom') {
|
||||||
|
$input['start_date'] = null;
|
||||||
|
$input['end_date'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class ConfirmSmsRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->isAdmin();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
|
@ -24,7 +24,7 @@ class GenerateSmsRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,10 +49,6 @@ class SystemMaintenance implements ShouldQueue
|
|||||||
|
|
||||||
nlog('Starting System Maintenance');
|
nlog('Starting System Maintenance');
|
||||||
|
|
||||||
if (Ninja::isHosted()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$delete_pdf_days = config('ninja.maintenance.delete_pdfs');
|
$delete_pdf_days = config('ninja.maintenance.delete_pdfs');
|
||||||
|
|
||||||
nlog("Number of days to keep PDFs {$delete_pdf_days}");
|
nlog("Number of days to keep PDFs {$delete_pdf_days}");
|
||||||
|
@ -87,7 +87,8 @@ class ReminderJob implements ShouldQueue
|
|||||||
$query->where('is_disabled', 0);
|
$query->where('is_disabled', 0);
|
||||||
})
|
})
|
||||||
->with('invitations')->cursor()->each(function ($invoice) {
|
->with('invitations')->cursor()->each(function ($invoice) {
|
||||||
if ($invoice->isPayable()) {
|
// if ($invoice->refresh() && $invoice->isPayable()) {
|
||||||
|
if ($invoice->isPayable()) {
|
||||||
|
|
||||||
//Attempts to prevent duplicates from sending
|
//Attempts to prevent duplicates from sending
|
||||||
if($invoice->reminder_last_sent && Carbon::parse($invoice->reminder_last_sent)->startOfDay()->eq(now()->startOfDay())){
|
if($invoice->reminder_last_sent && Carbon::parse($invoice->reminder_last_sent)->startOfDay()->eq(now()->startOfDay())){
|
||||||
@ -97,9 +98,8 @@ class ReminderJob implements ShouldQueue
|
|||||||
|
|
||||||
$reminder_template = $invoice->calculateTemplate('invoice');
|
$reminder_template = $invoice->calculateTemplate('invoice');
|
||||||
nlog("reminder template = {$reminder_template}");
|
nlog("reminder template = {$reminder_template}");
|
||||||
$invoice = $this->calcLateFee($invoice, $reminder_template);
|
|
||||||
$invoice->service()->touchReminder($reminder_template)->save();
|
$invoice->service()->touchReminder($reminder_template)->save();
|
||||||
$invoice->service()->touchPdf(true);
|
$invoice = $this->calcLateFee($invoice, $reminder_template);
|
||||||
|
|
||||||
//20-04-2022 fixes for endless reminders - generic template naming was wrong
|
//20-04-2022 fixes for endless reminders - generic template naming was wrong
|
||||||
$enabled_reminder = 'enable_'.$reminder_template;
|
$enabled_reminder = 'enable_'.$reminder_template;
|
||||||
@ -220,16 +220,18 @@ class ReminderJob implements ShouldQueue
|
|||||||
$invoice->client->service()->updateBalance($invoice->balance - $temp_invoice_balance);
|
$invoice->client->service()->updateBalance($invoice->balance - $temp_invoice_balance);
|
||||||
$invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
|
$invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
|
||||||
|
|
||||||
$transaction = [
|
// $transaction = [
|
||||||
'invoice' => $invoice->transaction_event(),
|
// 'invoice' => $invoice->transaction_event(),
|
||||||
'payment' => [],
|
// 'payment' => [],
|
||||||
'client' => $invoice->client->transaction_event(),
|
// 'client' => $invoice->client->transaction_event(),
|
||||||
'credit' => [],
|
// 'credit' => [],
|
||||||
'metadata' => ['setLateFee'],
|
// 'metadata' => ['setLateFee'],
|
||||||
];
|
// ];
|
||||||
|
|
||||||
// TransactionLog::dispatch(TransactionEvent::CLIENT_STATUS, $transaction, $invoice->company->db);
|
// TransactionLog::dispatch(TransactionEvent::CLIENT_STATUS, $transaction, $invoice->company->db);
|
||||||
|
|
||||||
|
$invoice->service()->touchPdf(true);
|
||||||
|
|
||||||
return $invoice;
|
return $invoice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,14 @@ class VersionCheck implements ShouldQueue
|
|||||||
{
|
{
|
||||||
$version_file = trim(@file_get_contents(config('ninja.version_url')));
|
$version_file = trim(@file_get_contents(config('ninja.version_url')));
|
||||||
|
|
||||||
nlog("latest version = {$version_file}");
|
|
||||||
|
|
||||||
if (Ninja::isSelfHost() && $version_file) {
|
if (Ninja::isSelfHost() && $version_file) {
|
||||||
Account::whereNotNull('id')->update(['latest_version' => $version_file]);
|
Account::whereNotNull('id')->update(['latest_version' => $version_file]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ninja::isSelfHost()) {
|
if (Ninja::isSelfHost()) {
|
||||||
|
|
||||||
|
nlog("latest version = {$version_file}");
|
||||||
|
|
||||||
$account = Account::first();
|
$account = Account::first();
|
||||||
|
|
||||||
if (! $account) {
|
if (! $account) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user