mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-21 02:31:19 +00:00
Merge branch 'release/3.3.5'
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,7 +3,6 @@
|
|||||||
composer.phar
|
composer.phar
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
.idea/
|
.idea/
|
||||||
.DS_Store
|
|
||||||
tests/_output/*
|
tests/_output/*
|
||||||
_ide_helper.php
|
_ide_helper.php
|
||||||
/build/logs/clover.xml
|
/build/logs/clover.xml
|
||||||
@@ -28,3 +27,4 @@ tests/_output/*
|
|||||||
.env
|
.env
|
||||||
clover.xml
|
clover.xml
|
||||||
node_modules/
|
node_modules/
|
||||||
|
addNewLines.php
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Firefly III (v3.3.4)
|
Firefly III (v3.3.5)
|
||||||
===========
|
===========
|
||||||
|
|
||||||
[](https://travis-ci.org/JC5/firefly-iii)
|
[](https://travis-ci.org/JC5/firefly-iii)
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php namespace FireflyIII\Handlers\Events;
|
<?php namespace FireflyIII\Handlers\Events;
|
||||||
|
|
||||||
use FireflyIII\Events\JournalDeleted;
|
use FireflyIII\Events\JournalDeleted;
|
||||||
use Illuminate\Contracts\Queue\ShouldBeQueued;
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class JournalDeletedHandler
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Handlers\Events
|
||||||
|
*/
|
||||||
class JournalDeletedHandler
|
class JournalDeletedHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the event handler.
|
* Create the event handler.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,8 +3,12 @@
|
|||||||
use FireflyIII\Events\JournalSaved;
|
use FireflyIII\Events\JournalSaved;
|
||||||
use FireflyIII\Models\PiggyBankEvent;
|
use FireflyIII\Models\PiggyBankEvent;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UpdateJournalConnection
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Handlers\Events
|
||||||
|
*/
|
||||||
class UpdateJournalConnection
|
class UpdateJournalConnection
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ class ReminderHelper implements ReminderHelperInterface
|
|||||||
|
|
||||||
if (!is_null($piggyBank->targetdate)) {
|
if (!is_null($piggyBank->targetdate)) {
|
||||||
// count back until now.
|
// count back until now.
|
||||||
// echo 'Count back!<br>';
|
|
||||||
$start = $piggyBank->targetdate;
|
$start = $piggyBank->targetdate;
|
||||||
$end = $piggyBank->startdate;
|
$end = $piggyBank->startdate;
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
)
|
)
|
||||||
->orderBy('accounts.name', 'ASC')
|
->orderBy('accounts.name', 'ASC')
|
||||||
->where(
|
->where(
|
||||||
function (Builder $query) use ($showSharedReports) {
|
function (Builder $query) {
|
||||||
|
|
||||||
$query->where('account_meta.data', '!=', '"sharedAsset"');
|
$query->where('account_meta.data', '!=', '"sharedAsset"');
|
||||||
$query->orWhereNull('account_meta.data');
|
$query->orWhereNull('account_meta.data');
|
||||||
@@ -272,15 +272,15 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
// only get deposits not to a shared account
|
// only get deposits not to a shared account
|
||||||
// and transfers to a shared account.
|
// and transfers to a shared account.
|
||||||
$query->where(
|
$query->where(
|
||||||
function ($query) {
|
function (Builder $query) {
|
||||||
$query->where(
|
$query->where(
|
||||||
function ($q) {
|
function (Builder $q) {
|
||||||
$q->where('transaction_types.type', 'Deposit');
|
$q->where('transaction_types.type', 'Deposit');
|
||||||
$q->where('acm_to.data', '!=', '"sharedAsset"');
|
$q->where('acm_to.data', '!=', '"sharedAsset"');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$query->orWhere(
|
$query->orWhere(
|
||||||
function ($q) {
|
function (Builder $q) {
|
||||||
$q->where('transaction_types.type', 'Transfer');
|
$q->where('transaction_types.type', 'Transfer');
|
||||||
$q->where('acm_from.data', '=', '"sharedAsset"');
|
$q->where('acm_from.data', '=', '"sharedAsset"');
|
||||||
}
|
}
|
||||||
@@ -427,15 +427,15 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
// get all withdrawals not from a shared accounts
|
// get all withdrawals not from a shared accounts
|
||||||
// and all transfers to a shared account
|
// and all transfers to a shared account
|
||||||
$query->where(
|
$query->where(
|
||||||
function ($query) {
|
function (Builder $query) {
|
||||||
$query->where(
|
$query->where(
|
||||||
function ($q) {
|
function (Builder $q) {
|
||||||
$q->where('transaction_types.type', 'Withdrawal');
|
$q->where('transaction_types.type', 'Withdrawal');
|
||||||
$q->where('acm_from.data', '!=', '"sharedAsset"');
|
$q->where('acm_from.data', '!=', '"sharedAsset"');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$query->orWhere(
|
$query->orWhere(
|
||||||
function ($q) {
|
function (Builder $q) {
|
||||||
$q->where('transaction_types.type', 'Transfer');
|
$q->where('transaction_types.type', 'Transfer');
|
||||||
$q->where('acm_to.data', '=', '"sharedAsset"');
|
$q->where('acm_to.data', '=', '"sharedAsset"');
|
||||||
}
|
}
|
||||||
@@ -495,15 +495,15 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
// show queries where transfer type is deposit, and its not to a shared account
|
// show queries where transfer type is deposit, and its not to a shared account
|
||||||
// or where its a transfer and its from a shared account (both count as incomes)
|
// or where its a transfer and its from a shared account (both count as incomes)
|
||||||
$query->where(
|
$query->where(
|
||||||
function ($query) {
|
function (Builder $query) {
|
||||||
$query->where(
|
$query->where(
|
||||||
function ($q) {
|
function (Builder $q) {
|
||||||
$q->where('transaction_types.type', 'Deposit');
|
$q->where('transaction_types.type', 'Deposit');
|
||||||
$q->where('acm_to.data', '!=', '"sharedAsset"');
|
$q->where('acm_to.data', '!=', '"sharedAsset"');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$query->orWhere(
|
$query->orWhere(
|
||||||
function ($q) {
|
function (Builder $q) {
|
||||||
$q->where('transaction_types.type', 'Transfer');
|
$q->where('transaction_types.type', 'Transfer');
|
||||||
$q->where('acm_from.data', '=', '"sharedAsset"');
|
$q->where('acm_from.data', '=', '"sharedAsset"');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use FireflyIII\Http\Requests;
|
|||||||
use FireflyIII\Http\Requests\AccountFormRequest;
|
use FireflyIII\Http\Requests\AccountFormRequest;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Input;
|
use Input;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
@@ -124,7 +125,7 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
// move to repository:
|
// move to repository:
|
||||||
$set = Auth::user()->accounts()->with(
|
$set = Auth::user()->accounts()->with(
|
||||||
['accountmeta' => function ($query) {
|
['accountmeta' => function (HasMany $query) {
|
||||||
$query->where('name', 'accountRole');
|
$query->where('name', 'accountRole');
|
||||||
}]
|
}]
|
||||||
)->accountTypeIn($types)->take($size)->offset($offset)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
|
)->accountTypeIn($types)->take($size)->offset($offset)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use Illuminate\Contracts\Auth\Guard;
|
|||||||
use Illuminate\Contracts\Auth\Registrar;
|
use Illuminate\Contracts\Auth\Registrar;
|
||||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Mail\Message;
|
||||||
use Mail;
|
use Mail;
|
||||||
use Session;
|
use Session;
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
// send email.
|
// send email.
|
||||||
Mail::send(
|
Mail::send(
|
||||||
'emails.registered', [], function ($message) use ($email) {
|
'emails.registered', [], function (Message $message) use ($email) {
|
||||||
$message->to($email, $email)->subject('Welcome to Firefly III!');
|
$message->to($email, $email)->subject('Welcome to Firefly III!');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -157,8 +157,6 @@ class BillController extends Controller
|
|||||||
public function store(BillFormRequest $request, BillRepositoryInterface $repository)
|
public function store(BillFormRequest $request, BillRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
|
|
||||||
var_dump($request->all());
|
|
||||||
|
|
||||||
$billData = [
|
$billData = [
|
||||||
'name' => $request->get('name'),
|
'name' => $request->get('name'),
|
||||||
'match' => $request->get('match'),
|
'match' => $request->get('match'),
|
||||||
|
|||||||
@@ -170,6 +170,10 @@ class BudgetController extends Controller
|
|||||||
|
|
||||||
Session::flash('success', 'New budget "' . $budget->name . '" stored!');
|
Session::flash('success', 'New budget "' . $budget->name . '" stored!');
|
||||||
|
|
||||||
|
if (intval(Input::get('create_another')) === 1) {
|
||||||
|
return Redirect::route('budgets.create')->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
return Redirect::route('budgets.index');
|
return Redirect::route('budgets.index');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use Carbon\Carbon;
|
|||||||
use DB;
|
use DB;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
||||||
use FireflyIII\Http\Requests;
|
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use Cache;
|
use Cache;
|
||||||
use ErrorException;
|
use ErrorException;
|
||||||
use FireflyIII\Http\Requests;
|
|
||||||
use League\CommonMark\CommonMarkConverter;
|
use League\CommonMark\CommonMarkConverter;
|
||||||
use Response;
|
use Response;
|
||||||
use Route;
|
use Route;
|
||||||
@@ -33,7 +32,7 @@ class HelpController extends Controller
|
|||||||
return Response::json($content);
|
return Response::json($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_inCache($route)) {
|
if ($this->inCache($route)) {
|
||||||
$content = [
|
$content = [
|
||||||
'text' => Cache::get('help.' . $route . '.text'),
|
'text' => Cache::get('help.' . $route . '.text'),
|
||||||
'title' => Cache::get('help.' . $route . '.title'),
|
'title' => Cache::get('help.' . $route . '.title'),
|
||||||
@@ -41,7 +40,7 @@ class HelpController extends Controller
|
|||||||
|
|
||||||
return Response::json($content);
|
return Response::json($content);
|
||||||
}
|
}
|
||||||
$content = $this->_getFromGithub($route);
|
$content = $this->getFromGithub($route);
|
||||||
|
|
||||||
|
|
||||||
Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week.
|
Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week.
|
||||||
@@ -56,7 +55,7 @@ class HelpController extends Controller
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function _inCache($route)
|
protected function inCache($route)
|
||||||
{
|
{
|
||||||
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
|
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
|
||||||
}
|
}
|
||||||
@@ -66,7 +65,7 @@ class HelpController extends Controller
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function _getFromGithub($route)
|
protected function getFromGithub($route)
|
||||||
{
|
{
|
||||||
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/' . e($route) . '.md';
|
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/' . e($route) . '.md';
|
||||||
$content = [
|
$content = [
|
||||||
|
|||||||
@@ -3,15 +3,14 @@
|
|||||||
use Amount;
|
use Amount;
|
||||||
use Auth;
|
use Auth;
|
||||||
use DB;
|
use DB;
|
||||||
use FireflyIII\Http\Requests;
|
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Models\TransactionType;
|
||||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
use Input;
|
use Input;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
use Session;
|
use Session;
|
||||||
use Config;
|
|
||||||
use FireflyIII\Models\TransactionType;
|
|
||||||
/**
|
/**
|
||||||
* Class JsonController
|
* Class JsonController
|
||||||
*
|
*
|
||||||
@@ -91,7 +90,6 @@ class JsonController extends Controller
|
|||||||
$count = $bill->transactionjournals()->before($range['end'])->after($range['start'])->count();
|
$count = $bill->transactionjournals()->before($range['end'])->after($range['start'])->count();
|
||||||
if ($count != 0) {
|
if ($count != 0) {
|
||||||
$journal = $bill->transactionjournals()->with('transactions')->before($range['end'])->after($range['start'])->first();
|
$journal = $bill->transactionjournals()->with('transactions')->before($range['end'])->after($range['start'])->first();
|
||||||
$paid['items'][] = $journal->description;
|
|
||||||
$currentAmount = 0;
|
$currentAmount = 0;
|
||||||
foreach ($journal->transactions as $t) {
|
foreach ($journal->transactions as $t) {
|
||||||
if (floatval($t->amount) > 0) {
|
if (floatval($t->amount) > 0) {
|
||||||
@@ -182,16 +180,17 @@ class JsonController extends Controller
|
|||||||
public function transactionJournals($what)
|
public function transactionJournals($what)
|
||||||
{
|
{
|
||||||
$descriptions = [];
|
$descriptions = [];
|
||||||
$dbType = TransactionType::whereType($what)->first();
|
$dbType = TransactionType::whereType($what)->first();
|
||||||
$journals = Auth::user()->transactionjournals()->where('transaction_type_id', $dbType->id)
|
$journals = Auth::user()->transactionjournals()->where('transaction_type_id', $dbType->id)
|
||||||
->orderBy('id','DESC')->take(50)
|
->orderBy('id', 'DESC')->take(50)
|
||||||
->get();
|
->get();
|
||||||
foreach($journals as $j) {
|
foreach ($journals as $j) {
|
||||||
$descriptions[] = $j->description;
|
$descriptions[] = $j->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
$descriptions = array_unique($descriptions);
|
$descriptions = array_unique($descriptions);
|
||||||
sort($descriptions);
|
sort($descriptions);
|
||||||
|
|
||||||
return Response::json($descriptions);
|
return Response::json($descriptions);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ 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\Models\PiggyBankEvent;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php namespace FireflyIII\Http\Controllers;
|
<?php namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use FireflyIII\Http\Requests;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
return Redirect::route('change-password');
|
return Redirect::route('change-password');
|
||||||
}
|
}
|
||||||
$result = $this->_validatePassword($request->get('current_password'), $request->get('new_password'), $request->get('new_password_confirmation'));
|
$result = $this->validatePassword($request->get('current_password'), $request->get('new_password'), $request->get('new_password_confirmation'));
|
||||||
if (!($result === true)) {
|
if (!($result === true)) {
|
||||||
Session::flash('error', $result);
|
Session::flash('error', $result);
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ class ProfileController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string|bool
|
* @return string|bool
|
||||||
*/
|
*/
|
||||||
protected function _validatePassword($old, $new1, $new2)
|
protected function validatePassword($old, $new1, $new2)
|
||||||
{
|
{
|
||||||
if (strlen($new1) == 0 || strlen($new2) == 0) {
|
if (strlen($new1) == 0 || strlen($new2) == 0) {
|
||||||
return 'Do fill in a password!';
|
return 'Do fill in a password!';
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php namespace FireflyIII\Http\Controllers;
|
<?php namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use FireflyIII\Http\Requests;
|
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionGroup;
|
use FireflyIII\Models\TransactionGroup;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Helpers\Reminders\ReminderHelperInterface;
|
use FireflyIII\Helpers\Reminders\ReminderHelperInterface;
|
||||||
use FireflyIII\Http\Requests;
|
|
||||||
use FireflyIII\Models\Reminder;
|
use FireflyIII\Models\Reminder;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
@@ -83,7 +82,7 @@ class ReminderController extends Controller
|
|||||||
|
|
||||||
// inactive reminders
|
// inactive reminders
|
||||||
$inactive = $reminders->filter(
|
$inactive = $reminders->filter(
|
||||||
function (Reminder $reminder) use ($today) {
|
function (Reminder $reminder) {
|
||||||
if ($reminder->active === false) {
|
if ($reminder->active === false) {
|
||||||
return $reminder;
|
return $reminder;
|
||||||
}
|
}
|
||||||
@@ -92,7 +91,7 @@ class ReminderController extends Controller
|
|||||||
|
|
||||||
// dismissed reminders
|
// dismissed reminders
|
||||||
$dismissed = $reminders->filter(
|
$dismissed = $reminders->filter(
|
||||||
function (Reminder $reminder) use ($today) {
|
function (Reminder $reminder) {
|
||||||
if ($reminder->notnow === true) {
|
if ($reminder->notnow === true) {
|
||||||
return $reminder;
|
return $reminder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ use Carbon\Carbon;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||||
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
||||||
use FireflyIII\Http\Requests;
|
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Database\Query\JoinClause;
|
use Illuminate\Database\Query\JoinClause;
|
||||||
@@ -382,8 +381,6 @@ class ReportController extends Controller
|
|||||||
$groupedIncomes = $query->journalsByRevenueAccount($date, $end, $showSharedReports);
|
$groupedIncomes = $query->journalsByRevenueAccount($date, $end, $showSharedReports);
|
||||||
$groupedExpenses = $query->journalsByExpenseAccount($date, $end, $showSharedReports);
|
$groupedExpenses = $query->journalsByExpenseAccount($date, $end, $showSharedReports);
|
||||||
|
|
||||||
//$groupedExpenses = $helper-> expensesGroupedByAccount($date, $end, 15);
|
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'reports.year', compact('date', 'groupedIncomes', 'groupedExpenses', 'year', 'balances', 'title', 'subTitle', 'subTitleIcon', 'mainTitleIcon')
|
'reports.year', compact('date', 'groupedIncomes', 'groupedExpenses', 'year', 'balances', 'title', 'subTitle', 'subTitleIcon', 'mainTitleIcon')
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php namespace FireflyIII\Http\Controllers;
|
<?php namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
use FireflyIII\Http\Requests;
|
|
||||||
use FireflyIII\Support\Search\SearchInterface;
|
use FireflyIII\Support\Search\SearchInterface;
|
||||||
use Input;
|
use Input;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Authenticate
|
* Class Authenticate
|
||||||
@@ -37,7 +38,7 @@ class Authenticate
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
if ($this->auth->guest()) {
|
if ($this->auth->guest()) {
|
||||||
if ($request->ajax()) {
|
if ($request->ajax()) {
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ use Carbon\Carbon;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Models\PiggyBankRepetition;
|
use FireflyIII\Models\PiggyBankRepetition;
|
||||||
use FireflyIII\Models\Reminder;
|
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
use Illuminate\Database\Query\JoinClause;
|
use Illuminate\Database\Query\JoinClause;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Navigation;
|
use Navigation;
|
||||||
use Session;
|
use Session;
|
||||||
@@ -48,7 +48,7 @@ class PiggyBanks
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
|
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
|
||||||
// get piggy banks without a repetition:
|
// get piggy banks without a repetition:
|
||||||
@@ -91,7 +91,6 @@ class PiggyBanks
|
|||||||
$start = clone $piggyBank->startdate;
|
$start = clone $piggyBank->startdate;
|
||||||
$end = clone $piggyBank->targetdate;
|
$end = clone $piggyBank->targetdate;
|
||||||
$max = clone $piggyBank->targetdate;
|
$max = clone $piggyBank->targetdate;
|
||||||
$index = 0;
|
|
||||||
|
|
||||||
// first loop: start date to target date.
|
// first loop: start date to target date.
|
||||||
// then, continue looping until end is > today
|
// then, continue looping until end is > today
|
||||||
@@ -127,7 +126,6 @@ class PiggyBanks
|
|||||||
$repetition->targetdate = is_null($piggyBank->targetdate) ? null : $piggyBank->targetdate;
|
$repetition->targetdate = is_null($piggyBank->targetdate) ? null : $piggyBank->targetdate;
|
||||||
$repetition->currentamount = 0;
|
$repetition->currentamount = 0;
|
||||||
// it might exist, catch:
|
// it might exist, catch:
|
||||||
//$repetition->save();
|
|
||||||
|
|
||||||
// then, loop from original target up to now.
|
// then, loop from original target up to now.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace FireflyIII\Http\Middleware;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Navigation;
|
use Navigation;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Session;
|
use Session;
|
||||||
@@ -44,7 +45,7 @@ class Range
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $theNext)
|
public function handle(Request $request, Closure $theNext)
|
||||||
{
|
{
|
||||||
if ($this->auth->check()) {
|
if ($this->auth->check()) {
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RedirectIfAuthenticated
|
* Class RedirectIfAuthenticated
|
||||||
@@ -38,7 +39,7 @@ class RedirectIfAuthenticated
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
if ($this->auth->check()) {
|
if ($this->auth->check()) {
|
||||||
return new RedirectResponse(url('/'));
|
return new RedirectResponse(url('/'));
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use Closure;
|
|||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Models\Reminder;
|
use FireflyIII\Models\Reminder;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,7 +44,7 @@ class Reminders
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
|
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
|
||||||
// do reminders stuff.
|
// do reminders stuff.
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ namespace FireflyIII\Http\Middleware;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
use Illuminate\Contracts\Routing\Middleware;
|
use Illuminate\Http\Request;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReplaceTestVars
|
* Class ReplaceTestVars
|
||||||
*
|
*
|
||||||
* @package App\Http\Middleware
|
* @package FireflyIII\Http\Middleware
|
||||||
*/
|
*/
|
||||||
class ReplaceTestVars implements Middleware
|
class ReplaceTestVars
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The application implementation.
|
* The application implementation.
|
||||||
@@ -40,7 +40,7 @@ class ReplaceTestVars implements Middleware
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
if ('testing' === $this->app->environment() && $request->has('_token')) {
|
if ('testing' === $this->app->environment() && $request->has('_token')) {
|
||||||
$input = $request->all();
|
$input = $request->all();
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use FireflyIII\Models\Account;
|
|
||||||
use Input;
|
use Input;
|
||||||
|
use Exception;
|
||||||
/**
|
/**
|
||||||
* Class JournalFormRequest
|
* Class JournalFormRequest
|
||||||
*
|
*
|
||||||
@@ -24,6 +23,7 @@ class JournalFormRequest extends Request
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ class JournalFormRequest extends Request
|
|||||||
$rules['category'] = 'between:1,255';
|
$rules['category'] = 'between:1,255';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
die('Cannot handle ' . $what);
|
throw new Exception('Cannot handle ' . $what);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ namespace FireflyIII\Http\Requests;
|
|||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Account;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Navigation;
|
use Navigation;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use FireflyIII\Models\Account;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ProfileFormRequest
|
* Class ProfileFormRequest
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ class PiggyBank extends Model
|
|||||||
return $rep;
|
return $rep;
|
||||||
} else {
|
} else {
|
||||||
Log::error('Tried to work with a piggy bank with a repeats=1 value! (id is '.$this->id.')');
|
Log::error('Tried to work with a piggy bank with a repeats=1 value! (id is '.$this->id.')');
|
||||||
//App::abort(500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<?php namespace FireflyIII\Models;
|
<?php namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PiggyBankRepetition
|
* Class PiggyBankRepetition
|
||||||
*
|
*
|
||||||
@@ -27,27 +28,6 @@ class PiggyBankRepetition extends Model
|
|||||||
return $this->belongsTo('FireflyIII\Models\PiggyBank');
|
return $this->belongsTo('FireflyIII\Models\PiggyBank');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param EloquentBuilder $query
|
|
||||||
* @param Carbon $date
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function scopeRelevantOnDate(EloquentBuilder $query, Carbon $date)
|
|
||||||
{
|
|
||||||
return $query->where(
|
|
||||||
function($q) use ($date) {
|
|
||||||
$q->where('startdate', '<=', $date->format('Y-m-d 00:00:00'));
|
|
||||||
$q->orWhereNull('startdate');
|
|
||||||
})
|
|
||||||
|
|
||||||
->where(function($q) use ($date) {
|
|
||||||
|
|
||||||
$q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00'));
|
|
||||||
$q->orWhereNull('targetdate');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param EloquentBuilder $query
|
* @param EloquentBuilder $query
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@@ -57,7 +37,30 @@ class PiggyBankRepetition extends Model
|
|||||||
*/
|
*/
|
||||||
public function scopeOnDates(EloquentBuilder $query, Carbon $start, Carbon $target)
|
public function scopeOnDates(EloquentBuilder $query, Carbon $start, Carbon $target)
|
||||||
{
|
{
|
||||||
return $query->where('startdate',$start->format('Y-m-d'))->where('targetdate',$target->format('Y-m-d'));
|
return $query->where('startdate', $start->format('Y-m-d'))->where('targetdate', $target->format('Y-m-d'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param EloquentBuilder $query
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function scopeRelevantOnDate(EloquentBuilder $query, Carbon $date)
|
||||||
|
{
|
||||||
|
return $query->where(
|
||||||
|
function (EloquentBuilder $q) use ($date) {
|
||||||
|
$q->where('startdate', '<=', $date->format('Y-m-d 00:00:00'));
|
||||||
|
$q->orWhereNull('startdate');
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->where(
|
||||||
|
function (EloquentBuilder $q) use ($date) {
|
||||||
|
|
||||||
|
$q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00'));
|
||||||
|
$q->orWhereNull('targetdate');
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<?php namespace FireflyIII\Providers;
|
<?php namespace FireflyIII\Providers;
|
||||||
|
|
||||||
use App;
|
|
||||||
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;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php namespace FireflyIII\Providers;
|
<?php namespace FireflyIII\Providers;
|
||||||
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Routing\Router;
|
use Illuminate\Routing\Router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,22 +31,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
parent::boot($router);
|
parent::boot($router);
|
||||||
|
|
||||||
$router->before(
|
|
||||||
function (Request $request) {
|
|
||||||
|
|
||||||
// put IP in session if not already there.
|
|
||||||
|
|
||||||
$reminders = [];
|
|
||||||
|
|
||||||
if ($request->user()) {
|
|
||||||
//Filter::setSessionDateRange();
|
|
||||||
//Reminders::updateReminders();
|
|
||||||
//Steam::removeEmptyBudgetLimits();
|
|
||||||
//$reminders = Reminders::getReminders();
|
|
||||||
}
|
|
||||||
// View::share('reminders', $reminders);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
|
|
||||||
return $paginator;
|
return $paginator;
|
||||||
|
|
||||||
//return Paginator::make($items, $count, 50);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -202,8 +201,8 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function store(array $data)
|
public function store(array $data)
|
||||||
{
|
{
|
||||||
$newAccount = $this->_store($data);
|
$newAccount = $this->storeAccount($data);
|
||||||
$this->_storeMetadata($newAccount, $data);
|
$this->storeMetadata($newAccount, $data);
|
||||||
|
|
||||||
|
|
||||||
// continue with the opposing account:
|
// continue with the opposing account:
|
||||||
@@ -215,8 +214,8 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
'name' => $data['name'] . ' initial balance',
|
'name' => $data['name'] . ' initial balance',
|
||||||
'active' => false,
|
'active' => false,
|
||||||
];
|
];
|
||||||
$opposing = $this->_store($opposingData);
|
$opposing = $this->storeAccount($opposingData);
|
||||||
$this->_storeInitialBalance($newAccount, $opposing, $data);
|
$this->storeInitialBalance($newAccount, $opposing, $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +235,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
// update meta data:
|
// update meta data:
|
||||||
$this->_updateMetadata($account, $data);
|
$this->updateMetadata($account, $data);
|
||||||
|
|
||||||
$openingBalance = $this->openingBalanceTransaction($account);
|
$openingBalance = $this->openingBalanceTransaction($account);
|
||||||
|
|
||||||
@@ -245,7 +244,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
// if opening balance, do an update:
|
// if opening balance, do an update:
|
||||||
if ($openingBalance) {
|
if ($openingBalance) {
|
||||||
// update existing opening balance.
|
// update existing opening balance.
|
||||||
$this->_updateInitialBalance($account, $openingBalance, $data);
|
$this->updateInitialBalance($account, $openingBalance, $data);
|
||||||
} else {
|
} else {
|
||||||
// create new opening balance.
|
// create new opening balance.
|
||||||
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
|
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
|
||||||
@@ -255,8 +254,8 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
'name' => $data['name'] . ' initial balance',
|
'name' => $data['name'] . ' initial balance',
|
||||||
'active' => false,
|
'active' => false,
|
||||||
];
|
];
|
||||||
$opposing = $this->_store($opposingData);
|
$opposing = $this->storeAccount($opposingData);
|
||||||
$this->_storeInitialBalance($account, $opposing, $data);
|
$this->storeInitialBalance($account, $opposing, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -275,7 +274,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @return Account
|
* @return Account
|
||||||
*/
|
*/
|
||||||
protected function _store(array $data)
|
protected function storeAccount(array $data)
|
||||||
{
|
{
|
||||||
$type = Config::get('firefly.accountTypeByIdentifier.' . $data['accountType']);
|
$type = Config::get('firefly.accountTypeByIdentifier.' . $data['accountType']);
|
||||||
$accountType = AccountType::whereType($type)->first();
|
$accountType = AccountType::whereType($type)->first();
|
||||||
@@ -307,7 +306,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
protected function _storeMetadata(Account $account, array $data)
|
protected function storeMetadata(Account $account, array $data)
|
||||||
{
|
{
|
||||||
$metaData = new AccountMeta(
|
$metaData = new AccountMeta(
|
||||||
[
|
[
|
||||||
@@ -329,7 +328,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @return TransactionJournal
|
* @return TransactionJournal
|
||||||
*/
|
*/
|
||||||
protected function _storeInitialBalance(Account $account, Account $opposing, array $data)
|
protected function storeInitialBalance(Account $account, Account $opposing, array $data)
|
||||||
{
|
{
|
||||||
$type = $data['openingBalance'] < 0 ? 'Withdrawal' : 'Deposit';
|
$type = $data['openingBalance'] < 0 ? 'Withdrawal' : 'Deposit';
|
||||||
$transactionType = TransactionType::whereType($type)->first();
|
$transactionType = TransactionType::whereType($type)->first();
|
||||||
@@ -398,7 +397,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
protected function _updateMetadata(Account $account, array $data)
|
protected function updateMetadata(Account $account, array $data)
|
||||||
{
|
{
|
||||||
$metaEntries = $account->accountMeta()->get();
|
$metaEntries = $account->accountMeta()->get();
|
||||||
$updated = false;
|
$updated = false;
|
||||||
@@ -435,7 +434,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @return TransactionJournal
|
* @return TransactionJournal
|
||||||
*/
|
*/
|
||||||
protected function _updateInitialBalance(Account $account, TransactionJournal $journal, array $data)
|
protected function updateInitialBalance(Account $account, TransactionJournal $journal, array $data)
|
||||||
{
|
{
|
||||||
$journal->date = $data['openingBalanceDate'];
|
$journal->date = $data['openingBalanceDate'];
|
||||||
|
|
||||||
|
|||||||
@@ -51,16 +51,11 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
foreach ($billStarts as $dateEntry) {
|
foreach ($billStarts as $dateEntry) {
|
||||||
if ($dateEntry['end'] > $start && $dateEntry['start'] < $end) {
|
if ($dateEntry['end'] > $start && $dateEntry['start'] < $end) {
|
||||||
// count transactions for bill in this range (not relevant yet!):
|
// count transactions for bill in this range (not relevant yet!):
|
||||||
// $count = $bill->transactionjournals()->before($dateEntry['end'])->after($dateEntry['start'])->count();
|
|
||||||
// if ($count == 0) {
|
|
||||||
$validRanges[] = $dateEntry;
|
$validRanges[] = $dateEntry;
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $validRanges;
|
return $validRanges;
|
||||||
// echo $bill->name;
|
|
||||||
// var_dump($validRanges);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use FireflyIII\Models\Transaction;
|
|||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class JournalRepository
|
* Class JournalRepository
|
||||||
@@ -275,7 +274,7 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
$transaction->save();
|
$transaction->save();
|
||||||
}
|
}
|
||||||
if (floatval($transaction->amount) > 0) {
|
if (floatval($transaction->amount) > 0) {
|
||||||
$transaction->amount = $data['amount'];
|
$transaction->amount = $data['amount'];
|
||||||
$transaction->account_id = $to->id;
|
$transaction->account_id = $to->id;
|
||||||
$transaction->save();
|
$transaction->save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use Auth;
|
|||||||
use DB;
|
use DB;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Models\PiggyBankRepetition;
|
use FireflyIII\Models\PiggyBankRepetition;
|
||||||
use FireflyIII\Models\Reminder;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Navigation;
|
use Navigation;
|
||||||
|
|
||||||
@@ -98,7 +97,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.id')
|
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.id')
|
||||||
->where('accounts.user_id', Auth::user()->id)
|
->where('accounts.user_id', Auth::user()->id)
|
||||||
->update(['order' => 0, 'piggy_banks.updated_at' => DB::Raw('NOW()')]);
|
->update(['order' => 0, 'piggy_banks.updated_at' => DB::Raw('NOW()')]);
|
||||||
//Auth::user()->piggyBanks()->update(['order' => 0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ namespace FireflyIII\Repositories\PiggyBank;
|
|||||||
|
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Models\PiggyBankRepetition;
|
use FireflyIII\Models\PiggyBankRepetition;
|
||||||
use FireflyIII\Models\Reminder;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Carbon\Carbon;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface PiggyBankRepositoryInterface
|
* Interface PiggyBankRepositoryInterface
|
||||||
@@ -39,6 +37,7 @@ interface PiggyBankRepositoryInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all piggy banks to order 0.
|
* Set all piggy banks to order 0.
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function reset();
|
public function reset();
|
||||||
@@ -55,7 +54,6 @@ interface PiggyBankRepositoryInterface
|
|||||||
public function setOrder($id, $order);
|
public function setOrder($id, $order);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,10 +11,8 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use FireflyIII\Validation\FireflyValidator;
|
|
||||||
|
|
||||||
$app = new Illuminate\Foundation\Application(
|
$app = new Illuminate\Foundation\Application(
|
||||||
realpath(__DIR__.'/../')
|
realpath(__DIR__ . '/../')
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -29,18 +27,18 @@ $app = new Illuminate\Foundation\Application(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$app->singleton(
|
$app->singleton(
|
||||||
'Illuminate\Contracts\Http\Kernel',
|
'Illuminate\Contracts\Http\Kernel',
|
||||||
'FireflyIII\Http\Kernel'
|
'FireflyIII\Http\Kernel'
|
||||||
);
|
);
|
||||||
|
|
||||||
$app->singleton(
|
$app->singleton(
|
||||||
'Illuminate\Contracts\Console\Kernel',
|
'Illuminate\Contracts\Console\Kernel',
|
||||||
'FireflyIII\Console\Kernel'
|
'FireflyIII\Console\Kernel'
|
||||||
);
|
);
|
||||||
|
|
||||||
$app->singleton(
|
$app->singleton(
|
||||||
'Illuminate\Contracts\Debug\ExceptionHandler',
|
'Illuminate\Contracts\Debug\ExceptionHandler',
|
||||||
'FireflyIII\Exceptions\Handler'
|
'FireflyIII\Exceptions\Handler'
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"laravel/framework": "5.0.*",
|
"laravel/framework": "5.0.*",
|
||||||
"davejamesmiller/laravel-breadcrumbs": "~3.0",
|
"davejamesmiller/laravel-breadcrumbs": "~3.0",
|
||||||
"grumpydictator/gchart": "dev-master",
|
"grumpydictator/gchart": "~1",
|
||||||
"watson/validating": "dev-master",
|
"watson/validating": "~1.0",
|
||||||
"doctrine/dbal": "~2.5",
|
"doctrine/dbal": "~2.5",
|
||||||
"illuminate/html": "~5.0",
|
"illuminate/html": "~5.0",
|
||||||
"league/commonmark": "0.7.*"
|
"league/commonmark": "0.7.*"
|
||||||
|
|||||||
18
composer.lock
generated
18
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "34e0c28c0f8f4c04b545b2cbb0f2f24b",
|
"hash": "b77b9f717b25e1e193bdc6edb18ad492",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "classpreloader/classpreloader",
|
"name": "classpreloader/classpreloader",
|
||||||
@@ -682,7 +682,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grumpydictator/gchart",
|
"name": "grumpydictator/gchart",
|
||||||
"version": "dev-master",
|
"version": "1.0.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/JC5/gchart.git",
|
"url": "https://github.com/JC5/gchart.git",
|
||||||
@@ -950,16 +950,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v5.0.22",
|
"version": "v5.0.23",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/framework.git",
|
"url": "https://github.com/laravel/framework.git",
|
||||||
"reference": "388289de68ba912746bd1adb20a8b1cd0f846ea1"
|
"reference": "59219f7afb60be05d74ce01fcb5d2440f7a1b13d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/framework/zipball/388289de68ba912746bd1adb20a8b1cd0f846ea1",
|
"url": "https://api.github.com/repos/laravel/framework/zipball/59219f7afb60be05d74ce01fcb5d2440f7a1b13d",
|
||||||
"reference": "388289de68ba912746bd1adb20a8b1cd0f846ea1",
|
"reference": "59219f7afb60be05d74ce01fcb5d2440f7a1b13d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1072,7 +1072,7 @@
|
|||||||
"framework",
|
"framework",
|
||||||
"laravel"
|
"laravel"
|
||||||
],
|
],
|
||||||
"time": "2015-03-27 14:49:51"
|
"time": "2015-03-28 16:56:59"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/commonmark",
|
"name": "league/commonmark",
|
||||||
@@ -2351,7 +2351,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "watson/validating",
|
"name": "watson/validating",
|
||||||
"version": "dev-master",
|
"version": "1.0.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/dwightwatson/validating.git",
|
"url": "https://github.com/dwightwatson/validating.git",
|
||||||
@@ -3962,8 +3962,6 @@
|
|||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": {
|
"stability-flags": {
|
||||||
"grumpydictator/gchart": 20,
|
|
||||||
"watson/validating": 20,
|
|
||||||
"barryvdh/laravel-debugbar": 0
|
"barryvdh/laravel-debugbar": 0
|
||||||
},
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ use FireflyIII\Models\BudgetLimit;
|
|||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Models\PiggyBankEvent;
|
use FireflyIII\Models\PiggyBankEvent;
|
||||||
use FireflyIII\Models\PiggyBankRepetition;
|
|
||||||
use FireflyIII\Models\Reminder;
|
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Models\TransactionGroup;
|
use FireflyIII\Models\TransactionGroup;
|
||||||
@@ -137,12 +135,9 @@ class TestDataSeeder extends Seeder
|
|||||||
$acc_c = Account::create(['user_id' => $user->id, 'account_type_id' => $assetType->id, 'name' => 'Delete me', 'active' => 1]);
|
$acc_c = Account::create(['user_id' => $user->id, 'account_type_id' => $assetType->id, 'name' => 'Delete me', 'active' => 1]);
|
||||||
|
|
||||||
// create account meta:
|
// create account meta:
|
||||||
$meta_a = AccountMeta::create(['account_id' => $acc_a->id, 'name' => 'accountRole', 'data' => 'defaultAsset']);
|
AccountMeta::create(['account_id' => $acc_a->id, 'name' => 'accountRole', 'data' => 'defaultAsset']);
|
||||||
$meta_b = AccountMeta::create(['account_id' => $acc_b->id, 'name' => 'accountRole', 'data' => 'savingAsset']);
|
AccountMeta::create(['account_id' => $acc_b->id, 'name' => 'accountRole', 'data' => 'savingAsset']);
|
||||||
$meta_c = AccountMeta::create(['account_id' => $acc_c->id, 'name' => 'accountRole', 'data' => 'defaultAsset']);
|
AccountMeta::create(['account_id' => $acc_c->id, 'name' => 'accountRole', 'data' => 'defaultAsset']);
|
||||||
// var_dump($meta_a->toArray());
|
|
||||||
// var_dump($meta_b->toArray());
|
|
||||||
// var_dump($meta_c->toArray());
|
|
||||||
|
|
||||||
$acc_d = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Checking account initial balance', 'active' => 0]);
|
$acc_d = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Checking account initial balance', 'active' => 0]);
|
||||||
$acc_e = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Savings account initial balance', 'active' => 0]);
|
$acc_e = Account::create(['user_id' => $user->id, 'account_type_id' => $ibType->id, 'name' => 'Savings account initial balance', 'active' => 0]);
|
||||||
@@ -211,20 +206,17 @@ class TestDataSeeder extends Seeder
|
|||||||
$bills = Budget::create(['user_id' => $user->id, 'name' => 'Bills']);
|
$bills = Budget::create(['user_id' => $user->id, 'name' => 'Bills']);
|
||||||
$deleteMe = Budget::create(['user_id' => $user->id, 'name' => 'Delete me']);
|
$deleteMe = Budget::create(['user_id' => $user->id, 'name' => 'Delete me']);
|
||||||
Budget::create(['user_id' => $user->id, 'name' => 'Budget without repetition']);
|
Budget::create(['user_id' => $user->id, 'name' => 'Budget without repetition']);
|
||||||
$groceriesLimit = BudgetLimit::create(
|
BudgetLimit::create(
|
||||||
['startdate' => $this->som, 'amount' => 201, 'repeats' => 0, 'repeat_freq' => 'monthly', 'budget_id' => $groceries->id]
|
['startdate' => $this->som, 'amount' => 201, 'repeats' => 0, 'repeat_freq' => 'monthly', 'budget_id' => $groceries->id]
|
||||||
);
|
);
|
||||||
$billsLimit = BudgetLimit::create(
|
BudgetLimit::create(
|
||||||
['startdate' => $this->som, 'amount' => 202, 'repeats' => 0, 'repeat_freq' => 'monthly', 'budget_id' => $bills->id]
|
['startdate' => $this->som, 'amount' => 202, 'repeats' => 0, 'repeat_freq' => 'monthly', 'budget_id' => $bills->id]
|
||||||
);
|
);
|
||||||
$deleteMeLimit = BudgetLimit::create(
|
BudgetLimit::create(
|
||||||
['startdate' => $this->som, 'amount' => 203, 'repeats' => 0, 'repeat_freq' => 'monthly', 'budget_id' => $deleteMe->id]
|
['startdate' => $this->som, 'amount' => 203, 'repeats' => 0, 'repeat_freq' => 'monthly', 'budget_id' => $deleteMe->id]
|
||||||
);
|
);
|
||||||
|
|
||||||
// and because we have no filters, some repetitions:
|
// and because we have no filters, some repetitions:
|
||||||
// LimitRepetition::create(['budget_limit_id' => $groceriesLimit->id, 'startdate' => $this->som, 'enddate' => $this->eom, 'amount' => 201]);
|
|
||||||
// LimitRepetition::create(['budget_limit_id' => $billsLimit->id, 'startdate' => $this->som, 'enddate' => $this->eom, 'amount' => 202]);
|
|
||||||
// LimitRepetition::create(['budget_limit_id' => $deleteMeLimit->id, 'startdate' => $this->som, 'enddate' => $this->eom, 'amount' => 203]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -255,7 +247,6 @@ class TestDataSeeder extends Seeder
|
|||||||
$endDate->addMonths(4);
|
$endDate->addMonths(4);
|
||||||
$nextYear->addYear()->subDay();
|
$nextYear->addYear()->subDay();
|
||||||
|
|
||||||
$next = $nextYear->format('Y-m-d');
|
|
||||||
$end = $endDate->format('Y-m-d');
|
$end = $endDate->format('Y-m-d');
|
||||||
|
|
||||||
// piggy bank
|
// piggy bank
|
||||||
@@ -351,8 +342,6 @@ class TestDataSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function createReminders()
|
public function createReminders()
|
||||||
{
|
{
|
||||||
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
|
||||||
// for weekly piggy bank (clothes)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$uri = urldecode(
|
$uri = urldecode(
|
||||||
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
|
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
|
||||||
);
|
);
|
||||||
|
|
||||||
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
|
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
|
||||||
// built-in PHP web server. This provides a convenient way to test a Laravel
|
// built-in PHP web server. This provides a convenient way to test a Laravel
|
||||||
// application without having installed a "real" web server software here.
|
// application without having installed a "real" web server software here.
|
||||||
if ($uri !== '/' and file_exists(__DIR__.'/public'.$uri))
|
if ($uri !== '/' && file_exists(__DIR__ . '/public' . $uri)) {
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once __DIR__.'/public/index.php';
|
require_once __DIR__ . '/public/index.php';
|
||||||
|
|||||||
Reference in New Issue
Block a user