Various last minute bug fixes.

This commit is contained in:
James Cole 2016-05-22 15:48:34 +02:00
parent 41430c3bb2
commit 44960e8e42
13 changed files with 56 additions and 35 deletions

View File

@ -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' => [
[

View File

@ -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;

View File

@ -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);

View File

@ -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 '<a href="/' . $url . '" title="' . $name . '">' . $name . '</a><br>';
echo '<a href="/' . $url . '" title="' . $name . '">' . $name . '</a><br>' . "\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)) {

View File

@ -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']);

View File

@ -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;

View File

@ -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());

View File

@ -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
*/

View File

@ -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);

View File

@ -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'],
]
);
}
}
/**

View File

@ -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;
}

View File

@ -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 */

View File

@ -94,7 +94,7 @@
</div>
</div>
</div>
<div class="box-body table-responsive no-padding">
<div class="box-body">
{% include 'list/journals.twig' %}
</div>
</div>