Skip to content

Firefly III: a personal finances manager

Fix https://github.com/firefly-iii/firefly-iii/issues/7588

James Cole1357074dcd72
diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php
index c3518e55b3..7ffb5922f1 100644
--- a/app/Services/Internal/Support/RecurringTransactionTrait.php
+++ b/app/Services/Internal/Support/RecurringTransactionTrait.php
@@ -281,6 +281,7 @@ trait RecurringTransactionTrait
}
}
+
/**
* @param RecurrenceTransaction $transaction
* @param array $tags
diff --git a/app/Support/Request/GetRecurrenceData.php b/app/Support/Request/GetRecurrenceData.php
index 661823ac60..6fc9a09e46 100644
--- a/app/Support/Request/GetRecurrenceData.php
+++ b/app/Support/Request/GetRecurrenceData.php
@@ -73,6 +73,9 @@ trait GetRecurrenceData
if (array_key_exists('piggy_bank_id', $transaction)) {
$return['piggy_bank_id'] = (int)$transaction['piggy_bank_id'];
}
+ if (array_key_exists('bill_id', $transaction)) {
+ $return['bill_id'] = (int)$transaction['bill_id'];
+ }
if (array_key_exists('tags', $transaction)) {
$return['tags'] = $transaction['tags'];
diff --git a/app/Validation/RecurrenceValidation.php b/app/Validation/RecurrenceValidation.php
index 0d5c8893fc..45696fcd65 100644
--- a/app/Validation/RecurrenceValidation.php
+++ b/app/Validation/RecurrenceValidation.php
@@ -203,12 +203,13 @@ trait RecurrenceValidation
*/
foreach ($repetitions as $index => $repetition) {
if (!array_key_exists('moment', $repetition)) {
- continue;
+ $repetition['moment'] = '';
}
if (null === $repetition['moment']) {
$repetition['moment'] = '';
}
$repetition['moment'] = $repetition['moment'] ?? 'invalid';
+
switch ($repetition['type'] ?? 'empty') {
default:
$validator->errors()->add(sprintf('repetitions.%d.type', $index), (string)trans('validation.valid_recurrence_rep_type'));
diff --git a/resources/views/recurring/show.twig b/resources/views/recurring/show.twig
index 355fada105..2d4b181bae 100644
--- a/resources/views/recurring/show.twig
+++ b/resources/views/recurring/show.twig
@@ -59,37 +59,39 @@
{{ trans('firefly.repeat_until_in_past', {date: array.repeat_until.isoFormat(monthAndDayFormat) }) }}
</span>
{% endif %}
- {% for rep in array.repetitions %}
- <p>
- <strong>{{ rep.description }}
- {% if rep.repetition_skip == 1 %}
- ({{ trans('firefly.recurring_skips_one')|lower }})
- {% endif %}
- {% if rep.repetition_skip > 1 %}
- ({{ trans('firefly.recurring_skips_more', {count: rep.repetition_skip})|lower }})
- {% endif %}
- </strong>
- </p>
- <table class="table" aria-label="Table">
- <tbody>
- {% for occ in rep.occurrences %}
- <tr>
- <th scope="row">{{ occ.date.isoFormat(trans('config.month_and_date_day_js')) }}</th>
- <td>
- {% if not occ.fired %}
- <form action="{{ route('recurring.trigger', [recurrence.id]) }}" method="post" style="display: inline;">
+ {% for rep in array.repetitions %}
+ <p>
+ <strong>{{ rep.description }}
+ {% if rep.repetition_skip == 1 %}
+ ({{ trans('firefly.recurring_skips_one')|lower }})
+ {% endif %}
+ {% if rep.repetition_skip > 1 %}
+ ({{ trans('firefly.recurring_skips_more', {count: rep.repetition_skip})|lower }})
+ {% endif %}
+ </strong>
+ </p>
+ <table class="table" aria-label="Table">
+ <tbody>
+ {% for occ in rep.occurrences %}
+ <tr>
+ <th scope="row">{{ occ.date.isoFormat(trans('config.month_and_date_day_js')) }}</th>
+ <td>
+ {% if not occ.fired %}
+ <form action="{{ route('recurring.trigger', [recurrence.id]) }}" method="post"
+ style="display: inline;">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
- <input type="hidden" name="date" value="{{ occ.date.isoFormat('YYYY-MM-DD') }}">
- <input type="submit" name="submit" value="{{ 'create_right_now'|_ }}"
- class="btn btn-sm btn-default">
+ <input type="hidden" name="date"
+ value="{{ occ.date.isoFormat('YYYY-MM-DD') }}">
+ <input type="submit" name="submit" value="{{ 'create_right_now'|_ }}"
+ class="btn btn-sm btn-default">
</form>
- {% endif %}
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endfor %}
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% endfor %}
</div>
<div class="box-footer">
<small>
@@ -161,8 +163,15 @@
{% endfor %}
</p>
{% endif %}
- {% if 0 != transaction.piggy_bank_id and array.type == 'Transfer' %}
- <a href="{{ route('piggy-banks.show', [transaction.piggy_bank_id]) }}">{{ transaction.piggy_bank_name }}</a>
+ {% if 0 != transaction.piggy_bank_id %}
+ <p>
+ <a href="{{ route('piggy-banks.show', [transaction.piggy_bank_id]) }}">{{ transaction.piggy_bank_name }}</a>
+ </p>
+ {% endif %}
+ {% if 0 != transaction.bill_id %}
+ <p>
+ <a href="{{ route('bills.show', [transaction.bill_id]) }}">{{ transaction.bill_name }}</a>
+ </p>
{% endif %}
</td>
</tr>