mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #8578 from lamaral/v5-develop
Add :MONTHYEAR keyword to recurring expenses
This commit is contained in:
commit
5fb4de2356
@ -95,6 +95,11 @@ class RecurringExpenseToExpenseFactory
|
|||||||
|
|
||||||
$replacements = [
|
$replacements = [
|
||||||
'literal' => [
|
'literal' => [
|
||||||
|
':MONTHYEAR' => \sprintf(
|
||||||
|
'%s %s',
|
||||||
|
Carbon::createFromDate(now()->year, now()->month)->translatedFormat('F'),
|
||||||
|
now()->year,
|
||||||
|
),
|
||||||
':MONTH' => Carbon::createFromDate(now()->year, now()->month)->translatedFormat('F'),
|
':MONTH' => Carbon::createFromDate(now()->year, now()->month)->translatedFormat('F'),
|
||||||
':YEAR' => now()->year,
|
':YEAR' => now()->year,
|
||||||
':QUARTER' => 'Q'.now()->quarter,
|
':QUARTER' => 'Q'.now()->quarter,
|
||||||
@ -240,6 +245,17 @@ class RecurringExpenseToExpenseFactory
|
|||||||
$output = \Carbon\Carbon::create()->month($output)->translatedFormat('F');
|
$output = \Carbon\Carbon::create()->month($output)->translatedFormat('F');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($matches->keys()->first() == ':MONTHYEAR') {
|
||||||
|
|
||||||
|
$final_date = now()->addMonths($output-now()->month);
|
||||||
|
|
||||||
|
$output = \sprintf(
|
||||||
|
'%s %s',
|
||||||
|
$final_date->translatedFormat('F'),
|
||||||
|
$final_date->year,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$value = preg_replace(
|
$value = preg_replace(
|
||||||
$target,
|
$target,
|
||||||
$output,
|
$output,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user