mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Optimized some code.
This commit is contained in:
parent
516725456f
commit
d67db74ca2
@ -227,11 +227,10 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param bool $shared
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function spentNoBudget(Account $account, Carbon $start, Carbon $end, $shared = false)
|
public function spentNoBudget(Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
Auth::user()->transactionjournals()
|
Auth::user()->transactionjournals()
|
||||||
|
@ -71,11 +71,10 @@ interface ReportQueryInterface
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param bool $shared
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function spentNoBudget(Account $account, Carbon $start, Carbon $end, $shared = false);
|
public function spentNoBudget(Account $account, Carbon $start, Carbon $end);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -229,16 +229,13 @@ class CsvController extends Controller
|
|||||||
public function map()
|
public function map()
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
// Make sure all fields we need are accounted for.
|
||||||
* Make sure all fields we need are accounted for.
|
|
||||||
*/
|
|
||||||
$fields = ['csv-file', 'csv-date-format', 'csv-has-headers', 'csv-map', 'csv-roles'];
|
$fields = ['csv-file', 'csv-date-format', 'csv-has-headers', 'csv-map', 'csv-roles'];
|
||||||
if (!$this->wizard->sessionHasValues($fields)) {
|
if (!$this->wizard->sessionHasValues($fields)) {
|
||||||
Session::flash('warning', 'Could not recover upload.');
|
Session::flash('warning', 'Could not recover upload.');
|
||||||
|
|
||||||
return redirect(route('csv.index'));
|
return redirect(route('csv.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The "options" array contains all options the user has
|
* The "options" array contains all options the user has
|
||||||
* per column, where the key represents the column.
|
* per column, where the key represents the column.
|
||||||
@ -246,8 +243,6 @@ class CsvController extends Controller
|
|||||||
* For each key there is an array which in turn represents
|
* For each key there is an array which in turn represents
|
||||||
* all the options available: grouped by ID.
|
* all the options available: grouped by ID.
|
||||||
*
|
*
|
||||||
* Aka:
|
|
||||||
*
|
|
||||||
* options[column index] = [
|
* options[column index] = [
|
||||||
* field id => field identifier.
|
* field id => field identifier.
|
||||||
* ]
|
* ]
|
||||||
@ -258,9 +253,7 @@ class CsvController extends Controller
|
|||||||
return view('error', ['message' => $e->getMessage()]);
|
return view('error', ['message' => $e->getMessage()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// After these values are prepped, read the actual CSV file
|
||||||
* After these values are prepped, read the actual CSV file
|
|
||||||
*/
|
|
||||||
$reader = $this->data->getReader();
|
$reader = $this->data->getReader();
|
||||||
$map = $this->data->getMap();
|
$map = $this->data->getMap();
|
||||||
$hasHeaders = $this->data->getHasHeaders();
|
$hasHeaders = $this->data->getHasHeaders();
|
||||||
|
@ -220,9 +220,9 @@ class TagController extends Controller
|
|||||||
public function store(TagFormRequest $request, TagRepositoryInterface $repository)
|
public function store(TagFormRequest $request, TagRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
if (Input::get('setTag') == 'true') {
|
if (Input::get('setTag') == 'true') {
|
||||||
$latitude = strlen($request->get('latitude')) > 0 ? $request->get('latitude') : null;
|
$latitude = $request->get('latitude');
|
||||||
$longitude = strlen($request->get('longitude')) > 0 ? $request->get('longitude') : null;
|
$longitude = $request->get('longitude');
|
||||||
$zoomLevel = strlen($request->get('zoomLevel')) > 0 ? $request->get('zoomLevel') : null;
|
$zoomLevel = $request->get('zoomLevel');
|
||||||
} else {
|
} else {
|
||||||
$latitude = null;
|
$latitude = null;
|
||||||
$longitude = null;
|
$longitude = null;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Config;
|
||||||
use ExpandedForm;
|
use ExpandedForm;
|
||||||
use FireflyIII\Events\JournalCreated;
|
use FireflyIII\Events\JournalCreated;
|
||||||
use FireflyIII\Events\JournalSaved;
|
use FireflyIII\Events\JournalSaved;
|
||||||
@ -189,28 +190,9 @@ class TransactionController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(JournalRepositoryInterface $repository, $what)
|
public function index(JournalRepositoryInterface $repository, $what)
|
||||||
{
|
{
|
||||||
$types = [];
|
$subTitleIcon = Config::get('firefly.transactionIconsByWhat.' . $what);
|
||||||
switch ($what) {
|
$types = Config::get('firefly.transactionTypesByWhat.' . $what);
|
||||||
case 'expenses':
|
$subTitle = trans('firefly.title_' . $what);
|
||||||
case 'withdrawal':
|
|
||||||
$subTitleIcon = 'fa-long-arrow-left';
|
|
||||||
$subTitle = trans('firefly.expenses');
|
|
||||||
$types = ['Withdrawal'];
|
|
||||||
break;
|
|
||||||
case 'revenue':
|
|
||||||
case 'deposit':
|
|
||||||
$subTitleIcon = 'fa-long-arrow-right';
|
|
||||||
$subTitle = trans('firefly.income');
|
|
||||||
$types = ['Deposit'];
|
|
||||||
break;
|
|
||||||
case 'transfer':
|
|
||||||
case 'transfers':
|
|
||||||
$subTitleIcon = 'fa-exchange';
|
|
||||||
$subTitle = trans('firefly.transfers');
|
|
||||||
$types = ['Transfer'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$page = intval(Input::get('page'));
|
$page = intval(Input::get('page'));
|
||||||
$offset = $page > 0 ? ($page - 1) * 50 : 0;
|
$offset = $page > 0 ? ($page - 1) * 50 : 0;
|
||||||
$journals = $repository->getJournalsOfTypes($types, $offset, $page);
|
$journals = $repository->getJournalsOfTypes($types, $offset, $page);
|
||||||
|
@ -102,6 +102,24 @@ return [
|
|||||||
'en' => ['en', 'English', 'en_US', 'en_US.utf8'],
|
'en' => ['en', 'English', 'en_US', 'en_US.utf8'],
|
||||||
'nl' => ['nl', 'Dutch', 'nl_NL', 'nl_NL.utf8'],
|
'nl' => ['nl', 'Dutch', 'nl_NL', 'nl_NL.utf8'],
|
||||||
],
|
],
|
||||||
|
'transactionTypesByWhat' => [
|
||||||
|
'expenses' => ['Withdrawal'],
|
||||||
|
'withdrawal' => ['Withdrawal'],
|
||||||
|
'revenue' => ['Deposit'],
|
||||||
|
'deposit' => ['Deposit'],
|
||||||
|
'transfer' => ['Transfer'],
|
||||||
|
'transfers' => ['Transfer'],
|
||||||
|
],
|
||||||
|
'transactionIconsByWhat' => [
|
||||||
|
'expenses' => 'fa-long-arrow-left',
|
||||||
|
'withdrawal' => 'fa-long-arrow-left',
|
||||||
|
'revenue' => 'fa-long-arrow-right',
|
||||||
|
'deposit' => 'fa-long-arrow-right',
|
||||||
|
'transfer' => 'fa-exchange',
|
||||||
|
'transfers' => 'fa-exchange',
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
'month' => [
|
'month' => [
|
||||||
'en' => '%B %Y',
|
'en' => '%B %Y',
|
||||||
'nl' => '%B %Y',
|
'nl' => '%B %Y',
|
||||||
|
@ -19,6 +19,14 @@ return [
|
|||||||
'never' => 'Never',
|
'never' => 'Never',
|
||||||
'search_results_for' => 'Search results for ":query"',
|
'search_results_for' => 'Search results for ":query"',
|
||||||
|
|
||||||
|
// transaction index
|
||||||
|
'title_expenses' => 'Expenses',
|
||||||
|
'title_withdrawal' => 'Expenses',
|
||||||
|
'title_revenue' => 'Revenue / income',
|
||||||
|
'title_deposit' => 'Revenue / income',
|
||||||
|
'title_transfer' => 'Transfers',
|
||||||
|
'title_transfers' => 'Transfers',
|
||||||
|
|
||||||
// csv import:
|
// csv import:
|
||||||
'csv_import' => 'Import CSV file',
|
'csv_import' => 'Import CSV file',
|
||||||
'csv' => 'CSV',
|
'csv' => 'CSV',
|
||||||
|
@ -19,6 +19,14 @@ return [
|
|||||||
'never' => 'Nooit',
|
'never' => 'Nooit',
|
||||||
'search_results_for' => 'Zoekresultaten voor ":query"',
|
'search_results_for' => 'Zoekresultaten voor ":query"',
|
||||||
|
|
||||||
|
// transaction index
|
||||||
|
'title_expenses' => 'Uitgaven',
|
||||||
|
'title_withdrawal' => 'Uitgaven',
|
||||||
|
'title_revenue' => 'Inkomsten',
|
||||||
|
'title_deposit' => 'Inkomsten',
|
||||||
|
'title_transfer' => 'Overboekingen',
|
||||||
|
'title_transfers' => 'Overboekingen',
|
||||||
|
|
||||||
// csv import:
|
// csv import:
|
||||||
'csv_import' => 'Importeer CSV-bestand',
|
'csv_import' => 'Importeer CSV-bestand',
|
||||||
'csv' => 'CSV',
|
'csv' => 'CSV',
|
||||||
@ -39,7 +47,8 @@ return [
|
|||||||
'csv_column_roles_title' => 'Bepaal de inhoud van elke kolom',
|
'csv_column_roles_title' => 'Bepaal de inhoud van elke kolom',
|
||||||
'csv_column_roles_text' => 'Firefly kan niet automatisch ontdekken wat elke kolom betekent. Je moet het zelf aangeven. Gebruik de' .
|
'csv_column_roles_text' => 'Firefly kan niet automatisch ontdekken wat elke kolom betekent. Je moet het zelf aangeven. Gebruik de' .
|
||||||
' voorbeeldgegevens als je het ook niet zeker weet. Klik op het <i class="fa fa-question-circle"></i>-icoontje ' .
|
' voorbeeldgegevens als je het ook niet zeker weet. Klik op het <i class="fa fa-question-circle"></i>-icoontje ' .
|
||||||
'rechtsboven om te ontdekken wat elke kolomsoort precies is. Als de kolominhoud een directe relatie heeft met gegevens' .
|
'rechtsboven om te ontdekken wat elke kolomsoort precies is. Als de kolominhoud een directe relatie heeft met gegevens'
|
||||||
|
.
|
||||||
' die al in Firefly staan, gebruik dan het vinkje. Tijdens de volgende stap komt Firefly hier dan op terug.',
|
' die al in Firefly staan, gebruik dan het vinkje. Tijdens de volgende stap komt Firefly hier dan op terug.',
|
||||||
'csv_column' => 'CSV-kolom',
|
'csv_column' => 'CSV-kolom',
|
||||||
'cvs_column_name' => 'CSV-kolomnaam',
|
'cvs_column_name' => 'CSV-kolomnaam',
|
||||||
@ -88,7 +97,8 @@ return [
|
|||||||
'Firefly is klaar om je bestand te importeren. De instellingen en selecties die je zojuist hebt gemaakt kan je downloaden'
|
'Firefly is klaar om je bestand te importeren. De instellingen en selecties die je zojuist hebt gemaakt kan je downloaden'
|
||||||
. ' en opslaan. Bij de volgende keer kan je dit bestand ook uploaden. Als je kommagescheiden bestand dezelfde indeling'
|
. ' en opslaan. Bij de volgende keer kan je dit bestand ook uploaden. Als je kommagescheiden bestand dezelfde indeling'
|
||||||
. ' heeft, zullen alle selecties goed staan. Dat scheelt weer!',
|
. ' heeft, zullen alle selecties goed staan. Dat scheelt weer!',
|
||||||
'csv_more_information_text' => 'Ook als het importeren fout gaat is dit bestand handig. Na het importeren krijg je nogmaals de gelegenheid dit bestand'
|
'csv_more_information_text' =>
|
||||||
|
'Ook als het importeren fout gaat is dit bestand handig. Na het importeren krijg je nogmaals de gelegenheid dit bestand'
|
||||||
. 'te downloaden.',
|
. 'te downloaden.',
|
||||||
'csv_do_download_config' => 'Download het configuratiebestand',
|
'csv_do_download_config' => 'Download het configuratiebestand',
|
||||||
'csv_process_title' => 'Het importeren is klaar',
|
'csv_process_title' => 'Het importeren is klaar',
|
||||||
|
Loading…
Reference in New Issue
Block a user