mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 01:41:14 -06:00
Fix #2637
This commit is contained in:
parent
3ff8aa7509
commit
21f98be3e7
@ -41,6 +41,7 @@ use FireflyIII\Transformers\TransactionGroupTransformer;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use League\Fractal\Resource\Collection as FractalCollection;
|
||||
use League\Fractal\Resource\Item;
|
||||
@ -87,15 +88,18 @@ class TransactionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $transactionJournal
|
||||
* @param TransactionGroup $transactionGroup
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function attachments(TransactionJournal $transactionJournal): JsonResponse
|
||||
public function attachments(TransactionGroup $transactionGroup): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
$attachments = $this->journalAPIRepository->getAttachments($transactionJournal);
|
||||
$attachments = new Collection;
|
||||
foreach ($transactionGroup->transactionJournals as $transactionJournal) {
|
||||
$attachments = $this->journalAPIRepository->getAttachments($transactionJournal)->merge($attachments);
|
||||
}
|
||||
|
||||
/** @var AttachmentTransformer $transformer */
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
@ -189,15 +193,18 @@ class TransactionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $transactionJournal
|
||||
* @param TransactionGroup $transactionGroup
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function piggyBankEvents(TransactionJournal $transactionJournal): JsonResponse
|
||||
public function piggyBankEvents(TransactionGroup $transactionGroup): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
$events = $this->journalAPIRepository->getPiggyBankEvents($transactionJournal);
|
||||
$events = new Collection;
|
||||
foreach ($transactionGroup->transactionJournals as $transactionJournal) {
|
||||
$events = $this->journalAPIRepository->getPiggyBankEvents($transactionJournal)->merge($events);
|
||||
}
|
||||
|
||||
/** @var PiggyBankEventTransformer $transformer */
|
||||
$transformer = app(PiggyBankEventTransformer::class);
|
||||
|
@ -15,7 +15,7 @@
|
||||
{% endif %}
|
||||
<td>
|
||||
{% if event.transaction_journal_id %}
|
||||
<a href="{{ route('transactions.show',event.transaction_journal_id) }}"
|
||||
<a href="{{ route('transactions.show',event.transactionJournal.transaction_group_id) }}"
|
||||
title="{{ event.transactionJournal.description }}">{{ event.date.formatLocalized(monthAndDayFormat) }}</a>
|
||||
{% else %}
|
||||
{{ event.date.formatLocalized(monthAndDayFormat) }}
|
||||
|
@ -423,8 +423,8 @@ Route::group(
|
||||
Route::get('', ['uses' => 'TransactionController@index', 'as' => 'index']);
|
||||
Route::post('', ['uses' => 'TransactionController@store', 'as' => 'store']);
|
||||
Route::get('{transactionGroup}', ['uses' => 'TransactionController@show', 'as' => 'show']);
|
||||
Route::get('{transactionJournal}/attachments', ['uses' => 'TransactionController@attachments', 'as' => 'attachments']);
|
||||
Route::get('{transactionJournal}/piggy_bank_events', ['uses' => 'TransactionController@piggyBankEvents', 'as' => 'piggy_bank_events']);
|
||||
Route::get('{transactionGroup}/attachments', ['uses' => 'TransactionController@attachments', 'as' => 'attachments']);
|
||||
Route::get('{transactionGroup}/piggy_bank_events', ['uses' => 'TransactionController@piggyBankEvents', 'as' => 'piggy_bank_events']);
|
||||
Route::put('{transactionGroup}', ['uses' => 'TransactionController@update', 'as' => 'update']);
|
||||
Route::delete('{transactionGroup}/{transactionJournal}', ['uses' => 'TransactionController@deleteJournal', 'as' => 'delete-journal']);
|
||||
Route::delete('{transactionGroup}', ['uses' => 'TransactionController@delete', 'as' => 'delete']);
|
||||
|
Loading…
Reference in New Issue
Block a user