Merge branch 'release/3.1.4'

This commit is contained in:
Sander Dorigo
2014-10-14 07:32:00 +02:00
7 changed files with 104 additions and 121 deletions

View File

@@ -22,9 +22,9 @@ class ProfileController extends BaseController
*/
public function index()
{
View::share('title','Profile');
View::share('subTitle',Auth::user()->email);
View::share('mainTitleIcon','fa-user');
View::share('title', 'Profile');
View::share('subTitle', Auth::user()->email);
View::share('mainTitleIcon', 'fa-user');
return View::make('profile.index');
}
@@ -33,9 +33,9 @@ class ProfileController extends BaseController
*/
public function changePassword()
{
View::share('title',Auth::user()->email);
View::share('subTitle','Change your password');
View::share('mainTitleIcon','fa-user');
View::share('title', Auth::user()->email);
View::share('subTitle', 'Change your password');
View::share('mainTitleIcon', 'fa-user');
return View::make('profile.change-password');
}

View File

@@ -175,12 +175,6 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
return $messageBag;
}
if ($recurringTransaction->date < Carbon::now()) {
$messageBag->add('date', 'Must be in the future.');
return $messageBag;
}
if ($recurringTransaction->validate()) {
$recurringTransaction->save();
} else {

View File

@@ -33,46 +33,9 @@ class EloquentJournalTrigger
/** @var \RecurringTransaction $recurring */
foreach ($set as $recurring) {
$matches = explode(' ', $recurring->match);
/*
* Count the number of matches.
*/
$count = 0;
foreach ($matches as $word) {
if (!(strpos($description, strtolower($word)) === false)) {
$count++;
\Log::debug('Recurring transaction #' . $recurring->id . ': word "' . $word . '" found in "' . $description . '".');
}
}
/*
* Check the amount if match on words:
*/
$amount = max(floatval($journal->transactions[0]->amount), floatval($journal->transactions[1]->amount));
$min = floatval($recurring->amount_min);
$max = floatval($recurring->amount_max);
if ($amount >= $min && $amount <= $max) {
$result[$recurring->id] = $count;
}
\Event::fire('recurring.rescan', [$recurring, $journal]);
}
/*
* The one with the highest value is the winrar!
*/
$index = array_search(max($result), $result);
/*
* Find the recurring transaction:
*/
if ($result[$index] > 0 && $index > 0) {
$winner = $journal->user()->first()->recurringtransactions()->find($index);
if ($winner) {
$journal->recurringTransaction()->associate($winner);
$journal->save();
}
}
return true;
}

View File

@@ -41,21 +41,37 @@ class EloquentRecurringTrigger
$wordMatch = false;
$matches = explode(' ', $recurring->match);
$description = strtolower($journal->description);
$count = 0;
/*
* Attach expense account to description for more narrow matching.
*/
$transactions = $journal->transactions()->get();
/** @var \Transaction $transaction */
foreach ($transactions as $transaction) {
/** @var \Account $account */
$account = $transaction->account()->first();
/** @var \AccountType $type */
$type = $account->accountType()->first();
if ($type->type == 'Expense account' || $type->type == 'Beneficiary account') {
$description .= ' ' . strtolower($account->name);
}
}
$count = 0;
foreach ($matches as $word) {
if (!(strpos($description, strtolower($word)) === false)) {
$count++;
}
}
if ($count > 0) {
if ($count >= count($matches)) {
$wordMatch = true;
}
/*
* Match amount.
*/
$transactions = $journal->transactions()->get();
$amountMatch = false;
$amountMatch = false;
if (count($transactions) > 1) {
$amount = max(floatval($transactions[0]->amount), floatval($transactions[1]->amount));
@@ -73,6 +89,7 @@ class EloquentRecurringTrigger
$journal->recurringTransaction()->associate($recurring);
$journal->save();
}
}
/**

View File

@@ -1,43 +1,41 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="text-info">
Use this extremely obvious form to change your password.
</p>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-12">
{{Form::open(['class' => 'form-horizontal'])}}
<div class="form-group">
<label for="inputOldPassword" class="col-sm-4 control-label">Old password</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="inputOldPassword" placeholder="Old password" name="old">
</div>
<div class="panel panel-primary">
<div class="panel-heading">
Change your password
</div>
<div class="panel-body">
{{Form::open(['class' => 'form-horizontal'])}}
<div class="form-group">
<label for="inputOldPassword" class="col-sm-4 control-label">Old password</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="inputOldPassword" placeholder="Old password" name="old">
</div>
</div>
<div class="form-group">
<label for="inputNewPassword1" class="col-sm-4 control-label">New password</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="inputNewPassword1" placeholder="New password" name="new1">
</div>
</div>
<div class="form-group">
<label for="inputNewPassword1" class="col-sm-4 control-label">New password</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="inputNewPassword1" placeholder="New password" name="new1">
</div>
</div>
<div class="form-group">
<label for="inputNewPassword2" class="col-sm-4 control-label">New password (again)</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="inputNewPassword2" placeholder="New password (again)" name="new2">
</div>
<div class="form-group">
<label for="inputNewPassword2" class="col-sm-4 control-label">New password (again)</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="inputNewPassword2" placeholder="New password (again)" name="new2">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-10">
<button type="submit" class="btn btn-success">Change your password</button>
</div>
</div>
{{Form::close()}}
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-10">
<button type="submit" class="btn btn-success">Change your password</button>
</div>
</div>
{{Form::close()}}
</div>
</div>
</div>
@stop

View File

@@ -1,8 +1,15 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="lead"><a href="{{route('change-password')}}">Change your password</a></p>
<div class="col-lg-6 col-md-12 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
Options
</div>
<div class="panel-body">
<a href="{{route('change-password')}}">Change your password</a>
</div>
</div>
</div>
</div>
@stop

View File

@@ -212,41 +212,45 @@ $(function () {
});
$.getJSON('chart/home/recurring').success(function (data) {
$('#recurring').highcharts({
title: {
text: null
},
credits: {
enabled: false
},
tooltip: {
formatter: function () {
if (this.point.objType == 'paid') {
return this.key + ': \u20AC ' + Highcharts.numberFormat(this.y, 2);
} else {
return this.key + ': ~\u20AC ' + Highcharts.numberFormat(this.y, 2);
}
}
},
plotOptions: {
pie: {
events: {
click: function (e) {
if (e.point.url != null) {
window.location = e.point.url;
}
if (data[0].data.length == 0) {
$('#recurring').parent().parent().remove();
} else {
$('#recurring').highcharts({
title: {
text: null
},
credits: {
enabled: false
},
tooltip: {
formatter: function () {
if (this.point.objType == 'paid') {
return this.key + ': \u20AC ' + Highcharts.numberFormat(this.y, 2);
} else {
return this.key + ': ~\u20AC ' + Highcharts.numberFormat(this.y, 2);
}
},
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
}
}
},
series: data
});
},
plotOptions: {
pie: {
events: {
click: function (e) {
if (e.point.url != null) {
window.location = e.point.url;
}
}
},
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
}
}
},
series: data
});
}
});
});