Updated test database.

This commit is contained in:
James Cole
2016-12-30 13:47:23 +01:00
parent ac86e75233
commit a5036c86dc
32 changed files with 119 additions and 123 deletions

View File

@@ -21,7 +21,6 @@ use FireflyIII\Console\Commands\ScanAttachments;
use FireflyIII\Console\Commands\UpgradeDatabase;
use FireflyIII\Console\Commands\UpgradeFireflyInstructions;
use FireflyIII\Console\Commands\VerifyDatabase;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
/**

View File

@@ -19,9 +19,9 @@ use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Request;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException as ValException;
use Request;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**

View File

@@ -672,7 +672,9 @@ class JournalCollector implements JournalCollectorInterface
// join some extra tables:
$this->joinedCategory = true;
$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('categories as transaction_categories', 'transaction_categories.id', '=', 'category_transaction.category_id');

View File

@@ -58,9 +58,9 @@ class ConfigurationController extends Controller
// all available configuration and their default value in case
// they don't exist yet.
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$siteOwner = env('SITE_OWNER');
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$siteOwner = env('SITE_OWNER');
return view(
'admin.configuration.index',

View File

@@ -154,6 +154,7 @@ class LoginController extends Controller
$code = strlen(strval($foundUser->blocked_code)) > 0 ? $foundUser->blocked_code : 'general_blocked';
$errorMessage = strval(trans('firefly.' . $code . '_error', ['email' => $email]));
}
return $errorMessage;
}
}

View File

@@ -91,8 +91,8 @@ class BillController extends Controller
return Response::json($cache->get());
}
$results = $collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->getJournals();
$results = $results->sortBy(
$results = $collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->getJournals();
$results = $results->sortBy(
function (Transaction $transaction) {
return $transaction->date->format('U');
}

View File

@@ -315,7 +315,7 @@ class SingleController extends Controller
$data = $request->getJournalData();
$journal = $repository->update($journal, $data);
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
$this->attachments->saveAttachmentsForModel($journal, $files);
// flash errors

View File

@@ -36,8 +36,8 @@ class ConfigurationRequest extends Request
public function getConfigurationData(): array
{
return [
'single_user_mode' => intval($this->get('single_user_mode')) === 1,
'is_demo_site' => intval($this->get('is_demo_site')) === 1,
'single_user_mode' => intval($this->get('single_user_mode')) === 1,
'is_demo_site' => intval($this->get('is_demo_site')) === 1,
];
}
@@ -47,8 +47,8 @@ class ConfigurationRequest extends Request
public function rules()
{
$rules = [
'single_user_mode' => 'between:0,1|numeric',
'is_demo_site' => 'between:0,1|numeric',
'single_user_mode' => 'between:0,1|numeric',
'is_demo_site' => 'between:0,1|numeric',
];
return $rules;

View File

@@ -280,10 +280,10 @@ Breadcrumbs::register(
$title = trans(
'firefly.budget_in_period_breadcrumb', [
'name' => $budget->name,
'start' => $budgetLimit->start_date->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $budgetLimit->end_date->formatLocalized(strval(trans('config.month_and_day'))),
]
'name' => $budget->name,
'start' => $budgetLimit->start_date->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $budgetLimit->end_date->formatLocalized(strval(trans('config.month_and_day'))),
]
);
$breadcrumbs->push(

View File

@@ -35,7 +35,7 @@ class AccountMeta extends Model
'updated_at' => 'date',
];
/** @var array */
protected $dates = ['created_at', 'updated_at'];
protected $dates = ['created_at', 'updated_at'];
protected $fillable = ['account_id', 'name', 'data'];
protected $table = 'account_meta';

View File

@@ -43,7 +43,7 @@ class Attachment extends Model
];
/** @var array */
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
/** @var array */
/** @var array */
protected $fillable = ['attachable_id', 'attachable_type', 'user_id', 'md5', 'filename', 'mime', 'title', 'notes', 'description', 'size', 'uploaded'];
/**

View File

@@ -26,11 +26,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class AvailableBudget extends Model
{
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.
*
@@ -42,8 +37,12 @@ class AvailableBudget extends Model
'updated_at' => 'date',
'deleted_at' => '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

View File

@@ -30,9 +30,6 @@ class Budget extends Model
use SoftDeletes, ValidatingTrait;
/** @var array */
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
/**
* The attributes that should be casted to native types.
*
@@ -46,7 +43,8 @@ class Budget extends Model
'active' => 'boolean',
'encrypted' => 'boolean',
];
/** @var array */
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $fillable = ['user_id', 'name', 'active'];
protected $hidden = ['encrypted'];
protected $rules = ['name' => 'required|between:1,200',];

View File

@@ -41,14 +41,14 @@ class Category extends Model
'deleted_at' => 'date',
'encrypted' => 'boolean',
];
/** @var array */
protected $fillable = ['user_id', 'name'];
/** @var array */
protected $hidden = ['encrypted'];
/** @var array */
protected $rules = ['name' => 'required|between:1,200',];
/** @var array */
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
/** @var array */
protected $fillable = ['user_id', 'name'];
/** @var array */
protected $hidden = ['encrypted'];
/** @var array */
protected $rules = ['name' => 'required|between:1,200',];
/**
* @param array $fields

View File

@@ -33,7 +33,7 @@ class LimitRepetition extends Model
* @var array
*/
protected $casts
= [
= [
'created_at' => 'date',
'updated_at' => 'date',
'startdate' => 'date',

View File

@@ -29,7 +29,7 @@ class Note extends Model
* @var array
*/
protected $casts
= [
= [
'created_at' => 'date',
'updated_at' => 'date',
'deleted_at' => 'date',

View File

@@ -29,7 +29,7 @@ class PiggyBankEvent extends Model
* @var array
*/
protected $casts
= [
= [
'created_at' => 'date',
'updated_at' => 'date',
'date' => 'date',

View File

@@ -31,7 +31,7 @@ class PiggyBankRepetition extends Model
* @var array
*/
protected $casts
= [
= [
'created_at' => 'date',
'updated_at' => 'date',
'deleted_at' => 'date',

View File

@@ -33,7 +33,7 @@ class Preference extends Model
* @var array
*/
protected $casts
= [
= [
'created_at' => 'date',
'updated_at' => 'date',
];

View File

@@ -32,11 +32,11 @@ class RuleGroup extends Model
*/
protected $casts
= [
'created_at' => 'date',
'updated_at' => 'date',
'deleted_at' => 'date',
'active' => 'boolean',
'order' => 'int',
'created_at' => 'date',
'updated_at' => 'date',
'deleted_at' => 'date',
'active' => 'boolean',
'order' => 'int',
];
/** @var array */
protected $dates = ['created_at', 'updated_at', 'deleted_at'];

View File

@@ -32,7 +32,7 @@ class TransactionJournalMeta extends Model
* @var array
*/
protected $casts
= [
= [
'created_at' => 'date',
'updated_at' => 'date',
'deleted_at' => 'date',

View File

@@ -37,13 +37,13 @@ class EventServiceProvider extends ServiceProvider
protected $listen
= [
// new event handlers:
'FireflyIII\Events\RegisteredUser' => // is a User related event.
'FireflyIII\Events\RegisteredUser' => // is a User related event.
[
'FireflyIII\Handlers\Events\UserEventHandler@sendRegistrationMail',
'FireflyIII\Handlers\Events\UserEventHandler@attachUserRole',
],
'FireflyIII\Events\RequestedNewPassword' => [ // is a User related event.
'FireflyIII\Handlers\Events\UserEventHandler@sendNewPassword',
'FireflyIII\Events\RequestedNewPassword' => [ // is a User related event.
'FireflyIII\Handlers\Events\UserEventHandler@sendNewPassword',
],
'FireflyIII\Events\StoredTransactionJournal' => // is a Transaction Journal related event.
[

View File

@@ -32,11 +32,6 @@ interface AttachmentRepositoryInterface
*/
public function destroy(Attachment $attachment): bool;
/**
* @return Collection
*/
public function get(): Collection;
/**
* @param Attachment $attachment
*
@@ -45,11 +40,9 @@ interface AttachmentRepositoryInterface
public function exists(Attachment $attachment): bool;
/**
* @param Attachment $attachment
*
* @return string
* @return Collection
*/
public function getContent(Attachment $attachment): string;
public function get(): Collection;
/**
* @param Carbon $start
@@ -59,6 +52,13 @@ interface AttachmentRepositoryInterface
*/
public function getBetween(Carbon $start, Carbon $end): Collection;
/**
* @param Attachment $attachment
*
* @return string
*/
public function getContent(Attachment $attachment): string;
/**
* @param Attachment $attachment
* @param array $attachmentData

View File

@@ -83,6 +83,14 @@ interface BudgetRepositoryInterface
*/
public function getActiveBudgets(): Collection;
/**
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getAllBudgetLimits(Carbon $start, Carbon $end): Collection;
/**
* @param TransactionCurrency $currency
* @param Carbon $start
@@ -92,14 +100,6 @@ interface BudgetRepositoryInterface
*/
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 Carbon $start

View File

@@ -146,7 +146,6 @@ class CategoryRepository implements CategoryRepositoryInterface
->orderBy('transaction_journals.date', 'ASC')->first(['transaction_journals.date']);
// both exist, the one that is earliest "wins".
if (!is_null($firstTransaction) && !is_null($first) && Carbon::parse($firstTransaction->date)->lt($first)) {
$first = $firstTransaction->date;

View File

@@ -22,6 +22,14 @@ use FireflyIII\Models\ExportJob;
*/
interface ExportJobRepositoryInterface
{
/**
* @param ExportJob $job
* @param string $status
*
* @return bool
*/
public function changeStatus(ExportJob $job, string $status): bool;
/**
* @return bool
*/
@@ -32,14 +40,6 @@ interface ExportJobRepositoryInterface
*/
public function create(): ExportJob;
/**
* @param ExportJob $job
* @param string $status
*
* @return bool
*/
public function changeStatus(ExportJob $job, string $status): bool;
/**
* @param ExportJob $job
*

View File

@@ -14,7 +14,6 @@ declare(strict_types = 1);
namespace FireflyIII\Repositories\User;
use FireflyConfig;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\Role;
use FireflyIII\User;
@@ -53,6 +52,20 @@ class UserRepository implements UserRepositoryInterface
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
*/
@@ -134,17 +147,4 @@ class UserRepository implements UserRepositoryInterface
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;
}
}

View File

@@ -13,7 +13,6 @@ declare(strict_types = 1);
namespace FireflyIII\Rules;
use FireflyIII\Helpers\Collector\JournalCollector;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType;

View File

@@ -243,28 +243,6 @@ class Navigation
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,
* method returns "Y-m". If the date difference is larger, method returns "Y".
@@ -284,6 +262,7 @@ class Navigation
if ($start->diffInMonths($end) > 12) {
$format = 'Y';
}
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,
* method returns "1M". If the date difference is larger, method returns "1Y".

View File

@@ -14,10 +14,8 @@ declare(strict_types = 1);
namespace FireflyIII\Support\Twig;
use Amount;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Budget as ModelBudget;
use FireflyIII\Models\Category;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Support\CacheProperties;

View File

@@ -51,15 +51,6 @@ class User extends Authenticatable
*/
protected $table = 'users';
/**
* @return HasMany
*/
public function availableBudgets(): HasMany
{
return $this->hasMany('FireflyIII\Models\AvailableBudget');
}
/**
* @return HasMany
*/
@@ -96,6 +87,14 @@ class User extends Authenticatable
return $this->hasMany('FireflyIII\Models\Attachment');
}
/**
* @return HasMany
*/
public function availableBudgets(): HasMany
{
return $this->hasMany('FireflyIII\Models\AvailableBudget');
}
/**
* @return HasMany
*/

Binary file not shown.