mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 10:39:28 +00:00
Merge branch 'release/3.4.8'
Conflicts: resources/twig/auth/login.twig resources/twig/auth/password.twig resources/twig/auth/register.twig
This commit is contained in:
@@ -1 +1 @@
|
||||
src_dir: .
|
||||
src_dir: .
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -33,4 +33,4 @@ addNewLines.php
|
||||
.env.local
|
||||
|
||||
tests/_output/*
|
||||
tests/_output/*
|
||||
tests/_output/*
|
||||
|
@@ -1,3 +1,3 @@
|
||||
# .scrutinizer.yml
|
||||
tools:
|
||||
external_code_coverage: false
|
||||
external_code_coverage: false
|
||||
|
@@ -83,7 +83,8 @@ class GoogleBillChartGenerator implements BillChartGenerator
|
||||
clone $result->date,
|
||||
floatval($bill->amount_max),
|
||||
floatval($bill->amount_min),
|
||||
floatval($result->amount));
|
||||
floatval($result->amount)
|
||||
);
|
||||
}
|
||||
|
||||
$chart->generate();
|
||||
|
@@ -61,7 +61,7 @@ class ChartJsReportChartGenerator implements ReportChartGenerator
|
||||
|
||||
$data = [
|
||||
'count' => 2,
|
||||
'labels' => [],
|
||||
'labels' => [trans('firefly.sum_of_year'), trans('firefly.average_of_year')],
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => trans('firefly.income'),
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php namespace FireflyIII\Handlers\Events;
|
||||
|
||||
use App;
|
||||
use FireflyIII\Events\JournalSaved;
|
||||
use Log;
|
||||
|
||||
@@ -36,7 +35,7 @@ class RescanJournal
|
||||
Log::debug('Triggered saved event for journal #' . $journal->id . ' (' . $journal->description . ')');
|
||||
|
||||
/** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */
|
||||
$repository = App::make('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
$list = $journal->user->bills()->where('active', 1)->where('automatch', 1)->get();
|
||||
|
||||
Log::debug('Found ' . $list->count() . ' bills to check.');
|
||||
|
@@ -3,6 +3,7 @@ namespace FireflyIII\Helpers\Csv\Converter;
|
||||
|
||||
use Auth;
|
||||
use FireflyIII\Models\Account;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class AccountId
|
||||
@@ -19,11 +20,19 @@ class AccountId extends BasicConverter implements ConverterInterface
|
||||
{
|
||||
// is mapped? Then it's easy!
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
|
||||
/** @var Account $account */
|
||||
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
|
||||
} else {
|
||||
|
||||
/** @var Account $account */
|
||||
$account = Auth::user()->accounts()->find($this->value);
|
||||
|
||||
if (!is_null($account)) {
|
||||
Log::debug('Found ' . $account->accountType->type . ' named "******" with ID: ' . $this->value.' (not mapped) ');
|
||||
}
|
||||
}
|
||||
|
||||
return $account;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,4 +23,4 @@ class Amount extends BasicConverter implements ConverterInterface
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -65,4 +65,4 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -48,4 +48,4 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $account;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -119,4 +119,4 @@ class BasicConverter
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -27,4 +27,4 @@ class BillId extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $bill;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -35,4 +35,4 @@ class BillName extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $bill;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,4 +26,4 @@ class BudgetId extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $budget;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -32,4 +32,4 @@ class BudgetName extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $budget;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,4 +26,4 @@ class CategoryId extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $category;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,4 +31,4 @@ class CategoryName extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $category;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -46,4 +46,4 @@ interface ConverterInterface
|
||||
*/
|
||||
public function setValue($value);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -25,4 +25,4 @@ class CurrencyCode extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $currency;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,4 +25,4 @@ class CurrencyId extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $currency;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,4 +25,4 @@ class CurrencyName extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $currency;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,4 +25,4 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $currency;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,4 +24,4 @@ class Date extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,4 +18,4 @@ class Description extends BasicConverter implements ConverterInterface
|
||||
{
|
||||
return trim($this->data['description'] . ' ' . $this->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,4 +19,4 @@ class Ignore extends BasicConverter implements ConverterInterface
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
|
||||
/** @var Account $account */
|
||||
foreach ($set as $account) {
|
||||
if ($account->iban == $this->value) {
|
||||
Log::debug('OpposingAccountIban::convert found an Account (#' . $account->id . ': ' . $account->name . ') with IBAN ' . $this->value);
|
||||
Log::debug('OpposingAccountIban::convert found an Account (#' . $account->id . ': ******) with IBAN ******');
|
||||
|
||||
return $account;
|
||||
}
|
||||
@@ -54,4 +54,4 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,4 +29,4 @@ class OpposingAccountId extends BasicConverter implements ConverterInterface
|
||||
return $account;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,4 +28,4 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,4 +23,4 @@ class RabobankDebetCredit extends BasicConverter implements ConverterInterface
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -37,4 +37,4 @@ class TagsComma extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $tags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -37,4 +37,4 @@ class TagsSpace extends BasicConverter implements ConverterInterface
|
||||
|
||||
return $tags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,16 +25,19 @@ class Data
|
||||
protected $hasHeaders;
|
||||
|
||||
/** @var array */
|
||||
protected $map;
|
||||
protected $map = [];
|
||||
/** @var array */
|
||||
protected $mapped;
|
||||
protected $mapped = [];
|
||||
/** @var Reader */
|
||||
protected $reader;
|
||||
/** @var array */
|
||||
protected $roles;
|
||||
protected $roles = [];
|
||||
|
||||
/** @var array */
|
||||
protected $specifix;
|
||||
protected $specifix = [];
|
||||
|
||||
/** @var int */
|
||||
protected $importAccount = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -48,6 +51,7 @@ class Data
|
||||
$this->sessionRoles();
|
||||
$this->sessionMapped();
|
||||
$this->sessionSpecifix();
|
||||
$this->sessionImportAccount();
|
||||
}
|
||||
|
||||
protected function sessionHasHeaders()
|
||||
@@ -57,6 +61,13 @@ class Data
|
||||
}
|
||||
}
|
||||
|
||||
protected function sessionImportAccount()
|
||||
{
|
||||
if (Session::has('csv-import-account')) {
|
||||
$this->importAccount = intval(Session::get('csv-import-account'));
|
||||
}
|
||||
}
|
||||
|
||||
protected function sessionDateFormat()
|
||||
{
|
||||
if (Session::has('csv-date-format')) {
|
||||
@@ -116,6 +127,15 @@ class Data
|
||||
$this->dateFormat = $dateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $importAccount
|
||||
*/
|
||||
public function setImportAccount($importAccount)
|
||||
{
|
||||
Session::put('csv-import-account', $importAccount);
|
||||
$this->importAccount = $importAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
@@ -247,7 +267,7 @@ class Data
|
||||
*/
|
||||
public function getSpecifix()
|
||||
{
|
||||
return $this->specifix;
|
||||
return is_array($this->specifix) ? $this->specifix : [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,4 +280,4 @@ class Data
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -2,16 +2,17 @@
|
||||
|
||||
namespace FireflyIII\Helpers\Csv;
|
||||
|
||||
use App;
|
||||
use Auth;
|
||||
use Config;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Csv\Converter\ConverterInterface;
|
||||
use FireflyIII\Helpers\Csv\PostProcessing\PostProcessorInterface;
|
||||
use FireflyIII\Helpers\Csv\Specifix\SpecifixInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Log;
|
||||
|
||||
@@ -42,7 +43,10 @@ class Importer
|
||||
/** @var int */
|
||||
protected $rows = 0;
|
||||
/** @var array */
|
||||
protected $specifix;
|
||||
protected $specifix = [];
|
||||
|
||||
/** @var Collection */
|
||||
protected $journals;
|
||||
|
||||
/**
|
||||
* Used by CsvController.
|
||||
@@ -74,6 +78,15 @@ class Importer
|
||||
return $this->rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getJournals()
|
||||
{
|
||||
return $this->journals;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -81,6 +94,7 @@ class Importer
|
||||
{
|
||||
set_time_limit(0);
|
||||
|
||||
$this->journals = new Collection;
|
||||
$this->map = $this->data->getMap();
|
||||
$this->roles = $this->data->getRoles();
|
||||
$this->mapped = $this->data->getMapped();
|
||||
@@ -88,14 +102,17 @@ class Importer
|
||||
|
||||
foreach ($this->data->getReader() as $index => $row) {
|
||||
if ($this->parseRow($index)) {
|
||||
Log::debug('--- Importing row ' . $index);
|
||||
$this->rows++;
|
||||
$result = $this->importRow($row);
|
||||
if (!($result === true)) {
|
||||
if (!($result instanceof TransactionJournal)) {
|
||||
Log::error('Caught error at row #' . $index . ': ' . $result);
|
||||
$this->errors[$index] = $result;
|
||||
} else {
|
||||
$this->imported++;
|
||||
$this->journals->push($result);
|
||||
}
|
||||
Log::debug('---');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,14 +135,17 @@ class Importer
|
||||
*/
|
||||
protected function importRow($row)
|
||||
{
|
||||
|
||||
$data = $this->getFiller(); // These fields are necessary to create a new transaction journal. Some are optional
|
||||
foreach ($row as $index => $value) {
|
||||
$role = isset($this->roles[$index]) ? $this->roles[$index] : '_ignore';
|
||||
$class = Config::get('csv.roles.' . $role . '.converter');
|
||||
$field = Config::get('csv.roles.' . $role . '.field');
|
||||
|
||||
Log::debug('Column #' . $index . ' (role: ' . $role . ') : converter ' . $class . ' stores its data into field ' . $field . ':');
|
||||
|
||||
/** @var ConverterInterface $converter */
|
||||
$converter = App::make('FireflyIII\Helpers\Csv\Converter\\' . $class);
|
||||
$converter = app('FireflyIII\Helpers\Csv\Converter\\' . $class);
|
||||
$converter->setData($data); // the complete array so far.
|
||||
$converter->setField($field);
|
||||
$converter->setIndex($index);
|
||||
@@ -133,7 +153,6 @@ class Importer
|
||||
$converter->setValue($value);
|
||||
$converter->setRole($role);
|
||||
$data[$field] = $converter->convert();
|
||||
|
||||
}
|
||||
// move to class vars.
|
||||
$this->importData = $data;
|
||||
@@ -147,11 +166,8 @@ class Importer
|
||||
return $result; // return error.
|
||||
}
|
||||
$journal = $this->createTransactionJournal();
|
||||
if ($journal instanceof TransactionJournal) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $journal;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,6 +185,7 @@ class Importer
|
||||
// some extra's:
|
||||
$filler['bill-id'] = null;
|
||||
$filler['opposing-account-object'] = null;
|
||||
$filler['asset-account-object'] = null;
|
||||
$filler['amount-modifier'] = '1';
|
||||
|
||||
return $filler;
|
||||
@@ -186,9 +203,10 @@ class Importer
|
||||
|
||||
foreach ($this->getSpecifix() as $className) {
|
||||
/** @var SpecifixInterface $specifix */
|
||||
$specifix = App::make('FireflyIII\Helpers\Csv\Specifix\\' . $className);
|
||||
$specifix = app('FireflyIII\Helpers\Csv\Specifix\\' . $className);
|
||||
$specifix->setData($this->importData);
|
||||
$specifix->setRow($this->importRow);
|
||||
Log::debug('Now post-process specifix named ' . $className . ':');
|
||||
$this->importData = $specifix->fix();
|
||||
}
|
||||
|
||||
@@ -196,8 +214,9 @@ class Importer
|
||||
$set = Config::get('csv.post_processors');
|
||||
foreach ($set as $className) {
|
||||
/** @var PostProcessorInterface $postProcessor */
|
||||
$postProcessor = App::make('FireflyIII\Helpers\Csv\PostProcessing\\' . $className);
|
||||
$postProcessor = app('FireflyIII\Helpers\Csv\PostProcessing\\' . $className);
|
||||
$postProcessor->setData($this->importData);
|
||||
Log::debug('Now post-process processor named ' . $className . ':');
|
||||
$this->importData = $postProcessor->process();
|
||||
}
|
||||
|
||||
@@ -208,7 +227,7 @@ class Importer
|
||||
*/
|
||||
public function getSpecifix()
|
||||
{
|
||||
return $this->specifix;
|
||||
return is_array($this->specifix) ? $this->specifix : [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,6 +243,10 @@ class Importer
|
||||
return 'Opposing account is null';
|
||||
}
|
||||
|
||||
if (!($this->importData['asset-account-object'] instanceof Account)) {
|
||||
return 'No asset account to import into.';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -238,6 +261,8 @@ class Importer
|
||||
if (is_null($this->importData['date'])) {
|
||||
$date = $this->importData['date-rent'];
|
||||
}
|
||||
|
||||
|
||||
$transactionType = $this->getTransactionType(); // defaults to deposit
|
||||
$errors = new MessageBag;
|
||||
$journal = TransactionJournal::create(
|
||||
@@ -245,10 +270,13 @@ class Importer
|
||||
'description' => $this->importData['description'], 'completed' => 0, 'date' => $date, 'bill_id' => $this->importData['bill-id'],]
|
||||
);
|
||||
if ($journal->getErrors()->count() == 0) {
|
||||
$accountId = $this->importData['asset-account']->id; // create first transaction:
|
||||
// first transaction
|
||||
$accountId = $this->importData['asset-account-object']->id; // create first transaction:
|
||||
$amount = $this->importData['amount'];
|
||||
$transaction = Transaction::create(['transaction_journal_id' => $journal->id, 'account_id' => $accountId, 'amount' => $amount]);
|
||||
$errors = $transaction->getErrors();
|
||||
|
||||
// second transaction
|
||||
$accountId = $this->importData['opposing-account-object']->id; // create second transaction:
|
||||
$amount = bcmul($this->importData['amount'], -1);
|
||||
$transaction = Transaction::create(['transaction_journal_id' => $journal->id, 'account_id' => $accountId, 'amount' => $amount]);
|
||||
@@ -266,6 +294,18 @@ class Importer
|
||||
$this->saveCategory($journal);
|
||||
$this->saveTags($journal);
|
||||
|
||||
// some debug info:
|
||||
$journalId = $journal->id;
|
||||
$type = $journal->transactionType->type;
|
||||
/** @var Account $asset */
|
||||
$asset = $this->importData['asset-account-object'];
|
||||
/** @var Account $opposing */
|
||||
$opposing = $this->importData['opposing-account-object'];
|
||||
|
||||
Log::info('Created journal #' . $journalId . ' of type ' . $type . '!');
|
||||
Log::info('Asset account ****** (#' . $asset->id . ') lost/gained: ' . $this->importData['amount']);
|
||||
Log::info($opposing->accountType->type . ' ****** (#' . $opposing->id . ') lost/gained: ' . bcmul($this->importData['amount'], -1));
|
||||
|
||||
return $journal;
|
||||
}
|
||||
|
||||
@@ -328,4 +368,4 @@ class Importer
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -27,8 +27,8 @@ class AnyAccount implements MapperInterface
|
||||
}
|
||||
asort($list);
|
||||
|
||||
array_unshift($list, trans('firefly.csv_do_not_map'));
|
||||
$list = [0 => trans('firefly.csv_do_not_map')] + $list;
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -38,8 +38,8 @@ class AssetAccount implements MapperInterface
|
||||
|
||||
asort($list);
|
||||
|
||||
array_unshift($list, trans('firefly.csv_do_not_map'));
|
||||
$list = [0 => trans('firefly.csv_do_not_map')] + $list;
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,8 +27,8 @@ class Bill implements MapperInterface
|
||||
}
|
||||
asort($list);
|
||||
|
||||
array_unshift($list, trans('firefly.csv_do_not_map'));
|
||||
$list = [0 => trans('firefly.csv_do_not_map')] + $list;
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,8 +27,8 @@ class Budget implements MapperInterface
|
||||
}
|
||||
asort($list);
|
||||
|
||||
array_unshift($list, trans('firefly.csv_do_not_map'));
|
||||
$list = [0 => trans('firefly.csv_do_not_map')] + $list;
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,8 +27,8 @@ class Category implements MapperInterface
|
||||
}
|
||||
asort($list);
|
||||
|
||||
array_unshift($list, trans('firefly.csv_do_not_map'));
|
||||
$list = [0 => trans('firefly.csv_do_not_map')] + $list;
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -13,4 +13,4 @@ interface MapperInterface
|
||||
* @return array
|
||||
*/
|
||||
public function getMap();
|
||||
}
|
||||
}
|
||||
|
@@ -27,8 +27,8 @@ class Tag implements MapperInterface
|
||||
}
|
||||
asort($list);
|
||||
|
||||
array_unshift($list, trans('firefly.csv_do_not_map'));
|
||||
$list = [0 => trans('firefly.csv_do_not_map')] + $list;
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,8 +25,8 @@ class TransactionCurrency implements MapperInterface
|
||||
|
||||
asort($list);
|
||||
|
||||
array_unshift($list, trans('firefly.csv_do_not_map'));
|
||||
$list = [0 => trans('firefly.csv_do_not_map')] + $list;
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -32,4 +32,4 @@ class Amount implements PostProcessorInterface
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
185
app/Helpers/Csv/PostProcessing/AssetAccount.php
Normal file
185
app/Helpers/Csv/PostProcessing/AssetAccount.php
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Helpers\Csv\PostProcessing;
|
||||
|
||||
use Auth;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use Log;
|
||||
use Validator;
|
||||
|
||||
/**
|
||||
* Class AssetAccount
|
||||
*
|
||||
* @package FireflyIII\Helpers\Csv\PostProcessing
|
||||
*/
|
||||
class AssetAccount implements PostProcessorInterface
|
||||
{
|
||||
|
||||
/** @var array */
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
$result = $this->checkIdNameObject(); // has object in ID or Name?
|
||||
if (!is_null($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result = $this->checkIbanString();
|
||||
if (!is_null($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result = $this->checkNameString();
|
||||
if (!is_null($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*/
|
||||
public function setData(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function checkIdNameObject()
|
||||
{
|
||||
if ($this->data['asset-account-id'] instanceof Account) { // first priority. try to find the account based on ID, if any
|
||||
$this->data['asset-account-object'] = $this->data['asset-account-id'];
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
if ($this->data['asset-account-iban'] instanceof Account) { // second: try to find the account based on IBAN, if any.
|
||||
$this->data['asset-account-object'] = $this->data['asset-account-iban'];
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
protected function checkIbanString()
|
||||
{
|
||||
$rules = ['iban' => 'iban'];
|
||||
$check = ['iban' => $this->data['asset-account-iban']];
|
||||
$validator = Validator::make($check, $rules);
|
||||
if (!$validator->fails()) {
|
||||
$this->data['asset-account-object'] = $this->parseIbanString();
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Account|null
|
||||
*/
|
||||
protected function parseIbanString()
|
||||
{
|
||||
// create by name and/or iban.
|
||||
$accounts = Auth::user()->accounts()->get();
|
||||
foreach ($accounts as $entry) {
|
||||
if ($entry->iban == $this->data['asset-account-iban']) {
|
||||
|
||||
return $entry;
|
||||
}
|
||||
}
|
||||
$account = $this->createAccount();
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Account|null
|
||||
*/
|
||||
protected function createAccount()
|
||||
{
|
||||
$accountType = $this->getAccountType();
|
||||
|
||||
// create if not exists:
|
||||
$name = is_string($this->data['asset-account-name']) && strlen($this->data['asset-account-name']) > 0 ? $this->data['asset-account-name']
|
||||
: $this->data['asset-account-iban'];
|
||||
$account = Account::firstOrCreateEncrypted(
|
||||
[
|
||||
'user_id' => Auth::user()->id,
|
||||
'account_type_id' => $accountType->id,
|
||||
'name' => $name,
|
||||
'iban' => $this->data['asset-account-iban'],
|
||||
'active' => true,
|
||||
]
|
||||
);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return AccountType
|
||||
*/
|
||||
protected function getAccountType()
|
||||
{
|
||||
return AccountType::where('type', 'Asset account')->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
protected function checkNameString()
|
||||
{
|
||||
if ($this->data['asset-account-name'] instanceof Account) { // third: try to find account based on name, if any.
|
||||
$this->data['asset-account-object'] = $this->data['asset-account-name'];
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
if (is_string($this->data['asset-account-name'])) {
|
||||
$this->data['asset-account-object'] = $this->parseNameString();
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Account|null
|
||||
*/
|
||||
protected function parseNameString()
|
||||
{
|
||||
$accountType = $this->getAccountType();
|
||||
$accounts = Auth::user()->accounts()->where('account_type_id', $accountType->id)->get();
|
||||
foreach ($accounts as $entry) {
|
||||
if ($entry->name == $this->data['asset-account-name']) {
|
||||
Log::debug('Found an asset account with this name (#' . $entry->id . ': ******)');
|
||||
|
||||
return $entry;
|
||||
}
|
||||
}
|
||||
// create if not exists:
|
||||
$account = Account::firstOrCreateEncrypted(
|
||||
[
|
||||
'user_id' => Auth::user()->id,
|
||||
'account_type_id' => $accountType->id,
|
||||
'name' => $this->data['asset-account-name'],
|
||||
'iban' => '',
|
||||
'active' => true,
|
||||
]
|
||||
);
|
||||
|
||||
return $account;
|
||||
}
|
||||
}
|
@@ -34,4 +34,4 @@ class Bill implements PostProcessorInterface
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -38,4 +38,4 @@ class Currency implements PostProcessorInterface
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -35,4 +35,4 @@ class Description implements PostProcessorInterface
|
||||
|
||||
$this->data = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,10 @@ class OpposingAccount implements PostProcessorInterface
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
// three values:
|
||||
// opposing-account-id, opposing-account-iban, opposing-account-name
|
||||
|
||||
|
||||
$result = $this->checkIdNameObject();
|
||||
if (!is_null($result)) {
|
||||
return $result;
|
||||
@@ -56,11 +60,13 @@ class OpposingAccount implements PostProcessorInterface
|
||||
protected function checkIdNameObject()
|
||||
{
|
||||
if ($this->data['opposing-account-id'] instanceof Account) { // first priority. try to find the account based on ID, if any
|
||||
Log::debug('OpposingAccountPostProcession: opposing-account-id is an Account.');
|
||||
$this->data['opposing-account-object'] = $this->data['opposing-account-id'];
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
if ($this->data['opposing-account-iban'] instanceof Account) { // second: try to find the account based on IBAN, if any.
|
||||
Log::debug('OpposingAccountPostProcession: opposing-account-iban is an Account.');
|
||||
$this->data['opposing-account-object'] = $this->data['opposing-account-iban'];
|
||||
|
||||
return $this->data;
|
||||
@@ -75,9 +81,12 @@ class OpposingAccount implements PostProcessorInterface
|
||||
protected function checkIbanString()
|
||||
{
|
||||
$rules = ['iban' => 'iban'];
|
||||
$check = ['iban' => $this->data['opposing-account-iban']];
|
||||
$iban = $this->data['opposing-account-iban'];
|
||||
$check = ['iban' => $iban];
|
||||
$validator = Validator::make($check, $rules);
|
||||
if (!$validator->fails()) {
|
||||
if (is_string($iban) && strlen($iban) > 0 && !$validator->fails()) {
|
||||
|
||||
Log::debug('OpposingAccountPostProcession: opposing-account-iban is a string (******).');
|
||||
$this->data['opposing-account-object'] = $this->parseIbanString();
|
||||
|
||||
return $this->data;
|
||||
@@ -95,12 +104,14 @@ class OpposingAccount implements PostProcessorInterface
|
||||
$accounts = Auth::user()->accounts()->get();
|
||||
foreach ($accounts as $entry) {
|
||||
if ($entry->iban == $this->data['opposing-account-iban']) {
|
||||
Log::debug('OpposingAccountPostProcession: opposing-account-iban matches an Account.');
|
||||
|
||||
return $entry;
|
||||
}
|
||||
}
|
||||
$account = $this->createAccount();
|
||||
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
@@ -123,6 +134,7 @@ class OpposingAccount implements PostProcessorInterface
|
||||
'active' => true,
|
||||
]
|
||||
);
|
||||
Log::debug('OpposingAccountPostProcession: created a new account.');
|
||||
|
||||
return $account;
|
||||
}
|
||||
@@ -153,11 +165,13 @@ class OpposingAccount implements PostProcessorInterface
|
||||
protected function checkNameString()
|
||||
{
|
||||
if ($this->data['opposing-account-name'] instanceof Account) { // third: try to find account based on name, if any.
|
||||
Log::debug('OpposingAccountPostProcession: opposing-account-name is an Account.');
|
||||
$this->data['opposing-account-object'] = $this->data['opposing-account-name'];
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
if (is_string($this->data['opposing-account-name'])) {
|
||||
|
||||
$this->data['opposing-account-object'] = $this->parseNameString();
|
||||
|
||||
return $this->data;
|
||||
@@ -175,7 +189,7 @@ class OpposingAccount implements PostProcessorInterface
|
||||
$accounts = Auth::user()->accounts()->where('account_type_id', $accountType->id)->get();
|
||||
foreach ($accounts as $entry) {
|
||||
if ($entry->name == $this->data['opposing-account-name']) {
|
||||
Log::debug('Found an account with this name (#' . $entry->id . ': ' . $entry->name . ')');
|
||||
Log::debug('Found an account with this name (#' . $entry->id . ': ******)');
|
||||
|
||||
return $entry;
|
||||
}
|
||||
@@ -193,4 +207,4 @@ class OpposingAccount implements PostProcessorInterface
|
||||
|
||||
return $account;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,4 +26,4 @@ interface PostProcessorInterface
|
||||
* @param array $data
|
||||
*/
|
||||
public function setData(array $data);
|
||||
}
|
||||
}
|
||||
|
@@ -42,4 +42,4 @@ class Dummy
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace FireflyIII\Helpers\Csv\Specifix;
|
||||
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class RabobankDescription
|
||||
*
|
||||
@@ -32,10 +34,16 @@ class RabobankDescription
|
||||
*/
|
||||
protected function rabobankFixEmptyOpposing()
|
||||
{
|
||||
if (strlen($this->data['opposing-account-name']) == 0) {
|
||||
Log::debug('RaboSpecifix: Opposing account name is "******".');
|
||||
if (is_string($this->data['opposing-account-name']) && strlen($this->data['opposing-account-name']) == 0) {
|
||||
Log::debug('RaboSpecifix: opp-name is zero length, changed to: "******"');
|
||||
$this->data['opposing-account-name'] = $this->row[10];
|
||||
|
||||
Log::debug('Description was: "******".');
|
||||
$this->data['description'] = trim(str_replace($this->row[10], '', $this->data['description']));
|
||||
Log::debug('Description is now: "******".');
|
||||
}
|
||||
$this->data['description'] = trim(str_replace($this->row[10], '', $this->data['description']));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,4 +63,4 @@ class RabobankDescription
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -22,4 +22,4 @@ interface SpecifixInterface
|
||||
* @param array $row
|
||||
*/
|
||||
public function setRow($row);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace FireflyIII\Helpers\Csv;
|
||||
|
||||
use App;
|
||||
use Auth;
|
||||
use Config;
|
||||
use Crypt;
|
||||
@@ -10,7 +9,7 @@ use FireflyIII\Helpers\Csv\Mapper\MapperInterface;
|
||||
use League\Csv\Reader;
|
||||
use ReflectionException;
|
||||
use Session;
|
||||
|
||||
use Log;
|
||||
/**
|
||||
* Class Wizard
|
||||
*
|
||||
@@ -45,9 +44,7 @@ class Wizard implements WizardInterface
|
||||
/*
|
||||
* Make each one unique.
|
||||
*/
|
||||
foreach ($values as $column => $found) {
|
||||
$values[$column] = array_unique($found);
|
||||
}
|
||||
$values = $this->uniqueRecursive($values);
|
||||
|
||||
return $values;
|
||||
}
|
||||
@@ -112,6 +109,7 @@ class Wizard implements WizardInterface
|
||||
{
|
||||
foreach ($fields as $field) {
|
||||
if (!Session::has($field)) {
|
||||
Log::error('Session is missing field: ' . $field);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +135,7 @@ class Wizard implements WizardInterface
|
||||
$class = 'FireflyIII\Helpers\Csv\Mapper\\' . $mapper;
|
||||
try {
|
||||
/** @var MapperInterface $mapObject */
|
||||
$mapObject = App::make($class);
|
||||
$mapObject = app($class);
|
||||
} catch (ReflectionException $e) {
|
||||
throw new FireflyException('Column "' . $columnRole . '" cannot be mapped because class ' . $mapper . ' does not exist.');
|
||||
}
|
||||
@@ -177,4 +175,18 @@ class Wizard implements WizardInterface
|
||||
{
|
||||
return ($hasHeaders && $index > 1) || !$hasHeaders;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function uniqueRecursive(array $array)
|
||||
{
|
||||
foreach ($array as $column => $found) {
|
||||
$array[$column] = array_unique($found);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
@@ -56,4 +56,4 @@ interface WizardInterface
|
||||
*/
|
||||
public function storeCsvFile($path);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Helpers\Report;
|
||||
|
||||
use App;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Collection\Account as AccountCollection;
|
||||
use FireflyIII\Helpers\Collection\Balance;
|
||||
@@ -115,8 +114,8 @@ class ReportHelper implements ReportHelperInterface
|
||||
*/
|
||||
public function getBalanceReport(Carbon $start, Carbon $end, $shared)
|
||||
{
|
||||
$repository = App::make('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
$tagRepository = App::make('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
||||
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
$tagRepository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
||||
$balance = new Balance;
|
||||
|
||||
// build a balance header:
|
||||
@@ -200,15 +199,15 @@ class ReportHelper implements ReportHelperInterface
|
||||
* This method generates a full report for the given period on all
|
||||
* the users bills and their payments.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return BillCollection
|
||||
*/
|
||||
public function getBillReport(Carbon $start, Carbon $end)
|
||||
{
|
||||
/** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */
|
||||
$repository = App::make('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
$bills = $repository->getBills();
|
||||
$collection = new BillCollection;
|
||||
|
||||
@@ -253,7 +252,7 @@ class ReportHelper implements ReportHelperInterface
|
||||
{
|
||||
$object = new BudgetCollection;
|
||||
/** @var \FireflyIII\Repositories\Budget\BudgetRepositoryInterface $repository */
|
||||
$repository = App::make('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
$set = $repository->getBudgets();
|
||||
|
||||
foreach ($set as $budget) {
|
||||
@@ -323,7 +322,7 @@ class ReportHelper implements ReportHelperInterface
|
||||
* GET CATEGORIES:
|
||||
*/
|
||||
/** @var \FireflyIII\Repositories\Category\CategoryRepositoryInterface $repository */
|
||||
$repository = App::make('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
|
||||
$repository = app('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
|
||||
$set = $repository->getCategories();
|
||||
foreach ($set as $category) {
|
||||
$spent = $repository->spentInPeriodCorrected($category, $start, $end, $shared);
|
||||
|
@@ -35,8 +35,8 @@ interface ReportHelperInterface
|
||||
* This method generates a full report for the given period on all
|
||||
* the users bills and their payments.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return BillCollection
|
||||
*/
|
||||
|
@@ -21,7 +21,11 @@ use Steam;
|
||||
class ReportQuery implements ReportQueryInterface
|
||||
{
|
||||
/**
|
||||
* See ReportQueryInterface::incomeInPeriodCorrected
|
||||
* See ReportQueryInterface::incomeInPeriodCorrected.
|
||||
*
|
||||
* This method's length is caused mainly by the query build stuff. Therefor:
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
|
@@ -3,6 +3,7 @@
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Http\Requests\AccountFormRequest;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@@ -57,17 +58,19 @@ class AccountController extends Controller
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function delete(Account $account)
|
||||
public function delete(AccountRepositoryInterface $repository, Account $account)
|
||||
{
|
||||
$typeName = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);
|
||||
$typeName = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);
|
||||
$accountList = Expandedform::makeSelectList($repository->getAccounts([$account->accountType->type]), true);
|
||||
unset($accountList[$account->id]);
|
||||
|
||||
// put previous url in session
|
||||
Session::put('accounts.delete.url', URL::previous());
|
||||
Session::flash('gaEventCategory', 'accounts');
|
||||
Session::flash('gaEventAction', 'delete-' . $typeName);
|
||||
|
||||
return view('accounts.delete', compact('account', 'subTitle'));
|
||||
return view('accounts.delete', compact('account', 'subTitle', 'accountList'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,12 +81,12 @@ class AccountController extends Controller
|
||||
*/
|
||||
public function destroy(AccountRepositoryInterface $repository, Account $account)
|
||||
{
|
||||
|
||||
$type = $account->accountType->type;
|
||||
$typeName = Config::get('firefly.shortNamesByFullName.' . $type);
|
||||
$name = $account->name;
|
||||
$moveTo = Auth::user()->accounts()->find(intval(Input::get('move_account_before_delete')));
|
||||
|
||||
$repository->destroy($account);
|
||||
$repository->destroy($account, $moveTo);
|
||||
|
||||
Session::flash('success', trans('firefly.' . $typeName . '_deleted', ['name' => $name]));
|
||||
Preferences::mark();
|
||||
@@ -153,12 +156,23 @@ class AccountController extends Controller
|
||||
* HERE WE ARE
|
||||
*/
|
||||
$start = clone Session::get('start', Carbon::now()->startOfMonth());
|
||||
$end = clone Session::get('end', Carbon::now()->endOfMonth());
|
||||
$start->subDay();
|
||||
|
||||
// start balances:
|
||||
$ids = [];
|
||||
foreach ($accounts as $account) {
|
||||
$ids[] = $account->id;
|
||||
}
|
||||
|
||||
$startBalances = Steam::balancesById($ids, $start);
|
||||
$endBalances = Steam::balancesById($ids, $end);
|
||||
|
||||
$accounts->each(
|
||||
function (Account $account) use ($start, $repository) {
|
||||
$account->lastActivityDate = $repository->getLastActivity($account);
|
||||
$account->startBalance = Steam::balance($account, $start);
|
||||
$account->endBalance = Steam::balance($account, clone Session::get('end', Carbon::now()->endOfMonth()));
|
||||
function (Account $account) use ($startBalances, $endBalances) {
|
||||
$account->lastActivityDate = null;//$repository->getLastActivity($account);
|
||||
$account->startBalance = isset($startBalances[$account->id]) ? $startBalances[$account->id] : null;
|
||||
$account->endBalance = isset($endBalances[$account->id]) ? $endBalances[$account->id] : null;
|
||||
}
|
||||
);
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php namespace FireflyIII\Http\Controllers\Auth;
|
||||
|
||||
use App;
|
||||
use Auth;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Role;
|
||||
@@ -44,6 +43,8 @@ class AuthController extends Controller
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->middleware('guest', ['except' => 'getLogout']);
|
||||
}
|
||||
|
||||
@@ -109,7 +110,7 @@ class AuthController extends Controller
|
||||
return redirect($this->redirectPath());
|
||||
}
|
||||
// @codeCoverageIgnoreStart
|
||||
App::abort(500, 'Not a user!');
|
||||
abort(500, 'Not a user!');
|
||||
|
||||
return redirect('/');
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
@@ -36,6 +36,7 @@ class PasswordController extends Controller
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Chart;
|
||||
|
||||
use App;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Account;
|
||||
@@ -31,7 +30,7 @@ class AccountController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// create chart generator:
|
||||
$this->generator = App::make('FireflyIII\Generator\Chart\Account\AccountChartGenerator');
|
||||
$this->generator = app('FireflyIII\Generator\Chart\Account\AccountChartGenerator');
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,18 +2,14 @@
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Chart;
|
||||
|
||||
use App;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Response;
|
||||
use Session;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class BillController
|
||||
@@ -33,26 +29,21 @@ class BillController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// create chart generator:
|
||||
$this->generator = App::make('FireflyIII\Generator\Chart\Bill\BillChartGenerator');
|
||||
$this->generator = app('FireflyIII\Generator\Chart\Bill\BillChartGenerator');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows all bills and whether or not theyve been paid this month (pie chart).
|
||||
*
|
||||
* @param BillRepositoryInterface $repository
|
||||
* @param AccountRepositoryInterface $accounts
|
||||
* @param BillRepositoryInterface $repository
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function frontpage(BillRepositoryInterface $repository, AccountRepositoryInterface $accounts)
|
||||
public function frontpage(BillRepositoryInterface $repository)
|
||||
{
|
||||
|
||||
$start = Session::get('start', Carbon::now()->startOfMonth());
|
||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||
|
||||
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties();
|
||||
$cache = new CacheProperties(); // chart properties for cache:
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('bills');
|
||||
@@ -61,46 +52,13 @@ class BillController extends Controller
|
||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$bills = $repository->getActiveBills();
|
||||
$paid = new Collection; // journals.
|
||||
$unpaid = new Collection; // bills
|
||||
$set = $repository->getBillsForChart($start, $end);
|
||||
|
||||
// optionally expand this set with credit card data
|
||||
$set = $repository->getCreditCardInfoForChart($set, $start, $end);
|
||||
$paid = $set->get('paid');
|
||||
$unpaid = $set->get('unpaid');
|
||||
|
||||
/** @var Bill $bill */
|
||||
foreach ($bills as $bill) {
|
||||
$ranges = $repository->getRanges($bill, $start, $end);
|
||||
|
||||
foreach ($ranges as $range) {
|
||||
// paid a bill in this range?
|
||||
$journals = $repository->getJournalsInRange($bill, $range['start'], $range['end']);
|
||||
if ($journals->count() == 0) {
|
||||
$unpaid->push([$bill, $range['start']]);
|
||||
} else {
|
||||
$paid = $paid->merge($journals);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$creditCards = $accounts->getCreditCards();
|
||||
foreach ($creditCards as $creditCard) {
|
||||
$balance = Steam::balance($creditCard, $end, true);
|
||||
$date = new Carbon($creditCard->getMeta('ccMonthlyPaymentDate'));
|
||||
if ($balance < 0) {
|
||||
// unpaid! create a fake bill that matches the amount.
|
||||
$description = $creditCard->name;
|
||||
$amount = $balance * -1;
|
||||
$fakeBill = $repository->createFakeBill($description, $date, $amount);
|
||||
unset($description, $amount);
|
||||
$unpaid->push([$fakeBill, $date]);
|
||||
}
|
||||
if ($balance == 0) {
|
||||
// find transfer(s) TO the credit card which should account for
|
||||
// anything paid. If not, the CC is not yet used.
|
||||
$journals = $accounts->getTransfersInRange($creditCard, $start, $end);
|
||||
$paid = $paid->merge($journals);
|
||||
}
|
||||
}
|
||||
|
||||
// build chart:
|
||||
$data = $this->generator->frontpage($paid, $unpaid);
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Chart;
|
||||
|
||||
use App;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Budget;
|
||||
@@ -33,7 +32,7 @@ class BudgetController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// create chart generator:
|
||||
$this->generator = App::make('FireflyIII\Generator\Chart\Budget\BudgetChartGenerator');
|
||||
$this->generator = app('FireflyIII\Generator\Chart\Budget\BudgetChartGenerator');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,6 @@
|
||||
namespace FireflyIII\Http\Controllers\Chart;
|
||||
|
||||
|
||||
use App;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Category;
|
||||
@@ -32,7 +31,7 @@ class CategoryController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// create chart generator:
|
||||
$this->generator = App::make('FireflyIII\Generator\Chart\Category\CategoryChartGenerator');
|
||||
$this->generator = app('FireflyIII\Generator\Chart\Category\CategoryChartGenerator');
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Chart;
|
||||
|
||||
use App;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
@@ -29,7 +28,7 @@ class PiggyBankController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// create chart generator:
|
||||
$this->generator = App::make('FireflyIII\Generator\Chart\PiggyBank\PiggyBankChartGenerator');
|
||||
$this->generator = app('FireflyIII\Generator\Chart\PiggyBank\PiggyBankChartGenerator');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,6 @@
|
||||
namespace FireflyIII\Http\Controllers\Chart;
|
||||
|
||||
|
||||
use App;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
@@ -29,7 +28,7 @@ class ReportController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// create chart generator:
|
||||
$this->generator = App::make('FireflyIII\Generator\Chart\Report\ReportChartGenerator');
|
||||
$this->generator = app('FireflyIII\Generator\Chart\Report\ReportChartGenerator');
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use Config;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Csv\Data;
|
||||
use FireflyIII\Helpers\Csv\Importer;
|
||||
use FireflyIII\Helpers\Csv\WizardInterface;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Log;
|
||||
@@ -41,8 +42,8 @@ class CsvController extends Controller
|
||||
throw new FireflyException('CSV Import is not enabled.');
|
||||
}
|
||||
|
||||
$this->wizard = App::make('FireflyIII\Helpers\Csv\WizardInterface');
|
||||
$this->data = App::make('FireflyIII\Helpers\Csv\Data');
|
||||
$this->wizard = app('FireflyIII\Helpers\Csv\WizardInterface');
|
||||
$this->data = app('FireflyIII\Helpers\Csv\Data');
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +57,7 @@ class CsvController extends Controller
|
||||
public function columnRoles()
|
||||
{
|
||||
|
||||
$fields = ['csv-file', 'csv-date-format', 'csv-has-headers'];
|
||||
$fields = ['csv-file', 'csv-date-format', 'csv-has-headers', 'csv-import-account'];
|
||||
if (!$this->wizard->sessionHasValues($fields)) {
|
||||
Session::flash('warning', 'Could not recover upload.');
|
||||
|
||||
@@ -103,7 +104,7 @@ class CsvController extends Controller
|
||||
return redirect(route('csv.index'));
|
||||
}
|
||||
$data = [
|
||||
'date-format' => Session::get('date-format'),
|
||||
'date-format' => Session::get('csv-date-format'),
|
||||
'has-headers' => Session::get('csv-has-headers')
|
||||
];
|
||||
if (Session::has('csv-map')) {
|
||||
@@ -116,6 +117,10 @@ class CsvController extends Controller
|
||||
$data['mapped'] = Session::get('csv-mapped');
|
||||
}
|
||||
|
||||
if (Session::has('csv-specifix')) {
|
||||
$data['specifix'] = Session::get('csv-specifix');
|
||||
}
|
||||
|
||||
$result = json_encode($data, JSON_PRETTY_PRINT);
|
||||
$name = 'csv-configuration-' . date('Y-m-d') . '.json';
|
||||
|
||||
@@ -143,13 +148,14 @@ class CsvController extends Controller
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
public function index(AccountRepositoryInterface $repository)
|
||||
{
|
||||
$subTitle = trans('firefly.csv_import');
|
||||
|
||||
Session::forget('csv-date-format');
|
||||
Session::forget('csv-has-headers');
|
||||
Session::forget('csv-file');
|
||||
Session::forget('csv-import-account');
|
||||
Session::forget('csv-map');
|
||||
Session::forget('csv-roles');
|
||||
Session::forget('csv-mapped');
|
||||
@@ -161,11 +167,14 @@ class CsvController extends Controller
|
||||
$specifix[$entry] = trans('firefly.csv_specifix_' . $entry);
|
||||
}
|
||||
|
||||
// get a list of asset accounts:
|
||||
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Asset account', 'Default account']));
|
||||
|
||||
// can actually upload?
|
||||
$uploadPossible = is_writable(storage_path('upload'));
|
||||
$path = storage_path('upload');
|
||||
|
||||
return view('csv.index', compact('subTitle', 'uploadPossible', 'path', 'specifix'));
|
||||
return view('csv.index', compact('subTitle', 'uploadPossible', 'path', 'specifix', 'accounts'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -297,12 +306,13 @@ class CsvController extends Controller
|
||||
$rows = $importer->getRows();
|
||||
$errors = $importer->getErrors();
|
||||
$imported = $importer->getImported();
|
||||
$journals = $importer->getJournals();
|
||||
|
||||
Preferences::mark();
|
||||
|
||||
$subTitle = trans('firefly.csv_process_title');
|
||||
|
||||
return view('csv.process', compact('rows', 'errors', 'imported', 'subTitle'));
|
||||
return view('csv.process', compact('rows', 'errors', 'imported', 'subTitle', 'journals'));
|
||||
|
||||
}
|
||||
|
||||
@@ -367,19 +377,17 @@ class CsvController extends Controller
|
||||
return redirect(route('csv.index'));
|
||||
}
|
||||
|
||||
$fullPath = $this->wizard->storeCsvFile($request->file('csv')->getRealPath());
|
||||
$settings = [];
|
||||
$settings['date-format'] = Input::get('date_format');
|
||||
$settings['has-headers'] = intval(Input::get('has_headers')) === 1;
|
||||
$settings['specifix'] = Input::get('specifix');
|
||||
$settings['map'] = [];
|
||||
$settings['mapped'] = [];
|
||||
$settings['roles'] = [];
|
||||
$fullPath = $this->wizard->storeCsvFile($request->file('csv')->getRealPath());
|
||||
$settings = [];
|
||||
$settings['date-format'] = Input::get('date_format');
|
||||
$settings['has-headers'] = intval(Input::get('has_headers')) === 1;
|
||||
$settings['specifix'] = Input::get('specifix');
|
||||
$settings['import-account'] = intval(Input::get('csv_import_account'));
|
||||
$settings['map'] = [];
|
||||
$settings['mapped'] = [];
|
||||
$settings['roles'] = [];
|
||||
|
||||
/*
|
||||
* Process config file if present.
|
||||
*/
|
||||
if ($request->hasFile('csv_config')) {
|
||||
if ($request->hasFile('csv_config')) { // Process config file if present.
|
||||
$data = file_get_contents($request->file('csv_config')->getRealPath());
|
||||
$json = json_decode($data, true);
|
||||
if (is_array($json)) {
|
||||
@@ -394,8 +402,9 @@ class CsvController extends Controller
|
||||
$this->data->setMapped($settings['mapped']);
|
||||
$this->data->setRoles($settings['roles']);
|
||||
$this->data->setSpecifix($settings['specifix']);
|
||||
$this->data->setImportAccount($settings['import-account']);
|
||||
|
||||
return redirect(route('csv.column-roles'));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ use Config;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Input;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Route;
|
||||
use Session;
|
||||
@@ -72,7 +73,6 @@ class HomeController extends Controller
|
||||
$count = $repository->countAccounts($types);
|
||||
bcscale(2);
|
||||
|
||||
|
||||
if ($count == 0) {
|
||||
return redirect(route('new-user.index'));
|
||||
}
|
||||
@@ -84,6 +84,7 @@ class HomeController extends Controller
|
||||
$frontPage = Preferences::get('frontPageAccounts', []);
|
||||
$start = Session::get('start', Carbon::now()->startOfMonth());
|
||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||
$showTour = Preferences::get('tour', true)->data;
|
||||
|
||||
$accounts = $repository->getFrontpageAccounts($frontPage);
|
||||
$savings = $repository->getSavingsAccounts();
|
||||
@@ -114,7 +115,9 @@ class HomeController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts'));
|
||||
return view(
|
||||
'index', compact('count', 'showTour', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,6 +131,7 @@ class HomeController extends Controller
|
||||
|
||||
return redirect(route('index'));
|
||||
}
|
||||
Log::debug('Make log.');
|
||||
|
||||
// get all routes:
|
||||
$routeCollection = Route::getRoutes();
|
||||
|
@@ -12,6 +12,7 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Preferences;
|
||||
use Response;
|
||||
use Session;
|
||||
use Steam;
|
||||
@@ -24,6 +25,43 @@ use Steam;
|
||||
class JsonController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function endTour()
|
||||
{
|
||||
Preferences::set('tour', false);
|
||||
|
||||
return Response::json('true');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function tour()
|
||||
{
|
||||
$pref = Preferences::get('tour', true);
|
||||
if (!$pref) {
|
||||
abort(404);
|
||||
}
|
||||
$headers = ['main-content', 'sidebar-toggle', 'account-menu', 'budget-menu', 'report-menu', 'transaction-menu', 'option-menu', 'main-content-end'];
|
||||
$steps = [];
|
||||
foreach ($headers as $header) {
|
||||
$steps[] = [
|
||||
'element' => '#' . $header,
|
||||
'title' => trans('help.' . $header . '-title'),
|
||||
'content' => trans('help.' . $header . '-text'),
|
||||
];
|
||||
}
|
||||
$steps[0]['orphan'] = true;// orphan and backdrop for first element.
|
||||
$steps[0]['backdrop'] = true;
|
||||
$steps[1]['placement'] = 'left';// sidebar position left:
|
||||
$steps[7]['orphan'] = true; // final in the center again.
|
||||
$steps[7]['backdrop'] = true;
|
||||
$template = view('json.tour')->render();
|
||||
|
||||
return Response::json(['steps' => $steps, 'template' => $template]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BillRepositoryInterface $repository
|
||||
@@ -34,8 +72,9 @@ class JsonController extends Controller
|
||||
*/
|
||||
public function boxBillsPaid(BillRepositoryInterface $repository, AccountRepositoryInterface $accountRepository)
|
||||
{
|
||||
$start = Session::get('start', Carbon::now()->startOfMonth());
|
||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||
$start = Session::get('start', Carbon::now()->startOfMonth());
|
||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||
$amount = 0;
|
||||
bcscale(2);
|
||||
|
||||
// works for json too!
|
||||
@@ -46,12 +85,7 @@ class JsonController extends Controller
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$amount = 0;
|
||||
|
||||
|
||||
// these two functions are the same as the chart
|
||||
$bills = $repository->getActiveBills();
|
||||
$bills = $repository->getActiveBills(); // these two functions are the same as the chart
|
||||
|
||||
/** @var Bill $bill */
|
||||
foreach ($bills as $bill) {
|
||||
@@ -59,14 +93,10 @@ class JsonController extends Controller
|
||||
}
|
||||
unset($bill, $bills);
|
||||
|
||||
/**
|
||||
* Find credit card accounts and possibly unpaid credit card bills.
|
||||
*/
|
||||
$creditCards = $accountRepository->getCreditCards();
|
||||
// if the balance is not zero, the monthly payment is still underway.
|
||||
$creditCards = $accountRepository->getCreditCards(); // Find credit card accounts and possibly unpaid credit card bills.
|
||||
/** @var Account $creditCard */
|
||||
foreach ($creditCards as $creditCard) {
|
||||
$balance = Steam::balance($creditCard, $end, true);
|
||||
$balance = Steam::balance($creditCard, $end, true); // if the balance is not zero, the monthly payment is still underway.
|
||||
if ($balance == 0) {
|
||||
// find a transfer TO the credit card which should account for
|
||||
// anything paid. If not, the CC is not yet used.
|
||||
@@ -76,7 +106,6 @@ class JsonController extends Controller
|
||||
$data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||
$cache->store($data);
|
||||
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
|
||||
@@ -133,7 +162,7 @@ class JsonController extends Controller
|
||||
/** @var Bill $entry */
|
||||
foreach ($unpaid as $entry) {
|
||||
$current = ($entry[0]->amount_max + $entry[0]->amount_min) / 2;
|
||||
$amount = bcadd($amount, $current);
|
||||
$amount = bcadd($amount, $current);
|
||||
}
|
||||
|
||||
$data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||
|
@@ -8,6 +8,7 @@ use FireflyIII\Http\Requests\TagFormRequest;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Input;
|
||||
use Preferences;
|
||||
use Response;
|
||||
@@ -184,7 +185,16 @@ class TagController extends Controller
|
||||
// loop each types and get the tags, group them by year.
|
||||
$collection = [];
|
||||
foreach ($types as $type) {
|
||||
|
||||
/** @var Collection $tags */
|
||||
$tags = Auth::user()->tags()->where('tagMode', $type)->orderBy('date', 'ASC')->get();
|
||||
|
||||
$tags = $tags->sortBy(
|
||||
function (Tag $tag) {
|
||||
return strtolower($tag->tag);
|
||||
}
|
||||
);
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($tags as $tag) {
|
||||
$year = is_null($tag->date) ? trans('firefly.no_year') : $tag->date->year;
|
||||
|
@@ -179,7 +179,7 @@ class TransactionController extends Controller
|
||||
Session::forget('transactions.edit.fromUpdate');
|
||||
|
||||
|
||||
return View::make('transactions.edit', compact('journal', 'accounts', 'what', 'budgets', 'piggies', 'subTitle'))->with('data', $preFilled);
|
||||
return view('transactions.edit', compact('journal', 'accounts', 'what', 'budgets', 'piggies', 'subTitle'))->with('data', $preFilled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,6 @@
|
||||
|
||||
namespace FireflyIII\Http\Middleware;
|
||||
|
||||
use App;
|
||||
use Carbon\Carbon;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
@@ -65,7 +64,7 @@ class Range
|
||||
}
|
||||
if (!Session::has('first')) {
|
||||
/** @var \FireflyIII\Repositories\Journal\JournalRepositoryInterface $repository */
|
||||
$repository = App::make('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
|
||||
$repository = app('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
|
||||
$journal = $repository->first();
|
||||
if ($journal) {
|
||||
Session::put('first', $journal->date);
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
use App;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
@@ -85,7 +84,7 @@ class JournalFormRequest extends Request
|
||||
$rules['category'] = 'between:1,255';
|
||||
break;
|
||||
default:
|
||||
App::abort(500, 'Cannot handle ' . $what);
|
||||
abort(500, 'Cannot handle ' . $what);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -296,6 +296,9 @@ Route::group(
|
||||
Route::get('/json/revenue-accounts', ['uses' => 'JsonController@revenueAccounts', 'as' => 'json.revenue-accounts']);
|
||||
Route::get('/json/categories', ['uses' => 'JsonController@categories', 'as' => 'json.categories']);
|
||||
Route::get('/json/tags', ['uses' => 'JsonController@tags', 'as' => 'json.tags']);
|
||||
Route::get('/json/tour', ['uses' => 'JsonController@tour', 'as' => 'json.tour']);
|
||||
Route::post('/json/end-tour', ['uses' => 'JsonController@endTour']);
|
||||
|
||||
Route::get('/json/box/in', ['uses' => 'JsonController@boxIn', 'as' => 'json.box.in']);
|
||||
Route::get('/json/box/out', ['uses' => 'JsonController@boxOut', 'as' => 'json.box.out']);
|
||||
Route::get('/json/box/bills-unpaid', ['uses' => 'JsonController@boxBillsUnpaid', 'as' => 'json.box.paid']);
|
||||
|
@@ -11,22 +11,23 @@ use Watson\Validating\ValidatingTrait;
|
||||
* Class Account
|
||||
*
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $user_id
|
||||
* @property integer $account_type_id
|
||||
* @property string $name
|
||||
* @property boolean $active
|
||||
* @property boolean $encrypted
|
||||
* @property float $virtual_balance
|
||||
* @property string $virtual_balance_encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta
|
||||
* @property-read \FireflyIII\Models\AccountType $accountType
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $user_id
|
||||
* @property integer $account_type_id
|
||||
* @property string $name
|
||||
* @property boolean $active
|
||||
* @property boolean $encrypted
|
||||
* @property float $virtual_balance
|
||||
* @property string $iban
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta
|
||||
* @property-read \FireflyIII\Models\AccountType $accountType
|
||||
* @property-read mixed $name_for_editform
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereUpdatedAt($value)
|
||||
@@ -37,19 +38,16 @@ use Watson\Validating\ValidatingTrait;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereActive($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereEncrypted($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereVirtualBalance($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereVirtualBalanceEncrypted($value)
|
||||
* @method static \FireflyIII\Models\Account accountTypeIn($types)
|
||||
* @method static \FireflyIII\Models\Account hasMetaValue($name, $value)
|
||||
* @property boolean joinedAccountTypes
|
||||
* @property mixed startBalance
|
||||
* @property mixed endBalance
|
||||
* @property mixed lastActivityDate
|
||||
* @property mixed piggyBalance
|
||||
* @property mixed difference
|
||||
* @property mixed percentage
|
||||
* @property string $iban
|
||||
* @property-read mixed $name_for_editform
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereIban($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account accountTypeIn($types)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account hasMetaValue($name, $value)
|
||||
* @property-read bool $joinedAccountTypes
|
||||
* @property float $startBalance
|
||||
* @property float $endBalance
|
||||
* @property float $piggyBalance
|
||||
* @property float $percentage
|
||||
* @property float $difference
|
||||
* @property \Carbon\Carbon $lastActivityDate
|
||||
*/
|
||||
class Account extends Model
|
||||
{
|
||||
|
@@ -6,15 +6,14 @@ use Watson\Validating\ValidatingTrait;
|
||||
/**
|
||||
* Class AccountMeta
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $account_id
|
||||
* @property string $name
|
||||
* @property string $data
|
||||
* @property-read \FireflyIII\Models\Account $account
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $account_id
|
||||
* @property string $name
|
||||
* @property string $data
|
||||
* @property-read \FireflyIII\Models\Account $account
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereUpdatedAt($value)
|
||||
|
@@ -5,14 +5,13 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Class AccountType
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $type
|
||||
* @property boolean $editable
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $type
|
||||
* @property boolean $editable
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereUpdatedAt($value)
|
||||
|
@@ -4,29 +4,26 @@ use Crypt;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Bill
|
||||
* Class Bill
|
||||
*
|
||||
* @codeCoverageIgnore Class Bill
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $user_id
|
||||
* @property string $name
|
||||
* @property string $match
|
||||
* @property float $amount_min
|
||||
* @property string $amount_min_encrypted
|
||||
* @property float $amount_max
|
||||
* @property string $amount_max_encrypted
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property boolean $active
|
||||
* @property boolean $automatch
|
||||
* @property string $repeat_freq
|
||||
* @property integer $skip
|
||||
* @property boolean $name_encrypted
|
||||
* @property boolean $match_encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $user_id
|
||||
* @property string $name
|
||||
* @property string $match
|
||||
* @property float $amount_min
|
||||
* @property float $amount_max
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property boolean $active
|
||||
* @property boolean $automatch
|
||||
* @property string $repeat_freq
|
||||
* @property integer $skip
|
||||
* @property boolean $name_encrypted
|
||||
* @property boolean $match_encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUpdatedAt($value)
|
||||
@@ -34,9 +31,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatch($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMin($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMinEncrypted($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMax($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMaxEncrypted($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereDate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereActive($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAutomatch($value)
|
||||
@@ -44,8 +39,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereSkip($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereNameEncrypted($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatchEncrypted($value)
|
||||
* @property mixed nextExpectedMatch
|
||||
* @property mixed lastFoundMatch
|
||||
* @property-read \Carbon\Carbon $nextExpectedMatch
|
||||
* @property-read \Carbon\Carbon $lastFoundMatch
|
||||
*/
|
||||
class Bill extends Model
|
||||
{
|
||||
|
@@ -7,19 +7,18 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
/**
|
||||
* Class Budget
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $name
|
||||
* @property integer $user_id
|
||||
* @property boolean $active
|
||||
* @property boolean $encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $name
|
||||
* @property integer $user_id
|
||||
* @property boolean $active
|
||||
* @property boolean $encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereUpdatedAt($value)
|
||||
@@ -39,9 +38,6 @@ class Budget extends Model
|
||||
|
||||
/**
|
||||
* @param array $fields
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return Budget
|
||||
*/
|
||||
|
@@ -5,26 +5,23 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Class BudgetLimit
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $budget_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property float $amount
|
||||
* @property string $amount_encrypted
|
||||
* @property boolean $repeats
|
||||
* @property string $repeat_freq
|
||||
* @property-read \FireflyIII\Models\Budget $budget
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\LimitRepetition[] $limitrepetitions
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $budget_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property float $amount
|
||||
* @property boolean $repeats
|
||||
* @property string $repeat_freq
|
||||
* @property-read \FireflyIII\Models\Budget $budget
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\LimitRepetition[] $limitrepetitions
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereBudgetId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereStartdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereAmount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereAmountEncrypted($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereRepeats($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereRepeatFreq($value)
|
||||
*/
|
||||
|
@@ -8,15 +8,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* Class Category
|
||||
*
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $name
|
||||
* @property integer $user_id
|
||||
* @property boolean $encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $name
|
||||
* @property integer $user_id
|
||||
* @property boolean $encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUpdatedAt($value)
|
||||
@@ -24,8 +24,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUserId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereEncrypted($value)
|
||||
* @property mixed spent
|
||||
* @property mixed lastActivity
|
||||
* @property-read float $spent
|
||||
* @property-read \Carbon\Carbon $lastActivity
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
|
@@ -6,15 +6,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
/**
|
||||
* Class Component
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $name
|
||||
* @property integer $user_id
|
||||
* @property string $class
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $name
|
||||
* @property integer $user_id
|
||||
* @property string $class
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereUpdatedAt($value)
|
||||
|
@@ -5,17 +5,15 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Class LimitRepetition
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $budget_limit_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property \Carbon\Carbon $enddate
|
||||
* @property float $amount
|
||||
* @property string $amount_encrypted
|
||||
* @property-read \FireflyIII\Models\BudgetLimit $budgetLimit
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $budget_limit_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property \Carbon\Carbon $enddate
|
||||
* @property float $amount
|
||||
* @property-read \FireflyIII\Models\BudgetLimit $budgetLimit
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereUpdatedAt($value)
|
||||
@@ -23,7 +21,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereStartdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereEnddate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereAmount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereAmountEncrypted($value)
|
||||
*/
|
||||
class LimitRepetition extends Model
|
||||
{
|
||||
|
@@ -8,13 +8,13 @@ use Zizaco\Entrust\EntrustPermission;
|
||||
* Class Permission
|
||||
*
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property string $name
|
||||
* @property string $display_name
|
||||
* @property string $description
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.role')[] $roles
|
||||
* @property integer $id
|
||||
* @property string $name
|
||||
* @property string $display_name
|
||||
* @property string $description
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.role[] $roles
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Permission whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Permission whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Permission whereDisplayName($value)
|
||||
|
@@ -7,23 +7,23 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
/**
|
||||
* Class PiggyBank
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $account_id
|
||||
* @property string $name
|
||||
* @property float $targetamount
|
||||
* @property string $targetamount_encrypted
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property \Carbon\Carbon $targetdate
|
||||
* @property integer $order
|
||||
* @property boolean $encrypted
|
||||
* @property-read \FireflyIII\Models\Account $account
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankRepetition[] $piggyBankRepetitions
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $account_id
|
||||
* @property string $name
|
||||
* @property float $targetamount
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property \Carbon\Carbon $targetdate
|
||||
* @property integer $order
|
||||
* @property boolean $encrypted
|
||||
* @property boolean $remind_me
|
||||
* @property integer $reminder_skip
|
||||
* @property-read \FireflyIII\Models\Account $account
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankRepetition[] $piggyBankRepetitions
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereUpdatedAt($value)
|
||||
@@ -31,18 +31,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereAccountId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereTargetamount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereTargetamountEncrypted($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereStartdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereTargetdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereOrder($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereEncrypted($value)
|
||||
* @property PiggyBankRepetition currentRep
|
||||
* @property string $reminder
|
||||
* @property integer $reminder_skip
|
||||
* @property boolean $remind_me
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminder($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminderSkip($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereRemindMe($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminderSkip($value)
|
||||
* @property-read \FireflyIII\Models\PiggyBankRepetition $currentRep
|
||||
*/
|
||||
class PiggyBank extends Model
|
||||
{
|
||||
|
@@ -5,18 +5,16 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Class PiggyBankEvent
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $piggy_bank_id
|
||||
* @property integer $transaction_journal_id
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property float $amount
|
||||
* @property string $amount_encrypted
|
||||
* @property-read \FireflyIII\Models\PiggyBank $piggyBank
|
||||
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $piggy_bank_id
|
||||
* @property integer $transaction_journal_id
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property float $amount
|
||||
* @property-read \FireflyIII\Models\PiggyBank $piggyBank
|
||||
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereUpdatedAt($value)
|
||||
@@ -24,7 +22,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereTransactionJournalId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereDate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereAmount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereAmountEncrypted($value)
|
||||
*/
|
||||
class PiggyBankEvent extends Model
|
||||
{
|
||||
|
@@ -7,17 +7,15 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Class PiggyBankRepetition
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $piggy_bank_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property \Carbon\Carbon $targetdate
|
||||
* @property float $currentamount
|
||||
* @property string $currentamount_encrypted
|
||||
* @property-read \FireflyIII\Models\PiggyBank $piggyBank
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $piggy_bank_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property \Carbon\Carbon $targetdate
|
||||
* @property float $currentamount
|
||||
* @property-read \FireflyIII\Models\PiggyBank $piggyBank
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereUpdatedAt($value)
|
||||
@@ -25,9 +23,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereStartdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereTargetdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCurrentamount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCurrentamountEncrypted($value)
|
||||
* @method static \FireflyIII\Models\PiggyBankRepetition onDates($start, $target)
|
||||
* @method static \FireflyIII\Models\PiggyBankRepetition relevantOnDate($date)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition onDates($start, $target)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition relevantOnDate($date)
|
||||
*/
|
||||
class PiggyBankRepetition extends Model
|
||||
{
|
||||
|
@@ -6,17 +6,16 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Class Preference
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $user_id
|
||||
* @property string $name
|
||||
* @property string $name_encrypted
|
||||
* @property string $data
|
||||
* @property string $data_encrypted
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $user_id
|
||||
* @property string $name
|
||||
* @property string $name_encrypted
|
||||
* @property string $data
|
||||
* @property string $data_encrypted
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereUpdatedAt($value)
|
||||
|
@@ -8,14 +8,14 @@ use Zizaco\Entrust\EntrustRole;
|
||||
* Class Role
|
||||
*
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property string $name
|
||||
* @property string $display_name
|
||||
* @property string $description
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('auth.model')[] $users
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.permission')[] $perms
|
||||
* @property integer $id
|
||||
* @property string $name
|
||||
* @property string $display_name
|
||||
* @property string $description
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('auth.model[] $users
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.permission[] $perms
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereDisplayName($value)
|
||||
|
@@ -10,20 +10,20 @@ use Watson\Validating\ValidatingTrait;
|
||||
* Class Tag
|
||||
*
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $deleted_at
|
||||
* @property integer $user_id
|
||||
* @property string $tag
|
||||
* @property string $tagMode
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property string $description
|
||||
* @property float $latitude
|
||||
* @property float $longitude
|
||||
* @property integer $zoomLevel
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $deleted_at
|
||||
* @property integer $user_id
|
||||
* @property string $tag
|
||||
* @property string $tagMode
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property string $description
|
||||
* @property float $latitude
|
||||
* @property float $longitude
|
||||
* @property integer $zoomLevel
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereUpdatedAt($value)
|
||||
|
@@ -9,19 +9,17 @@ use Watson\Validating\ValidatingTrait;
|
||||
/**
|
||||
* Class Transaction
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $account_id
|
||||
* @property integer $transaction_journal_id
|
||||
* @property string $description
|
||||
* @property float $amount
|
||||
* @property string $amount_encrypted
|
||||
* @property-read \FireflyIII\Models\Account $account
|
||||
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $account_id
|
||||
* @property integer $transaction_journal_id
|
||||
* @property string $description
|
||||
* @property float $amount
|
||||
* @property-read \FireflyIII\Models\Account $account
|
||||
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereUpdatedAt($value)
|
||||
@@ -30,11 +28,10 @@ use Watson\Validating\ValidatingTrait;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereTransactionJournalId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereDescription($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereAmount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereAmountEncrypted($value)
|
||||
* @method static \FireflyIII\Models\Transaction after($date)
|
||||
* @method static \FireflyIII\Models\Transaction before($date)
|
||||
* @property mixed before
|
||||
* @property mixed after
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction after($date)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction before($date)
|
||||
* @property float $before
|
||||
* @property float $after
|
||||
*/
|
||||
class Transaction extends Model
|
||||
{
|
||||
|
@@ -6,16 +6,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
/**
|
||||
* Class TransactionCurrency
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $code
|
||||
* @property string $name
|
||||
* @property string $symbol
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $code
|
||||
* @property string $name
|
||||
* @property string $symbol
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereUpdatedAt($value)
|
||||
|
@@ -6,16 +6,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
/**
|
||||
* Class TransactionGroup
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $user_id
|
||||
* @property string $relation
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $user_id
|
||||
* @property string $relation
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereUpdatedAt($value)
|
||||
|
@@ -13,35 +13,35 @@ use Watson\Validating\ValidatingTrait;
|
||||
* Class TransactionJournal
|
||||
*
|
||||
* @package FireflyIII\Models
|
||||
* @SuppressWarnings (PHPMD.TooManyMethods)
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $user_id
|
||||
* @property integer $transaction_type_id
|
||||
* @property integer $bill_id
|
||||
* @property integer $transaction_currency_id
|
||||
* @property string $description
|
||||
* @property boolean $completed
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property boolean $encrypted
|
||||
* @property integer $order
|
||||
* @property-read \FireflyIII\Models\Bill $bill
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
|
||||
* @property-read mixed $actual_amount
|
||||
* @property-read mixed $amount
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
|
||||
* @property-read mixed $asset_account
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
||||
* @property-read mixed $corrected_actual_amount
|
||||
* @property-read mixed $destination_account
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
|
||||
* @property-read \FireflyIII\Models\TransactionCurrency $transactionCurrency
|
||||
* @property-read \FireflyIII\Models\TransactionType $transactionType
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionGroup[] $transactiongroups
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property integer $user_id
|
||||
* @property integer $transaction_type_id
|
||||
* @property integer $bill_id
|
||||
* @property integer $transaction_currency_id
|
||||
* @property string $description
|
||||
* @property boolean $completed
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property boolean $encrypted
|
||||
* @property integer $order
|
||||
* @property integer $tag_count
|
||||
* @property-read \FireflyIII\Models\Bill $bill
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
|
||||
* @property-read mixed $actual_amount
|
||||
* @property-read mixed $amount
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
|
||||
* @property-read mixed $correct_amount
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
||||
* @property-read mixed $destination_account
|
||||
* @property-read mixed $source_account
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
|
||||
* @property-read \FireflyIII\Models\TransactionCurrency $transactionCurrency
|
||||
* @property-read \FireflyIII\Models\TransactionType $transactionType
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionGroup[] $transactiongroups
|
||||
* @property-read \FireflyIII\User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereUpdatedAt($value)
|
||||
@@ -55,25 +55,19 @@ use Watson\Validating\ValidatingTrait;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereDate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereEncrypted($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereOrder($value)
|
||||
* @method static \FireflyIII\Models\TransactionJournal accountIs($account)
|
||||
* @method static \FireflyIII\Models\TransactionJournal after($date)
|
||||
* @method static \FireflyIII\Models\TransactionJournal before($date)
|
||||
* @method static \FireflyIII\Models\TransactionJournal onDate($date)
|
||||
* @method static \FireflyIII\Models\TransactionJournal transactionTypes($types)
|
||||
* @method static \FireflyIII\Models\TransactionJournal withRelevantData()
|
||||
* @property-read mixed $expense_account
|
||||
* @property string account_encrypted
|
||||
* @property bool joinedTransactions
|
||||
* @property bool joinedTransactionTypes
|
||||
* @property mixed account_id
|
||||
* @property mixed name
|
||||
* @property mixed symbol
|
||||
* @property-read mixed $correct_amount
|
||||
* @method static \FireflyIII\Models\TransactionJournal orderBy
|
||||
* @method static \FireflyIII\Models\TransactionJournal|null first
|
||||
* @property-read mixed $source_account
|
||||
* @property integer $tag_count
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereTagCount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal accountIs($account)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal after($date)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal before($date)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal onDate($date)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal transactionTypes($types)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal withRelevantData()
|
||||
* @property-read bool $account_encrypted
|
||||
* @property-read bool $joinedTransactions
|
||||
* @property-read bool $joinedTransactionTypes
|
||||
* @property-read int $account_id
|
||||
* @property-read string $name
|
||||
* @property-read string $symbol
|
||||
*/
|
||||
class TransactionJournal extends Model
|
||||
{
|
||||
@@ -150,14 +144,9 @@ class TransactionJournal extends Model
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$amount = '0';
|
||||
bcscale(2);
|
||||
/** @var Transaction $t */
|
||||
foreach ($this->transactions as $t) {
|
||||
if ($t->amount > 0) {
|
||||
$amount = $t->amount;
|
||||
}
|
||||
}
|
||||
$set = $this->transactions->sortByDesc('amount');
|
||||
$amount = $set->first()->amount;
|
||||
|
||||
if (intval($this->tag_count) === 1) {
|
||||
// get amount for single tag:
|
||||
@@ -175,6 +164,49 @@ class TransactionJournal extends Model
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
* @param $amount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function amountByTagAdvancePayment(Tag $tag, $amount)
|
||||
{
|
||||
if ($this->transactionType->type == 'Withdrawal') {
|
||||
$others = $tag->transactionJournals()->transactionTypes(['Deposit'])->get();
|
||||
foreach ($others as $other) {
|
||||
$amount = bcsub($amount, $other->actual_amount);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
if ($this->transactionType->type == 'Deposit') {
|
||||
return '0';
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $tag
|
||||
* @param $amount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function amountByTagBalancingAct($tag, $amount)
|
||||
{
|
||||
if ($this->transactionType->type == 'Withdrawal') {
|
||||
$transfer = $tag->transactionJournals()->transactionTypes(['Transfer'])->first();
|
||||
if ($transfer) {
|
||||
$amount = bcsub($amount, $transfer->actual_amount);
|
||||
|
||||
return $amount;
|
||||
}
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assuming the journal has only one tag. Parameter amount is used as fallback.
|
||||
*
|
||||
@@ -186,28 +218,12 @@ class TransactionJournal extends Model
|
||||
protected function amountByTag(Tag $tag, $amount)
|
||||
{
|
||||
if ($tag->tagMode == 'advancePayment') {
|
||||
if ($this->transactionType->type == 'Withdrawal') {
|
||||
$others = $tag->transactionJournals()->transactionTypes(['Deposit'])->get();
|
||||
foreach ($others as $other) {
|
||||
$amount = bcsub($amount, $other->actual_amount);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
if ($this->transactionType->type == 'Deposit') {
|
||||
return '0';
|
||||
}
|
||||
return $this->amountByTagAdvancePayment($tag, $amount);
|
||||
}
|
||||
|
||||
if ($tag->tagMode == 'balancingAct') {
|
||||
if ($this->transactionType->type == 'Withdrawal') {
|
||||
$transfer = $tag->transactionJournals()->transactionTypes(['Transfer'])->first();
|
||||
if ($transfer) {
|
||||
$amount = bcsub($amount, $transfer->actual_amount);
|
||||
return $this->amountByTagBalancingAct($tag, $amount);
|
||||
|
||||
return $amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
@@ -5,7 +5,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Class TransactionRelation
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
*/
|
||||
class TransactionRelation extends Model
|
||||
|
@@ -6,14 +6,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
/**
|
||||
* Class TransactionType
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Models
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $type
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property string $type
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereUpdatedAt($value)
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use App;
|
||||
use FireflyIII\Support\Amount;
|
||||
use FireflyIII\Support\ExpandedForm;
|
||||
use FireflyIII\Support\Navigation;
|
||||
@@ -38,7 +37,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
* Default Twig configuration:
|
||||
*/
|
||||
|
||||
$config = App::make('config');
|
||||
$config = app('config');
|
||||
Twig::addExtension(new Functions($config));
|
||||
Twig::addExtension(new PiggyBank);
|
||||
Twig::addExtension(new General);
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Repositories\Account;
|
||||
|
||||
use App;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
@@ -47,11 +46,17 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
* @param Account $moveTo
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function destroy(Account $account)
|
||||
public function destroy(Account $account, Account $moveTo = null)
|
||||
{
|
||||
if (!is_null($moveTo)) {
|
||||
// update all transactions:
|
||||
DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]);
|
||||
}
|
||||
|
||||
$account->delete();
|
||||
|
||||
return true;
|
||||
@@ -64,11 +69,18 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*/
|
||||
public function getAccounts(array $types)
|
||||
{
|
||||
/** @var Collection $result */
|
||||
$result = Auth::user()->accounts()->with(
|
||||
['accountmeta' => function (HasMany $query) {
|
||||
$query->where('name', 'accountRole');
|
||||
}]
|
||||
)->accountTypeIn($types)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
|
||||
)->accountTypeIn($types)->get(['accounts.*']);
|
||||
|
||||
$result = $result->sortBy(
|
||||
function (Account $account) {
|
||||
return strtolower($account->name);
|
||||
}
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -204,9 +216,9 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
$lastTransaction = $account->transactions()->leftJoin(
|
||||
'transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id'
|
||||
)->orderBy('transaction_journals.date', 'DESC')->first(['transactions.*', 'transaction_journals.date']);
|
||||
)->orderBy('transaction_journals.date', 'DESC')->first(['transactions.account_id', 'transaction_journals.date']);
|
||||
if ($lastTransaction) {
|
||||
return $lastTransaction->transactionjournal->date;
|
||||
return $lastTransaction->date;
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -456,6 +468,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
'accountType' => $type,
|
||||
'name' => $data['name'] . ' initial balance',
|
||||
'active' => false,
|
||||
'iban' => '',
|
||||
'virtualBalance' => 0,
|
||||
];
|
||||
$opposing = $this->storeAccount($opposingData);
|
||||
@@ -505,7 +518,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
$existingAccount = Account::firstOrNullEncrypted($searchData);
|
||||
if (!$existingAccount) {
|
||||
Log::error('Account create error: ' . $newAccount->getErrors()->toJson());
|
||||
App::abort(500);
|
||||
abort(500);
|
||||
// @codeCoverageIgnoreStart
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
@@ -26,10 +26,11 @@ interface AccountRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
* @param Account $moveTo
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function destroy(Account $account);
|
||||
public function destroy(Account $account, Account $moveTo = null);
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
|
@@ -10,6 +10,7 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Illuminate\Support\Collection;
|
||||
use Navigation;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class BillRepository
|
||||
@@ -39,6 +40,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
return $amount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a fake bill to help the chart controller.
|
||||
*
|
||||
@@ -383,4 +385,84 @@ class BillRepository implements BillRepositoryInterface
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of paid bills and a collection of unpaid bills to be used
|
||||
* in the pie chart on the front page.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getBillsForChart(Carbon $start, Carbon $end)
|
||||
{
|
||||
$paid = new Collection;
|
||||
$unpaid = new Collection;
|
||||
|
||||
$bills = $this->getActiveBills();
|
||||
/** @var Bill $bill */
|
||||
foreach ($bills as $bill) {
|
||||
$ranges = $this->getRanges($bill, $start, $end);
|
||||
|
||||
foreach ($ranges as $range) {
|
||||
// paid a bill in this range?
|
||||
$journals = $this->getJournalsInRange($bill, $range['start'], $range['end']);
|
||||
if ($journals->count() == 0) {
|
||||
$unpaid->push([$bill, $range['start']]);
|
||||
} else {
|
||||
$paid = $paid->merge($journals);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$set = new Collection;
|
||||
$set->put('paid', $paid);
|
||||
$set->put('unpaid', $unpaid);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the paid/unpaid bills collection set up before and expands it using
|
||||
* credit cards the user might have.
|
||||
*
|
||||
* @param Collection $set
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getCreditCardInfoForChart(Collection $set, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
$accounts = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$creditCards = $accounts->getCreditCards();
|
||||
$paid = $set->get('paid');
|
||||
$unpaid = $set->get('unpaid');
|
||||
|
||||
foreach ($creditCards as $creditCard) {
|
||||
$balance = Steam::balance($creditCard, $end, true);
|
||||
$date = new Carbon($creditCard->getMeta('ccMonthlyPaymentDate'));
|
||||
if ($balance < 0) {
|
||||
// unpaid! create a fake bill that matches the amount.
|
||||
$description = $creditCard->name;
|
||||
$amount = $balance * -1;
|
||||
$fakeBill = $this->createFakeBill($description, $date, $amount);
|
||||
unset($description, $amount);
|
||||
$unpaid->push([$fakeBill, $date]);
|
||||
}
|
||||
if ($balance == 0) {
|
||||
// find transfer(s) TO the credit card which should account for
|
||||
// anything paid. If not, the CC is not yet used.
|
||||
$journals = $accounts->getTransfersInRange($creditCard, $start, $end);
|
||||
$paid = $paid->merge($journals);
|
||||
}
|
||||
}
|
||||
$set = new Collection;
|
||||
$set->put('paid', $paid);
|
||||
$set->put('unpaid', $unpaid);
|
||||
|
||||
return $set;
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,29 @@ use Illuminate\Support\Collection;
|
||||
interface BillRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Takes the paid/unpaid bills collection set up before and expands it using
|
||||
* credit cards the user might have.
|
||||
*
|
||||
* @param Collection $set
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getCreditCardInfoForChart(Collection $set, Carbon $start, Carbon $end);
|
||||
|
||||
/**
|
||||
* Gets a collection of paid bills and a collection of unpaid bills to be used
|
||||
* in the pie chart on the front page.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getBillsForChart(Carbon $start, Carbon $end);
|
||||
|
||||
/**
|
||||
* Returns the sum of all payments connected to this bill between the dates.
|
||||
*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user