diff --git a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php index e5f418e022..607f705538 100644 --- a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php +++ b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php @@ -13,7 +13,6 @@ namespace FireflyIII\Generator\Chart\Budget; use Illuminate\Support\Collection; use Navigation; -use Preferences; /** * Class ChartJsBudgetChartGenerator @@ -29,12 +28,10 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface * * @return array */ - public function budgetLimit(Collection $entries, string $dateFormat = 'monthAndDay'): array + public function budgetLimit(Collection $entries, string $dateFormat = 'month_and_day'): array { - $language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data; - $format = config('firefly.' . $dateFormat . '.' . $language); - - $data = [ + $format = strval(trans('config.' . $dateFormat)); + $data = [ 'labels' => [], 'datasets' => [ [ diff --git a/app/Helpers/Csv/Converter/CurrencyCode.php b/app/Helpers/Csv/Converter/CurrencyCode.php index 1f115aec1c..f9ee3dc585 100644 --- a/app/Helpers/Csv/Converter/CurrencyCode.php +++ b/app/Helpers/Csv/Converter/CurrencyCode.php @@ -35,7 +35,7 @@ class CurrencyCode extends BasicConverter implements ConverterInterface return $currency; } - $currency = $repository->findByCode(intval($this->value)); + $currency = $repository->findByCode($this->value); return $currency; diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 5507097b80..60cc1931e6 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -83,7 +83,6 @@ class BudgetController extends Controller $currentEnd->subDay(); $spent = $repository->spentInPeriod($budgetCollection, new Collection, $currentStart, $currentEnd); $entry = [$first, ($spent * -1)]; - $entries->push($entry); $first = Navigation::addPeriod($first, $range, 0); } @@ -128,7 +127,7 @@ class BudgetController extends Controller $start->addDay(); } - $data = $this->generator->budgetLimit($entries, 'monthAndDay'); + $data = $this->generator->budgetLimit($entries, 'month_and_day'); $cache->store($data); return Response::json($data); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 54f8d2d6a9..172b4c6695 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -170,12 +170,23 @@ class HomeController extends Controller $name = $route->getName(); $methods = $route->getMethods(); - $search = ['{account}', '{what}', '{rule}', '{tj}']; - $replace = [1, 'asset', 1, 1]; - $url = str_replace($search, $replace, $route->getUri()); + $search = [ + '{account}', '{what}', '{rule}', '{tj}', '{category}', '{budget}', '{code}', '{date}', '{attachment}', '{bill}', '{limitrepetition}', + '{currency}', '{jobKey}', '{piggyBank}', '{ruleGroup}', '{rule}', '{route}', '{unfinishedJournal}', + '{reportType}', '{start_date}', '{end_date}', '{accountList}','{tag}','{journalList}' + + ]; + $replace = [1, 'asset', 1, 1, 1, 1, 'abc', '2016-01-01', 1, 1, 1, 1, 1, 1, 1, 1, 'index', 1, + 'default', '20160101', '20160131', '1,2',1,'1,2' + ]; + if (count($search) != count($replace)) { + echo 'count'; + exit; + } + $url = str_replace($search, $replace, $route->getUri()); if (!is_null($name) && in_array('GET', $methods) && !$this->startsWithAny($ignore, $name)) { - echo '' . $name . '
'; + echo '' . $name . '
' . "\n"; } } @@ -190,7 +201,10 @@ class HomeController extends Controller * * @return bool */ - private function startsWithAny(array $array, string $needle): bool + private + function startsWithAny( + array $array, string $needle + ): bool { foreach ($array as $entry) { if ((substr($needle, 0, strlen($entry)) === $entry)) { diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.php index 8fc42f10b6..d24b9be3ba 100644 --- a/app/Http/Controllers/Popup/ReportController.php +++ b/app/Http/Controllers/Popup/ReportController.php @@ -44,7 +44,7 @@ class ReportController extends Controller */ public function info(Request $request) { - $attributes = $request->get('attributes'); + $attributes = $request->get('attributes') ?? []; $attributes = $this->parseAttributes($attributes); View::share('start', $attributes['startDate']); diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index 85b34ae973..0b908806cd 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -548,12 +548,14 @@ class RuleController extends Controller 'rule-trigger-values' => $request->get('rule-trigger-value'), 'rule-trigger-stop' => $request->get('rule-trigger-stop'), ]; - foreach ($data['rule-triggers'] as $index => $triggerType) { - $triggers[] = [ - 'type' => $triggerType, - 'value' => $data['rule-trigger-values'][$index], - 'stopProcessing' => intval($data['rule-trigger-stop'][$index]) === 1 ? true : false, - ]; + if (is_array($data['rule-triggers'])) { + foreach ($data['rule-triggers'] as $index => $triggerType) { + $triggers[] = [ + 'type' => $triggerType, + 'value' => $data['rule-trigger-values'][$index], + 'stopProcessing' => intval($data['rule-trigger-stop'][$index]) === 1 ? true : false, + ]; + } } return $triggers; diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index baa07bbbc1..cf1a0ca710 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -92,7 +92,7 @@ class TagController extends Controller */ public function delete(Tag $tag) { - $subTitle = trans('firefly.delete_tag', ['name' => $tag->tag]); + $subTitle = trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]); // put previous url in session Session::put('tags.delete.url', URL::previous()); diff --git a/app/Http/routes.php b/app/Http/routes.php index 17f3592a11..977c3fb18c 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -354,8 +354,8 @@ Route::group( Route::get('/transaction/create-split/{unfinishedJournal}', ['uses' => 'Transaction\SplitController@create', 'as' => 'split.journal.create']); Route::post('/transaction/store-split/{unfinishedJournal}', ['uses' => 'Transaction\SplitController@store', 'as' => 'split.journal.store']); - Route::get('/transaction/edit-split/{journal}', ['uses' => 'Transaction\SplitController@edit', 'as' => 'split.journal.edit']); - Route::post('/transaction/edit-split/{journal}', ['uses' => 'Transaction\SplitController@update', 'as' => 'split.journal.update']); + Route::get('/transaction/edit-split/{tj}', ['uses' => 'Transaction\SplitController@edit', 'as' => 'split.journal.edit']); + Route::post('/transaction/edit-split/{tj}', ['uses' => 'Transaction\SplitController@update', 'as' => 'split.journal.update']); /** * Tag Controller */ diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 00bb36d752..4287eb429c 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -317,7 +317,6 @@ class CategoryRepository implements CategoryRepositoryInterface // and left join transaction-category where null category $journalIds = $set->pluck('id')->toArray(); $secondQuery = $this->user->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transaction.transaction_journal_id') ->leftJoin('category_transaction', 'category_transaction.transaction_id', '=', 'transactions.id') ->whereNull('category_transaction.id') ->whereIn('transaction_journals.id', $journalIds); diff --git a/app/Support/Migration/TestData.php b/app/Support/Migration/TestData.php index d2bd2b42aa..63c65d4c1c 100644 --- a/app/Support/Migration/TestData.php +++ b/app/Support/Migration/TestData.php @@ -110,11 +110,11 @@ class TestData 'attachable_type' => $attachment['attachable_type'], 'user_id' => $attachment['user_id'], 'md5' => md5($attachment['content']), - 'filename' => $attachment['filename'], - 'title' => $attachment['title'], - 'description' => $attachment['description'], - 'notes' => $attachment['notes'], - 'mime' => $attachment['mime'], + 'filename' => Crypt::encrypt($attachment['filename']), + 'title' => Crypt::encrypt($attachment['title']), + 'description' => Crypt::encrypt($attachment['description']), + 'notes' => Crypt::encrypt($attachment['notes']), + 'mime' => Crypt::encrypt($attachment['mime']), 'size' => strlen($attachment['content']), 'uploaded' => 1, ] @@ -664,6 +664,18 @@ class TestData ); } } + + foreach ($this->data['piggy-events'] as $event) { + DB::table('piggy_bank_events')->insert( + [ + 'created_at' => $this->time, + 'updated_at' => $this->time, + 'piggy_bank_id' => $event['piggy_bank_id'], + 'date' => $event['date'], + 'amount' => $event['amount'], + ] + ); + } } /** diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php index aa519155c5..717c7d364b 100644 --- a/app/Support/Preferences.php +++ b/app/Support/Preferences.php @@ -35,9 +35,7 @@ class Preferences if (Cache::has($fullName)) { Cache::forget($fullName); } - /** @var Preference $preference */ - $preference = Preference::where('user_id', Auth::user()->id)->where('name', $name)->first(); - $preference->delete(); + Preference::where('user_id', Auth::user()->id)->where('name', $name)->delete(); return true; } diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.php index 9abd56a515..fd4158cf49 100644 --- a/app/Support/Twig/Journal.php +++ b/app/Support/Twig/Journal.php @@ -293,7 +293,7 @@ class Journal extends Twig_Extension $set = Category::distinct()->leftJoin('category_transaction', 'categories.id', '=', 'category_transaction.category_id') ->leftJoin('transactions', 'category_transaction.transaction_id', '=', 'transactions.id') ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('categories.user_ud', $journal->user_id) + ->where('categories.user_id', $journal->user_id) ->where('transaction_journals.id', $journal->id) ->get(['categories.*']); /** @var Category $category */ diff --git a/resources/views/tags/show.twig b/resources/views/tags/show.twig index 9d1999bf4a..07053aebd4 100644 --- a/resources/views/tags/show.twig +++ b/resources/views/tags/show.twig @@ -94,7 +94,7 @@ -
+
{% include 'list/journals.twig' %}