Merge pull request #7984 from turbo124/v5-develop

Minor Fixes
This commit is contained in:
David Bomba 2022-11-26 14:17:10 +11:00 committed by GitHub
commit ea5b950a54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 31 deletions

View File

@ -48,46 +48,46 @@ class Kernel extends ConsoleKernel
$schedule->job(new VersionCheck)->daily();
/* 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 */
$schedule->job(new ReminderJob)->hourly()->withoutOverlapping();
$schedule->job(new ReminderJob)->hourly()->withoutOverlapping()->name('reminder-job')->onOneServer();
/* Returns the number of jobs in the queue */
$schedule->job(new QueueSize)->everyFiveMinutes()->withoutOverlapping();
/* 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 */
$schedule->job(new UpdateExchangeRates)->dailyAt('23:30')->withoutOverlapping();
/* 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*/
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping();
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping()->name('recurring-invoice-job')->onOneServer();
/* 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 */
$schedule->job(new QuoteCheckExpired)->dailyAt('05:10')->withoutOverlapping();
$schedule->job(new QuoteCheckExpired)->dailyAt('05:10')->withoutOverlapping()->name('quote-expired-job')->onOneServer();
/* 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 */
$schedule->job(new SchedulerCheck)->dailyAt('01:10')->withoutOverlapping();
/* 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 */
$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 */
$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()) {

View File

@ -32,8 +32,6 @@ class GenericReportRequest extends Request
return [
'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',
'start_date' => 'bail|required_if:date_range,custom|nullable|date',
'report_keys' => 'present|array',
@ -57,6 +55,12 @@ class GenericReportRequest extends Request
$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);
}
}

View File

@ -24,7 +24,7 @@ class ConfirmSmsRequest extends Request
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
return true;
}
public function rules()

View File

@ -24,7 +24,7 @@ class GenerateSmsRequest extends Request
*/
public function authorize() : bool
{
return auth()->user();
return true;
}

View File

@ -49,10 +49,6 @@ class SystemMaintenance implements ShouldQueue
nlog('Starting System Maintenance');
if (Ninja::isHosted()) {
return;
}
$delete_pdf_days = config('ninja.maintenance.delete_pdfs');
nlog("Number of days to keep PDFs {$delete_pdf_days}");

View File

@ -87,6 +87,7 @@ class ReminderJob implements ShouldQueue
$query->where('is_disabled', 0);
})
->with('invitations')->cursor()->each(function ($invoice) {
// if ($invoice->refresh() && $invoice->isPayable()) {
if ($invoice->isPayable()) {
//Attempts to prevent duplicates from sending
@ -97,9 +98,8 @@ class ReminderJob implements ShouldQueue
$reminder_template = $invoice->calculateTemplate('invoice');
nlog("reminder template = {$reminder_template}");
$invoice = $this->calcLateFee($invoice, $reminder_template);
$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
$enabled_reminder = 'enable_'.$reminder_template;
@ -220,16 +220,18 @@ class ReminderJob implements ShouldQueue
$invoice->client->service()->updateBalance($invoice->balance - $temp_invoice_balance);
$invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
$transaction = [
'invoice' => $invoice->transaction_event(),
'payment' => [],
'client' => $invoice->client->transaction_event(),
'credit' => [],
'metadata' => ['setLateFee'],
];
// $transaction = [
// 'invoice' => $invoice->transaction_event(),
// 'payment' => [],
// 'client' => $invoice->client->transaction_event(),
// 'credit' => [],
// 'metadata' => ['setLateFee'],
// ];
// TransactionLog::dispatch(TransactionEvent::CLIENT_STATUS, $transaction, $invoice->company->db);
$invoice->service()->touchPdf(true);
return $invoice;
}
}

View File

@ -37,13 +37,14 @@ class VersionCheck implements ShouldQueue
{
$version_file = trim(@file_get_contents(config('ninja.version_url')));
nlog("latest version = {$version_file}");
if (Ninja::isSelfHost() && $version_file) {
Account::whereNotNull('id')->update(['latest_version' => $version_file]);
}
if (Ninja::isSelfHost()) {
nlog("latest version = {$version_file}");
$account = Account::first();
if (! $account) {