mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
A set of small fixes, courtesy of scrutinizer-ci
This commit is contained in:
parent
9155c13e08
commit
28fdad9426
@ -119,7 +119,7 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator
|
|||||||
public function single(Account $account, Carbon $start, Carbon $end)
|
public function single(Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
// language:
|
// language:
|
||||||
$format = trans('config.month_and_day');
|
$format = (string)trans('config.month_and_day');
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
|
@ -49,7 +49,7 @@ class ChartJsBillChartGenerator implements BillChartGenerator
|
|||||||
*/
|
*/
|
||||||
public function single(Bill $bill, Collection $entries)
|
public function single(Bill $bill, Collection $entries)
|
||||||
{
|
{
|
||||||
$format = trans('config.month');
|
$format = (string)trans('config.month');
|
||||||
$data = [
|
$data = [
|
||||||
'count' => 3,
|
'count' => 3,
|
||||||
'labels' => [],
|
'labels' => [],
|
||||||
|
@ -149,7 +149,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator
|
|||||||
public function year(Collection $budgets, Collection $entries)
|
public function year(Collection $budgets, Collection $entries)
|
||||||
{
|
{
|
||||||
// language:
|
// language:
|
||||||
$format = trans('config.month');
|
$format = (string)trans('config.month');
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'labels' => [],
|
'labels' => [],
|
||||||
|
@ -59,7 +59,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator
|
|||||||
{
|
{
|
||||||
|
|
||||||
// language:
|
// language:
|
||||||
$format = trans('config.month');
|
$format = (string)trans('config.month');
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'count' => 0,
|
'count' => 0,
|
||||||
@ -170,7 +170,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator
|
|||||||
{
|
{
|
||||||
|
|
||||||
// language:
|
// language:
|
||||||
$format = trans('config.month');
|
$format = (string)trans('config.month');
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'count' => 0,
|
'count' => 0,
|
||||||
|
@ -84,7 +84,7 @@ class ChartJsReportChartGenerator implements ReportChartGenerator
|
|||||||
public function yearInOut(Collection $entries)
|
public function yearInOut(Collection $entries)
|
||||||
{
|
{
|
||||||
// language:
|
// language:
|
||||||
$format = trans('config.month');
|
$format = (string)trans('config.month');
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'count' => 2,
|
'count' => 2,
|
||||||
|
@ -22,9 +22,9 @@ class Controller extends BaseController
|
|||||||
{
|
{
|
||||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||||
|
|
||||||
/** @var string|\Symfony\Component\Translation\TranslatorInterface */
|
/** @var string */
|
||||||
protected $monthAndDayFormat;
|
protected $monthAndDayFormat;
|
||||||
/** @var string|\Symfony\Component\Translation\TranslatorInterface */
|
/** @var string */
|
||||||
protected $monthFormat;
|
protected $monthFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,8 +40,8 @@ class Controller extends BaseController
|
|||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$pref = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'));
|
$pref = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'));
|
||||||
$lang = $pref->data;
|
$lang = $pref->data;
|
||||||
$this->monthFormat = trans('config.month');
|
$this->monthFormat = (string)trans('config.month');
|
||||||
$this->monthAndDayFormat = trans('config.month_and_day');
|
$this->monthAndDayFormat = (string)trans('config.month_and_day');
|
||||||
|
|
||||||
App::setLocale($lang);
|
App::setLocale($lang);
|
||||||
Carbon::setLocale(substr($lang, 0, 2));
|
Carbon::setLocale(substr($lang, 0, 2));
|
||||||
|
@ -355,7 +355,10 @@ Breadcrumbs::register(
|
|||||||
$breadcrumbs->parent('reports.index');
|
$breadcrumbs->parent('reports.index');
|
||||||
|
|
||||||
$monthFormat = (string)trans('config.month_and_day');
|
$monthFormat = (string)trans('config.month_and_day');
|
||||||
$title = (string)trans('firefly.report_' . $reportType, ['start' => $start->formatLocalized($monthFormat), 'end' => $end->formatLocalized($monthFormat)]);
|
$title = (string)trans(
|
||||||
|
'firefly.report_' . $reportType,
|
||||||
|
['start' => $start->formatLocalized($monthFormat), 'end' => $end->formatLocalized($monthFormat)]
|
||||||
|
);
|
||||||
|
|
||||||
$breadcrumbs->push($title, route('reports.report', [$reportType, $start->format('Ymd'), $end->format('Ymd'), $accountIds]));
|
$breadcrumbs->push($title, route('reports.report', [$reportType, $start->format('Ymd'), $end->format('Ymd'), $accountIds]));
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,11 @@ class Account extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes, ValidatingTrait;
|
use SoftDeletes, ValidatingTrait;
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
/** @var array */
|
||||||
protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
|
protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
|
||||||
|
/** @var array */
|
||||||
protected $hidden = ['virtual_balance_encrypted', 'encrypted'];
|
protected $hidden = ['virtual_balance_encrypted', 'encrypted'];
|
||||||
protected $rules
|
protected $rules
|
||||||
= [
|
= [
|
||||||
@ -52,6 +55,8 @@ class Account extends Model
|
|||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'active' => 'required|boolean',
|
'active' => 'required|boolean',
|
||||||
];
|
];
|
||||||
|
/** @var bool */
|
||||||
|
private $joinedAccountTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
|
@ -26,6 +26,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property string $dateFormatted
|
* @property string $dateFormatted
|
||||||
* @property string $budgeted
|
* @property string $budgeted
|
||||||
* @property float $amount
|
* @property float $amount
|
||||||
|
* @property Carbon $date
|
||||||
*/
|
*/
|
||||||
class Budget extends Model
|
class Budget extends Model
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property-read User $user
|
* @property-read User $user
|
||||||
* @property string $dateFormatted
|
* @property string $dateFormatted
|
||||||
* @property float $spent
|
* @property float $spent
|
||||||
|
* @property Carbon $lastActivity
|
||||||
*/
|
*/
|
||||||
class Category extends Model
|
class Category extends Model
|
||||||
{
|
{
|
||||||
|
@ -27,11 +27,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property integer $zoomLevel
|
* @property integer $zoomLevel
|
||||||
* @property-read Collection|TransactionJournal[] $transactionjournals
|
* @property-read Collection|TransactionJournal[] $transactionjournals
|
||||||
* @property-read User $user
|
* @property-read User $user
|
||||||
|
* @property int $account_id
|
||||||
*/
|
*/
|
||||||
class Tag extends Model
|
class Tag extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode'];
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'date'];
|
protected $dates = ['created_at', 'updated_at', 'date'];
|
||||||
|
protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
@ -66,30 +67,18 @@ class Tag extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the model to the database.
|
* @param Tag $value
|
||||||
*
|
*
|
||||||
* @param array $options
|
* @return Tag
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function save(array $options = [])
|
public static function routeBinder(Tag $value)
|
||||||
{
|
{
|
||||||
foreach ($this->transactionjournals()->get() as $journal) {
|
if (Auth::check()) {
|
||||||
$count = $journal->tags()->count();
|
if ($value->user_id == Auth::user()->id) {
|
||||||
$journal->tag_count = $count;
|
return $value;
|
||||||
$journal->save();
|
}
|
||||||
}
|
}
|
||||||
|
throw new NotFoundHttpException;
|
||||||
return parent::save($options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
||||||
*/
|
|
||||||
public function transactionjournals()
|
|
||||||
{
|
|
||||||
return $this->belongsToMany('FireflyIII\Models\TransactionJournal');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,6 +109,24 @@ class Tag extends Model
|
|||||||
return Crypt::decrypt($value);
|
return Crypt::decrypt($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the model to the database.
|
||||||
|
*
|
||||||
|
* @param array $options
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function save(array $options = [])
|
||||||
|
{
|
||||||
|
foreach ($this->transactionjournals()->get() as $journal) {
|
||||||
|
$count = $journal->tags()->count();
|
||||||
|
$journal->tag_count = $count;
|
||||||
|
$journal->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::save($options);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
@ -140,6 +147,15 @@ class Tag extends Model
|
|||||||
$this->attributes['tag'] = Crypt::encrypt($value);
|
$this->attributes['tag'] = Crypt::encrypt($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||||
|
*/
|
||||||
|
public function transactionjournals()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany('FireflyIII\Models\TransactionJournal');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
@ -150,20 +166,4 @@ class Tag extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Tag $value
|
|
||||||
*
|
|
||||||
* @return Tag
|
|
||||||
*/
|
|
||||||
public static function routeBinder(Tag $value)
|
|
||||||
{
|
|
||||||
if (Auth::check()) {
|
|
||||||
if ($value->user_id == Auth::user()->id) {
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new NotFoundHttpException;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ use Watson\Validating\ValidatingTrait;
|
|||||||
* @property float $journalAmount
|
* @property float $journalAmount
|
||||||
* @property int $account_id
|
* @property int $account_id
|
||||||
* @property int $budget_id
|
* @property int $budget_id
|
||||||
|
* @property string $account_name
|
||||||
* @method static Builder|TransactionJournal accountIs($account)
|
* @method static Builder|TransactionJournal accountIs($account)
|
||||||
* @method static Builder|TransactionJournal after($date)
|
* @method static Builder|TransactionJournal after($date)
|
||||||
* @method static Builder|TransactionJournal before($date)
|
* @method static Builder|TransactionJournal before($date)
|
||||||
@ -61,12 +62,16 @@ class TransactionJournal extends Model
|
|||||||
use SoftDeletes, ValidatingTrait;
|
use SoftDeletes, ValidatingTrait;
|
||||||
|
|
||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at'];
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at'];
|
||||||
|
/** @var array */
|
||||||
protected $fillable
|
protected $fillable
|
||||||
= ['user_id', 'transaction_type_id', 'bill_id', 'transaction_currency_id', 'description', 'completed', 'date', 'encrypted', 'tag_count'];
|
= ['user_id', 'transaction_type_id', 'bill_id', 'transaction_currency_id', 'description', 'completed', 'date', 'encrypted', 'tag_count'];
|
||||||
|
/** @var array */
|
||||||
protected $hidden = ['encrypted'];
|
protected $hidden = ['encrypted'];
|
||||||
|
/** @var array */
|
||||||
protected $rules
|
protected $rules
|
||||||
= [
|
= [
|
||||||
'user_id' => 'required|exists:users,id',
|
'user_id' => 'required|exists:users,id',
|
||||||
'transaction_type_id' => 'required|exists:transaction_types,id',
|
'transaction_type_id' => 'required|exists:transaction_types,id',
|
||||||
'bill_id' => 'exists:bills,id',
|
'bill_id' => 'exists:bills,id',
|
||||||
@ -77,6 +82,9 @@ class TransactionJournal extends Model
|
|||||||
'encrypted' => 'required|boolean',
|
'encrypted' => 'required|boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $joinedTransactionTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $value
|
* @param $value
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user