Various code fixes.

This commit is contained in:
James Cole 2016-02-10 16:23:37 +01:00
parent 426351bb54
commit 3e502db772
6 changed files with 12 additions and 14 deletions

View File

@ -89,7 +89,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
'type' => strtolower($journal->transactionType->type), 'type' => strtolower($journal->transactionType->type),
'description' => $journal->description, 'description' => $journal->description,
'journal_id' => $journal->id, 'journal_id' => $journal->id,
'date' => $journal->date->formatLocalized(trans('config.month_and_day')), 'date' => $journal->date->formatLocalized(strval(trans('config.month_and_day'))),
'amount' => Amount::formatJournal($journal, false), 'amount' => Amount::formatJournal($journal, false),
]; ];
$string = trans('firefly.attachment_explanation', $args) . "\n"; $string = trans('firefly.attachment_explanation', $args) . "\n";

View File

@ -80,7 +80,7 @@ class AuthController extends Controller
if (strlen($code) == 0) { if (strlen($code) == 0) {
$code = 'general_blocked'; $code = 'general_blocked';
} }
$message = trans('firefly.' . $code . '_error', ['email' => $credentials['email']]); $message = strval(trans('firefly.' . $code . '_error', ['email' => $credentials['email']]));
} }
if ($throttles) { if ($throttles) {

View File

@ -87,7 +87,7 @@ Breadcrumbs::register(
$object = $attachment->attachable; $object = $attachment->attachable;
if ($object instanceof TransactionJournal) { if ($object instanceof TransactionJournal) {
$breadcrumbs->parent('transactions.show', $object); $breadcrumbs->parent('transactions.show', $object);
$breadcrumbs->push($attachment->filename, route('attachments.edit', $attachment)); $breadcrumbs->push($attachment->filename, route('attachments.edit', [$attachment]));
} else { } else {
throw new FireflyException('Cannot make breadcrumb for attachment connected to object of type ' . get_class($object)); throw new FireflyException('Cannot make breadcrumb for attachment connected to object of type ' . get_class($object));
@ -101,7 +101,7 @@ Breadcrumbs::register(
$object = $attachment->attachable; $object = $attachment->attachable;
if ($object instanceof TransactionJournal) { if ($object instanceof TransactionJournal) {
$breadcrumbs->parent('transactions.show', $object); $breadcrumbs->parent('transactions.show', $object);
$breadcrumbs->push(trans('firefly.delete_attachment', ['name' => $attachment->filename]), route('attachments.edit', $attachment)); $breadcrumbs->push(trans('firefly.delete_attachment', ['name' => $attachment->filename]), route('attachments.edit', [$attachment]));
} else { } else {
throw new FireflyException('Cannot make breadcrumb for attachment connected to object of type ' . get_class($object)); throw new FireflyException('Cannot make breadcrumb for attachment connected to object of type ' . get_class($object));
@ -440,19 +440,19 @@ Breadcrumbs::register(
Breadcrumbs::register( Breadcrumbs::register(
'rules.rule.create', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { 'rules.rule.create', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) {
$breadcrumbs->parent('rules.index'); $breadcrumbs->parent('rules.index');
$breadcrumbs->push(trans('firefly.make_new_rule', ['title' => $ruleGroup->title]), route('rules.rule.create', $ruleGroup)); $breadcrumbs->push(trans('firefly.make_new_rule', ['title' => $ruleGroup->title]), route('rules.rule.create', [$ruleGroup]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'rules.rule.edit', function (BreadCrumbGenerator $breadcrumbs, Rule $rule) { 'rules.rule.edit', function (BreadCrumbGenerator $breadcrumbs, Rule $rule) {
$breadcrumbs->parent('rules.index'); $breadcrumbs->parent('rules.index');
$breadcrumbs->push(trans('firefly.edit_rule', ['title' => $rule->title]), route('rules.rule.edit', $rule)); $breadcrumbs->push(trans('firefly.edit_rule', ['title' => $rule->title]), route('rules.rule.edit', [$rule]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'rules.rule.delete', function (BreadCrumbGenerator $breadcrumbs, Rule $rule) { 'rules.rule.delete', function (BreadCrumbGenerator $breadcrumbs, Rule $rule) {
$breadcrumbs->parent('rules.index'); $breadcrumbs->parent('rules.index');
$breadcrumbs->push(trans('firefly.delete_rule', ['title' => $rule->title]), route('rules.rule.delete', $rule)); $breadcrumbs->push(trans('firefly.delete_rule', ['title' => $rule->title]), route('rules.rule.delete', [$rule]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
@ -464,13 +464,13 @@ Breadcrumbs::register(
Breadcrumbs::register( Breadcrumbs::register(
'rules.rule-group.edit', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { 'rules.rule-group.edit', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) {
$breadcrumbs->parent('rules.index'); $breadcrumbs->parent('rules.index');
$breadcrumbs->push(trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]), route('rules.rule-group.edit', $ruleGroup)); $breadcrumbs->push(trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]), route('rules.rule-group.edit', [$ruleGroup]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'rules.rule-group.delete', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { 'rules.rule-group.delete', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) {
$breadcrumbs->parent('rules.index'); $breadcrumbs->parent('rules.index');
$breadcrumbs->push(trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]), route('rules.rule-group.delete', $ruleGroup)); $breadcrumbs->push(trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]), route('rules.rule-group.delete', [$ruleGroup]));
} }
); );

View File

@ -228,7 +228,7 @@ class TestData
Budget::firstOrCreateEncrypted(['name' => 'Car', 'user_id' => $user->id]); Budget::firstOrCreateEncrypted(['name' => 'Car', 'user_id' => $user->id]);
// some empty budgets. // some empty budgets.
foreach (['A', 'B', 'C', 'D', "E"] as $letter) { foreach (['A', 'B', 'C', 'D', 'E'] as $letter) {
Budget::firstOrCreateEncrypted(['name' => 'Empty budget ' . $letter, 'user_id' => $user->id]); Budget::firstOrCreateEncrypted(['name' => 'Empty budget ' . $letter, 'user_id' => $user->id]);
} }
@ -984,7 +984,6 @@ class TestData
foreach (Budget::get() as $budget) { foreach (Budget::get() as $budget) {
if ($budget->name == $name && $user->id == $budget->user_id) { if ($budget->name == $name && $user->id == $budget->user_id) {
return $budget; return $budget;
break;
} }
} }

View File

@ -185,7 +185,7 @@ class Navigation
if (isset($formatMap[$repeatFrequency])) { if (isset($formatMap[$repeatFrequency])) {
return $date->formatLocalized($formatMap[$repeatFrequency]); return $date->formatLocalized(strval($formatMap[$repeatFrequency]));
} }
throw new FireflyException('No date formats for frequency "' . $repeatFrequency . '"!'); throw new FireflyException('No date formats for frequency "' . $repeatFrequency . '"!');
} }

View File

@ -17,7 +17,6 @@ use Twig_SimpleFunction;
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* Class TwigSupport * Class TwigSupport
* @todo these functions should be parameterized.
* *
* @package FireflyIII\Support * @package FireflyIII\Support
*/ */
@ -99,7 +98,7 @@ class General extends Twig_Extension
protected function activeRoutePartialWhat(): Twig_SimpleFunction protected function activeRoutePartialWhat(): Twig_SimpleFunction
{ {
return new Twig_SimpleFunction( return new Twig_SimpleFunction(
'activeRoutePartialWhat', function ($context) : string { 'activeRoutePartialWhat', function ($context) : string {
$args = func_get_args(); $args = func_get_args();
$route = $args[1]; // name of the route. $route = $args[1]; // name of the route.
$what = $args[2]; // name of the route. $what = $args[2]; // name of the route.