Code cleanup.

This commit is contained in:
James Cole
2015-07-26 15:51:07 +02:00
parent 0e2419d61a
commit 17a8c4918c
30 changed files with 176 additions and 172 deletions

View File

@@ -124,7 +124,7 @@ class AttachmentController extends Controller
*/
public function preview(Attachment $attachment)
{
if($attachment->mime == 'application/pdf') {
if ($attachment->mime == 'application/pdf') {
$file = public_path('images/page_white_acrobat.png');
} else {
$file = public_path('images/page_green.png');

View File

@@ -6,7 +6,6 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Preferences;
use Session;
use View;
/**

View File

@@ -1,5 +1,6 @@
<?php namespace FireflyIII\Http\Controllers;
use Artisan;
use Auth;
use Carbon\Carbon;
use Config;
@@ -11,7 +12,7 @@ use Preferences;
use Route;
use Session;
use Steam;
use Artisan;
/**
* Class HomeController
*

View File

@@ -193,7 +193,6 @@ Route::group(
Route::post('/accounts/destroy/{account}', ['uses' => 'AccountController@destroy', 'as' => 'accounts.destroy']);
/**
* Attachment Controller
*/

View File

@@ -38,7 +38,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereRemindMe($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminderSkip($value)
* @property-read \FireflyIII\Models\PiggyBankRepetition $currentRep
* @property string $reminder
* @property string $reminder
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminder($value)
*/
class PiggyBank extends Model

View File

@@ -68,7 +68,7 @@ use Watson\Validating\ValidatingTrait;
* @property-read int $account_id
* @property-read string $name
* @property-read string $symbol
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
*/
class TransactionJournal extends Model
{

View File

@@ -12,6 +12,21 @@ use FireflyIII\Models\Attachment;
class AttachmentRepository implements AttachmentRepositoryInterface
{
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment)
{
/** @var \FireflyIII\Helpers\Attachments\AttachmentHelperInterface $helper */
$helper = app('FireflyIII\Helpers\Attachments\AttachmentHelperInterface');
$file = $helper->getAttachmentLocation($attachment);
unlink($file);
$attachment->delete();
}
/**
* @param Attachment $attachment
* @param array $data
@@ -29,19 +44,4 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return $attachment;
}
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment)
{
/** @var \FireflyIII\Helpers\Attachments\AttachmentHelperInterface $helper */
$helper = app('FireflyIII\Helpers\Attachments\AttachmentHelperInterface');
$file = $helper->getAttachmentLocation($attachment);
unlink($file);
$attachment->delete();
}
}

View File

@@ -12,6 +12,13 @@ use FireflyIII\Models\Attachment;
interface AttachmentRepositoryInterface
{
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment);
/**
* @param Attachment $attachment
* @param array $attachmentData
@@ -19,12 +26,5 @@ interface AttachmentRepositoryInterface
* @return Attachment
*/
public function update(Attachment $attachment, array $attachmentData);
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment);
}

View File

@@ -96,7 +96,7 @@ class Steam
*
* @return int
*/
public function phpBytes($string)
public function phpBytes($string)
{
$string = strtolower($string);

View File

@@ -33,10 +33,10 @@ use Zizaco\Entrust\Traits\EntrustUserTrait;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User wherePassword($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereReset($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereRememberToken($value)
* @property boolean $blocked
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property boolean $blocked
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereBlocked($value)
* @property string $blocked_code
* @property string $blocked_code
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereBlockedCode($value)
*/
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
@@ -49,7 +49,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
*
* @var array
*/
protected $fillable = ['email', 'password','blocked','blocked_code'];
protected $fillable = ['email', 'password', 'blocked', 'blocked_code'];
/**
* The attributes excluded from the model's JSON form.
*

View File

@@ -145,12 +145,12 @@ return [
'ExpandedForm' => [
'is_safe' => [
'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',
'multiRadio','file','multiCheckbox','staticText'
'multiRadio', 'file', 'multiCheckbox', 'staticText'
]
],
'Form' => [
'is_safe' => [
'input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea','file'
'input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea', 'file'
]
],
],

View File

@@ -8,6 +8,16 @@ use Illuminate\Database\Schema\Blueprint;
*/
class ChangesForV349 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
/**
* Run the migrations.
*
@@ -22,14 +32,4 @@ class ChangesForV349 extends Migration
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@@ -8,6 +8,17 @@ use Illuminate\Database\Schema\Blueprint;
*/
class ChangesForV3410 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('attachments');
}
/**
* Run the migrations.
*
@@ -42,16 +53,4 @@ class ChangesForV3410 extends Migration
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('attachments');
}
}

View File

@@ -2,102 +2,102 @@
return [
// new user:
'bank_name' => 'Bank name',
'bank_balance' => 'Balance',
'savings_balance' => 'Savings balance',
'credit_card_limit' => 'Credit card limit',
'bank_name' => 'Bank name',
'bank_balance' => 'Balance',
'savings_balance' => 'Savings balance',
'credit_card_limit' => 'Credit card limit',
'name' => 'Name',
'active' => 'Active',
'amount_min' => 'Minimum amount',
'amount_max' => 'Maximum amount',
'match' => 'Matches on',
'repeat_freq' => 'Repeats',
'account_from_id' => 'From account',
'account_to_id' => 'To account',
'account_id' => 'Asset account',
'budget_id' => 'Budget',
'openingBalance' => 'Opening balance',
'tagMode' => 'Tag mode',
'tagPosition' => 'Tag location',
'virtualBalance' => 'Virtual balance',
'longitude_latitude' => 'Location',
'targetamount' => 'Target amount',
'accountRole' => 'Account role',
'openingBalanceDate' => 'Opening balance date',
'ccType' => 'Credit card payment plan',
'ccMonthlyPaymentDate' => 'Credit card monthly payment date',
'piggy_bank_id' => 'Piggy bank',
'returnHere' => 'Return here',
'returnHereExplanation' => 'After storing, return here to create another one.',
'returnHereUpdateExplanation' => 'After updating, return here.',
'description' => 'Description',
'expense_account' => 'Expense account',
'revenue_account' => 'Revenue account',
'amount' => 'Amount',
'date' => 'Date',
'category' => 'Category',
'tags' => 'Tags',
'deletePermanently' => 'Delete permanently',
'cancel' => 'Cancel',
'targetdate' => 'Target date',
'tag' => 'Tag',
'under' => 'Under',
'symbol' => 'Symbol',
'code' => 'Code',
'iban' => 'IBAN',
'csv' => 'CSV file',
'has_headers' => 'Headers',
'date_format' => 'Date format',
'csv_config' => 'CSV import configuration',
'specifix' => 'Bank- or file specific fixes',
'csv_import_account' => 'Default import account',
'attachments[]' => 'Attachments',
'store_new_withdrawal' => 'Store new withdrawal',
'store_new_deposit' => 'Store new deposit',
'store_new_transfer' => 'Store new transfer',
'add_new_withdrawal' => 'Add a new withdrawal',
'add_new_deposit' => 'Add a new deposit',
'add_new_transfer' => 'Add a new transfer',
'noPiggybank' => '(no piggy bank)',
'noBudget' => '(no budget)',
'title' => 'Title',
'notes' => 'Notes',
'filename' => 'File name',
'mime' => 'Mime type',
'size' => 'Size',
'name' => 'Name',
'active' => 'Active',
'amount_min' => 'Minimum amount',
'amount_max' => 'Maximum amount',
'match' => 'Matches on',
'repeat_freq' => 'Repeats',
'account_from_id' => 'From account',
'account_to_id' => 'To account',
'account_id' => 'Asset account',
'budget_id' => 'Budget',
'openingBalance' => 'Opening balance',
'tagMode' => 'Tag mode',
'tagPosition' => 'Tag location',
'virtualBalance' => 'Virtual balance',
'longitude_latitude' => 'Location',
'targetamount' => 'Target amount',
'accountRole' => 'Account role',
'openingBalanceDate' => 'Opening balance date',
'ccType' => 'Credit card payment plan',
'ccMonthlyPaymentDate' => 'Credit card monthly payment date',
'piggy_bank_id' => 'Piggy bank',
'returnHere' => 'Return here',
'returnHereExplanation' => 'After storing, return here to create another one.',
'returnHereUpdateExplanation' => 'After updating, return here.',
'description' => 'Description',
'expense_account' => 'Expense account',
'revenue_account' => 'Revenue account',
'amount' => 'Amount',
'date' => 'Date',
'category' => 'Category',
'tags' => 'Tags',
'deletePermanently' => 'Delete permanently',
'cancel' => 'Cancel',
'targetdate' => 'Target date',
'tag' => 'Tag',
'under' => 'Under',
'symbol' => 'Symbol',
'code' => 'Code',
'iban' => 'IBAN',
'csv' => 'CSV file',
'has_headers' => 'Headers',
'date_format' => 'Date format',
'csv_config' => 'CSV import configuration',
'specifix' => 'Bank- or file specific fixes',
'csv_import_account' => 'Default import account',
'attachments[]' => 'Attachments',
'store_new_withdrawal' => 'Store new withdrawal',
'store_new_deposit' => 'Store new deposit',
'store_new_transfer' => 'Store new transfer',
'add_new_withdrawal' => 'Add a new withdrawal',
'add_new_deposit' => 'Add a new deposit',
'add_new_transfer' => 'Add a new transfer',
'noPiggybank' => '(no piggy bank)',
'noBudget' => '(no budget)',
'title' => 'Title',
'notes' => 'Notes',
'filename' => 'File name',
'mime' => 'Mime type',
'size' => 'Size',
'delete_account' => 'Delete account ":name"',
'delete_bill' => 'Delete bill ":name"',
'delete_budget' => 'Delete budget ":name"',
'delete_category' => 'Delete category ":name"',
'delete_currency' => 'Delete currency ":name"',
'delete_piggyBank' => 'Delete piggy bank ":name"',
'delete_journal' => 'Delete transaction with description ":description"',
'delete_attachment' => 'Delete attachment ":name"',
'delete_account' => 'Delete account ":name"',
'delete_bill' => 'Delete bill ":name"',
'delete_budget' => 'Delete budget ":name"',
'delete_category' => 'Delete category ":name"',
'delete_currency' => 'Delete currency ":name"',
'delete_piggyBank' => 'Delete piggy bank ":name"',
'delete_journal' => 'Delete transaction with description ":description"',
'delete_attachment' => 'Delete attachment ":name"',
'attachment_areYouSure' => 'Are you sure you want to delete the attachment named ":name"?',
'account_areYouSure' => 'Are you sure you want to delete the account named ":name"?',
'bill_areYouSure' => 'Are you sure you want to delete the bill named ":name"?',
'budget_areYouSure' => 'Are you sure you want to delete the budget named ":name"?',
'category_areYouSure' => 'Are you sure you want to delete the category named ":name"?',
'currency_areYouSure' => 'Are you sure you want to delete the currency named ":name"?',
'piggyBank_areYouSure' => 'Are you sure you want to delete the piggy bank named ":name"?',
'journal_areYouSure' => 'Are you sure you want to delete the transaction described ":description"?',
'tag_areYouSure' => 'Are you sure you want to delete the tag ":tag"?',
'attachment_areYouSure' => 'Are you sure you want to delete the attachment named ":name"?',
'account_areYouSure' => 'Are you sure you want to delete the account named ":name"?',
'bill_areYouSure' => 'Are you sure you want to delete the bill named ":name"?',
'budget_areYouSure' => 'Are you sure you want to delete the budget named ":name"?',
'category_areYouSure' => 'Are you sure you want to delete the category named ":name"?',
'currency_areYouSure' => 'Are you sure you want to delete the currency named ":name"?',
'piggyBank_areYouSure' => 'Are you sure you want to delete the piggy bank named ":name"?',
'journal_areYouSure' => 'Are you sure you want to delete the transaction described ":description"?',
'tag_areYouSure' => 'Are you sure you want to delete the tag ":tag"?',
'permDeleteWarning' => 'Deleting stuff from Firely is permanent and cannot be undone.',
'also_delete_transactions' => 'The only transaction connected to this account will be deleted as well.' .
'|All :count transactions connected to this account will be deleted as well.',
'also_delete_piggyBanks' => 'The only piggy bank connected to this account will be deleted as well.' .
'|All :count piggy bank connected to this account will be deleted as well.',
'bill_keep_transactions' => 'The only transaction connected to this bill will not be deleted.' .
'|All :count transactions connected to this bill will spared deletion.',
'budget_keep_transactions' => 'The only transaction connected to this budget will not be deleted.' .
'|All :count transactions connected to this budget will spared deletion.',
'category_keep_transactions' => 'The only transaction connected to this category will not be deleted.' .
'|All :count transactions connected to this category will spared deletion.',
'tag_keep_transactions' => 'The only transaction connected to this tag will not be deleted.' .
'|All :count transactions connected to this tag will spared deletion.',
'permDeleteWarning' => 'Deleting stuff from Firely is permanent and cannot be undone.',
'also_delete_transactions' => 'The only transaction connected to this account will be deleted as well.' .
'|All :count transactions connected to this account will be deleted as well.',
'also_delete_piggyBanks' => 'The only piggy bank connected to this account will be deleted as well.' .
'|All :count piggy bank connected to this account will be deleted as well.',
'bill_keep_transactions' => 'The only transaction connected to this bill will not be deleted.' .
'|All :count transactions connected to this bill will spared deletion.',
'budget_keep_transactions' => 'The only transaction connected to this budget will not be deleted.' .
'|All :count transactions connected to this budget will spared deletion.',
'category_keep_transactions' => 'The only transaction connected to this category will not be deleted.' .
'|All :count transactions connected to this category will spared deletion.',
'tag_keep_transactions' => 'The only transaction connected to this tag will not be deleted.' .
'|All :count transactions connected to this tag will spared deletion.',
];

View File

@@ -30,9 +30,11 @@
{{ Lang.choice('form.also_delete_piggyBanks', account.piggyBanks|length, {count: account.piggyBanks|length}) }}
{% endif %}
</p>
<p class="text-success">
{{ 'save_transactions_by_moving'|_ }}
</p>
<p>
{{ Form.select('move_account_before_delete', accountList, null, {class: 'form-control'}) }}
</p>

View File

@@ -25,7 +25,7 @@
</div>
<div class="box-body">
{% if Config.get('firefly.chart') == 'google' %}
<div id="overview-chart"></div>
<div id="overview-chart"></div>
{% endif %}
{% if Config.get('firefly.chart') == 'chartjs' %}
<canvas id="overview-chart" style="width:100%;height:400px;"></canvas>

View File

@@ -55,6 +55,5 @@
</div>
</form>
{% endblock %}

View File

@@ -18,8 +18,8 @@
<div class="register-box-body">
<p class="login-box-msg">Register a new account</p>
{% if host == 'geld.nder.be' %}
<p class="text-info login-box-msg">Please note that an account on this site will only
work for one (1) week.</p>
<p class="text-info login-box-msg">Please note that an account on this site will only
work for one (1) week.</p>
{% endif %}
<form role="form" id="register" method="POST" action="{{ URL.to('/auth/register') }}">

View File

@@ -44,9 +44,9 @@
{% if journals|length > 0 %}
<ul>
{% for journal in journals %}
<li>#{{ journal.id }}: <a href="{{ route('transactions.show', [journal.id]) }}">{{ journal.description }}</a></li>
{% endfor %}
{% for journal in journals %}
<li>#{{ journal.id }}: <a href="{{ route('transactions.show', [journal.id]) }}">{{ journal.description }}</a></li>
{% endfor %}
</ul>
{% endif %}

View File

@@ -54,6 +54,7 @@
}
}
</script>
</body>

View File

@@ -42,8 +42,8 @@
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;

View File

@@ -1,12 +1,14 @@
<div class="popover" role="tooltip">
<div class="arrow"></div>
<h3 class="popover-title"></h3>
<div class="popover-content"></div>
<div class="popover-navigation">
<div class="btn-group">
<button class="btn btn-sm btn-default" data-role="prev">&laquo; {{ 'prev'|_ }}</button>
<button class="btn btn-sm btn-default" data-role="next">{{ 'prev'|_ }} &raquo;</button>
<button class="btn btn-sm btn-default" data-role="pause-resume" data-pause-text="{{ 'pause'|_ }}" data-resume-text="Resume"> {{ 'pause'|_ }}</button>
<button class="btn btn-sm btn-default" data-role="pause-resume" data-pause-text="{{ 'pause'|_ }}"
data-resume-text="Resume"> {{ 'pause'|_ }}</button>
</div>
<button class="btn btn-sm btn-default" data-role="end">{{ 'end-tour'|_ }}</button>
</div>

View File

@@ -191,8 +191,8 @@
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;

View File

@@ -51,8 +51,8 @@
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;

View File

@@ -52,8 +52,8 @@
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;

View File

@@ -53,7 +53,8 @@
<td>
<a href="{{ route('transactions.show',journal.id) }}" title="{{ journal.description }}">{{ journal.description }}</a>
{% if journal.attachments|length > 0 %}
<i class="fa fa-paperclip pull-right" title="{{ Lang.choice('firefly.nr_of_attachments', journal.attachments|length, {count: journal.attachments|length}) }}"></i>
<i class="fa fa-paperclip pull-right"
title="{{ Lang.choice('firefly.nr_of_attachments', journal.attachments|length, {count: journal.attachments|length}) }}"></i>
{% endif %}
</td>

View File

@@ -124,9 +124,9 @@
<a class="{{ activeRoutePartial('currency') }}" href="{{ route('currency.index') }}"><i class="fa fa-usd fa-fw"></i> {{ 'currencies'|_ }}</a>
</li>
{% if Config.get('firefly.csv_import_enabled') %}
<li class="{{ activeRoutePartial('csv') }}">
<a href="{{ route('csv.index') }}"><i class="fa fa-file-text-o fa-fw"></i> {{ 'csv_import'|_ }}</a>
</li>
<li class="{{ activeRoutePartial('csv') }}">
<a href="{{ route('csv.index') }}"><i class="fa fa-file-text-o fa-fw"></i> {{ 'csv_import'|_ }}</a>
</li>
{% endif %}
</ul>

View File

@@ -16,6 +16,7 @@
<p class="text-danger">
{{ trans('form.permDeleteWarning') }}
</p>
<p>
{{ trans('form.tag_areYouSure', {'tag': tag.tag}) }}
</p>

View File

@@ -21,7 +21,7 @@
</p>
<p>
{{'tags_group'|_ }}
{{ 'tags_group'|_ }}
</p>
<p>

View File

@@ -93,7 +93,7 @@
</td>
<td>
<i class="fa {{ att.mime|mimeIcon }}"></i>
<a href="{{ route('attachments.download', att.id) }}" tle="{{ att.filename }}">
<a href="{{ route('attachments.download', att.id) }}" tle="{{ att.filename }}">
{% if att.title %}
{{ att.title }}
{% else %}