1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Support ‘Two Years’ recurrence

This commit is contained in:
Hillel Coren 2017-12-31 09:55:00 +02:00
parent 1839028832
commit 5f1970a2c2
5 changed files with 11 additions and 0 deletions

View File

@ -230,6 +230,7 @@ if (! defined('APP_NAME')) {
define('FREQUENCY_FOUR_MONTHS', 7);
define('FREQUENCY_SIX_MONTHS', 8);
define('FREQUENCY_ANNUALLY', 9);
define('FREQUENCY_TWO_YEARS', 10);
define('REPORT_FREQUENCY_DAILY', 'daily');
define('REPORT_FREQUENCY_WEEKLY', 'weekly');

View File

@ -358,6 +358,9 @@ trait GeneratesNumbers
case FREQUENCY_ANNUALLY:
$resetDate->addYear();
break;
case FREQUENCY_TWO_YEARS:
$resetDate->addYears(2);
break;
}
$this->reset_counter_date = $resetDate->format('Y-m-d');

View File

@ -70,6 +70,8 @@ trait HasRecurrence
return $monthsSinceLastSent >= 6;
case FREQUENCY_ANNUALLY:
return $monthsSinceLastSent >= 12;
case FREQUENCY_TWO_YEARS:
return $monthsSinceLastSent >= 24;
default:
return false;
}
@ -112,6 +114,9 @@ trait HasRecurrence
case FREQUENCY_ANNUALLY:
$rule = 'FREQ=YEARLY;';
break;
case FREQUENCY_TWO_YEARS:
$rule = 'FREQ=YEARLY;INTERVAL=2;';
break;
}
if ($this->end_date) {

View File

@ -18,6 +18,7 @@ class FrequencySeeder extends Seeder
['name' => 'Four months', 'date_interval' => '4 months'],
['name' => 'Six months', 'date_interval' => '6 months'],
['name' => 'Annually', 'date_interval' => '1 year'],
['name' => 'Two years', 'date_interval' => '2 years'],
];
foreach ($frequencies as $frequency) {

View File

@ -1389,6 +1389,7 @@ $LANG = array(
'freq_four_months' => 'Four months',
'freq_six_months' => 'Six months',
'freq_annually' => 'Annually',
'freq_two_years' => 'Two years',
// Payment types
'payment_type_Apply Credit' => 'Apply Credit',