mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 03:08:11 +00:00
Updated test database.
This commit is contained in:
@@ -21,7 +21,6 @@ use FireflyIII\Console\Commands\ScanAttachments;
|
|||||||
use FireflyIII\Console\Commands\UpgradeDatabase;
|
use FireflyIII\Console\Commands\UpgradeDatabase;
|
||||||
use FireflyIII\Console\Commands\UpgradeFireflyInstructions;
|
use FireflyIII\Console\Commands\UpgradeFireflyInstructions;
|
||||||
use FireflyIII\Console\Commands\VerifyDatabase;
|
use FireflyIII\Console\Commands\VerifyDatabase;
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -19,9 +19,9 @@ use Illuminate\Auth\Access\AuthorizationException;
|
|||||||
use Illuminate\Auth\AuthenticationException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Request;
|
|
||||||
use Illuminate\Session\TokenMismatchException;
|
use Illuminate\Session\TokenMismatchException;
|
||||||
use Illuminate\Validation\ValidationException as ValException;
|
use Illuminate\Validation\ValidationException as ValException;
|
||||||
|
use Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -672,7 +672,9 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
// join some extra tables:
|
// join some extra tables:
|
||||||
$this->joinedCategory = true;
|
$this->joinedCategory = true;
|
||||||
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
|
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
|
||||||
$this->query->leftJoin('categories as transaction_journal_categories', 'transaction_journal_categories.id', '=', 'category_transaction_journal.category_id');
|
$this->query->leftJoin(
|
||||||
|
'categories as transaction_journal_categories', 'transaction_journal_categories.id', '=', 'category_transaction_journal.category_id'
|
||||||
|
);
|
||||||
|
|
||||||
$this->query->leftJoin('category_transaction', 'category_transaction.transaction_id', '=', 'transactions.id');
|
$this->query->leftJoin('category_transaction', 'category_transaction.transaction_id', '=', 'transactions.id');
|
||||||
$this->query->leftJoin('categories as transaction_categories', 'transaction_categories.id', '=', 'category_transaction.category_id');
|
$this->query->leftJoin('categories as transaction_categories', 'transaction_categories.id', '=', 'category_transaction.category_id');
|
||||||
|
@@ -154,6 +154,7 @@ class LoginController extends Controller
|
|||||||
$code = strlen(strval($foundUser->blocked_code)) > 0 ? $foundUser->blocked_code : 'general_blocked';
|
$code = strlen(strval($foundUser->blocked_code)) > 0 ? $foundUser->blocked_code : 'general_blocked';
|
||||||
$errorMessage = strval(trans('firefly.' . $code . '_error', ['email' => $email]));
|
$errorMessage = strval(trans('firefly.' . $code . '_error', ['email' => $email]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $errorMessage;
|
return $errorMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,11 +26,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
class AvailableBudget extends Model
|
class AvailableBudget extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
/** @var array */
|
|
||||||
protected $fillable = ['user_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date'];
|
|
||||||
|
|
||||||
/** @var array */
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@@ -44,6 +39,10 @@ class AvailableBudget extends Model
|
|||||||
'start_date' => 'date',
|
'start_date' => 'date',
|
||||||
'end_date' => 'date',
|
'end_date' => 'date',
|
||||||
];
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
/** @var array */
|
||||||
|
protected $fillable = ['user_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
|
@@ -30,9 +30,6 @@ class Budget extends Model
|
|||||||
|
|
||||||
use SoftDeletes, ValidatingTrait;
|
use SoftDeletes, ValidatingTrait;
|
||||||
|
|
||||||
/** @var array */
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@@ -46,7 +43,8 @@ class Budget extends Model
|
|||||||
'active' => 'boolean',
|
'active' => 'boolean',
|
||||||
'encrypted' => 'boolean',
|
'encrypted' => 'boolean',
|
||||||
];
|
];
|
||||||
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
protected $fillable = ['user_id', 'name', 'active'];
|
protected $fillable = ['user_id', 'name', 'active'];
|
||||||
protected $hidden = ['encrypted'];
|
protected $hidden = ['encrypted'];
|
||||||
protected $rules = ['name' => 'required|between:1,200',];
|
protected $rules = ['name' => 'required|between:1,200',];
|
||||||
|
@@ -42,13 +42,13 @@ class Category extends Model
|
|||||||
'encrypted' => 'boolean',
|
'encrypted' => 'boolean',
|
||||||
];
|
];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
|
/** @var array */
|
||||||
protected $fillable = ['user_id', 'name'];
|
protected $fillable = ['user_id', 'name'];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $hidden = ['encrypted'];
|
protected $hidden = ['encrypted'];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $rules = ['name' => 'required|between:1,200',];
|
protected $rules = ['name' => 'required|between:1,200',];
|
||||||
/** @var array */
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
|
@@ -32,11 +32,6 @@ interface AttachmentRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function destroy(Attachment $attachment): bool;
|
public function destroy(Attachment $attachment): bool;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function get(): Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
@@ -45,11 +40,9 @@ interface AttachmentRepositoryInterface
|
|||||||
public function exists(Attachment $attachment): bool;
|
public function exists(Attachment $attachment): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Attachment $attachment
|
* @return Collection
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getContent(Attachment $attachment): string;
|
public function get(): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@@ -59,6 +52,13 @@ interface AttachmentRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getBetween(Carbon $start, Carbon $end): Collection;
|
public function getBetween(Carbon $start, Carbon $end): Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Attachment $attachment
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getContent(Attachment $attachment): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
* @param array $attachmentData
|
* @param array $attachmentData
|
||||||
|
@@ -83,6 +83,14 @@ interface BudgetRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getActiveBudgets(): Collection;
|
public function getActiveBudgets(): Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getAllBudgetLimits(Carbon $start, Carbon $end): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@@ -92,14 +100,6 @@ interface BudgetRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string;
|
public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getAllBudgetLimits(Carbon $start, Carbon $end): Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
|
@@ -146,7 +146,6 @@ class CategoryRepository implements CategoryRepositoryInterface
|
|||||||
->orderBy('transaction_journals.date', 'ASC')->first(['transaction_journals.date']);
|
->orderBy('transaction_journals.date', 'ASC')->first(['transaction_journals.date']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// both exist, the one that is earliest "wins".
|
// both exist, the one that is earliest "wins".
|
||||||
if (!is_null($firstTransaction) && !is_null($first) && Carbon::parse($firstTransaction->date)->lt($first)) {
|
if (!is_null($firstTransaction) && !is_null($first) && Carbon::parse($firstTransaction->date)->lt($first)) {
|
||||||
$first = $firstTransaction->date;
|
$first = $firstTransaction->date;
|
||||||
|
@@ -22,6 +22,14 @@ use FireflyIII\Models\ExportJob;
|
|||||||
*/
|
*/
|
||||||
interface ExportJobRepositoryInterface
|
interface ExportJobRepositoryInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param ExportJob $job
|
||||||
|
* @param string $status
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function changeStatus(ExportJob $job, string $status): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -32,14 +40,6 @@ interface ExportJobRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function create(): ExportJob;
|
public function create(): ExportJob;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ExportJob $job
|
|
||||||
* @param string $status
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function changeStatus(ExportJob $job, string $status): bool;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ExportJob $job
|
* @param ExportJob $job
|
||||||
*
|
*
|
||||||
|
@@ -14,7 +14,6 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Repositories\User;
|
namespace FireflyIII\Repositories\User;
|
||||||
|
|
||||||
|
|
||||||
use FireflyConfig;
|
|
||||||
use FireflyIII\Models\BudgetLimit;
|
use FireflyIII\Models\BudgetLimit;
|
||||||
use FireflyIII\Models\Role;
|
use FireflyIII\Models\Role;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
@@ -53,6 +52,20 @@ class UserRepository implements UserRepositoryInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
* @param string $password
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function changePassword(User $user, string $password): bool
|
||||||
|
{
|
||||||
|
$user->password = bcrypt($password);
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@@ -134,17 +147,4 @@ class UserRepository implements UserRepositoryInterface
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param User $user
|
|
||||||
* @param string $password
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function changePassword(User $user, string $password): bool
|
|
||||||
{
|
|
||||||
$user->password = bcrypt($password);
|
|
||||||
$user->save();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Rules;
|
namespace FireflyIII\Rules;
|
||||||
|
|
||||||
use FireflyIII\Helpers\Collector\JournalCollector;
|
|
||||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
|
@@ -243,28 +243,6 @@ class Navigation
|
|||||||
throw new FireflyException(sprintf('No date formats for frequency "%s"!', $repeatFrequency));
|
throw new FireflyException(sprintf('No date formats for frequency "%s"!', $repeatFrequency));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If the date difference between start and end is less than a month, method returns "endOfDay". If the difference is less than a year,
|
|
||||||
* method returns "endOfMonth". If the date difference is larger, method returns "endOfYear".
|
|
||||||
*
|
|
||||||
* @param \Carbon\Carbon $start
|
|
||||||
* @param \Carbon\Carbon $end
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function preferredEndOfPeriod(Carbon $start, Carbon $end): string
|
|
||||||
{
|
|
||||||
$format = 'endOfDay';
|
|
||||||
if ($start->diffInMonths($end) > 1) {
|
|
||||||
$format = 'endOfMonth';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($start->diffInMonths($end) > 12) {
|
|
||||||
$format = 'endOfYear';
|
|
||||||
}
|
|
||||||
return $format;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the date difference between start and end is less than a month, method returns "Y-m-d". If the difference is less than a year,
|
* If the date difference between start and end is less than a month, method returns "Y-m-d". If the difference is less than a year,
|
||||||
* method returns "Y-m". If the date difference is larger, method returns "Y".
|
* method returns "Y-m". If the date difference is larger, method returns "Y".
|
||||||
@@ -284,6 +262,7 @@ class Navigation
|
|||||||
if ($start->diffInMonths($end) > 12) {
|
if ($start->diffInMonths($end) > 12) {
|
||||||
$format = 'Y';
|
$format = 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $format;
|
return $format;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,6 +290,29 @@ class Navigation
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the date difference between start and end is less than a month, method returns "endOfDay". If the difference is less than a year,
|
||||||
|
* method returns "endOfMonth". If the date difference is larger, method returns "endOfYear".
|
||||||
|
*
|
||||||
|
* @param \Carbon\Carbon $start
|
||||||
|
* @param \Carbon\Carbon $end
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function preferredEndOfPeriod(Carbon $start, Carbon $end): string
|
||||||
|
{
|
||||||
|
$format = 'endOfDay';
|
||||||
|
if ($start->diffInMonths($end) > 1) {
|
||||||
|
$format = 'endOfMonth';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($start->diffInMonths($end) > 12) {
|
||||||
|
$format = 'endOfYear';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $format;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the date difference between start and end is less than a month, method returns "1D". If the difference is less than a year,
|
* If the date difference between start and end is less than a month, method returns "1D". If the difference is less than a year,
|
||||||
* method returns "1M". If the date difference is larger, method returns "1Y".
|
* method returns "1M". If the date difference is larger, method returns "1Y".
|
||||||
|
@@ -14,10 +14,8 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Support\Twig;
|
namespace FireflyIII\Support\Twig;
|
||||||
|
|
||||||
|
|
||||||
use Amount;
|
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\Budget as ModelBudget;
|
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
|
17
app/User.php
17
app/User.php
@@ -51,15 +51,6 @@ class User extends Authenticatable
|
|||||||
*/
|
*/
|
||||||
protected $table = 'users';
|
protected $table = 'users';
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return HasMany
|
|
||||||
*/
|
|
||||||
public function availableBudgets(): HasMany
|
|
||||||
{
|
|
||||||
return $this->hasMany('FireflyIII\Models\AvailableBudget');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany
|
* @return HasMany
|
||||||
*/
|
*/
|
||||||
@@ -96,6 +87,14 @@ class User extends Authenticatable
|
|||||||
return $this->hasMany('FireflyIII\Models\Attachment');
|
return $this->hasMany('FireflyIII\Models\Attachment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return HasMany
|
||||||
|
*/
|
||||||
|
public function availableBudgets(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany('FireflyIII\Models\AvailableBudget');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany
|
* @return HasMany
|
||||||
*/
|
*/
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user