mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Error handling for https://github.com/firefly-iii/firefly-iii/issues/5575
This commit is contained in:
parent
78ebec01a4
commit
8238ae7d0a
@ -83,14 +83,18 @@ class ReconcileController extends Controller
|
|||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function overview(Request $request, Account $account, Carbon $start, Carbon $end): JsonResponse
|
public function overview(Request $request, Account $account = null, Carbon $start = null, Carbon $end = null): JsonResponse
|
||||||
{
|
{
|
||||||
$startBalance = $request->get('startBalance');
|
$startBalance = $request->get('startBalance');
|
||||||
$endBalance = $request->get('endBalance');
|
$endBalance = $request->get('endBalance');
|
||||||
$accountCurrency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
$accountCurrency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||||
$amount = '0';
|
$amount = '0';
|
||||||
$clearedAmount = '0';
|
$clearedAmount = '0';
|
||||||
|
$route = '';
|
||||||
|
|
||||||
|
if (null === $start && null === $end) {
|
||||||
|
throw new FireflyException('Invalid dates submitted.');
|
||||||
|
}
|
||||||
if ($end->lt($start)) {
|
if ($end->lt($start)) {
|
||||||
[$start, $end] = [$end, $start];
|
[$start, $end] = [$end, $start];
|
||||||
}
|
}
|
||||||
@ -220,8 +224,11 @@ class ReconcileController extends Controller
|
|||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
* @throws JsonException
|
* @throws JsonException
|
||||||
*/
|
*/
|
||||||
public function transactions(Account $account, Carbon $start, Carbon $end)
|
public function transactions(Account $account, Carbon $start = null, Carbon $end = null)
|
||||||
{
|
{
|
||||||
|
if (null === $start || null === $end) {
|
||||||
|
throw new FireflyException('Invalid dates submitted.');
|
||||||
|
}
|
||||||
if ($end->lt($start)) {
|
if ($end->lt($start)) {
|
||||||
[$end, $start] = [$start, $end];
|
[$end, $start] = [$start, $end];
|
||||||
}
|
}
|
||||||
|
7
public/v1/js/ff/accounts/reconcile.js
vendored
7
public/v1/js/ff/accounts/reconcile.js
vendored
@ -201,7 +201,12 @@ function getTransactionsForRange() {
|
|||||||
var index = indexUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val());
|
var index = indexUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val());
|
||||||
window.history.pushState('object or string', "Reconcile account", index);
|
window.history.pushState('object or string', "Reconcile account", index);
|
||||||
|
|
||||||
$.getJSON(uri).done(placeTransactions);
|
$.getJSON(uri).done(placeTransactions).catch(exceptionHandling)
|
||||||
|
}
|
||||||
|
function exceptionHandling() {
|
||||||
|
$('#transactions_holder').empty().append($('<p>').addClass('text-center lead').html(selectRangeAndBalance));
|
||||||
|
$('.start_reconcile').show();
|
||||||
|
$('.initial_instructions').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
@ -131,6 +131,7 @@
|
|||||||
var transactionsUri = '{{ transactionsUri }}';
|
var transactionsUri = '{{ transactionsUri }}';
|
||||||
var overviewUri = '{{ overviewUri }}';
|
var overviewUri = '{{ overviewUri }}';
|
||||||
var indexUri = '{{ indexUri }}';
|
var indexUri = '{{ indexUri }}';
|
||||||
|
var selectRangeAndBalance = '{{ 'select_range_and_balance'|_|escape('js') }}';
|
||||||
</script>
|
</script>
|
||||||
<script src="v1/js/ff/accounts/reconcile.js?v={{ FF_VERSION }}" type="text/javascript" nonce="{{ JS_NONCE }}"></script>
|
<script src="v1/js/ff/accounts/reconcile.js?v={{ FF_VERSION }}" type="text/javascript" nonce="{{ JS_NONCE }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user