Hello!
I have installed the self hosted edition of InvoiceNinja on FreeBSD and it was an easy install with everything going smoothly. I really like the “Endless Reminder” feature as it seems like it takes a lot more than just 3 reminders to get some customers to pay these days. However it would be good to be able to set the endless reminders to a more frequent interval than weekly, such as something like twice a week or every 2-3 days.
Is there possibly a simple change/hack of the code which can be made to achieve this?
I see the following sections of code which seem to pertain to this but I’m not sure what could be changed to make these reminders more frequent.
~app/Console/Commands/SendReminders.php
// endless reminders
$invoices = $this->invoiceRepo->findNeedingEndlessReminding($account);
$this->info(date('r ') . $account->name . ': ' . $invoices->count() . ' endless invoices found');
foreach ($invoices as $invoice) {
if ($invoice->last_sent_date == date('Y-m-d')) {
continue;
}
$this->info(date('r') . ' Send email: ' . $invoice->id);
dispatch(new SendInvoiceEmail($invoice, $invoice->user_id, 'reminder4'));
—
~app/Ninja/Repositories/InvoiceRepository.php
public function findNeedingEndlessReminding(Account $account)
{
$settings = $account->account_email_settings;
$frequencyId = $settings->frequency_id_reminder4;
if (! $frequencyId || ! $account->enable_reminder4) {
return collect();
}
$frequency = Utils::getFromCache($frequencyId, 'frequencies');
$lastSentDate = date_create();
$lastSentDate->sub(date_interval_create_from_date_string($frequency->date_interval));
$invoices = Invoice::invoiceType(INVOICE_TYPE_STANDARD)
->with('client', 'invoice_items')
->whereHas('client', function ($query) {
$query->whereSendReminders(true);
})
->whereAccountId($account->id)
->where('balance', '>', 0)
->where('is_recurring', '=', false)
->whereIsPublic(true)
->where('last_sent_date', '<', $lastSentDate);
for ($i=1; $i<=3; $i++) {
if (!$account->{"enable_reminder{$i}"}) {
continue;
}
$field = $account->{"field_reminder{$i}"} == REMINDER_FIELD_DUE_DATE ? 'due_date' : 'invoice_date'
$date = date_create();
if ($account->{"direction_reminder{$i}"} == REMINDER_DIRECTION_AFTER) {
Appreciate any help on this
Thanks!
Ken