Compare commits

..

83 Commits
3.4 ... 3.4.0.4

Author SHA1 Message Date
James Cole
cf00922ad2 Merge branch 'release/3.4.0.4' 2015-05-09 15:13:20 +02:00
James Cole
d07b2e773b Update read me 2015-05-09 15:13:14 +02:00
James Cole
506ef7b0b9 Covered currency repository. 2015-05-09 15:11:12 +02:00
James Cole
2cd5dae8e2 New read me [skip ci] 2015-05-09 15:08:56 +02:00
James Cole
a1cd49c111 First attempt at translations. 2015-05-09 13:56:03 +02:00
James Cole
aca2973aef Experimental chart [skip ci] 2015-05-09 13:55:07 +02:00
James Cole
0a7a691c95 Experimental chart [skip ci] 2015-05-09 13:53:58 +02:00
James Cole
72906a7afd Experimental chart [skip ci] 2015-05-09 13:52:33 +02:00
James Cole
d1a4a83570 Covered category repository. 2015-05-09 13:14:02 +02:00
James Cole
e0396b29e8 Add GA beacon [skip ci] 2015-05-09 10:43:37 +02:00
James Cole
536833cfe0 Fixed tests. 2015-05-09 10:25:52 +02:00
James Cole
317b02d1b9 Finished budget repository tests. 2015-05-09 10:23:13 +02:00
James Cole
75e279ea0d Update read me [skip ci] 2015-05-09 09:17:09 +02:00
James Cole
dc2ad21f4c Updated read me [skip ci] 2015-05-09 09:15:39 +02:00
James Cole
484d49aae1 Fixed tests 2015-05-09 09:15:27 +02:00
James Cole
ca39438ad4 Small update to the read me. [skip ci] 2015-05-09 09:11:54 +02:00
James Cole
49a65ebff4 New budget repository tests. 2015-05-09 09:05:37 +02:00
James Cole
befdc05084 Rewrote read me. [skip ci] 2015-05-08 19:34:03 +02:00
James Cole
1fbffe761b Merge branch 'release/3.4.0.3' into develop 2015-05-08 17:35:03 +02:00
James Cole
36aad379ff Merge branch 'release/3.4.0.3' 2015-05-08 17:35:02 +02:00
James Cole
540cfa072e Update read me. 2015-05-08 17:34:54 +02:00
James Cole
3b049c15cc Updated composer.json [skip ci] 2015-05-08 17:15:16 +02:00
James Cole
3e93ed0a17 Small JS fix. [skip ci] 2015-05-08 17:13:49 +02:00
James Cole
d7d9358136 Fix sorting [skip ci] 2015-05-08 17:04:24 +02:00
James Cole
5cf0939ff9 Fixed sorting [skip ci] 2015-05-08 17:03:20 +02:00
James Cole
8dc6f91d3c Add sort options. [skip ci] 2015-05-08 17:00:39 +02:00
James Cole
a3a25db230 New tests. 2015-05-08 16:44:57 +02:00
James Cole
c06f18c815 Some new tests 2015-05-08 14:00:49 +02:00
James Cole
6802f04036 First two tests for bill repository. 2015-05-08 12:50:39 +02:00
James Cole
beeccdf345 New (incomplete) tests [skip ci] 2015-05-08 12:44:42 +02:00
James Cole
58241ed39d Covered account repository. 2015-05-08 12:42:12 +02:00
James Cole
31128020f0 Merge branch 'release/3.4.0.2' 2015-05-08 07:57:06 +02:00
James Cole
6c48afc37b Merge branch 'release/3.4.0.2' into develop 2015-05-08 07:57:06 +02:00
James Cole
7a2f169dfc Push new version. 2015-05-08 07:56:55 +02:00
James Cole
ed910b99a7 Update travis configuration [skip ci] 2015-05-08 07:48:04 +02:00
James Cole
54195c0826 Updated tests. 2015-05-08 07:39:05 +02:00
James Cole
cefbbcd1df Fixed some tests. 2015-05-08 07:27:29 +02:00
James Cole
cc01592085 Cover some more account repository. 2015-05-08 06:01:39 +02:00
James Cole
5a98a5252d Added tests. 2015-05-07 21:26:00 +02:00
James Cole
184e8b1132 Some new tests. 2015-05-07 20:56:27 +02:00
James Cole
2b6b896c2e Some more coverage. 2015-05-06 18:09:45 +02:00
James Cole
96d06b7a93 Added incomplete tests. 2015-05-05 22:46:28 +02:00
James Cole
f54f1611b5 First tests for account repository. 2015-05-05 20:46:13 +02:00
James Cole
69ad757e8b Lazily remove todo's [skip ci] 2015-05-05 13:03:39 +02:00
James Cole
e0beb796ad Some cleaning up [skip ci] 2015-05-05 13:03:04 +02:00
James Cole
f331e7d820 Removed unnecessary imports (use statements) [skip ci] 2015-05-05 12:57:27 +02:00
James Cole
cbb62d3d78 Added new line at the end of files. [skip ci] 2015-05-05 12:51:57 +02:00
James Cole
c85bc59c1d Merge branch 'release/3.4.0.1' into develop 2015-05-05 12:35:23 +02:00
James Cole
8081eeb007 Merge branch 'release/3.4.0.1' 2015-05-05 12:35:22 +02:00
James Cole
56f91bd10d Increment version. 2015-05-05 12:35:11 +02:00
James Cole
8e20b78731 Cleanup. 2015-05-05 10:30:39 +02:00
James Cole
23a09b7081 Code cleanup. 2015-05-05 10:23:01 +02:00
James Cole
67fdd27499 Various code cleanup [skip ci] 2015-05-05 07:51:02 +02:00
James Cole
e1941daedd Updated phpdoc. [skip ci] 2015-05-05 07:48:34 +02:00
James Cole
f28bc568a4 Some cleanup [skip ci] 2015-05-05 07:43:16 +02:00
James Cole
f24cfe39aa Expanded some tests. 2015-05-05 07:41:30 +02:00
James Cole
59d2bf3f79 Covered transaction controller. 2015-05-05 07:28:04 +02:00
James Cole
3176e54614 Partial coverage of the transaction controller. 2015-05-04 23:46:14 +02:00
James Cole
eb090f7265 Better factory. 2015-05-04 22:33:52 +02:00
James Cole
6d3a9bfd18 Some cleaning up 2015-05-04 22:33:03 +02:00
James Cole
76f08b7acb Full coverage for chart controller. 2015-05-04 19:28:49 +02:00
James Cole
1ff99346aa Update chart [skip ci] 2015-05-04 18:51:51 +02:00
James Cole
369695ab32 Update chart [skip ci] 2015-05-04 18:51:38 +02:00
James Cole
7e23dd1d66 Update composer.lock [skip ci] 2015-05-04 18:45:32 +02:00
James Cole
0205d3fc5c Overspent transactions have a separate colour [skip ci] 2015-05-04 18:45:20 +02:00
James Cole
4660cf2ad5 Fixed a bug in the display of the current currency code. 2015-05-03 16:16:43 +02:00
James Cole
e26d08d674 Update git ignore. [skip ci] 2015-05-03 16:14:15 +02:00
James Cole
0932bf2797 Don't need these files [skip ci] 2015-05-03 16:13:38 +02:00
James Cole
f560fc6d76 Covered search controller. 2015-05-03 15:55:19 +02:00
James Cole
aa6209af00 Covered tag controller. 2015-05-03 15:00:39 +02:00
James Cole
4a51176193 General cleanup. 2015-05-03 12:58:55 +02:00
James Cole
bb84f7a434 Fixed parameter order [skip ci] 2015-05-03 12:54:39 +02:00
James Cole
48168b1ef0 Covered report controller. 2015-05-03 11:02:34 +02:00
James Cole
8281c7c83e Don't escape currency symbol [skip ci] 2015-05-03 10:11:16 +02:00
James Cole
a07c1e3c71 See code. [skip ci] 2015-05-03 10:07:18 +02:00
James Cole
0766bb31fe Better amount formatting [skip ci] 2015-05-03 10:03:50 +02:00
James Cole
ff4472c1a5 FormatAmountPlain is HTML safe [skip ci] 2015-05-03 10:01:38 +02:00
James Cole
17424740e5 Show plain amount instead of coloured amounts. [skip ci] 2015-05-03 10:00:47 +02:00
James Cole
dad0b2fcd3 Show plain amount instead of coloured amounts. [skip ci] 2015-05-03 10:00:03 +02:00
James Cole
c48dbf030f Covered the reminder controller. 2015-05-03 09:55:22 +02:00
James Cole
617808d603 Covered profile controller with tests. 2015-05-03 09:19:14 +02:00
James Cole
845149deee Boxes are empty, so even when it's zero, place the amount. 2015-05-03 08:56:44 +02:00
James Cole
1a9e009327 Merge branch 'release/3.4' into develop 2015-05-02 23:51:45 +02:00
163 changed files with 5132 additions and 867 deletions

View File

@@ -1,18 +0,0 @@
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
EMAIL_SMTP=
EMAIL_DRIVER=smtp
EMAIL_USERNAME=
EMAIL_PASSWORD=
ANALYTICS_ID=

View File

@@ -1,18 +0,0 @@
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
EMAIL_SMTP=
EMAIL_DRIVER=smtp
EMAIL_USERNAME=
EMAIL_PASSWORD=
ANALYTICS_ID=

View File

@@ -8,8 +8,8 @@ DB_DATABASE=homestead
DB_USERNAME=homestead DB_USERNAME=homestead
DB_PASSWORD=secret DB_PASSWORD=secret
CACHE_DRIVER=file CACHE_DRIVER=array
SESSION_DRIVER=file SESSION_DRIVER=array
EMAIL_SMTP= EMAIL_SMTP=
EMAIL_USERNAME= EMAIL_USERNAME=

2
.gitignore vendored
View File

@@ -29,3 +29,5 @@ clover.xml
node_modules/ node_modules/
addNewLines.php addNewLines.php
.phpstorm.meta.php .phpstorm.meta.php
.env.backup
.env.local

View File

@@ -16,7 +16,7 @@ install:
- mv -v .env.testing .env - mv -v .env.testing .env
script: script:
- phpunit --debug - phpunit
after_script: after_script:
- php vendor/bin/coveralls - php vendor/bin/coveralls

100
README.md
View File

@@ -1,46 +1,62 @@
Firefly III (v3.4) # Firefly III
=========== #### v3.4.0.4
[![Build Status](https://travis-ci.org/JC5/firefly-iii.svg?branch=develop)](https://travis-ci.org/JC5/firefly-iii) [![Build Status](https://travis-ci.org/JC5/firefly-iii.svg?branch=develop)](https://travis-ci.org/JC5/firefly-iii)
[![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii) [![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102/mini.png)](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102/mini.png)](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102)
[![Code Climate](https://codeclimate.com/github/JC5/firefly-iii/badges/gpa.svg)](https://codeclimate.com/github/JC5/firefly-iii) [![Code Climate](https://codeclimate.com/github/JC5/firefly-iii/badges/gpa.svg)](https://codeclimate.com/github/JC5/firefly-iii)
[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.svg?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=master) [![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.svg?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=master)
[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.svg?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=develop)
[![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii) [![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
[![Total Downloads](https://poser.pugx.org/grumpydictator/firefly-iii/downloads.svg)](https://packagist.org/packages/grumpydictator/firefly-iii) ![GA](https://ga-beacon.appspot.com/UA-58172398-6/firefly-iii/readme)
[![Latest Unstable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/unstable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii) ## About
[![License](https://poser.pugx.org/grumpydictator/firefly-iii/license.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
Firefly III is a tool to help you manage your finances. Please read the full description [in the wiki](https://github.com/JC5/firefly-iii/wiki/full-description). "Firefly III" is a financial manager. It can help you keep track of expenses, income, budgets and everything in between. It even supports credit cards, shared
household accounts and savings accounts! It's pretty fancy. You should use it to save and organise money.
Firefly Mark III is a new version of Firefly built upon best practices and lessons learned Firefly is a system you'll have install yourself on webhosting of your choosing.
from building [Firefly](https://github.com/JC5/Firefly). It's Mark III since the original Firefly never made it outside of my
laptop and [Firefly II](https://github.com/JC5/Firefly) is live.
If you're not sure if this tool is for you, please read the [full description](https://github.com/JC5/firefly-iii/wiki/full-description). Personal financial management is pretty difficult, and everybody has their own approach to it. Some people
make budgets, other people limit their cashflow by throwing away their credit cards, others get a better job.
There are tons of ways to save and earn money.
To install and use Firefly III, please read [the installation guide](https://github.com/JC5/firefly-iii/wiki/Installation),
[the upgrade guide](https://github.com/JC5/firefly-iii/wiki/Upgrade-instructions) (if applicable) and the **[first use guide](https://github.com/JC5/firefly-iii/wiki/First-use)**.
If you want to try out Firefly III, you can do so on [this dedicated website](https://geld.nder.be/). This site always runs the latest version of Firefly III. If you want to use it, please read the [privacy considerations](https://github.com/JC5/firefly-iii/wiki/Privacy-on-demo-site) for this demo-site. To get to know Firefly, and to see if it fits you, check out these resources:
- The screenshots below on this very page.
- The featurelist below, also on this very page.
- The [full description](https://github.com/JC5/firefly-iii/wiki/full-description), which will tell you how Firefly works,
and the philosophy behind it.
### About the name (if you care)
It's III, or 3, because [version 2](https://github.com/JC5/Firefly) and version 1 (not online) preceded it. It has been growing steadily ever since.
## Running and installing
If you're still interested please read [the installation guide](https://github.com/JC5/firefly-iii/wiki/Installation),
[the upgrade guide](https://github.com/JC5/firefly-iii/wiki/Upgrade-instructions) (if applicable)
and the **[first use guide](https://github.com/JC5/firefly-iii/wiki/First-use)**.
If you want to try out Firefly III, you can do so on [this dedicated website](https://geld.nder.be/).
This site always runs the latest version of Firefly III. If you want to use it, please read the [privacy considerations](https://github.com/JC5/firefly-iii/wiki/Privacy-on-demo-site) for this demo-site.
## Current features ## Current features
- [A double-entry bookkeeping system](https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system); - [A double-entry bookkeeping system](https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system);
- You can store, edit and remove withdrawals, deposits and transfers. This allows you full financial management; - You can store, edit and remove [withdrawals, deposits and transfers](https://en.wikipedia.org/wiki/Financial_transaction). This allows you full financial management;
- You can manage different types of accounts - You can manage different types of accounts
- Asset accounts - [Asset](https://en.wikipedia.org/wiki/Asset) accounts
- Shared asset accounts (household accounts) - Shared [asset accounts](https://en.wikipedia.org/wiki/Asset) ([household accounts](https://en.wikipedia.org/wiki/Household))
- Saving accounts - Saving accounts
- Credit cards - Credit cards
- It's possible to create, change and manage money using _[budgets](https://en.wikipedia.org/wiki/Envelope_system)_; - It's possible to create, change and manage money using _[budgets](https://en.wikipedia.org/wiki/Envelope_system)_;
- Organize transactions using categories; - Organize transactions using categories;
- Save towards a goal using piggy banks; - Save towards a goal using [piggy banks](https://en.wikipedia.org/wiki/Piggy_bank);
- Predict and anticipate bills; - Predict and anticipate [bills](https://en.wikipedia.org/wiki/Invoice);
- View income / expense reports; - View income / expense [reports](https://en.wikipedia.org/wiki/Financial_statement);
- Lots of help text in case you don't get it; - Organize expenses using tags;
- Lots of help text in case you don't get it.
Everything is organised: Everything is organised:
@@ -50,33 +66,29 @@ Everything is organised:
- Lots of charts because we all love them. - Lots of charts because we all love them.
- Financial reporting showing you how well you are doing; - Financial reporting showing you how well you are doing;
## Changes
Firefly III will feature, but does not feature yet:
- More control over other resources outside of personal finance
- Debts
- More test-coverage;
- Firefly will be able to split transactions; a single purchase can be split in multiple entries, for more fine-grained control.
- Firefly will be able to join transactions.
- Any other features I might not have thought of.
Some stuff has been removed:
- The nesting of budgets, categories and beneficiaries is removed because it was pretty pointless.
## Screenshots ## Screenshots
![Index](http://i.imgur.com/TkZNIer.png) _Please note that everything in these screenshots is fictional and may not be realistic._
![Accounts](http://i.imgur.com/YE8WavP.png) ![Index](https://i.nder.be/c09vfw90)
![Budgets](http://i.imgur.com/Go0M6Nd.png) ![Accounts](https://i.nder.be/hkn0vhcg)
![Reports](http://i.imgur.com/EnEIyQI.png) ![Budgets](https://i.nder.be/h2snx2mw)
![Reports 1](https://i.nder.be/c9f8zy5c)
![Reports 2](https://i.nder.be/ghvs5png)
![Bills](https://i.nder.be/h58kh00p)
![Piggy banks](https://i.nder.be/hkud0h53)
## Current state ## Current state
I have the basics up and running. Test coverage is currently coming, slowly.
Questions, ideas or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)! Firefly III is pretty much all grown up. Full test coverage (nerd alert!) is coming. One of the things on the todo-list
is adding translations.
Questions, ideas, bugs or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)!
If you like this tool, feel free to [donate me some beer money](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2ZMV952UUSCLU&lc=NL&item_name=Development%20of%20Firefly&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted).

View File

@@ -19,7 +19,8 @@ class JournalCreated extends Event
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @param TransactionJournal $journal
* @param $piggyBankId
*/ */
public function __construct(TransactionJournal $journal, $piggyBankId) public function __construct(TransactionJournal $journal, $piggyBankId)
{ {

View File

@@ -2,6 +2,11 @@
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
/**
* Class JournalDeleted
*
* @package FireflyIII\Events
*/
class JournalDeleted extends Event class JournalDeleted extends Event
{ {
@@ -10,7 +15,6 @@ class JournalDeleted extends Event
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void
*/ */
public function __construct() public function __construct()
{ {

View File

@@ -3,6 +3,11 @@
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
/**
* Class JournalSaved
*
* @package FireflyIII\Events
*/
class JournalSaved extends Event class JournalSaved extends Event
{ {
@@ -13,7 +18,7 @@ class JournalSaved extends Event
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @param TransactionJournal $journal
*/ */
public function __construct(TransactionJournal $journal) public function __construct(TransactionJournal $journal)
{ {

View File

@@ -49,8 +49,7 @@ class Handler extends ExceptionHandler
*/ */
public function report(Exception $e) public function report(Exception $e)
{ {
/** @noinspection PhpInconsistentReturnPointsInspection */ parent::report($e);
return parent::report($e);
} }
} }

View File

@@ -19,7 +19,6 @@ class ConnectJournalToPiggyBank
/** /**
* Create the event handler. * Create the event handler.
* *
* @return void
*/ */
public function __construct() public function __construct()
{ {

View File

@@ -15,7 +15,6 @@ class RescanJournal
/** /**
* Create the event handler. * Create the event handler.
* *
* @return void
*/ */
public function __construct() public function __construct()
{ {
@@ -41,7 +40,7 @@ class RescanJournal
Log::debug('Found ' . $list->count() . ' bills to check.'); Log::debug('Found ' . $list->count() . ' bills to check.');
/** @var Bill $bill */ /** @var \FireflyIII\Models\Bill $bill */
foreach ($list as $bill) { foreach ($list as $bill) {
Log::debug('Now calling bill #' . $bill->id . ' (' . $bill->name . ')'); Log::debug('Now calling bill #' . $bill->id . ' (' . $bill->name . ')');
$repository->scan($bill, $journal); $repository->scan($bill, $journal);

View File

@@ -2,7 +2,6 @@
use FireflyIII\Events\JournalSaved; use FireflyIII\Events\JournalSaved;
use FireflyIII\Models\PiggyBankEvent; use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\Transaction;
/** /**
* Class UpdateJournalConnection * Class UpdateJournalConnection
@@ -15,7 +14,6 @@ class UpdateJournalConnection
/** /**
* Create the event handler. * Create the event handler.
* *
* @return void
*/ */
public function __construct() public function __construct()
{ {

View File

@@ -54,7 +54,9 @@ class Help implements HelpInterface
} }
/** /**
* @return boolean * @param $route
*
* @return bool
*/ */
public function hasRoute($route) public function hasRoute($route)
{ {
@@ -62,10 +64,10 @@ class Help implements HelpInterface
} }
/** /**
* @param $title * @param $route
* @param array $content * @param array $content
* *
* @return void * @internal param $title
*/ */
public function putInCache($route, array $content) public function putInCache($route, array $content)
{ {

View File

@@ -17,11 +17,6 @@ interface HelpInterface
*/ */
public function getFromCache($key); public function getFromCache($key);
/**
* @return boolean
*/
public function hasRoute($route);
/** /**
* @param $route * @param $route
* *
@@ -31,11 +26,10 @@ interface HelpInterface
/** /**
* @param $route * @param $route
* @param array $content
* *
* @return void * @return bool
*/ */
public function putInCache($route, array $content); public function hasRoute($route);
/** /**
* @param $route * @param $route
@@ -43,4 +37,12 @@ interface HelpInterface
* @return bool * @return bool
*/ */
public function inCache($route); public function inCache($route);
/**
* @param $route
* @param array $content
*
* @return void
*/
public function putInCache($route, array $content);
} }

View File

@@ -91,11 +91,11 @@ class ReportHelper implements ReportHelperInterface
$end = Carbon::now(); $end = Carbon::now();
$months = []; $months = [];
while ($start <= $end) { while ($start <= $end) {
$year = $start->format('Y'); $year = $start->year;
$months[$year][] = [ $months[$year][] = [
'formatted' => $start->format('F Y'), 'formatted' => $start->format('F Y'),
'month' => intval($start->format('m')), 'month' => $start->month,
'year' => intval($start->format('Y')), 'year' => $year,
]; ];
$start->addMonth(); $start->addMonth();
} }
@@ -114,10 +114,10 @@ class ReportHelper implements ReportHelperInterface
$end = Carbon::now(); $end = Carbon::now();
$years = []; $years = [];
while ($start <= $end) { while ($start <= $end) {
$years[] = $start->format('Y'); $years[] = $start->year;
$start->addYear(); $start->addYear();
} }
$years[] = Carbon::now()->format('Y'); $years[] = Carbon::now()->year;
// force the current year. // force the current year.
$years = array_unique($years); $years = array_unique($years);
@@ -136,7 +136,7 @@ class ReportHelper implements ReportHelperInterface
$end = clone $date; $end = clone $date;
$sharedAccounts = []; $sharedAccounts = [];
if ($showSharedReports === false) { if ($showSharedReports === false) {
$sharedCollection = \Auth::user()->accounts() $sharedCollection = Auth::user()->accounts()
->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id') ->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')
->where('account_meta.name', '=', 'accountRole') ->where('account_meta.name', '=', 'accountRole')
->where('account_meta.data', '=', json_encode('sharedAsset')) ->where('account_meta.data', '=', json_encode('sharedAsset'))

View File

@@ -150,8 +150,16 @@ class ReportQuery implements ReportQueryInterface
$set = $query->get(['accounts.*']); $set = $query->get(['accounts.*']);
$set->each( $set->each(
function (Account $account) use ($start, $end) { function (Account $account) use ($start, $end) {
/**
* The balance for today always incorporates transactions
* made on today. So to get todays "start" balance, we sub one
* day.
*/
$yesterday = clone $start;
$yesterday->subDay();
/** @noinspection PhpParamsInspection */ /** @noinspection PhpParamsInspection */
$account->startBalance = Steam::balance($account, $start); $account->startBalance = Steam::balance($account, $yesterday);
$account->endBalance = Steam::balance($account, $end); $account->endBalance = Steam::balance($account, $end);
} }
); );

View File

@@ -67,11 +67,12 @@ class AccountController extends Controller
} }
/** /**
* @param AccountRepositoryInterface $repository
* @param Account $account * @param Account $account
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function destroy(Account $account, AccountRepositoryInterface $repository) public function destroy(AccountRepositoryInterface $repository, Account $account)
{ {
$type = $account->accountType->type; $type = $account->accountType->type;
@@ -86,12 +87,12 @@ class AccountController extends Controller
} }
/** /**
* @param Account $account
* @param AccountRepositoryInterface $repository * @param AccountRepositoryInterface $repository
* @param Account $account
* *
* @return View * @return View
*/ */
public function edit(Account $account, AccountRepositoryInterface $repository) public function edit(AccountRepositoryInterface $repository, Account $account)
{ {
$what = Config::get('firefly.shortNamesByFullName')[$account->accountType->type]; $what = Config::get('firefly.shortNamesByFullName')[$account->accountType->type];
@@ -129,12 +130,12 @@ class AccountController extends Controller
} }
/** /**
* @param $what
* @param AccountRepositoryInterface $repository * @param AccountRepositoryInterface $repository
* @param $what
* *
* @return View * @return View
*/ */
public function index($what, AccountRepositoryInterface $repository) public function index(AccountRepositoryInterface $repository, $what)
{ {
$subTitle = Config::get('firefly.subTitlesByIdentifier.' . $what); $subTitle = Config::get('firefly.subTitlesByIdentifier.' . $what);
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what); $subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
@@ -158,12 +159,12 @@ class AccountController extends Controller
} }
/** /**
* @param Account $account
* @param AccountRepositoryInterface $repository * @param AccountRepositoryInterface $repository
* @param Account $account
* *
* @return View * @return View
*/ */
public function show(Account $account, AccountRepositoryInterface $repository) public function show(AccountRepositoryInterface $repository, Account $account)
{ {
$page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page')); $page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page'));
$subTitleIcon = Config::get('firefly.subTitlesByIdentifier.' . $account->accountType->type); $subTitleIcon = Config::get('firefly.subTitlesByIdentifier.' . $account->accountType->type);
@@ -214,13 +215,13 @@ class AccountController extends Controller
} }
/** /**
* @param Account $account
* @param AccountFormRequest $request * @param AccountFormRequest $request
* @param AccountRepositoryInterface $repository * @param AccountRepositoryInterface $repository
* @param Account $account
* *
* @return \Illuminate\Http\RedirectResponse * @return $this|\Illuminate\Http\RedirectResponse
*/ */
public function update(Account $account, AccountFormRequest $request, AccountRepositoryInterface $repository) public function update(AccountFormRequest $request, AccountRepositoryInterface $repository, Account $account)
{ {
$accountData = [ $accountData = [

View File

@@ -4,7 +4,6 @@ use Config;
use FireflyIII\Http\Requests; use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\BillFormRequest; use FireflyIII\Http\Requests\BillFormRequest;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Bill; use FireflyIII\Models\Bill;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
@@ -35,11 +34,12 @@ class BillController extends Controller
} }
/** /**
* @param AccountRepositoryInterface $repository
* @param Bill $bill * @param Bill $bill
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function add(Bill $bill, AccountRepositoryInterface $repository) public function add(AccountRepositoryInterface $repository, Bill $bill)
{ {
$matches = explode(',', $bill->match); $matches = explode(',', $bill->match);
$description = []; $description = [];
@@ -89,8 +89,9 @@ class BillController extends Controller
Session::put('bills.create.url', URL::previous()); Session::put('bills.create.url', URL::previous());
} }
Session::forget('bills.create.fromStore'); Session::forget('bills.create.fromStore');
$subTitle = 'Create new bill';
return view('bills.create')->with('periods', $periods)->with('subTitle', 'Create new'); return view('bills.create', compact('periods', 'subTitle'));
} }
/** /**
@@ -102,16 +103,18 @@ class BillController extends Controller
{ {
// put previous url in session // put previous url in session
Session::put('bills.delete.url', URL::previous()); Session::put('bills.delete.url', URL::previous());
$subTitle = 'Delete "' . e($bill->name) . '"';
return view('bills.delete')->with('bill', $bill)->with('subTitle', 'Delete "' . e($bill->name) . '"'); return view('bills.delete', compact('bill', 'subTitle'));
} }
/** /**
* @param BillRepositoryInterface $repository
* @param Bill $bill * @param Bill $bill
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function destroy(Bill $bill, BillRepositoryInterface $repository) public function destroy(BillRepositoryInterface $repository, Bill $bill)
{ {
$repository->destroy($bill); $repository->destroy($bill);
@@ -129,6 +132,7 @@ class BillController extends Controller
public function edit(Bill $bill) public function edit(Bill $bill)
{ {
$periods = Config::get('firefly.periods_to_text'); $periods = Config::get('firefly.periods_to_text');
$subTitle = 'Edit "' . e($bill->name) . '"';
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('bills.edit.fromUpdate') !== true) { if (Session::get('bills.edit.fromUpdate') !== true) {
@@ -136,7 +140,7 @@ class BillController extends Controller
} }
Session::forget('bills.edit.fromUpdate'); Session::forget('bills.edit.fromUpdate');
return view('bills.edit')->with('periods', $periods)->with('bill', $bill)->with('subTitle', 'Edit "' . e($bill->name) . '"'); return view('bills.edit', compact('subTitle', 'periods', 'bill'));
} }
/** /**
@@ -158,11 +162,12 @@ class BillController extends Controller
} }
/** /**
* @param BillRepositoryInterface $repository
* @param Bill $bill * @param Bill $bill
* *
* @return mixed * @return \Illuminate\Http\RedirectResponse
*/ */
public function rescan(Bill $bill, BillRepositoryInterface $repository) public function rescan(BillRepositoryInterface $repository, Bill $bill)
{ {
if (intval($bill->active) == 0) { if (intval($bill->active) == 0) {
Session::flash('warning', 'Inactive bills cannot be scanned.'); Session::flash('warning', 'Inactive bills cannot be scanned.');
@@ -183,21 +188,26 @@ class BillController extends Controller
} }
/** /**
* @param BillRepositoryInterface $repository
* @param Bill $bill * @param Bill $bill
* *
* @return mixed * @return mixed
*/ */
public function show(Bill $bill, BillRepositoryInterface $repository) public function show(BillRepositoryInterface $repository, Bill $bill)
{ {
$journals = $repository->getJournals($bill); $journals = $repository->getJournals($bill);
$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill); $bill->nextExpectedMatch = $repository->nextExpectedMatch($bill);
$hideBill = true; $hideBill = true;
$subTitle = e($bill->name);
return view('bills.show', compact('journals', 'hideBill', 'bill'))->with('subTitle', e($bill->name)); return view('bills.show', compact('journals', 'hideBill', 'bill', 'subTitle'));
} }
/** /**
* @return $this * @param BillFormRequest $request
* @param BillRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/ */
public function store(BillFormRequest $request, BillRepositoryInterface $repository) public function store(BillFormRequest $request, BillRepositoryInterface $repository)
{ {
@@ -218,11 +228,13 @@ class BillController extends Controller
} }
/** /**
* @param BillFormRequest $request
* @param BillRepositoryInterface $repository
* @param Bill $bill * @param Bill $bill
* *
* @return $this * @return $this|\Illuminate\Http\RedirectResponse
*/ */
public function update(Bill $bill, BillFormRequest $request, BillRepositoryInterface $repository) public function update(BillFormRequest $request, BillRepositoryInterface $repository, Bill $bill)
{ {
$billData = $request->getBillData(); $billData = $request->getBillData();
$bill = $repository->update($bill, $billData); $bill = $repository->update($bill, $billData);

View File

@@ -5,7 +5,6 @@ use Carbon\Carbon;
use FireflyIII\Http\Requests; use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\BudgetFormRequest; use FireflyIII\Http\Requests\BudgetFormRequest;
use FireflyIII\Models\Budget; use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\LimitRepetition; use FireflyIII\Models\LimitRepetition;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Input; use Input;
@@ -36,11 +35,12 @@ class BudgetController extends Controller
} }
/** /**
* @param BudgetRepositoryInterface $repository
* @param Budget $budget * @param Budget $budget
* *
* @return \Illuminate\Http\JsonResponse * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function amount(Budget $budget, BudgetRepositoryInterface $repository) public function amount(BudgetRepositoryInterface $repository, Budget $budget)
{ {
$amount = intval(Input::get('amount')); $amount = intval(Input::get('amount'));
$date = Session::get('start', Carbon::now()->startOfMonth()); $date = Session::get('start', Carbon::now()->startOfMonth());
@@ -60,8 +60,9 @@ class BudgetController extends Controller
Session::put('budgets.create.url', URL::previous()); Session::put('budgets.create.url', URL::previous());
} }
Session::forget('budgets.create.fromStore'); Session::forget('budgets.create.fromStore');
$subTitle = 'Create a new budget';
return view('budgets.create')->with('subTitle', 'Create a new budget'); return view('budgets.create', compact('subTitle'));
} }
/** /**
@@ -81,6 +82,7 @@ class BudgetController extends Controller
/** /**
* @param Budget $budget * @param Budget $budget
* @param BudgetRepositoryInterface $repository
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
@@ -116,7 +118,9 @@ class BudgetController extends Controller
} }
/** /**
* @return mixed * @param BudgetRepositoryInterface $repository
*
* @return View
*/ */
public function index(BudgetRepositoryInterface $repository) public function index(BudgetRepositoryInterface $repository)
{ {
@@ -150,7 +154,9 @@ class BudgetController extends Controller
} }
/** /**
* @return \Illuminate\View\View * @param BudgetRepositoryInterface $repository
*
* @return View
*/ */
public function noBudget(BudgetRepositoryInterface $repository) public function noBudget(BudgetRepositoryInterface $repository)
{ {
@@ -163,7 +169,7 @@ class BudgetController extends Controller
} }
/** /**
* @return mixed * @return \Illuminate\Http\RedirectResponse
*/ */
public function postUpdateIncome() public function postUpdateIncome()
{ {
@@ -175,16 +181,18 @@ class BudgetController extends Controller
} }
/** /**
* * @param BudgetRepositoryInterface $repository
* @param Budget $budget * @param Budget $budget
* @param LimitRepetition $repetition * @param LimitRepetition $repetition
* *
* @return \Illuminate\View\View * @return View
*/ */
public function show(Budget $budget, LimitRepetition $repetition = null, BudgetRepositoryInterface $repository) public function show(BudgetRepositoryInterface $repository, Budget $budget, LimitRepetition $repetition = null)
{ {
if (!is_null($repetition->id) && $repetition->budgetLimit->budget->id != $budget->id) { if (!is_null($repetition->id) && $repetition->budgetLimit->budget->id != $budget->id) {
return view('error')->with('message', 'Invalid selection.'); $message = 'Invalid selection.';
return view('error', compact('message'));
} }
$journals = $repository->getJournals($budget, $repetition); $journals = $repository->getJournals($budget, $repetition);
@@ -224,13 +232,13 @@ class BudgetController extends Controller
} }
/** /**
* @param Budget $budget
* @param BudgetFormRequest $request * @param BudgetFormRequest $request
* @param BudgetRepositoryInterface $repository * @param BudgetRepositoryInterface $repository
* @param Budget $budget
* *
* @return \Illuminate\Http\RedirectResponse * @return $this|\Illuminate\Http\RedirectResponse
*/ */
public function update(Budget $budget, BudgetFormRequest $request, BudgetRepositoryInterface $repository) public function update(BudgetFormRequest $request, BudgetRepositoryInterface $repository, Budget $budget)
{ {
$budgetData = [ $budgetData = [
'name' => $request->input('name'), 'name' => $request->input('name'),
@@ -254,14 +262,14 @@ class BudgetController extends Controller
} }
/** /**
* @return $this * @return View
*/ */
public function updateIncome() public function updateIncome()
{ {
$date = Session::get('start', Carbon::now()->startOfMonth())->format('FY'); $date = Session::get('start', Carbon::now()->startOfMonth())->format('FY');
$budgetAmount = Preferences::get('budgetIncomeTotal' . $date, 1000); $amount = Preferences::get('budgetIncomeTotal' . $date, 1000);
return view('budgets.income')->with('amount', $budgetAmount); return view('budgets.income', compact('amount'));
} }
} }

View File

@@ -2,7 +2,6 @@
use Auth; use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\CategoryFormRequest; use FireflyIII\Http\Requests\CategoryFormRequest;
use FireflyIII\Models\Category; use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
@@ -41,8 +40,9 @@ class CategoryController extends Controller
Session::put('categories.create.url', URL::previous()); Session::put('categories.create.url', URL::previous());
} }
Session::forget('categories.create.fromStore'); Session::forget('categories.create.fromStore');
$subTitle = 'Create a new category';
return view('categories.create')->with('subTitle', 'Create a new category'); return view('categories.create', compact('subTitle'));
} }
/** /**
@@ -61,11 +61,12 @@ class CategoryController extends Controller
} }
/** /**
* @param CategoryRepositoryInterface $repository
* @param Category $category * @param Category $category
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function destroy(Category $category, CategoryRepositoryInterface $repository) public function destroy(CategoryRepositoryInterface $repository, Category $category)
{ {
$name = $category->name; $name = $category->name;
@@ -96,8 +97,9 @@ class CategoryController extends Controller
} }
/** /**
* @return $this * @param CategoryRepositoryInterface $repository
* *
* @return $this
*/ */
public function index(CategoryRepositoryInterface $repository) public function index(CategoryRepositoryInterface $repository)
{ {
@@ -113,6 +115,8 @@ class CategoryController extends Controller
} }
/** /**
* @param CategoryRepositoryInterface $repository
*
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function noCategory(CategoryRepositoryInterface $repository) public function noCategory(CategoryRepositoryInterface $repository)
@@ -126,11 +130,12 @@ class CategoryController extends Controller
} }
/** /**
* @param CategoryRepositoryInterface $repository
* @param Category $category * @param Category $category
* *
* @return $this * @return View
*/ */
public function show(Category $category, CategoryRepositoryInterface $repository) public function show(CategoryRepositoryInterface $repository, Category $category)
{ {
$hideCategory = true; // used in list. $hideCategory = true; // used in list.
$page = intval(Input::get('page')); $page = intval(Input::get('page'));
@@ -169,13 +174,13 @@ class CategoryController extends Controller
/** /**
* @param Category $category
* @param CategoryFormRequest $request * @param CategoryFormRequest $request
* @param CategoryRepositoryInterface $repository * @param CategoryRepositoryInterface $repository
* @param Category $category
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function update(Category $category, CategoryFormRequest $request, CategoryRepositoryInterface $repository) public function update(CategoryFormRequest $request, CategoryRepositoryInterface $repository, Category $category)
{ {
$categoryData = [ $categoryData = [
'name' => $request->input('name'), 'name' => $request->input('name'),

View File

@@ -68,11 +68,12 @@ class CurrencyController extends Controller
} }
/** /**
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency * @param TransactionCurrency $currency
* *
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View * @return \Illuminate\Http\RedirectResponse|View
*/ */
public function delete(TransactionCurrency $currency, CurrencyRepositoryInterface $repository) public function delete(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{ {
if ($repository->countJournals($currency) > 0) { if ($repository->countJournals($currency) > 0) {
@@ -89,11 +90,13 @@ class CurrencyController extends Controller
} }
/** /**
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency * @param TransactionCurrency $currency
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
* @throws \Exception
*/ */
public function destroy(TransactionCurrency $currency, CurrencyRepositoryInterface $repository) public function destroy(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{ {
if ($repository->countJournals($currency) > 0) { if ($repository->countJournals($currency) > 0) {
Session::flash('error', 'Cannot destroy ' . e($currency->name) . ' because there are still transactions attached to it.'); Session::flash('error', 'Cannot destroy ' . e($currency->name) . ' because there are still transactions attached to it.');
@@ -130,6 +133,8 @@ class CurrencyController extends Controller
} }
/** /**
* @param CurrencyRepositoryInterface $repository
*
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function index(CurrencyRepositoryInterface $repository) public function index(CurrencyRepositoryInterface $repository)
@@ -141,7 +146,9 @@ class CurrencyController extends Controller
} }
/** /**
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. *
* @param CurrencyFormRequest $request
* @param CurrencyRepositoryInterface $repository
* *
* @return $this|\Illuminate\Http\RedirectResponse * @return $this|\Illuminate\Http\RedirectResponse
*/ */
@@ -166,11 +173,13 @@ class CurrencyController extends Controller
} }
/** /**
* @param CurrencyFormRequest $request
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency * @param TransactionCurrency $currency
* *
* @return $this|\Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function update(TransactionCurrency $currency, CurrencyFormRequest $request, CurrencyRepositoryInterface $repository) public function update(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{ {
$data = $request->getCurrencyData(); $data = $request->getCurrencyData();
$currency = $repository->update($currency, $data); $currency = $repository->update($currency, $data);

View File

@@ -35,12 +35,12 @@ class GoogleChartController extends Controller
/** /**
* @param GChart $chart
* @param Account $account * @param Account $account
* @param string $view
* *
* @return \Illuminate\Http\JsonResponse * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function accountBalanceChart(Account $account, GChart $chart) public function accountBalanceChart(GChart $chart, Account $account)
{ {
$chart->addColumn('Day of month', 'date'); $chart->addColumn('Day of month', 'date');
$chart->addColumn('Balance for ' . $account->name, 'number'); $chart->addColumn('Balance for ' . $account->name, 'number');
@@ -65,6 +65,7 @@ class GoogleChartController extends Controller
/** /**
* @param GChart $chart * @param GChart $chart
* @param AccountRepositoryInterface $repository
* *
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
@@ -104,11 +105,13 @@ class GoogleChartController extends Controller
} }
/** /**
* @param int $year * @param GChart $chart
* @param BudgetRepositoryInterface $repository
* @param $year
* *
* @return $this|\Illuminate\Http\JsonResponse * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function allBudgetsAndSpending($year, GChart $chart, BudgetRepositoryInterface $repository) public function allBudgetsAndSpending(GChart $chart, BudgetRepositoryInterface $repository, $year)
{ {
$budgets = $repository->getBudgets(); $budgets = $repository->getBudgets();
$chart->addColumn('Month', 'date'); $chart->addColumn('Month', 'date');
@@ -138,6 +141,7 @@ class GoogleChartController extends Controller
/** /**
* @param GChart $chart * @param GChart $chart
* @param BudgetRepositoryInterface $repository
* *
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
@@ -145,7 +149,8 @@ class GoogleChartController extends Controller
{ {
$chart->addColumn('Budget', 'string'); $chart->addColumn('Budget', 'string');
$chart->addColumn('Left', 'number'); $chart->addColumn('Left', 'number');
//$chart->addColumn('Spent', 'number'); $chart->addColumn('Spent', 'number');
$chart->addColumn('Overspent', 'number');
$budgets = $repository->getBudgets(); $budgets = $repository->getBudgets();
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = Session::get('start', Carbon::now()->startOfMonth());
@@ -156,24 +161,43 @@ class GoogleChartController extends Controller
$repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end); $repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end);
if ($repetitions->count() == 0) { if ($repetitions->count() == 0) {
$expenses = $repository->sumBudgetExpensesInPeriod($budget, $start, $end); $expenses = $repository->sumBudgetExpensesInPeriod($budget, $start, $end);
$allEntries->push([$budget->name, 0, $expenses]); $allEntries->push([$budget->name, 0, 0, $expenses]);
continue; continue;
} }
/** @var LimitRepetition $repetition */ /** @var LimitRepetition $repetition */
foreach ($repetitions as $repetition) { foreach ($repetitions as $repetition) {
$expenses = $repository->sumBudgetExpensesInPeriod($budget, $repetition->startdate, $repetition->enddate); $expenses = $repository->sumBudgetExpensesInPeriod($budget, $repetition->startdate, $repetition->enddate);
$allEntries->push([$budget->name . ' (' . $repetition->startdate->format('j M Y') . ')', floatval($repetition->amount), $expenses]); $left = $expenses < floatval($repetition->amount) ? floatval($repetition->amount) - $expenses : 0;
$spent = $expenses > floatval($repetition->amount) ? 0 : $expenses;
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
$allEntries->push(
[$budget->name . ' (' . $repetition->startdate->format('j M Y') . ')',
$left,
$spent,
$overspent
]
);
} }
} }
$noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end); $noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end);
$allEntries->push(['(no budget)', 0, $noBudgetExpenses]); $allEntries->push(['(no budget)', 0, 0, $noBudgetExpenses]);
foreach ($allEntries as $entry) { foreach ($allEntries as $entry) {
if ($entry[2] > 0) { if ($entry[1] != 0 || $entry[2] != 0 || $entry[3] != 0) {
$left = $entry[1] - $entry[2]; $chart->addRow($entry[0], $entry[1], $entry[2], $entry[3]);
$chart->addRow($entry[0], $left);
} }
// if ($entry[2] > 0) {
// $left = $entry[1] - $entry[2];
// if ($left > 0) {
// $chart->addRow($entry[0], $left, null);
// } else {
// if ($left < 0) {
// $chart->addRow($entry[0], null, $left);
// }
// }
//
// }
} }
$chart->generate(); $chart->generate();
@@ -184,6 +208,7 @@ class GoogleChartController extends Controller
/** /**
* @param GChart $chart * @param GChart $chart
* @param CategoryRepositoryInterface $repository
* *
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
@@ -210,12 +235,13 @@ class GoogleChartController extends Controller
} }
/** /**
* @param Bill $bill
* @param GChart $chart * @param GChart $chart
* @param BillRepositoryInterface $repository
* @param Bill $bill
* *
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function billOverview(Bill $bill, GChart $chart, BillRepositoryInterface $repository) public function billOverview(GChart $chart, BillRepositoryInterface $repository, Bill $bill)
{ {
$chart->addColumn('Date', 'date'); $chart->addColumn('Date', 'date');
@@ -239,6 +265,9 @@ class GoogleChartController extends Controller
/** /**
* @param GChart $chart * @param GChart $chart
* *
* @param BillRepositoryInterface $repository
* @param AccountRepositoryInterface $accounts
*
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function billsOverview(GChart $chart, BillRepositoryInterface $repository, AccountRepositoryInterface $accounts) public function billsOverview(GChart $chart, BillRepositoryInterface $repository, AccountRepositoryInterface $accounts)
@@ -319,13 +348,14 @@ class GoogleChartController extends Controller
} }
/** /**
* * @param GChart $chart
* @param BudgetRepositoryInterface $repository
* @param Budget $budget * @param Budget $budget
* @param LimitRepetition $repetition * @param LimitRepetition $repetition
* *
* @return \Illuminate\Http\JsonResponse * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function budgetLimitSpending(Budget $budget, LimitRepetition $repetition, GChart $chart, BudgetRepositoryInterface $repository) public function budgetLimitSpending(GChart $chart, BudgetRepositoryInterface $repository, Budget $budget, LimitRepetition $repetition)
{ {
$start = clone $repetition->startdate; $start = clone $repetition->startdate;
$end = $repetition->enddate; $end = $repetition->enddate;
@@ -352,10 +382,10 @@ class GoogleChartController extends Controller
} }
/** /**
* @param Budget $budget
* @param int $year
* @param GChart $chart * @param GChart $chart
* @param BudgetRepositoryInterface $repository * @param BudgetRepositoryInterface $repository
* @param Budget $budget
* @param int $year
* *
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
@@ -389,12 +419,13 @@ class GoogleChartController extends Controller
} }
/** /**
* * @param GChart $chart
* @param CategoryRepositoryInterface $repository
* @param Category $category * @param Category $category
* *
* @return \Illuminate\Http\JsonResponse * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function categoryOverviewChart(Category $category, GChart $chart, CategoryRepositoryInterface $repository) public function categoryOverviewChart(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
{ {
// oldest transaction in category: // oldest transaction in category:
$start = $repository->getFirstActivityDate($category); $start = $repository->getFirstActivityDate($category);
@@ -425,12 +456,13 @@ class GoogleChartController extends Controller
} }
/** /**
* * @param GChart $chart
* @param CategoryRepositoryInterface $repository
* @param Category $category * @param Category $category
* *
* @return \Illuminate\Http\JsonResponse * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function categoryPeriodChart(Category $category, GChart $chart, CategoryRepositoryInterface $repository) public function categoryPeriodChart(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
{ {
$start = clone Session::get('start', Carbon::now()->startOfMonth()); $start = clone Session::get('start', Carbon::now()->startOfMonth());
$chart->addColumn('Period', 'date'); $chart->addColumn('Period', 'date');
@@ -452,11 +484,13 @@ class GoogleChartController extends Controller
/** /**
* @param GChart $chart
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @return \Illuminate\Http\JsonResponse * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function piggyBankHistory(PiggyBank $piggyBank, GChart $chart, PiggyBankRepositoryInterface $repository) public function piggyBankHistory(GChart $chart, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{ {
$chart->addColumn('Date', 'date'); $chart->addColumn('Date', 'date');
$chart->addColumn('Balance', 'number'); $chart->addColumn('Balance', 'number');
@@ -477,12 +511,13 @@ class GoogleChartController extends Controller
} }
/** /**
* * @param GChart $chart
* @param ReportQueryInterface $query
* @param $year * @param $year
* *
* @return \Illuminate\Http\JsonResponse * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function yearInExp($year, GChart $chart, ReportQueryInterface $query) public function yearInExp(GChart $chart, ReportQueryInterface $query, $year)
{ {
$start = new Carbon('01-01-' . $year); $start = new Carbon('01-01-' . $year);
$chart->addColumn('Month', 'date'); $chart->addColumn('Month', 'date');
@@ -515,12 +550,13 @@ class GoogleChartController extends Controller
} }
/** /**
* * @param GChart $chart
* @param ReportQueryInterface $query
* @param $year * @param $year
* *
* @return \Illuminate\Http\JsonResponse * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function yearInExpSum($year, GChart $chart, ReportQueryInterface $query) public function yearInExpSum(GChart $chart, ReportQueryInterface $query, $year)
{ {
$start = new Carbon('01-01-' . $year); $start = new Carbon('01-01-' . $year);
$chart->addColumn('Summary', 'string'); $chart->addColumn('Summary', 'string');

View File

@@ -13,11 +13,12 @@ class HelpController extends Controller
{ {
/** /**
* @param HelpInterface $help
* @param $route * @param $route
* *
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse
*/ */
public function show($route, HelpInterface $help) public function show(HelpInterface $help, $route)
{ {
$content = [ $content = [
'text' => '<p>There is no help for this route!</p>', 'text' => '<p>There is no help for this route!</p>',

View File

@@ -5,8 +5,7 @@ use Carbon\Carbon;
use FireflyIII\Helpers\Report\ReportQueryInterface; use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\Bill; use FireflyIII\Models\Bill;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Preference;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
@@ -30,6 +29,8 @@ class JsonController extends Controller
/** /**
* @param BillRepositoryInterface $repository * @param BillRepositoryInterface $repository
* *
* @param AccountRepositoryInterface $accountRepository
*
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function boxBillsPaid(BillRepositoryInterface $repository, AccountRepositoryInterface $accountRepository) public function boxBillsPaid(BillRepositoryInterface $repository, AccountRepositoryInterface $accountRepository)
@@ -149,6 +150,8 @@ class JsonController extends Controller
/** /**
* Returns a list of categories. * Returns a list of categories.
* *
* @param CategoryRepositoryInterface $repository
*
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse
*/ */
public function categories(CategoryRepositoryInterface $repository) public function categories(CategoryRepositoryInterface $repository)
@@ -166,6 +169,8 @@ class JsonController extends Controller
/** /**
* Returns a JSON list of all beneficiaries. * Returns a JSON list of all beneficiaries.
* *
* @param AccountRepositoryInterface $accountRepository
*
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse
*/ */
public function expenseAccounts(AccountRepositoryInterface $accountRepository) public function expenseAccounts(AccountRepositoryInterface $accountRepository)
@@ -181,25 +186,10 @@ class JsonController extends Controller
} }
/** /**
* Returns a JSON list of all beneficiaries. * @param AccountRepositoryInterface $accountRepository
* *
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse
*/ */
public function tags(TagRepositoryInterface $tagRepository)
{
$list = $tagRepository->get();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->tag;
}
return Response::json($return);
}
/**
* @return \Illuminate\Http\JsonResponse
*/
public function revenueAccounts(AccountRepositoryInterface $accountRepository) public function revenueAccounts(AccountRepositoryInterface $accountRepository)
{ {
$list = $accountRepository->getAccounts(['Revenue account']); $list = $accountRepository->getAccounts(['Revenue account']);
@@ -217,6 +207,7 @@ class JsonController extends Controller
*/ */
public function setSharedReports() public function setSharedReports()
{ {
/** @var Preference $pref */
$pref = Preferences::get('showSharedReports', false); $pref = Preferences::get('showSharedReports', false);
$new = !$pref->data; $new = !$pref->data;
Preferences::set('showSharedReports', $new); Preferences::set('showSharedReports', $new);
@@ -236,11 +227,31 @@ class JsonController extends Controller
} }
/** /**
* Returns a JSON list of all beneficiaries.
*
* @param TagRepositoryInterface $tagRepository
*
* @return \Illuminate\Http\JsonResponse
*/
public function tags(TagRepositoryInterface $tagRepository)
{
$list = $tagRepository->get();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->tag;
}
return Response::json($return);
}
/**
* @param JournalRepositoryInterface $repository
* @param $what * @param $what
* *
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function transactionJournals($what, JournalRepositoryInterface $repository) public function transactionJournals(JournalRepositoryInterface $repository, $what)
{ {
$descriptions = []; $descriptions = [];
$dbType = $repository->getTransactionType($what); $dbType = $repository->getTransactionType($what);

View File

@@ -6,9 +6,7 @@ use Config;
use ExpandedForm; use ExpandedForm;
use FireflyIII\Http\Requests; use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\PiggyBankFormRequest; use FireflyIII\Http\Requests\PiggyBankFormRequest;
use FireflyIII\Models\Account;
use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@@ -40,11 +38,12 @@ class PiggyBankController extends Controller
/** /**
* Add money to piggy bank * Add money to piggy bank
* *
* @param AccountRepositoryInterface $repository
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @return $this * @return $this
*/ */
public function add(PiggyBank $piggyBank, AccountRepositoryInterface $repository) public function add(AccountRepositoryInterface $repository, PiggyBank $piggyBank)
{ {
$leftOnAccount = $repository->leftOnAccount($piggyBank->account); $leftOnAccount = $repository->leftOnAccount($piggyBank->account);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount; $savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
@@ -55,6 +54,8 @@ class PiggyBankController extends Controller
} }
/** /**
* @param AccountRepositoryInterface $repository
*
* @return mixed * @return mixed
*/ */
public function create(AccountRepositoryInterface $repository) public function create(AccountRepositoryInterface $repository)
@@ -62,8 +63,6 @@ class PiggyBankController extends Controller
$periods = Config::get('firefly.piggy_bank_periods'); $periods = Config::get('firefly.piggy_bank_periods');
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account'])); $accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
//Auth::user()->accounts()->orderBy('accounts.name', 'ASC')->accountTypeIn(['Default account', 'Asset account'])->get(['accounts.*'])
// );
$subTitle = 'Create new piggy bank'; $subTitle = 'Create new piggy bank';
$subTitleIcon = 'fa-plus'; $subTitleIcon = 'fa-plus';
@@ -92,11 +91,12 @@ class PiggyBankController extends Controller
} }
/** /**
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function destroy(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository) public function destroy(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{ {
@@ -107,13 +107,12 @@ class PiggyBankController extends Controller
} }
/** /**
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. * @param AccountRepositoryInterface $repository
*
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @return $this * @return View
*/ */
public function edit(PiggyBank $piggyBank, AccountRepositoryInterface $repository) public function edit(AccountRepositoryInterface $repository, PiggyBank $piggyBank)
{ {
$periods = Config::get('firefly.piggy_bank_periods'); $periods = Config::get('firefly.piggy_bank_periods');
@@ -149,7 +148,10 @@ class PiggyBankController extends Controller
} }
/** /**
* @return $this * @param AccountRepositoryInterface $repository
* @param PiggyBankRepositoryInterface $piggyRepository
*
* @return View
*/ */
public function index(AccountRepositoryInterface $repository, PiggyBankRepositoryInterface $piggyRepository) public function index(AccountRepositoryInterface $repository, PiggyBankRepositoryInterface $piggyRepository)
{ {
@@ -187,7 +189,7 @@ class PiggyBankController extends Controller
} }
/** /**
* Allow user to order piggy banks. * @param PiggyBankRepositoryInterface $repository
*/ */
public function order(PiggyBankRepositoryInterface $repository) public function order(PiggyBankRepositoryInterface $repository)
{ {
@@ -204,13 +206,13 @@ class PiggyBankController extends Controller
} }
/** /**
* POST add money to piggy bank * @param PiggyBankRepositoryInterface $repository
* * @param AccountRepositoryInterface $accounts
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function postAdd(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository, AccountRepositoryInterface $accounts) public function postAdd(PiggyBankRepositoryInterface $repository, AccountRepositoryInterface $accounts, PiggyBank $piggyBank)
{ {
$amount = round(floatval(Input::get('amount')), 2); $amount = round(floatval(Input::get('amount')), 2);
$leftOnAccount = $accounts->leftOnAccount($piggyBank->account); $leftOnAccount = $accounts->leftOnAccount($piggyBank->account);
@@ -240,11 +242,12 @@ class PiggyBankController extends Controller
} }
/** /**
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function postRemove(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository) public function postRemove(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{ {
$amount = floatval(Input::get('amount')); $amount = floatval(Input::get('amount'));
@@ -269,7 +272,6 @@ class PiggyBankController extends Controller
/** /**
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @SuppressWarnings("Unused")
* *
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
@@ -279,11 +281,12 @@ class PiggyBankController extends Controller
} }
/** /**
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @return $this * @return View
*/ */
public function show(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository) public function show(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{ {
$events = $repository->getEvents($piggyBank); $events = $repository->getEvents($piggyBank);
@@ -332,13 +335,13 @@ class PiggyBankController extends Controller
} }
/** /**
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBankFormRequest $request
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
*
* @return $this * @return $this
*/ */
public function update(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository, PiggyBankFormRequest $request) public function update(PiggyBankRepositoryInterface $repository, PiggyBankFormRequest $request, PiggyBank $piggyBank)
{ {
$piggyBankData = [ $piggyBankData = [
'name' => $request->get('name'), 'name' => $request->get('name'),

View File

@@ -26,20 +26,20 @@ class PreferencesController extends Controller
} }
/** /**
* @param AccountRepositoryInterface $repository
*
* @return $this|\Illuminate\View\View * @return $this|\Illuminate\View\View
*/ */
public function index(AccountRepositoryInterface $repository) public function index(AccountRepositoryInterface $repository)
{ {
$accounts = $repository->getAccounts(['Default account', 'Asset account']); $accounts = $repository->getAccounts(['Default account', 'Asset account']);
$viewRange = Preferences::get('viewRange', '1M'); $viewRangePref = Preferences::get('viewRange', '1M');
$viewRangeValue = $viewRange->data; $viewRange = $viewRangePref->data;
$frontPage = Preferences::get('frontPageAccounts', []); $frontPageAccounts = Preferences::get('frontPageAccounts', []);
$budgetMax = Preferences::get('budgetMaximum', 1000); $budgetMax = Preferences::get('budgetMaximum', 1000);
$budgetMaximum = $budgetMax->data; $budgetMaximum = $budgetMax->data;
return view('preferences.index', compact('budgetMaximum'))->with('accounts', $accounts)->with('frontPageAccounts', $frontPage)->with( return view('preferences.index', compact('budgetMaximum', 'accounts', 'frontPageAccounts', 'viewRange'));
'viewRange', $viewRangeValue
);
} }
/** /**

View File

@@ -26,16 +26,6 @@ class ProfileController extends Controller
); );
} }
/**
* @return \Illuminate\View\View
*
*/
public function index()
{
return view('profile.index')->with('title', 'Profile')->with('subTitle', Auth::user()->email)->with('mainTitleIcon', 'fa-user');
}
/** /**
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
@@ -47,8 +37,66 @@ class ProfileController extends Controller
} }
/** /**
* @return \Illuminate\View\View
* *
*/ */
public function index()
{
return view('profile.index')->with('title', 'Profile')->with('subTitle', Auth::user()->email)->with('mainTitleIcon', 'fa-user');
}
/**
* @param ProfileFormRequest $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function postChangePassword(ProfileFormRequest $request)
{
// old, new1, new2
if (!Hash::check($request->get('current_password'), Auth::user()->password)) {
Session::flash('error', 'Invalid current password!');
return Redirect::route('change-password');
}
$result = $this->validatePassword($request->get('current_password'), $request->get('new_password'));
if (!($result === true)) {
Session::flash('error', $result);
return Redirect::route('change-password');
}
// update the user with the new password.
Auth::user()->password = $request->get('new_password');
Auth::user()->save();
Session::flash('success', 'Password changed!');
return Redirect::route('profile');
}
/**
*
* @param string $old
* @param string $new1
*
* @return string|bool
*/
protected function validatePassword($old, $new1)
{
if ($new1 == $old) {
return 'The idea is to change your password.';
}
return true;
}
/**
* @param DeleteAccountFormRequest $request
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Exception
*/
public function postDeleteAccount(DeleteAccountFormRequest $request) public function postDeleteAccount(DeleteAccountFormRequest $request)
{ {
// old, new1, new2 // old, new1, new2
@@ -66,57 +114,4 @@ class ProfileController extends Controller
} }
/**
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function postChangePassword(ProfileFormRequest $request)
{
// old, new1, new2
if (!Hash::check($request->get('current_password'), Auth::user()->password)) {
Session::flash('error', 'Invalid current password!');
return Redirect::route('change-password');
}
$result = $this->validatePassword($request->get('current_password'), $request->get('new_password'), $request->get('new_password_confirmation'));
if (!($result === true)) {
Session::flash('error', $result);
return Redirect::route('change-password');
}
// update the user with the new password.
Auth::user()->password = $request->get('new_password');
Auth::user()->save();
Session::flash('success', 'Password changed!');
return Redirect::route('profile');
}
/**
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
*
* @param string $old
* @param string $new1
* @param string $new2
*
* @return string|bool
*/
protected function validatePassword($old, $new1, $new2)
{
if (strlen($new1) == 0 || strlen($new2) == 0) {
return 'Do fill in a password!';
}
if ($new1 == $old) {
return 'The idea is to change your password.';
}
if ($new1 !== $new2) {
return 'New passwords do not match!';
}
return true;
}
} }

View File

@@ -1,9 +1,7 @@
<?php namespace FireflyIII\Http\Controllers; <?php namespace FireflyIII\Http\Controllers;
use Auth;
use Carbon\Carbon;
use FireflyIII\Helpers\Reminders\ReminderHelperInterface;
use FireflyIII\Models\Reminder; use FireflyIII\Models\Reminder;
use FireflyIII\Repositories\Reminder\ReminderRepositoryInterface;
use Redirect; use Redirect;
use Session; use Session;
use URL; use URL;
@@ -19,6 +17,8 @@ class ReminderController extends Controller
/** /**
* @param Reminder $reminder * @param Reminder $reminder
*
* @return \Illuminate\Http\RedirectResponse
*/ */
public function act(Reminder $reminder) public function act(Reminder $reminder)
{ {
@@ -36,6 +36,8 @@ class ReminderController extends Controller
/** /**
* @param Reminder $reminder * @param Reminder $reminder
*
* @return \Illuminate\Http\RedirectResponse
*/ */
public function dismiss(Reminder $reminder) public function dismiss(Reminder $reminder)
{ {
@@ -48,55 +50,18 @@ class ReminderController extends Controller
} }
/** /**
* @param ReminderRepositoryInterface $repository
* *
* @return \Illuminate\View\View
*/ */
public function index(ReminderHelperInterface $helper) public function index(ReminderRepositoryInterface $repository)
{ {
$reminders = Auth::user()->reminders()->get();
$reminders->each( $active = $repository->getActiveReminders();
function (Reminder $reminder) use ($helper) { $expired = $repository->getExpiredReminders();
$reminder->description = $helper->getReminderText($reminder); $inactive = $repository->getInactiveReminders();
} $dismissed = $repository->getDismissedReminders();
);
$today = new Carbon;
// active reminders:
$active = $reminders->filter(
function (Reminder $reminder) use ($today) {
if ($reminder->notnow === false && $reminder->active === true && $reminder->startdate <= $today && $reminder->enddate >= $today) {
return $reminder;
}
}
);
// expired reminders:
$expired = $reminders->filter(
function (Reminder $reminder) use ($today) {
if ($reminder->notnow === false && $reminder->active === true && $reminder->startdate > $today || $reminder->enddate < $today) {
return $reminder;
}
}
);
// inactive reminders
$inactive = $reminders->filter(
function (Reminder $reminder) {
if ($reminder->active === false) {
return $reminder;
}
}
);
// dismissed reminders
$dismissed = $reminders->filter(
function (Reminder $reminder) {
if ($reminder->notnow === true) {
return $reminder;
}
}
);
$title = 'Reminders'; $title = 'Reminders';
$mainTitleIcon = 'fa-clock-o'; $mainTitleIcon = 'fa-clock-o';
@@ -106,6 +71,8 @@ class ReminderController extends Controller
/** /**
* @param Reminder $reminder * @param Reminder $reminder
*
* @return \Illuminate\View\View
*/ */
public function show(Reminder $reminder) public function show(Reminder $reminder)
{ {

View File

@@ -1,7 +1,6 @@
<?php namespace FireflyIII\Http\Controllers; <?php namespace FireflyIII\Http\Controllers;
use Carbon\Carbon; use Carbon\Carbon;
use Exception;
use FireflyIII\Helpers\Report\ReportHelperInterface; use FireflyIII\Helpers\Report\ReportHelperInterface;
use FireflyIII\Helpers\Report\ReportQueryInterface; use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
@@ -76,6 +75,7 @@ class ReportController extends Controller
// should always hide account // should always hide account
$hide = true; $hide = true;
// loop all budgets // loop all budgets
/** @var \FireflyIII\Models\Budget $budget */
foreach ($budgets as $budget) { foreach ($budgets as $budget) {
$id = intval($budget->id); $id = intval($budget->id);
$data = $budget->toArray(); $data = $budget->toArray();
@@ -107,9 +107,9 @@ class ReportController extends Controller
} }
/** /**
* @param ReportHelperInterface $helper
*
* @return View * @return View
* @internal param ReportHelperInterface $helper
*
*/ */
public function index() public function index()
{ {
@@ -132,11 +132,6 @@ class ReportController extends Controller
public function modalBalancedTransfers(Account $account, $year = '2014', $month = '1') public function modalBalancedTransfers(Account $account, $year = '2014', $month = '1')
{ {
try {
new Carbon($year . '-' . $month . '-01');
} catch (Exception $e) {
return view('error')->with('message', 'Invalid date');
}
$start = new Carbon($year . '-' . $month . '-01'); $start = new Carbon($year . '-' . $month . '-01');
$end = clone $start; $end = clone $start;
$end->endOfMonth(); $end->endOfMonth();
@@ -152,17 +147,13 @@ class ReportController extends Controller
* @param Account $account * @param Account $account
* @param string $year * @param string $year
* @param string $month * @param string $month
* @param ReportQueryInterface $query
* *
* @return View * @return View
* @internal param ReportQueryInterface $query
*
*/ */
public function modalLeftUnbalanced(Account $account, $year = '2014', $month = '1') public function modalLeftUnbalanced(Account $account, $year = '2014', $month = '1')
{ {
try {
new Carbon($year . '-' . $month . '-01');
} catch (Exception $e) {
return view('error')->with('message', 'Invalid date');
}
$start = new Carbon($year . '-' . $month . '-01'); $start = new Carbon($year . '-' . $month . '-01');
$end = clone $start; $end = clone $start;
$end->endOfMonth(); $end->endOfMonth();
@@ -174,6 +165,8 @@ class ReportController extends Controller
if ($count == 0) { if ($count == 0) {
return $journal; return $journal;
} }
return null;
} }
); );
@@ -189,11 +182,6 @@ class ReportController extends Controller
*/ */
public function modalNoBudget(Account $account, $year = '2014', $month = '1') public function modalNoBudget(Account $account, $year = '2014', $month = '1')
{ {
try {
new Carbon($year . '-' . $month . '-01');
} catch (Exception $e) {
return view('error')->with('message', 'Invalid date');
}
$start = new Carbon($year . '-' . $month . '-01'); $start = new Carbon($year . '-' . $month . '-01');
$end = clone $start; $end = clone $start;
$end->endOfMonth(); $end->endOfMonth();
@@ -211,11 +199,6 @@ class ReportController extends Controller
*/ */
public function month($year = '2014', $month = '1') public function month($year = '2014', $month = '1')
{ {
try {
new Carbon($year . '-' . $month . '-01');
} catch (Exception $e) {
return view('error')->with('message', 'Invalid date.');
}
$date = new Carbon($year . '-' . $month . '-01'); $date = new Carbon($year . '-' . $month . '-01');
$subTitle = 'Report for ' . $date->format('F Y'); $subTitle = 'Report for ' . $date->format('F Y');
$subTitleIcon = 'fa-calendar'; $subTitleIcon = 'fa-calendar';
@@ -327,11 +310,6 @@ class ReportController extends Controller
*/ */
public function year($year) public function year($year)
{ {
try {
new Carbon('01-01-' . $year);
} catch (Exception $e) {
return view('error')->with('message', 'Invalid date.');
}
/** @var Preference $pref */ /** @var Preference $pref */
$pref = Preferences::get('showSharedReports', false); $pref = Preferences::get('showSharedReports', false);
$showSharedReports = $pref->data; $showSharedReports = $pref->data;

View File

@@ -12,6 +12,10 @@ class SearchController extends Controller
{ {
/** /**
* Results always come in the form of an array [results, count, fullCount] * Results always come in the form of an array [results, count, fullCount]
*
* @param SearchInterface $searcher
*
* @return $this
*/ */
public function index(SearchInterface $searcher) public function index(SearchInterface $searcher)
{ {

View File

@@ -22,10 +22,10 @@ use View;
* Remember: a balancingAct takes at most one expense and one transfer. * Remember: a balancingAct takes at most one expense and one transfer.
* an advancePayment takes at most one expense, infinite deposits and NO transfers. * an advancePayment takes at most one expense, infinite deposits and NO transfers.
* *
* TODO transaction can only have one advancePayment OR balancingAct. * transaction can only have one advancePayment OR balancingAct.
* TODO Other attempts to put in such a tag are blocked. * Other attempts to put in such a tag are blocked.
* TODO also show an error when editing a tag and it becomes either * also show an error when editing a tag and it becomes either
* TODO of these two types. Or rather, block editing of the tag. * of these two types. Or rather, block editing of the tag.
* *
* @package FireflyIII\Http\Controllers * @package FireflyIII\Http\Controllers
*/ */
@@ -87,11 +87,12 @@ class TagController extends Controller
} }
/** /**
* @param TagRepositoryInterface $repository
* @param Tag $tag * @param Tag $tag
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function destroy(Tag $tag, TagRepositoryInterface $repository) public function destroy(TagRepositoryInterface $repository, Tag $tag)
{ {
$tagName = $tag->tag; $tagName = $tag->tag;
@@ -194,6 +195,8 @@ class TagController extends Controller
/** /**
* @param $state * @param $state
*
* @return \Symfony\Component\HttpFoundation\Response
*/ */
public function hideTagHelp($state) public function hideTagHelp($state)
{ {
@@ -234,6 +237,10 @@ class TagController extends Controller
/** /**
* @param TagFormRequest $request * @param TagFormRequest $request
*
* @param TagRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/ */
public function store(TagFormRequest $request, TagRepositoryInterface $repository) public function store(TagFormRequest $request, TagRepositoryInterface $repository)
{ {
@@ -273,9 +280,13 @@ class TagController extends Controller
} }
/** /**
* @param TagFormRequest $request
* @param TagRepositoryInterface $repository
* @param Tag $tag * @param Tag $tag
*
* @return $this|\Illuminate\Http\RedirectResponse
*/ */
public function update(Tag $tag, TagFormRequest $request, TagRepositoryInterface $repository) public function update(TagFormRequest $request, TagRepositoryInterface $repository, Tag $tag)
{ {
if (Input::get('setTag') == 'true') { if (Input::get('setTag') == 'true') {
$latitude = strlen($request->get('latitude')) > 0 ? $request->get('latitude') : null; $latitude = strlen($request->get('latitude')) > 0 ? $request->get('latitude') : null;

View File

@@ -1,6 +1,7 @@
<?php namespace FireflyIII\Http\Controllers; <?php namespace FireflyIII\Http\Controllers;
use Auth; use Auth;
use Carbon\Carbon;
use ExpandedForm; use ExpandedForm;
use FireflyIII\Events\JournalCreated; use FireflyIII\Events\JournalCreated;
use FireflyIII\Events\JournalSaved; use FireflyIII\Events\JournalSaved;
@@ -8,8 +9,8 @@ use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\JournalFormRequest; use FireflyIII\Http\Requests\JournalFormRequest;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Pagination\LengthAwarePaginator;
use Input; use Input;
use Redirect; use Redirect;
use Response; use Response;
@@ -34,19 +35,14 @@ class TransactionController extends Controller
} }
/** /**
* Shows the view helping the user to create a new transaction journal. * @param AccountRepositoryInterface $repository
*
* @param string $what * @param string $what
* *
* @return \Illuminate\View\View * @return View
*/ */
public function create($what = 'deposit') public function create(AccountRepositoryInterface $repository, $what = 'deposit')
{ {
$accounts = ExpandedForm::makeSelectList( $accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->orderBy('accounts.name', 'ASC')->orderBy('name', 'ASC')->where(
'active', 1
)->orderBy('name', 'DESC')->get(['accounts.*'])
);
$budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get()); $budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get());
$budgets[0] = '(no budget)'; $budgets[0] = '(no budget)';
$piggies = ExpandedForm::makeSelectList(Auth::user()->piggyBanks()->get()); $piggies = ExpandedForm::makeSelectList(Auth::user()->piggyBanks()->get());
@@ -95,15 +91,16 @@ class TransactionController extends Controller
} }
/** /**
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $transactionJournal * @param TransactionJournal $transactionJournal
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function destroy(TransactionJournal $transactionJournal) public function destroy(JournalRepositoryInterface $repository, TransactionJournal $transactionJournal)
{ {
Session::flash('success', 'Transaction "' . e($transactionJournal->description) . '" destroyed.'); Session::flash('success', 'Transaction "' . e($transactionJournal->description) . '" destroyed.');
$transactionJournal->delete(); $repository->delete($transactionJournal);
// redirect to previous URL: // redirect to previous URL:
return Redirect::to(Session::get('transactions.delete.url')); return Redirect::to(Session::get('transactions.delete.url'));
@@ -112,18 +109,15 @@ class TransactionController extends Controller
/** /**
* Shows the view to edit a transaction. * Shows the view to edit a transaction.
* *
* @param AccountRepositoryInterface $repository
* @param TransactionJournal $journal * @param TransactionJournal $journal
* *
* @return $this * @return $this
*/ */
public function edit(TransactionJournal $journal, JournalRepositoryInterface $repository) public function edit(AccountRepositoryInterface $repository, TransactionJournal $journal)
{ {
$what = strtolower($journal->transactiontype->type); $what = strtolower($journal->transactiontype->type);
$accounts = ExpandedForm::makeSelectList( $accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->orderBy('accounts.name', 'ASC')->where('active', 1)->orderBy(
'name', 'DESC'
)->get(['accounts.*'])
);
$budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get()); $budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get());
$budgets[0] = '(no budget)'; $budgets[0] = '(no budget)';
$transactions = $journal->transactions()->orderBy('amount', 'DESC')->get(); $transactions = $journal->transactions()->orderBy('amount', 'DESC')->get();
@@ -176,12 +170,14 @@ class TransactionController extends Controller
} }
/** /**
* @param JournalRepositoryInterface $repository
* @param $what * @param $what
* *
* @return $this * @return View
*/ */
public function index($what) public function index(JournalRepositoryInterface $repository, $what)
{ {
$types = [];
switch ($what) { switch ($what) {
case 'expenses': case 'expenses':
case 'withdrawal': case 'withdrawal':
@@ -203,18 +199,10 @@ class TransactionController extends Controller
break; break;
} }
$page = intval(\Input::get('page')); $page = intval(Input::get('page'));
$offset = $page > 0 ? ($page - 1) * 50 : 0; $offset = $page > 0 ? ($page - 1) * 50 : 0;
$journals = $repository->getJournalsOfTypes($types, $offset, $page);
$set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take(50)->offset($offset)
->orderBy('date', 'DESC')
->orderBy('order', 'ASC')
->orderBy('id', 'DESC')
->get(
['transaction_journals.*']
);
$count = Auth::user()->transactionJournals()->transactionTypes($types)->count();
$journals = new LengthAwarePaginator($set, $count, 50, $page);
$journals->setPath('transactions/' . $what); $journals->setPath('transactions/' . $what);
return view('transactions.index', compact('subTitle', 'what', 'subTitleIcon', 'journals')); return view('transactions.index', compact('subTitle', 'what', 'subTitleIcon', 'journals'));
@@ -222,15 +210,19 @@ class TransactionController extends Controller
} }
/** /**
* Reorder transactions (which all must have the same date) * @param JournalRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/ */
public function reorder() public function reorder(JournalRepositoryInterface $repository)
{ {
$ids = Input::get('items'); $ids = Input::get('items');
$date = new Carbon(Input::get('date'));
if (count($ids) > 0) { if (count($ids) > 0) {
$order = 0; $order = 0;
foreach ($ids as $id) { foreach ($ids as $id) {
$journal = Auth::user()->transactionjournals()->where('id', $id)->where('date', Input::get('date'))->first();
$journal = $repository->getWithDate($id, $date);
if ($journal) { if ($journal) {
$journal->order = $order; $journal->order = $order;
$order++; $order++;
@@ -244,31 +236,22 @@ class TransactionController extends Controller
} }
/** /**
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $journal * @param TransactionJournal $journal
* *
* @return $this * @return $this
*/ */
public function show(TransactionJournal $journal) public function show(JournalRepositoryInterface $repository, TransactionJournal $journal)
{ {
$journal->transactions->each( $journal->transactions->each(
function (Transaction $t) use ($journal) { function (Transaction $t) use ($journal, $repository) {
$t->before = floatval( $t->before = $repository->getAmountBefore($journal, $t);
$t->account->transactions()->leftJoin(
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
)
->where('transaction_journals.date', '<=', $journal->date->format('Y-m-d'))
->where('transaction_journals.order', '>=', $journal->order)
->where('transaction_journals.id', '!=', $journal->id)
->sum('transactions.amount')
);
$t->after = $t->before + $t->amount; $t->after = $t->before + $t->amount;
} }
); );
$subTitle = e($journal->transactiontype->type) . ' "' . e($journal->description) . '"';
return view('transactions.show', compact('journal', 'subTitle'));
return view('transactions.show', compact('journal'))->with(
'subTitle', e($journal->transactiontype->type) . ' "' . e($journal->description) . '"'
);
} }
/** /**
@@ -280,7 +263,6 @@ class TransactionController extends Controller
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository) public function store(JournalFormRequest $request, JournalRepositoryInterface $repository)
{ {
$journalData = $request->getJournalData(); $journalData = $request->getJournalData();
$journal = $repository->store($journalData); $journal = $repository->store($journalData);
@@ -289,11 +271,7 @@ class TransactionController extends Controller
// ConnectJournalToPiggyBank // ConnectJournalToPiggyBank
event(new JournalCreated($journal, intval($request->get('piggy_bank_id')))); event(new JournalCreated($journal, intval($request->get('piggy_bank_id'))));
if (intval($request->get('reminder_id')) > 0) { $repository->deactivateReminder($request->get('reminder_id'));
$reminder = Auth::user()->reminders()->find($request->get('reminder_id'));
$reminder->active = 0;
$reminder->save();
}
Session::flash('success', 'New transaction "' . $journal->description . '" stored!'); Session::flash('success', 'New transaction "' . $journal->description . '" stored!');
@@ -309,14 +287,15 @@ class TransactionController extends Controller
} }
/** /**
* @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $journal * @param TransactionJournal $journal
* *
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind. * @return $this|\Illuminate\Http\RedirectResponse
*
* @return $this
*/ */
public function update(TransactionJournal $journal, JournalFormRequest $request, JournalRepositoryInterface $repository) public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
{ {
$journalData = $request->getJournalData(); $journalData = $request->getJournalData();

View File

@@ -57,7 +57,7 @@ class JournalFormRequest extends Request
$rules = [ $rules = [
'description' => 'required|min:1,max:255', 'description' => 'required|min:1,max:255',
'what' => 'required|in:withdrawal,deposit,transfer|exists:transaction_types,type', 'what' => 'required|in:withdrawal,deposit,transfer',
'amount' => 'numeric|required|min:0.01', 'amount' => 'numeric|required|min:0.01',
'date' => 'required|date', 'date' => 'required|date',
'reminder_id' => 'numeric|exists:reminders,id', 'reminder_id' => 'numeric|exists:reminders,id',

View File

@@ -9,9 +9,10 @@ use FireflyIII\Models\Category;
use FireflyIII\Models\LimitRepetition; use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Reminder; use FireflyIII\Models\Reminder;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\Tag;
/* /*
* Back home. * Back home.
*/ */
@@ -312,21 +313,21 @@ Breadcrumbs::register(
Breadcrumbs::register( Breadcrumbs::register(
'reports.year', function (Generator $breadcrumbs, Carbon $date) { 'reports.year', function (Generator $breadcrumbs, Carbon $date) {
$breadcrumbs->parent('reports.index'); $breadcrumbs->parent('reports.index');
$breadcrumbs->push($date->format('Y'), route('reports.year', $date->format('Y'))); $breadcrumbs->push($date->year, route('reports.year', $date->year));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'reports.month', function (Generator $breadcrumbs, Carbon $date) { 'reports.month', function (Generator $breadcrumbs, Carbon $date) {
$breadcrumbs->parent('reports.index'); $breadcrumbs->parent('reports.index');
$breadcrumbs->push('Monthly report for ' . $date->format('F Y'), route('reports.month', $date)); $breadcrumbs->push('Monthly report for ' . $date->format('F Y'), route('reports.month', [$date->year, $date->month]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'reports.budget', function (Generator $breadcrumbs, Carbon $date) { 'reports.budget', function (Generator $breadcrumbs, Carbon $date) {
$breadcrumbs->parent('reports.index'); $breadcrumbs->parent('reports.index');
$breadcrumbs->push('Budget report for ' . $date->format('F Y'), route('reports.budget', $date)); $breadcrumbs->push('Budget report for ' . $date->format('F Y'), route('reports.budget', [$date->year, $date->month]));
} }
); );
@@ -412,6 +413,6 @@ Breadcrumbs::register(
Breadcrumbs::register( Breadcrumbs::register(
'tags.show', function (Generator $breadcrumbs, Tag $tag) { 'tags.show', function (Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.index'); $breadcrumbs->parent('tags.index');
$breadcrumbs->push(e($tag->tag), route('tags.show', $tag)); $breadcrumbs->push(e($tag->tag), route('tags.show', $tag->id));
} }
); );

View File

@@ -13,6 +13,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
// models // models
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'account', 'account',
function ($value, $route) { function ($value, $route) {
@@ -30,6 +31,7 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'tj', function ($value, $route) { 'tj', function ($value, $route) {
if (Auth::check()) { if (Auth::check()) {
@@ -43,6 +45,7 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'currency', function ($value, $route) { 'currency', function ($value, $route) {
if (Auth::check()) { if (Auth::check()) {
@@ -55,6 +58,7 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'bill', function ($value, $route) { 'bill', function ($value, $route) {
if (Auth::check()) { if (Auth::check()) {
@@ -68,6 +72,7 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'budget', function ($value, $route) { 'budget', function ($value, $route) {
if (Auth::check()) { if (Auth::check()) {
@@ -81,6 +86,7 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'reminder', function ($value, $route) { 'reminder', function ($value, $route) {
if (Auth::check()) { if (Auth::check()) {
@@ -94,6 +100,7 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'limitrepetition', function ($value, $route) { 'limitrepetition', function ($value, $route) {
if (Auth::check()) { if (Auth::check()) {
@@ -111,6 +118,7 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'piggyBank', function ($value, $route) { 'piggyBank', function ($value, $route) {
if (Auth::check()) { if (Auth::check()) {
@@ -127,12 +135,13 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'category', function ($value, $route) { 'category', function ($value, $route) {
if (Auth::check()) { if (Auth::check()) {
return Category::where('id', $value)->where('user_id', Auth::user()->id)->first(); $object = Category::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) { if ($object) {
$object = $object; return $object;
} }
} }
@@ -140,12 +149,30 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'reminder', function ($value, $route) {
if (Auth::check()) {
/** @var \FireflyIII\Models\Reminder $object */
$object = Reminder::find($value);
if ($object) {
if ($object->remindersable->account->user_id == Auth::user()->id) {
return $object;
}
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'tag', function ($value, $route) { 'tag', function ($value, $route) {
if (Auth::check()) { if (Auth::check()) {
return Tag::where('id', $value)->where('user_id', Auth::user()->id)->first(); $object = Tag::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) { if ($object) {
$object = $object; return $object;
} }
} }

View File

@@ -60,6 +60,31 @@ class Account extends Model
} }
/**
* @param array $fields
*
* @return Account|null
*/
public static function firstOrNullEncrypted(array $fields)
{
// everything but the name:
$query = Account::orderBy('id');
foreach ($fields as $name => $value) {
if ($name != 'name') {
$query->where($name, $value);
}
}
$set = $query->get(['accounts.*']);
/** @var Account $account */
foreach ($set as $account) {
if ($account->name == $fields['name']) {
return $account;
}
}
return null;
}
/** /**
* @return \Illuminate\Database\Eloquent\Relations\HasMany * @return \Illuminate\Database\Eloquent\Relations\HasMany
*/ */

View File

@@ -1,9 +1,10 @@
<?php namespace FireflyIII\Models; <?php namespace FireflyIII\Models;
use App;
use Crypt; use Crypt;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use App;
/** /**
* Class Category * Class Category
* *

View File

@@ -12,6 +12,8 @@ use Illuminate\Database\Eloquent\Model;
class PiggyBankRepetition extends Model class PiggyBankRepetition extends Model
{ {
protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount'];
/** /**
* @return array * @return array
*/ */

View File

@@ -78,6 +78,11 @@ class Reminder extends Model
return $query->where('reminders.startdate', '=', $start->format('Y-m-d 00:00:00'))->where('reminders.enddate', '=', $end->format('Y-m-d 00:00:00')); return $query->where('reminders.startdate', '=', $start->format('Y-m-d 00:00:00'))->where('reminders.enddate', '=', $end->format('Y-m-d 00:00:00'));
} }
/**
* @param EloquentBuilder $query
*
* @return $this
*/
public function scopeToday(EloquentBuilder $query) public function scopeToday(EloquentBuilder $query)
{ {
$today = new Carbon; $today = new Carbon;

View File

@@ -66,8 +66,13 @@ class TransactionJournal extends Model
return floatval($t->amount); return floatval($t->amount);
} }
} }
return 0;
} }
/**
* @return Account|mixed
*/
public function getAssetAccountAttribute() public function getAssetAccountAttribute()
{ {
$positive = true; // the asset account is in the transaction with the positive amount. $positive = true; // the asset account is in the transaction with the positive amount.
@@ -225,7 +230,7 @@ class TransactionJournal extends Model
*/ */
public function setDescriptionAttribute($value) public function setDescriptionAttribute($value)
{ {
$this->attributes['description'] = \Crypt::encrypt($value); $this->attributes['description'] = Crypt::encrypt($value);
$this->attributes['encrypted'] = true; $this->attributes['encrypted'] = true;
} }

View File

@@ -1,11 +1,11 @@
<?php namespace FireflyIII\Providers; <?php namespace FireflyIII\Providers;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\LimitRepetition; use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankRepetition; use FireflyIII\Models\PiggyBankRepetition;
use FireflyIII\Models\Reminder;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Support\Facades\Navigation; use FireflyIII\Support\Facades\Navigation;
@@ -13,7 +13,6 @@ use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Log; use Log;
use FireflyIII\Models\Reminder;
/** /**
* Class EventServiceProvider * Class EventServiceProvider
@@ -118,8 +117,8 @@ class EventServiceProvider extends ServiceProvider
try { try {
$repetition->save(); $repetition->save();
} catch (QueryException $e) { } catch (QueryException $e) {
\Log::error('Trying to save new LimitRepetition failed!'); Log::error('Trying to save new LimitRepetition failed!');
\Log::error($e->getMessage()); Log::error($e->getMessage());
} }
} else { } else {
if ($set->count() == 1) { if ($set->count() == 1) {

View File

@@ -3,7 +3,6 @@
namespace FireflyIII\Providers; namespace FireflyIII\Providers;
use App; use App;
use FireflyIII\Models\Account;
use FireflyIII\Support\Amount; use FireflyIII\Support\Amount;
use FireflyIII\Support\ExpandedForm; use FireflyIII\Support\ExpandedForm;
use FireflyIII\Support\Navigation; use FireflyIII\Support\Navigation;
@@ -84,6 +83,7 @@ class FireflyServiceProvider extends ServiceProvider
$this->app->bind('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface', 'FireflyIII\Repositories\PiggyBank\PiggyBankRepository'); $this->app->bind('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface', 'FireflyIII\Repositories\PiggyBank\PiggyBankRepository');
$this->app->bind('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface', 'FireflyIII\Repositories\Currency\CurrencyRepository'); $this->app->bind('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface', 'FireflyIII\Repositories\Currency\CurrencyRepository');
$this->app->bind('FireflyIII\Repositories\Tag\TagRepositoryInterface', 'FireflyIII\Repositories\Tag\TagRepository'); $this->app->bind('FireflyIII\Repositories\Tag\TagRepositoryInterface', 'FireflyIII\Repositories\Tag\TagRepository');
$this->app->bind('FireflyIII\Repositories\Reminder\ReminderRepositoryInterface', 'FireflyIII\Repositories\Reminder\ReminderRepository');
$this->app->bind('FireflyIII\Support\Search\SearchInterface', 'FireflyIII\Support\Search\Search'); $this->app->bind('FireflyIII\Support\Search\SearchInterface', 'FireflyIII\Support\Search\Search');

View File

@@ -16,12 +16,14 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Query\Builder;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log; use Log;
use Session; use Session;
use Steam; use Steam;
/** /**
* Class AccountRepository * Class AccountRepository
* *
@@ -224,7 +226,7 @@ class AccountRepository implements AccountRepositoryInterface
// then, percentage. // then, percentage.
$difference = $account->endBalance - $account->piggyBalance; $difference = $account->endBalance - $account->piggyBalance;
$account->difference = $difference; $account->difference = $difference;
$account->percentage = $difference != 0 ? round((($difference / $account->endBalance) * 100)) : 100; $account->percentage = $difference != 0 && $account->endBalance != 0 ? round((($difference / $account->endBalance) * 100)) : 100;
} }
); );
@@ -269,6 +271,7 @@ class AccountRepository implements AccountRepositoryInterface
$pct = $pct > 100 ? 100 : $pct; $pct = $pct > 100 ? 100 : $pct;
$account->difference = $diff; $account->difference = $diff;
$account->percentage = round($pct); $account->percentage = round($pct);
} }
); );
@@ -287,7 +290,7 @@ class AccountRepository implements AccountRepositoryInterface
public function getTransfersInRange(Account $account, Carbon $start, Carbon $end) public function getTransfersInRange(Account $account, Carbon $start, Carbon $end)
{ {
return TransactionJournal::whereIn( return TransactionJournal::whereIn(
'id', function ($q) use ($account, $start, $end) { 'id', function (Builder $q) use ($account, $start, $end) {
$q->select('transaction_journals.id') $q->select('transaction_journals.id')
->from('transactions') ->from('transactions')
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
@@ -310,7 +313,7 @@ class AccountRepository implements AccountRepositoryInterface
*/ */
public function leftOnAccount(Account $account) public function leftOnAccount(Account $account)
{ {
$balance = \Steam::balance($account, null, true); $balance = Steam::balance($account, null, true);
/** @var PiggyBank $p */ /** @var PiggyBank $p */
foreach ($account->piggybanks()->get() as $p) { foreach ($account->piggybanks()->get() as $p) {
$balance -= $p->currentRelevantRep()->currentamount; $balance -= $p->currentRelevantRep()->currentamount;
@@ -374,6 +377,8 @@ class AccountRepository implements AccountRepositoryInterface
/** /**
* @param Account $account * @param Account $account
* @param array $data * @param array $data
*
* @return Account
*/ */
public function update(Account $account, array $data) public function update(Account $account, array $data)
{ {
@@ -438,13 +443,20 @@ class AccountRepository implements AccountRepositoryInterface
if (!$newAccount->isValid()) { if (!$newAccount->isValid()) {
// does the account already exist? // does the account already exist?
$existingAccount = Account::where('user_id', $data['user'])->where('account_type_id', $accountType->id)->where('name', $data['name'])->first(); $searchData = [
'user_id' => $data['user'],
'account_type_id' => $accountType->id,
'name' => $data['name']
];
$existingAccount = Account::firstOrNullEncrypted($searchData);
if (!$existingAccount) { if (!$existingAccount) {
Log::error('Account create error: ' . $newAccount->getErrors()->toJson()); Log::error('Account create error: ' . $newAccount->getErrors()->toJson());
App::abort(500); App::abort(500);
// @codeCoverageIgnoreStart
} }
// @codeCoverageIgnoreEnd
$newAccount = $existingAccount; $newAccount = $existingAccount;
} }
$newAccount->save(); $newAccount->save();
@@ -498,9 +510,6 @@ class AccountRepository implements AccountRepositoryInterface
'encrypted' => true 'encrypted' => true
] ]
); );
if (!$journal->isValid()) {
App::abort(500);
}
$journal->save(); $journal->save();
@@ -524,9 +533,6 @@ class AccountRepository implements AccountRepositoryInterface
'amount' => $firstAmount 'amount' => $firstAmount
] ]
); );
if (!$one->isValid()) {
App::abort(500);
}
$one->save(); $one->save();
// second transaction: to // second transaction: to
@@ -537,9 +543,6 @@ class AccountRepository implements AccountRepositoryInterface
'amount' => $secondAmount 'amount' => $secondAmount
] ]
); );
if (!$two->isValid()) {
App::abort(500);
}
$two->save(); $two->save();
return $journal; return $journal;

View File

@@ -88,7 +88,7 @@ interface AccountRepositoryInterface
/** /**
* @param Account $account * @param Account $account
* @param string $range * @param $page
* *
* @return LengthAwarePaginator * @return LengthAwarePaginator
*/ */

View File

@@ -4,6 +4,7 @@ namespace FireflyIII\Repositories\Bill;
use Auth; use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use DB;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType; use FireflyIII\Models\AccountType;
use FireflyIII\Models\Bill; use FireflyIII\Models\Bill;
@@ -119,7 +120,7 @@ class BillRepository implements BillRepositoryInterface
*/ */
public function getPossiblyRelatedJournals(Bill $bill) public function getPossiblyRelatedJournals(Bill $bill)
{ {
$set = \DB::table('transactions')->where('amount', '>', 0)->where('amount', '>=', $bill->amount_min)->where('amount', '<=', $bill->amount_max)->get( $set = DB::table('transactions')->where('amount', '>', 0)->where('amount', '>=', $bill->amount_min)->where('amount', '<=', $bill->amount_max)->get(
['transaction_journal_id'] ['transaction_journal_id']
); );
$ids = []; $ids = [];
@@ -211,10 +212,12 @@ class BillRepository implements BillRepositoryInterface
* $today is the start of the next period, to make sure FF3 won't miss anything * $today is the start of the next period, to make sure FF3 won't miss anything
* when the current period has a transaction journal. * when the current period has a transaction journal.
*/ */
$today = Navigation::addPeriod(new Carbon, $bill->repeat_freq, 0); /** @var \Carbon\Carbon $obj */
$obj = new Carbon;
$today = Navigation::addPeriod($obj, $bill->repeat_freq, 0);
$skip = $bill->skip + 1; $skip = $bill->skip + 1;
$start = Navigation::startOfPeriod(new Carbon, $bill->repeat_freq); $start = Navigation::startOfPeriod($obj, $bill->repeat_freq);
/* /*
* go back exactly one month/week/etc because FF3 does not care about 'next' * go back exactly one month/week/etc because FF3 does not care about 'next'
* bills if they're too far into the past. * bills if they're too far into the past.
@@ -259,11 +262,8 @@ class BillRepository implements BillRepositoryInterface
/* /*
* Attach expense account to description for more narrow matching. * Attach expense account to description for more narrow matching.
*/ */
if (count($journal->transactions) < 2) {
$transactions = $journal->transactions()->get(); $transactions = $journal->transactions()->get();
} else {
$transactions = $journal->transactions;
}
/** @var Transaction $transaction */ /** @var Transaction $transaction */
foreach ($transactions as $transaction) { foreach ($transactions as $transaction) {
/** @var Account $account */ /** @var Account $account */

View File

@@ -10,6 +10,7 @@ use FireflyIII\Models\LimitRepetition;
use Illuminate\Database\Query\Builder as QueryBuilder; use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Input;
/** /**
* Class BudgetRepository * Class BudgetRepository
@@ -24,21 +25,6 @@ class BudgetRepository implements BudgetRepositoryInterface
*/ */
public function cleanupBudgets() public function cleanupBudgets()
{ {
$limits = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')->get(['budget_limits.*']);
// loop budget limits:
$found = [];
/** @var BudgetLimit $limit */
foreach ($limits as $limit) {
$key = $limit->budget_id . '-' . $limit->startdate;
if (isset($found[$key])) {
$limit->delete();
} else {
$found[$key] = true;
}
unset($key);
}
// delete limits with amount 0: // delete limits with amount 0:
BudgetLimit::where('amount', 0)->delete(); BudgetLimit::where('amount', 0)->delete();
@@ -162,7 +148,7 @@ class BudgetRepository implements BudgetRepositoryInterface
*/ */
public function getJournals(Budget $budget, LimitRepetition $repetition = null, $take = 50) public function getJournals(Budget $budget, LimitRepetition $repetition = null, $take = 50)
{ {
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $take : 0; $offset = intval(Input::get('page')) > 0 ? intval(Input::get('page')) * $take : 0;
$setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset) $setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)

View File

@@ -72,8 +72,8 @@ interface CategoryRepositoryInterface
/** /**
* @param Category $category * @param Category $category
* @param Carbon $start * @param \Carbon\Carbon $start
* @param Carbon $end * @param \Carbon\Carbon $end
* *
* @return float * @return float
*/ */

View File

@@ -4,6 +4,7 @@ namespace FireflyIII\Repositories\Journal;
use App; use App;
use Auth; use Auth;
use Carbon\Carbon;
use DB; use DB;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType; use FireflyIII\Models\AccountType;
@@ -13,6 +14,7 @@ use FireflyIII\Models\Tag;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log; use Log;
@@ -24,6 +26,38 @@ use Log;
class JournalRepository implements JournalRepositoryInterface class JournalRepository implements JournalRepositoryInterface
{ {
/**
* @param int $reminderId
*
* @return bool
*/
public function deactivateReminder($reminderId)
{
$reminder = Auth::user()->reminders()->find($reminderId);
if ($reminder) {
$reminder->active = 0;
$reminder->save();
}
}
/**
* @param TransactionJournal $journal
*
* @return bool
*/
public function delete(TransactionJournal $journal)
{
// delete transactions first:
/** @var Transaction $transaction */
foreach ($journal->transactions()->get() as $transaction) {
$transaction->delete();
}
$journal->delete();
return true;
}
/** /**
* Get users first transaction journal * Get users first transaction journal
* *
@@ -34,6 +68,25 @@ class JournalRepository implements JournalRepositoryInterface
return Auth::user()->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']); return Auth::user()->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);
} }
/**
* @param TransactionJournal $journal
* @param Transaction $transaction
*
* @return float
*/
public function getAmountBefore(TransactionJournal $journal, Transaction $transaction)
{
return floatval(
$transaction->account->transactions()->leftJoin(
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
)
->where('transaction_journals.date', '<=', $journal->date->format('Y-m-d'))
->where('transaction_journals.order', '>=', $journal->order)
->where('transaction_journals.id', '!=', $journal->id)
->sum('transactions.amount')
);
}
/** /**
* @param TransactionType $dbType * @param TransactionType $dbType
* *
@@ -44,6 +97,28 @@ class JournalRepository implements JournalRepositoryInterface
return Auth::user()->transactionjournals()->where('transaction_type_id', $dbType->id)->orderBy('id', 'DESC')->take(50)->get(); return Auth::user()->transactionjournals()->where('transaction_type_id', $dbType->id)->orderBy('id', 'DESC')->take(50)->get();
} }
/**
* @param array $types
* @param int $offset
* @param int $page
*
* @return LengthAwarePaginator
*/
public function getJournalsOfTypes(array $types, $offset, $page)
{
$set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take(50)->offset($offset)
->orderBy('date', 'DESC')
->orderBy('order', 'ASC')
->orderBy('id', 'DESC')
->get(
['transaction_journals.*']
);
$count = Auth::user()->transactionJournals()->transactionTypes($types)->count();
$journals = new LengthAwarePaginator($set, $count, 50, $page);
return $journals;
}
/** /**
* @param $type * @param $type
* *
@@ -54,6 +129,17 @@ class JournalRepository implements JournalRepositoryInterface
return TransactionType::whereType($type)->first(); return TransactionType::whereType($type)->first();
} }
/**
* @param $id
* @param Carbon $date
*
* @return TransactionJournal
*/
public function getWithDate($id, Carbon $date)
{
return Auth::user()->transactionjournals()->where('id', $id)->where('date', $date->format('Y-m-d'))->first();
}
/** /**
* *
* * Remember: a balancingAct takes at most one expense and one transfer. * * Remember: a balancingAct takes at most one expense and one transfer.
@@ -109,6 +195,7 @@ class JournalRepository implements JournalRepositoryInterface
// store or get budget // store or get budget
if (intval($data['budget_id']) > 0) { if (intval($data['budget_id']) > 0) {
/** @var \FireflyIII\Models\Budget $budget */
$budget = Budget::find($data['budget_id']); $budget = Budget::find($data['budget_id']);
$journal->budgets()->save($budget); $journal->budgets()->save($budget);
} }
@@ -168,6 +255,7 @@ class JournalRepository implements JournalRepositoryInterface
// unlink all budgets and recreate them: // unlink all budgets and recreate them:
$journal->budgets()->detach(); $journal->budgets()->detach();
if (intval($data['budget_id']) > 0) { if (intval($data['budget_id']) > 0) {
/** @var \FireflyIII\Models\Budget $budget */
$budget = Budget::find($data['budget_id']); $budget = Budget::find($data['budget_id']);
$journal->budgets()->save($budget); $journal->budgets()->save($budget);
} }

View File

@@ -2,9 +2,11 @@
namespace FireflyIII\Repositories\Journal; namespace FireflyIII\Repositories\Journal;
use Carbon\Carbon;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** /**
@@ -14,6 +16,20 @@ use Illuminate\Support\Collection;
*/ */
interface JournalRepositoryInterface interface JournalRepositoryInterface
{ {
/**
* @param int $reminderId
*
* @return bool
*/
public function deactivateReminder($reminderId);
/**
* @param TransactionJournal $journal
*
* @return bool
*/
public function delete(TransactionJournal $journal);
/** /**
* Get users first transaction journal * Get users first transaction journal
* *
@@ -21,6 +37,14 @@ interface JournalRepositoryInterface
*/ */
public function first(); public function first();
/**
* @param TransactionJournal $journal
* @param Transaction $transaction
*
* @return float
*/
public function getAmountBefore(TransactionJournal $journal, Transaction $transaction);
/** /**
* @param TransactionType $dbType * @param TransactionType $dbType
* *
@@ -28,6 +52,15 @@ interface JournalRepositoryInterface
*/ */
public function getJournalsOfType(TransactionType $dbType); public function getJournalsOfType(TransactionType $dbType);
/**
* @param array $types
* @param int $offset
* @param int $page
*
* @return LengthAwarePaginator
*/
public function getJournalsOfTypes(array $types, $offset, $page);
/** /**
* @param $type * @param $type
* *
@@ -35,6 +68,14 @@ interface JournalRepositoryInterface
*/ */
public function getTransactionType($type); public function getTransactionType($type);
/**
* @param $id
* @param Carbon $date
*
* @return TransactionJournal
*/
public function getWithDate($id, Carbon $date);
/** /**
* @param TransactionJournal $journal * @param TransactionJournal $journal
* @param array $array * @param array $array

View File

@@ -21,7 +21,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
/** /**
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
* *
* Based on the piggy bank, the reminder-setting and * Based on the piggy bank, the reminder-setting and
* other variables this method tries to divide the piggy bank into equal parts. Each is * other variables this method tries to divide the piggy bank into equal parts. Each is
@@ -189,10 +188,11 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
} }
/** /**
* @param PiggyBank $account * @param PiggyBank $piggyBank
* @param array $data * @param array $data
* *
* @return PiggyBank * @return PiggyBank
* @internal param PiggyBank $account
*/ */
public function update(PiggyBank $piggyBank, array $data) public function update(PiggyBank $piggyBank, array $data)
{ {

View File

@@ -15,7 +15,6 @@ interface PiggyBankRepositoryInterface
{ {
/** /**
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
* *
* Based on the piggy bank, the reminder-setting and * Based on the piggy bank, the reminder-setting and
* other variables this method tries to divide the piggy bank into equal parts. Each is * other variables this method tries to divide the piggy bank into equal parts. Each is
@@ -95,7 +94,7 @@ interface PiggyBankRepositoryInterface
public function store(array $data); public function store(array $data);
/** /**
* @param PiggyBank $account * @param PiggyBank $piggyBank
* @param array $data * @param array $data
* *
* @return PiggyBank * @return PiggyBank

View File

@@ -0,0 +1,116 @@
<?php
namespace FireflyIII\Repositories\Reminder;
use App;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Reminder;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
/**
* Class ReminderRepository
*
* @package FireflyIII\Repositories\Reminder
*/
class ReminderRepository implements ReminderRepositoryInterface
{
/** @var \FireflyIII\Helpers\Reminders\ReminderHelperInterface */
protected $helper;
/**
*
*/
public function __construct()
{
/** @var \FireflyIII\Helpers\Reminders\ReminderHelperInterface helper */
$this->helper = App::make('FireflyIII\Helpers\Reminders\ReminderHelperInterface');
}
/**
* @return Collection
*/
public function getActiveReminders()
{
$today = new Carbon;
// active reminders:
$active = Auth::user()->reminders()
->where('notnow', 0)
->where('active', 1)
->where('startdate', '<=', $today->format('Y-m-d 00:00:00'))
->where('enddate', '>=', $today->format('Y-m-d 00:00:00'))
->get();
$active->each(
function (Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder);
}
);
return $active;
}
/**
* @return Collection
*/
public function getDismissedReminders()
{
$dismissed = Auth::user()->reminders()
->where('notnow', 1)
->get();
$dismissed->each(
function (Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder);
}
);
return $dismissed;
}
/**
* @return Collection
*/
public function getExpiredReminders()
{
$expired = Auth::user()->reminders()
->where('notnow', 0)
->where('active', 1)
->where(
function (Builder $q) {
$today = new Carbon;
$q->where('startdate', '>', $today->format('Y-m-d 00:00:00'));
$q->orWhere('enddate', '<', $today->format('Y-m-d 00:00:00'));
}
)->get();
$expired->each(
function (Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder);
}
);
return $expired;
}
/**
* @return Collection
*/
public function getInactiveReminders()
{
$inactive = Auth::user()->reminders()
->where('active', 0)
->get();
$inactive->each(
function (Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder);
}
);
return $inactive;
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace FireflyIII\Repositories\Reminder;
use Illuminate\Support\Collection;
/**
* Interface ReminderRepositoryInterface
*
* @package FireflyIII\Repositories\Reminder
*/
interface ReminderRepositoryInterface
{
/**
* @return Collection
*/
public function getActiveReminders();
/**
* @return Collection
*/
public function getDismissedReminders();
/**
* @return Collection
*/
public function getExpiredReminders();
/**
* @return Collection
*/
public function getInactiveReminders();
}

View File

@@ -1,6 +1,7 @@
<?php <?php
namespace FireflyIII\Repositories\Tag; namespace FireflyIII\Repositories\Tag;
use FireflyIII\Models\Tag; use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@@ -11,7 +12,8 @@ use Illuminate\Support\Collection;
* *
* @package FireflyIII\Repositories\Tag * @package FireflyIII\Repositories\Tag
*/ */
interface TagRepositoryInterface { interface TagRepositoryInterface
{
/** /**
* @param array $data * @param array $data

View File

@@ -39,17 +39,10 @@ class Amount
if (defined('FFCURRENCYSYMBOL')) { if (defined('FFCURRENCYSYMBOL')) {
return FFCURRENCYSYMBOL; return FFCURRENCYSYMBOL;
} }
if (\Cache::has('FFCURRENCYSYMBOL')) {
define('FFCURRENCYSYMBOL', \Cache::get('FFCURRENCYSYMBOL'));
return FFCURRENCYSYMBOL;
}
$currencyPreference = Prefs::get('currencyPreference', 'EUR'); $currencyPreference = Prefs::get('currencyPreference', 'EUR');
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first(); $currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
\Cache::forever('FFCURRENCYSYMBOL', $currency->symbol);
define('FFCURRENCYSYMBOL', $currency->symbol); define('FFCURRENCYSYMBOL', $currency->symbol);
return $currency->symbol; return $currency->symbol;
@@ -84,9 +77,11 @@ class Amount
} }
/** /**
* @return string
* *
* @param TransactionJournal $journal * @param TransactionJournal $journal
* @param bool $coloured
*
* @return string
*/ */
public function formatJournal(TransactionJournal $journal, $coloured = true) public function formatJournal(TransactionJournal $journal, $coloured = true)
{ {
@@ -151,18 +146,13 @@ class Amount
if (defined('FFCURRENCYCODE')) { if (defined('FFCURRENCYCODE')) {
return FFCURRENCYCODE; return FFCURRENCYCODE;
} }
if (Cache::has('FFCURRENCYCODE')) {
define('FFCURRENCYCODE', Cache::get('FFCURRENCYCODE'));
return FFCURRENCYCODE;
}
$currencyPreference = Prefs::get('currencyPreference', 'EUR'); $currencyPreference = Prefs::get('currencyPreference', 'EUR');
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first(); $currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
if ($currency) { if ($currency) {
Cache::forever('FFCURRENCYCODE', $currency->code);
define('FFCURRENCYCODE', $currency->code); define('FFCURRENCYCODE', $currency->code);
return $currency->code; return $currency->code;
@@ -171,6 +161,9 @@ class Amount
return 'EUR'; return 'EUR';
} }
/**
* @return mixed|static
*/
public function getDefaultCurrency() public function getDefaultCurrency()
{ {
$currencyPreference = Prefs::get('currencyPreference', 'EUR'); $currencyPreference = Prefs::get('currencyPreference', 'EUR');

View File

@@ -3,7 +3,6 @@
namespace FireflyIII\Support; namespace FireflyIII\Support;
use Amount as Amt; use Amount as Amt;
use FireflyIII\Models\TransactionCurrency;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag; use Illuminate\Support\MessageBag;
use Input; use Input;
@@ -237,11 +236,10 @@ class ExpandedForm
} }
/** /**
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
* *
* Takes any collection and tries to make a sensible select list compatible array of it. * Takes any collection and tries to make a sensible select list compatible array of it.
* *
* @param Collection $set * @param \Illuminate\Support\Collection $set
* @param bool $addEmpty * @param bool $addEmpty
* *
* @return mixed * @return mixed
@@ -289,10 +287,12 @@ class ExpandedForm
/** /**
* @param $name * @param $name
* @param null $value * @param array $list
* @param null $selected
* @param array $options * @param array $options
* *
* @return string * @return string
* @internal param null $value
*/ */
public function multiRadio($name, array $list = [], $selected = null, array $options = []) public function multiRadio($name, array $list = [], $selected = null, array $options = [])
{ {

View File

@@ -15,7 +15,7 @@ class Navigation
/** /**
* @param Carbon $theDate * @param \Carbon\Carbon $theDate
* @param $repeatFreq * @param $repeatFreq
* @param $skip * @param $skip
* *
@@ -64,10 +64,10 @@ class Navigation
} }
/** /**
* @param Carbon $theCurrentEnd * @param \Carbon\Carbon $theCurrentEnd
* @param $repeatFreq * @param $repeatFreq
* *
* @return Carbon * @return \Carbon\Carbon
* @throws FireflyException * @throws FireflyException
*/ */
public function endOfPeriod(Carbon $theCurrentEnd, $repeatFreq) public function endOfPeriod(Carbon $theCurrentEnd, $repeatFreq)
@@ -148,9 +148,8 @@ class Navigation
} }
if (isset($specials[$repeatFreq])) { if (isset($specials[$repeatFreq])) {
$month = intval($theCurrentEnd->format('m'));
$currentEnd->endOfYear(); $currentEnd->endOfYear();
if ($month <= 6) { if ($theCurrentEnd->month <= 6) {
$currentEnd->subMonths(6); $currentEnd->subMonths(6);
} }
} }
@@ -184,7 +183,7 @@ class Navigation
$date->lastOfQuarter()->addDay(); $date->lastOfQuarter()->addDay();
break; break;
case '6M': case '6M':
if (intval($date->format('m')) >= 7) { if ($date->month >= 7) {
$date->startOfYear()->addYear(); $date->startOfYear()->addYear();
} else { } else {
$date->startOfYear()->addMonths(6); $date->startOfYear()->addMonths(6);
@@ -230,9 +229,8 @@ class Navigation
return $date; return $date;
} }
if ($range == '6M') { if ($range == '6M') {
$month = intval($date->format('m'));
$date->startOfYear(); $date->startOfYear();
if ($month <= 6) { if ($date->month <= 6) {
$date->subMonths(6); $date->subMonths(6);
} }
@@ -260,16 +258,15 @@ class Navigation
return $date->format($formatMap[$range]); return $date->format($formatMap[$range]);
} }
if ($range == '3M') { if ($range == '3M') {
$month = intval($date->format('m'));
return 'Q' . ceil(($month / 12) * 4) . ' ' . $date->format('Y');
return 'Q' . ceil(($date->month / 12) * 4) . ' ' . $date->year;
} }
if ($range == '6M') { if ($range == '6M') {
$month = intval($date->format('m')); $half = ceil(($date->month / 12) * 2);
$half = ceil(($month / 12) * 2);
$halfName = $half == 1 ? 'first' : 'second'; $halfName = $half == 1 ? 'first' : 'second';
return $halfName . ' half of ' . $date->format('Y'); return $halfName . ' half of ' . $date->year;
} }
throw new FireflyException('No _periodName() for range "' . $range . '"'); throw new FireflyException('No _periodName() for range "' . $range . '"');
} }
@@ -301,10 +298,10 @@ class Navigation
} }
/** /**
* @param Carbon $theDate * @param \Carbon\Carbon $theDate
* @param $repeatFreq * @param $repeatFreq
* *
* @return Carbon * @return \Carbon\Carbon
* @throws FireflyException * @throws FireflyException
*/ */
public function startOfPeriod(Carbon $theDate, $repeatFreq) public function startOfPeriod(Carbon $theDate, $repeatFreq)
@@ -333,7 +330,7 @@ class Navigation
return $date; return $date;
} }
if ($repeatFreq == 'half-year' || $repeatFreq == '6M') { if ($repeatFreq == 'half-year' || $repeatFreq == '6M') {
$month = intval($date->format('m')); $month = $date->month;
$date->startOfYear(); $date->startOfYear();
if ($month >= 7) { if ($month >= 7) {
$date->addMonths(6); $date->addMonths(6);
@@ -388,9 +385,9 @@ class Navigation
/** /**
* @param $range * @param $range
* @param Carbon $start * @param \Carbon\Carbon $start
* *
* @return Carbon * @return \Carbon\Carbon
* @throws FireflyException * @throws FireflyException
*/ */
public function updateEndDate($range, Carbon $start) public function updateEndDate($range, Carbon $start)
@@ -411,7 +408,7 @@ class Navigation
return $end; return $end;
} }
if ($range == '6M') { if ($range == '6M') {
if (intval($start->format('m')) >= 7) { if ($start->month >= 7) {
$end->endOfYear(); $end->endOfYear();
} else { } else {
$end->startOfYear()->addMonths(6); $end->startOfYear()->addMonths(6);
@@ -424,9 +421,9 @@ class Navigation
/** /**
* @param $range * @param $range
* @param Carbon $start * @param \Carbon\Carbon $start
* *
* @return Carbon * @return \Carbon\Carbon
* @throws FireflyException * @throws FireflyException
*/ */
public function updateStartDate($range, Carbon $start) public function updateStartDate($range, Carbon $start)
@@ -445,7 +442,7 @@ class Navigation
return $start; return $start;
} }
if ($range == '6M') { if ($range == '6M') {
if (intval($start->format('m')) >= 7) { if ($start->month >= 7) {
$start->startOfYear()->addMonths(6); $start->startOfYear()->addMonths(6);
} else { } else {
$start->startOfYear(); $start->startOfYear();

View File

@@ -16,7 +16,7 @@ class Preferences
* @param $name * @param $name
* @param null $default * @param null $default
* *
* @return null|Preference * @return null|\FireflyIII\Models\Preference
*/ */
public function get($name, $default = null) public function get($name, $default = null)
{ {

View File

@@ -84,7 +84,6 @@ class Search implements SearchInterface
} }
/** /**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* *
* @param array $words * @param array $words
* *
@@ -123,6 +122,8 @@ class Search implements SearchInterface
} }
} }
return null;
} }
); );
$filtered = $set->merge($decrypted); $filtered = $set->merge($decrypted);

View File

@@ -17,8 +17,8 @@ class Steam
{ {
/** /**
* *
* @param Account $account * @param \FireflyIII\Models\Account $account
* @param Carbon $date * @param \Carbon\Carbon $date
* @param bool $ignoreVirtualBalance * @param bool $ignoreVirtualBalance
* *
* @return float * @return float
@@ -91,7 +91,7 @@ class Steam
* Turns a collection into an array. Needs the field 'id' for the key, * Turns a collection into an array. Needs the field 'id' for the key,
* and saves only 'name' and 'amount' as a sub array. * and saves only 'name' and 'amount' as a sub array.
* *
* @param Collection $collection * @param \Illuminate\Support\Collection $collection
* *
* @return array * @return array
*/ */

View File

@@ -42,7 +42,7 @@ class General extends Twig_Extension
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'formatAmountPlain', function ($string) { 'formatAmountPlain', function ($string) {
return App::make('amount')->format($string, false); return App::make('amount')->format($string, false);
} }, ['is_safe' => ['html']]
); );
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(

View File

@@ -40,6 +40,7 @@ class Journal extends Twig_Extension
return '<span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>'; return '<span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>';
} }
return '';
}, ['is_safe' => ['html']] }, ['is_safe' => ['html']]
); );

View File

@@ -2,9 +2,9 @@
namespace FireflyIII\Support\Twig; namespace FireflyIII\Support\Twig;
use FireflyIII\Models\PiggyBank as PB;
use Twig_Extension; use Twig_Extension;
use Twig_SimpleFunction; use Twig_SimpleFunction;
use FireflyIII\Models\PiggyBank as PB;
/** /**
* Class PiggyBank * Class PiggyBank
@@ -26,6 +26,7 @@ class PiggyBank extends Twig_Extension
return $piggyBank->currentRelevantRep()->currentamount; return $piggyBank->currentRelevantRep()->currentamount;
} }
); );
return $functions; return $functions;
} }

View File

@@ -203,7 +203,13 @@ class FireflyValidator extends Validator
$alwaysEncrypted = true; $alwaysEncrypted = true;
} }
if (is_null(Auth::user())) {
// user is not logged in.. weird.
return true;
} else {
$query = DB::table($table)->where('user_id', Auth::user()->id); $query = DB::table($table)->where('user_id', Auth::user()->id);
}
if (!is_null($exclude)) { if (!is_null($exclude)) {
$query->where('id', '!=', $exclude); $query->where('id', '!=', $exclude);

32
composer.lock generated
View File

@@ -943,16 +943,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v5.0.28", "version": "v5.0.29",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "06a09429322cf53e5bd4587db1060f02a291562e" "reference": "aa7046645e094b0134a4125cce6694f4b076ac62"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/06a09429322cf53e5bd4587db1060f02a291562e", "url": "https://api.github.com/repos/laravel/framework/zipball/aa7046645e094b0134a4125cce6694f4b076ac62",
"reference": "06a09429322cf53e5bd4587db1060f02a291562e", "reference": "aa7046645e094b0134a4125cce6694f4b076ac62",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1065,7 +1065,7 @@
"framework", "framework",
"laravel" "laravel"
], ],
"time": "2015-04-21 01:44:32" "time": "2015-05-08 12:57:10"
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
@@ -1375,16 +1375,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v1.2.2", "version": "v1.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "08f97eb4efa029e2fafb6d8c98b71731bf0cf621" "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/08f97eb4efa029e2fafb6d8c98b71731bf0cf621", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dff239267fd1befa1cd40430c9ed12591aa720ca",
"reference": "08f97eb4efa029e2fafb6d8c98b71731bf0cf621", "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1394,7 +1394,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.2-dev" "dev-master": "1.3-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1416,7 +1416,7 @@
"parser", "parser",
"php" "php"
], ],
"time": "2015-04-03 14:33:59" "time": "2015-05-02 15:40:40"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@@ -3582,16 +3582,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "4.6.4", "version": "4.6.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "163232991e652e6efed2f8470326fffa61e848e2" "reference": "3afe303d873a4d64c62ef84de491b97b006fbdac"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/163232991e652e6efed2f8470326fffa61e848e2", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3afe303d873a4d64c62ef84de491b97b006fbdac",
"reference": "163232991e652e6efed2f8470326fffa61e848e2", "reference": "3afe303d873a4d64c62ef84de491b97b006fbdac",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -3650,7 +3650,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2015-04-11 05:23:21" "time": "2015-04-29 15:18:52"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",

View File

@@ -4,6 +4,8 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* Class CreatePasswordResetsTable * Class CreatePasswordResetsTable
*/ */
class CreatePasswordResetsTable extends Migration class CreatePasswordResetsTable extends Migration

View File

@@ -7,6 +7,7 @@ use FireflyIII\Models\Component;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName) // method names are mandated by laravel. * @SuppressWarnings(PHPMD.ShortMethodName) // method names are mandated by laravel.
* @SuppressWarnings("TooManyMethods") // I'm fine with this * @SuppressWarnings("TooManyMethods") // I'm fine with this

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @SuppressWarnings("MethodLength") // I don't mind this in case of migrations. * @SuppressWarnings("PHPMD.ExcessiveMethodLength")
* *
* Class ChangesForV322 * Class ChangesForV322
*/ */

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @SuppressWarnings("MethodLength") // I don't mind this in case of migrations. * @SuppressWarnings("PHPMD.ExcessiveMethodLength")
* *
* Class ChangesForV325 * Class ChangesForV325
*/ */

View File

@@ -4,6 +4,8 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* Class ChangesForV332 * Class ChangesForV332
*/ */
class ChangesForV332 extends Migration class ChangesForV332 extends Migration

View File

@@ -3,6 +3,11 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
/**
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* Class ChangesForV333
*/
class ChangesForV333 extends Migration class ChangesForV333 extends Migration
{ {

View File

@@ -4,6 +4,9 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* Class ChangesForV336 * Class ChangesForV336
*/ */
class ChangesForV336 extends Migration class ChangesForV336 extends Migration

View File

@@ -3,6 +3,12 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
/**
* @SuppressWarnings(PHPMD.ShortMethodName)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* Class ChangesForV3310
*/
class ChangesForV3310 extends Migration class ChangesForV3310 extends Migration
{ {
@@ -57,7 +63,8 @@ class ChangesForV3310 extends Migration
); );
Schema::create('tag_transaction_journal',function (Blueprint $table) { Schema::create(
'tag_transaction_journal', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->integer('tag_id')->unsigned(); $table->integer('tag_id')->unsigned();
$table->integer('transaction_journal_id')->unsigned(); $table->integer('transaction_journal_id')->unsigned();
@@ -69,7 +76,8 @@ class ChangesForV3310 extends Migration
// add unique. // add unique.
$table->unique(['tag_id', 'transaction_journal_id'], 'tag_t_joined'); $table->unique(['tag_id', 'transaction_journal_id'], 'tag_t_joined');
}); }
);
} }
} }

View File

@@ -4,6 +4,8 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* Class ChangesForV3310a * Class ChangesForV3310a
*/ */
class ChangesForV3310a extends Migration class ChangesForV3310a extends Migration

View File

@@ -1,12 +1,24 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* Class ChangesForV3310b * Class ChangesForV3310b
*/ */
class ChangesForV3310b extends Migration { class ChangesForV3310b extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
/** /**
* Run the migrations. * Run the migrations.
@@ -19,14 +31,4 @@ class ChangesForV3310b extends Migration {
DB::table('transaction_groups')->update(['relation' => 'balance']); DB::table('transaction_groups')->update(['relation' => 'balance']);
} }
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
} }

2
pu.sh
View File

@@ -11,7 +11,7 @@ fi
if [ ! -z "$1" ] if [ ! -z "$1" ]
then then
phpunit --verbose tests/controllers/$1.php phpunit --verbose tests/repositories/$1.php
fi fi
# restore .env file # restore .env file

View File

@@ -3,7 +3,8 @@ google.setOnLoadCallback(drawChart);
function drawChart() { function drawChart() {
googleLineChart('chart/home/account', 'accounts-chart'); googleLineChart('chart/home/account', 'accounts-chart');
googleColumnChart('chart/home/budgets', 'budgets-chart'); //googleColumnChart('chart/home/budgets', 'budgets-chart');
googleStackedColumnChart('chart/home/budgets', 'budgets-chart');
googleColumnChart('chart/home/categories', 'categories-chart'); googleColumnChart('chart/home/categories', 'categories-chart');
googlePieChart('chart/home/bills', 'bills-chart'); googlePieChart('chart/home/bills', 'bills-chart');
getBoxAmounts(); getBoxAmounts();
@@ -14,9 +15,7 @@ function getBoxAmounts() {
for (x in boxes) { for (x in boxes) {
var box = boxes[x]; var box = boxes[x];
$.getJSON('/json/box/' + box).success(function (data) { $.getJSON('/json/box/' + box).success(function (data) {
if (data.amount_raw != 0) {
$('#box-' + data.box).html(data.amount); $('#box-' + data.box).html(data.amount);
}
}).fail(function () { }).fail(function () {
console.log('Failed to get box!') console.log('Failed to get box!')
}); });

View File

@@ -1,13 +1,15 @@
if (typeof(google) != 'undefined') { if (typeof(google) != 'undefined') {
google.setOnLoadCallback(drawChart); google.setOnLoadCallback(drawChart);
}
function drawChart() { function drawChart() {
googleColumnChart('chart/reports/income-expenses/' + year, 'income-expenses-chart'); googleColumnChart('chart/reports/income-expenses/' + year, 'income-expenses-chart');
googleColumnChart('chart/reports/income-expenses-sum/' + year, 'income-expenses-sum-chart') googleColumnChart('chart/reports/income-expenses-sum/' + year, 'income-expenses-sum-chart')
googleStackedColumnChart('chart/budgets/spending/' + year, 'budgets'); googleStackedColumnChart('chart/budgets/spending/' + year, 'budgets');
} }
}
$(function () { $(function () {
$('.openModal').on('click', openModal); $('.openModal').on('click', openModal);

View File

@@ -0,0 +1,10 @@
<?php
return [
'welcome' => 'Welcome to Firefly!',
'mainTitle' => 'What\'s playing?',
'close' => 'Clone',
'pleaseHold' => 'Please hold...',
'mandatoryFields' => 'Mandatory fields',
'optionalFields' => 'Optional fields',
'options' => 'Options'
];

View File

@@ -9,7 +9,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa {{ subTitleIcon }}"></i> Mandatory fields <i class="fa {{ subTitleIcon }}"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('name') }} {{ ExpandedForm.text('name') }}
@@ -22,7 +22,7 @@
{% if what == 'asset' %} {% if what == 'asset' %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields <i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
@@ -35,10 +35,9 @@
</div> </div>
{% endif %} {% endif %}
<!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('create','account') }} {{ ExpandedForm.optionsList('create','account') }}

View File

@@ -9,7 +9,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa {{ subTitleIcon }}"></i> Mandatory fields <i class="fa {{ subTitleIcon }}"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('name') }} {{ ExpandedForm.text('name') }}
@@ -20,7 +20,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields <i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %} {% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %}
@@ -50,7 +50,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('update','account') }} {{ ExpandedForm.optionsList('update','account') }}

View File

@@ -5,10 +5,9 @@
<div class="row"> <div class="row">
<div class="col-lg-6 col-md-12 col-sm-6"> <div class="col-lg-6 col-md-12 col-sm-6">
<!-- panel for mandatory fields -->
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-exclamation-circle"></i> Mandatory fields <i class="fa fa-exclamation-circle"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('name') }} {{ ExpandedForm.text('name') }}
@@ -22,10 +21,9 @@
</div> </div>
<div class="col-lg-6 col-md-12 col-sm-6"> <div class="col-lg-6 col-md-12 col-sm-6">
<!-- panel for optional fields -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields <i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.integer('skip',0) }} {{ ExpandedForm.integer('skip',0) }}
@@ -37,7 +35,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('create','bill') }} {{ ExpandedForm.optionsList('create','bill') }}

View File

@@ -9,7 +9,7 @@
<div class="col-lg-6 col-md-12 col-sm-6"> <div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-exclamation-circle"></i> Mandatory fields <i class="fa fa-exclamation-circle"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('name') }} {{ ExpandedForm.text('name') }}
@@ -26,7 +26,7 @@
<div class="col-lg-6 col-md-12 col-sm-6"> <div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields <i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.integer('skip') }} {{ ExpandedForm.integer('skip') }}
@@ -37,7 +37,7 @@
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('update','bill') }} {{ ExpandedForm.optionsList('update','bill') }}

View File

@@ -25,3 +25,10 @@
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block styles %}
<link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all" />
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="js/bootstrap-sortable.js"></script>
{% endblock %}

View File

@@ -6,7 +6,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-exclamation"></i> Mandatory fields <i class="fa fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('name') }} {{ ExpandedForm.text('name') }}
@@ -17,7 +17,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('create','budget') }} {{ ExpandedForm.optionsList('create','budget') }}

View File

@@ -13,7 +13,7 @@
<div class="col-lg-6 col-md-12 col-sm-6"> <div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-fw fa-exclamation"></i> Mandatory fields <i class="fa fa-fw fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.checkbox('active') }} {{ ExpandedForm.checkbox('active') }}
@@ -26,7 +26,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('update','budget') }} {{ ExpandedForm.optionsList('update','budget') }}

View File

@@ -122,11 +122,11 @@
<!-- budget-info-X holds the input and the euro-sign: --> <!-- budget-info-X holds the input and the euro-sign: -->
<span id="budget-info-{{ budget.id }}"> <span id="budget-info-{{ budget.id }}">
{% if budget.currentRep.amount > budget.spent %} {% if budget.currentRep.amount > budget.spent %}
<span class="text-success">{{ getCurrencySymbol() }}</span> <input type="number" min="0" max="{{ budgetMaximum }}" data-id="{{ budget.id }}" <span class="text-success">{{ getCurrencySymbol()|raw }}</span> <input type="number" min="0" max="{{ budgetMaximum }}" data-id="{{ budget.id }}"
step="1" value="{{ budget.currentRep.amount }}" step="1" value="{{ budget.currentRep.amount }}"
style="width:90px;color:#3c763d;"/> style="width:90px;color:#3c763d;"/>
{% else %} {% else %}
<span class="text-danger">{{ getCurrencySymbol() }}</span> <input type="number" min="0" max="{{ budgetMaximum }}" data-id="{{ budget.id }}" <span class="text-danger">{{ getCurrencySymbol()|raw }}</span> <input type="number" min="0" max="{{ budgetMaximum }}" data-id="{{ budget.id }}"
step="1" value="{{ budget.currentRep.amount }}" step="1" value="{{ budget.currentRep.amount }}"
style="width:90px;color:#a94442;"/> style="width:90px;color:#a94442;"/>
{% endif %} {% endif %}
@@ -134,7 +134,7 @@
{% else %} {% else %}
<span id="budget-description-{{ budget.id }}"><em>No budget</em></span> <span id="budget-description-{{ budget.id }}"><em>No budget</em></span>
<span id="budget-info-{{ budget.id }}"> <span id="budget-info-{{ budget.id }}">
<span class="text-success" style="display:none;">{{ Amount.getCurrencySymbol() }}</span> <input data-id="{{ budget.id }}" type="number" <span class="text-success" style="display:none;">{{ getCurrencySymbol()|raw }}</span> <input data-id="{{ budget.id }}" type="number"
min="0" max="{{ budgetMaximum }}" step="1" min="0" max="{{ budgetMaximum }}" step="1"
value="0" value="0"
style="width:50px;color:#3c763d;display:none;"/> style="width:50px;color:#3c763d;display:none;"/>

View File

@@ -7,7 +7,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-exclamation"></i> Mandatory fields <i class="fa fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('name') }} {{ ExpandedForm.text('name') }}
@@ -20,7 +20,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('create','category') }} {{ ExpandedForm.optionsList('create','category') }}

View File

@@ -7,7 +7,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-exclamation"></i> Mandatory fields <i class="fa fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('name') }} {{ ExpandedForm.text('name') }}
@@ -21,7 +21,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('update','category') }} {{ ExpandedForm.optionsList('update','category') }}

View File

@@ -6,7 +6,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa {{ subTitleIcon }}"></i> Mandatory fields <i class="fa {{ subTitleIcon }}"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('name',null,{'maxlength' : 48}) }} {{ ExpandedForm.text('name',null,{'maxlength' : 48}) }}
@@ -22,7 +22,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('create','currency') }} {{ ExpandedForm.optionsList('create','currency') }}

View File

@@ -8,7 +8,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa {{ subTitleIcon }}"></i> Mandatory fields <i class="fa {{ subTitleIcon }}"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('name',null,{'maxlength' : 48}) }} {{ ExpandedForm.text('name',null,{'maxlength' : 48}) }}
@@ -23,7 +23,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('update','currency') }} {{ ExpandedForm.optionsList('update','currency') }}

View File

@@ -5,7 +5,7 @@
{% if count == 0 %} {% if count == 0 %}
<div class="row"> <div class="row">
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
<p class="lead">Welcome to Firefly III.</p> <p class="lead">{{ trans('firefly.welcome') }}</p>
<p> <p>
Create a new asset account to get started. Create a new asset account to get started.
@@ -75,12 +75,12 @@
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-success progress-bar-striped" style="width: {{ 100 - account.percentage }}%"> <div class="progress-bar progress-bar-success progress-bar-striped" style="width: {{ 100 - account.percentage }}%">
{% if account.percentage <= 50 %} {% if account.percentage <= 50 %}
{{account.difference|formatAmount}} {{account.difference|formatAmountPlain}}
{% endif %} {% endif %}
</div> </div>
<div class="progress-bar progress-bar-danger progress-bar-striped" style="width: {{ account.percentage }}%"> <div class="progress-bar progress-bar-danger progress-bar-striped" style="width: {{ account.percentage }}%">
{% if account.percentage > 50 %} {% if account.percentage > 50 %}
{{account.difference|formatAmount}} {{account.difference|formatAmountPlain}}
{% endif %} {% endif %}
</div> </div>
</div> </div>
@@ -89,13 +89,13 @@
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-success progress-bar-striped" style="width: {{account.percentage}}%"> <div class="progress-bar progress-bar-success progress-bar-striped" style="width: {{account.percentage}}%">
{% if account.percentage <= 50 %} {% if account.percentage <= 50 %}
{{account.difference|formatAmount}} {{account.difference|formatAmountPlain}}
{{account.difference|formatAmount}} {{account.difference|formatAmountPlain}}
{% endif %} {% endif %}
</div> </div>
<div class="progress-bar progress-bar-info progress-bar-striped" style="width: {{100 - account.percentage}}%"> <div class="progress-bar progress-bar-info progress-bar-striped" style="width: {{100 - account.percentage}}%">
{% if account.percentage > 50 %} {% if account.percentage > 50 %}
{{account.difference|formatAmount}} {{account.difference|formatAmountPlain}}
{% endif %} {% endif %}
</div> </div>
</div> </div>
@@ -132,12 +132,12 @@
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-info progress-bar-striped" style="width: {{100 - account.percentage}}%"> <div class="progress-bar progress-bar-info progress-bar-striped" style="width: {{100 - account.percentage}}%">
{% if account.percentage <= 50 %} {% if account.percentage <= 50 %}
{{account.piggyBalance|formatAmount}} divided {{account.piggyBalance|formatAmountPlain}} divided
{% endif %} {% endif %}
</div> </div>
<div class="progress-bar progress-bar-success progress-bar-striped" style="width: {{account.percentage}}%"> <div class="progress-bar progress-bar-success progress-bar-striped" style="width: {{account.percentage}}%">
{% if account.percentage > 50 %} {% if account.percentage > 50 %}
{{account.difference|formatAmount}} left to divide {{account.difference|formatAmountPlain}} left to divide
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@@ -89,15 +89,15 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">{{ trans('firefly.close') }}</span>
</button> </button>
<h4 class="modal-title" id="helpTitle">Please hold...</h4> <h4 class="modal-title" id="helpTitle">{{ trans('firefly.pleaseHold') }}</h4>
</div> </div>
<div class="modal-body" id="helpBody"> <div class="modal-body" id="helpBody">
<i class="fa fa-refresh fa-spin"></i> <i class="fa fa-refresh fa-spin"></i>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('firefly.close') }}</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,7 @@
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped sortable">
<thead>
<tr> <tr>
<th>&nbsp;</th> <th data-defaultsort="disabled">&nbsp;</th>
<th>Name</th> <th>Name</th>
<th>Matches on</th> <th>Matches on</th>
<th colspan="2">Matching amount</th> <th colspan="2">Matching amount</th>
@@ -9,8 +10,9 @@
<th>Is active</th> <th>Is active</th>
<th>Will be automatched</th> <th>Will be automatched</th>
<th>Repeats every</th> <th>Repeats every</th>
<th>&nbsp;</th> <th data-defaultsort="disabled">&nbsp;</th>
</tr> </tr></thead>
<tbody>
{% for entry in bills %} {% for entry in bills %}
<tr> <tr>
<td> <td>
@@ -22,46 +24,52 @@
<td> <td>
<a href="{{route('bills.show',entry.id)}}" title="{{ entry.name }}">{{ entry.name }}</a> <a href="{{route('bills.show',entry.id)}}" title="{{ entry.name }}">{{ entry.name }}</a>
</td> </td>
<td> <td data-value="{{ entry.match }}">
{% for match in entry.match|split(',') %} {% for match in entry.match|split(',') %}
<span class="label label-info">{{ match }}</span> <span class="label label-info">{{ match }}</span>
{% endfor %} {% endfor %}
</td> </td>
<td> <td data-value="{{ entry.amount_min }}">
{{ entry.amount_min|formatAmount }} {{ entry.amount_min|formatAmount }}
</td> </td>
<td> <td data-value="{{ entry.amount_max }}">
{{ entry.amount_max|formatAmount }} {{ entry.amount_max|formatAmount }}
</td> </td>
<td>
{% if entry.lastFoundMatch %} {% if entry.lastFoundMatch %}
<td data-value="{{ entry.lastFoundMatch.format('U') }}">
{{entry.lastFoundMatch.format('j F Y')}} {{entry.lastFoundMatch.format('j F Y')}}
{% else %}
<em>Unknown</em>
{% endif %}
</td> </td>
<td> {% else %}
<td data-value="0">
<em>Unknown</em>
</td>
{% endif %}
{% if entry.nextExpectedMatch%} {% if entry.nextExpectedMatch%}
<td data-value="{{entry.nextExpectedMatch.format('U')}}">
{{entry.nextExpectedMatch.format('j F Y')}} {{entry.nextExpectedMatch.format('j F Y')}}
{% else %}
<em>Unknown</em>
{% endif %}
</td> </td>
<td> {% else %}
<td data-value="0">
<em>Unknown</em>
</td>
{% endif %}
<td data-value="{{ entry.active }}">
{% if entry.active %} {% if entry.active %}
<i class="fa fa-fw fa-check"></i> <i class="fa fa-fw fa-check"></i>
{% else %} {% else %}
<i class="fa fa-fw fa-ban"></i> <i class="fa fa-fw fa-ban"></i>
{% endif %} {% endif %}
</td> </td>
<td> <td data-value="{{ entry.automatch }}">
{% if entry.automatch %} {% if entry.automatch %}
<i class="fa fa-fw fa-check"></i> <i class="fa fa-fw fa-check"></i>
{% else %} {% else %}
<i class="fa fa-fw fa-ban"></i> <i class="fa fa-fw fa-ban"></i>
{% endif %} {% endif %}
</td> </td>
<td> <td data-value="{{ entry.repeat_freq }}{{ entry.skip }}">
{{ entry.repeat_freq }} {{ entry.repeat_freq }}
{% if entry.skip > 0 %} {% if entry.skip > 0 %}
skips over {{entry.skip}} skips over {{entry.skip}}
@@ -75,4 +83,5 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody>
</table> </table>

View File

@@ -8,7 +8,7 @@
<div class="col-lg-6 col-md-12 col-sm-6"> <div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-fw fa-exclamation"></i> Mandatory fields <i class="fa fa-fw fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
@@ -20,10 +20,9 @@
</div> </div>
</div> </div>
<div class="col-lg-6 col-md-12 col-sm-12"> <div class="col-lg-6 col-md-12 col-sm-12">
<!-- panel for optional fields -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields <i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.date('targetdate') }} {{ ExpandedForm.date('targetdate') }}
@@ -35,7 +34,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('create','piggy bank') }} {{ ExpandedForm.optionsList('create','piggy bank') }}

View File

@@ -10,7 +10,7 @@
<div class="col-lg-6 col-md-12 col-sm-6"> <div class="col-lg-6 col-md-12 col-sm-6">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-fw fa-exclamation"></i> Mandatory fields <i class="fa fa-fw fa-exclamation"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
@@ -23,10 +23,9 @@
</div> </div>
<div class="col-lg-6 col-md-12 col-sm-12"> <div class="col-lg-6 col-md-12 col-sm-12">
<!-- panel for optional fields -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields <i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.date('targetdate') }} {{ ExpandedForm.date('targetdate') }}
@@ -38,7 +37,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('update','piggy bank') }} {{ ExpandedForm.optionsList('update','piggy bank') }}

View File

@@ -0,0 +1,14 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">No budget bla bla.</h4>
</div>
<div class="modal-body">
{% include 'list/journals.twig' %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>

View File

@@ -101,7 +101,7 @@
</tr> </tr>
<tr> <tr>
<td>Out</td> <td>Out</td>
<td>{{ (expenseSum*-1)|formatAmount }}</td> <td><span class="text-danger">{{ expenseSum|formatAmountPlain }}</span></td>
</tr> </tr>
<tr> <tr>
<td>Difference</td> <td>Difference</td>
@@ -143,7 +143,7 @@
{% for expense in groupedExpenses %} {% for expense in groupedExpenses %}
<tr> <tr>
<td><a href="{{route('accounts.show',expense.id)}}">{{ expense.name }}</a></td> <td><a href="{{route('accounts.show',expense.id)}}">{{ expense.name }}</a></td>
<td>{{ (expense.queryAmount*-1)|formatAmount }}</td> <td><span class="text-danger">{{ expense.queryAmount|formatAmountPlain }}</span></td>
</tr> </tr>
{% set sum = sum + (expense.queryAmount * -1) %} {% set sum = sum + (expense.queryAmount * -1) %}
{% endfor %} {% endfor %}

View File

@@ -7,7 +7,7 @@
<div class="col-lg-5 col-md-5 col-sm-12"> <div class="col-lg-5 col-md-5 col-sm-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-tag"></i> Mandatory fields <i class="fa fa-tag"></i> {{ trans('firefly.mandatoryFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.text('tag') }} {{ ExpandedForm.text('tag') }}
@@ -20,7 +20,7 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields <i class="fa fa-smile-o"></i> {{ trans('firefly.optionalFields') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.date('date') }} {{ ExpandedForm.date('date') }}
@@ -32,7 +32,7 @@
<!-- panel for options --> <!-- panel for options -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bolt"></i> Options <i class="fa fa-bolt"></i> {{ trans('firefly.options') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ ExpandedForm.optionsList('create','tag') }} {{ ExpandedForm.optionsList('create','tag') }}

Some files were not shown because too many files have changed in this diff Show More