mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-21 11:48:53 +00:00
Remove unused functions.
This commit is contained in:
@@ -24,21 +24,27 @@ namespace FireflyIII\Http\Controllers\Transaction;
|
||||
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Events\UpdatedTransactionJournal;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Requests\SplitJournalFormRequest;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use FireflyIII\Transformers\TransactionTransformer;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Preferences;
|
||||
use Session;
|
||||
use Steam;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use View;
|
||||
|
||||
/**
|
||||
@@ -91,6 +97,7 @@ class SplitController extends Controller
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function edit(Request $request, TransactionJournal $journal)
|
||||
{
|
||||
@@ -178,6 +185,7 @@ class SplitController extends Controller
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function arrayFromJournal(Request $request, TransactionJournal $journal): array
|
||||
{
|
||||
@@ -219,43 +227,28 @@ class SplitController extends Controller
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function getTransactionDataFromJournal(TransactionJournal $journal): array
|
||||
{
|
||||
$transactions = $this->tasker->getTransactionsOverview($journal);
|
||||
$return = [];
|
||||
/** @var array $transaction */
|
||||
foreach ($transactions as $index => $transaction) {
|
||||
$set = [
|
||||
'description' => $transaction['description'],
|
||||
'source_account_id' => $transaction['source_account_id'],
|
||||
'source_account_name' => $transaction['source_account_name'],
|
||||
'destination_account_id' => $transaction['destination_account_id'],
|
||||
'destination_account_name' => $transaction['destination_account_name'],
|
||||
'amount' => round($transaction['destination_amount'], 12),
|
||||
'budget_id' => isset($transaction['budget_id']) ? intval($transaction['budget_id']) : 0,
|
||||
'category' => $transaction['category'],
|
||||
'transaction_currency_id' => $transaction['transaction_currency_id'],
|
||||
'transaction_currency_code' => $transaction['transaction_currency_code'],
|
||||
'transaction_currency_symbol' => $transaction['transaction_currency_symbol'],
|
||||
'foreign_amount' => round($transaction['foreign_destination_amount'], 12),
|
||||
'foreign_currency_id' => $transaction['foreign_currency_id'],
|
||||
'foreign_currency_code' => $transaction['foreign_currency_code'],
|
||||
'foreign_currency_symbol' => $transaction['foreign_currency_symbol'],
|
||||
];
|
||||
// set initial category and/or budget:
|
||||
if ($set['budget_id'] === 0) {
|
||||
$set['budget_id'] = $this->repository->getJournalBudgetId($journal);
|
||||
}
|
||||
if (strlen($set['category']) === 0) {
|
||||
$set['category'] = $this->repository->getJournalCategoryName($journal);
|
||||
}
|
||||
// use collector to collect transactions.
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation();
|
||||
// filter on specific journals.
|
||||
$collector->setJournals(new Collection([$journal]));
|
||||
$set = $collector->getJournals();
|
||||
$transactions = [];
|
||||
$transformer = new TransactionTransformer(new ParameterBag);
|
||||
|
||||
|
||||
$return[] = $set;
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($set as $transaction) {
|
||||
if ($transaction->transaction_amount > 0) {
|
||||
$transactions[] = $transformer->transform($transaction);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
return $transactions;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,14 +270,14 @@ class SplitController extends Controller
|
||||
continue;
|
||||
}
|
||||
// take some info from first transaction, that should at least exist.
|
||||
$array[$index] = $row;
|
||||
$array[$index]['transaction_currency_id'] = $array[0]['transaction_currency_id'];
|
||||
$array[$index]['transaction_currency_code'] = $array[0]['transaction_currency_code'];
|
||||
$array[$index]['transaction_currency_symbol'] = $array[0]['transaction_currency_symbol'];
|
||||
$array[$index]['foreign_amount'] = round($array[0]['foreign_destination_amount'] ?? '0', 12);
|
||||
$array[$index]['foreign_currency_id'] = $array[0]['foreign_currency_id'];
|
||||
$array[$index]['foreign_currency_code'] = $array[0]['foreign_currency_code'];
|
||||
$array[$index]['foreign_currency_symbol'] = $array[0]['foreign_currency_symbol'];
|
||||
$array[$index] = $row;
|
||||
$array[$index]['currency_id'] = $array[0]['transaction_currency_id'];
|
||||
$array[$index]['currency_code'] = $array[0]['transaction_currency_code'];
|
||||
$array[$index]['currency_symbol'] = $array[0]['transaction_currency_symbol'];
|
||||
$array[$index]['foreign_amount'] = round($array[0]['foreign_destination_amount'] ?? '0', 12);
|
||||
$array[$index]['foreign_currency_id'] = $array[0]['foreign_currency_id'];
|
||||
$array[$index]['foreign_currency_code'] = $array[0]['foreign_currency_code'];
|
||||
$array[$index]['foreign_currency_symbol'] = $array[0]['foreign_currency_symbol'];
|
||||
}
|
||||
|
||||
return $array;
|
||||
|
Reference in New Issue
Block a user