From 17a8c4918c79008d3b1b81b62d875fe4a12df25c Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sun, 26 Jul 2015 15:51:07 +0200
Subject: [PATCH] Code cleanup.
---
app/Http/Controllers/AttachmentController.php | 2 +-
app/Http/Controllers/Controller.php | 1 -
app/Http/Controllers/HomeController.php | 3 +-
app/Http/routes.php | 1 -
app/Models/PiggyBank.php | 2 +-
app/Models/TransactionJournal.php | 2 +-
.../Attachment/AttachmentRepository.php | 30 +--
.../AttachmentRepositoryInterface.php | 14 +-
app/Support/Steam.php | 2 +-
app/User.php | 8 +-
config/twigbridge.php | 4 +-
.../2015_07_14_204645_changes_for_v349.php | 20 +-
.../2015_07_17_190438_changes_for_v3410.php | 23 ++-
resources/lang/en/form.php | 186 +++++++++---------
resources/twig/accounts/delete.twig | 2 +
resources/twig/accounts/show.twig | 2 +-
resources/twig/attachments/edit.twig | 1 -
resources/twig/auth/register.twig | 4 +-
resources/twig/csv/process.twig | 6 +-
resources/twig/emails/registered-html.twig | 1 +
resources/twig/errors/503.twig | 4 +-
resources/twig/json/tour.twig | 4 +-
resources/twig/layout/default.twig | 4 +-
resources/twig/layout/empty.twig | 4 +-
resources/twig/layout/guest.twig | 4 +-
resources/twig/list/journals.twig | 3 +-
resources/twig/partials/menu-sidebar.twig | 6 +-
resources/twig/tags/delete.twig | 1 +
resources/twig/tags/index.twig | 2 +-
resources/twig/transactions/show.twig | 2 +-
30 files changed, 176 insertions(+), 172 deletions(-)
diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php
index fe4a03b7bc..ac255e3783 100644
--- a/app/Http/Controllers/AttachmentController.php
+++ b/app/Http/Controllers/AttachmentController.php
@@ -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');
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 796da63c97..03a9a8d31c 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -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;
/**
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index b3d5f2ecf9..9b9c5bef5e 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -1,5 +1,6 @@
'AccountController@destroy', 'as' => 'accounts.destroy']);
-
/**
* Attachment Controller
*/
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index 57f7cc261b..33f6be11c4 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -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
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index b1f3d44f95..b9e7b436b3 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -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
{
diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php
index 5ae2b899fb..13f7f8f0a0 100644
--- a/app/Repositories/Attachment/AttachmentRepository.php
+++ b/app/Repositories/Attachment/AttachmentRepository.php
@@ -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();
- }
}
diff --git a/app/Repositories/Attachment/AttachmentRepositoryInterface.php b/app/Repositories/Attachment/AttachmentRepositoryInterface.php
index 9998ce9d8f..44ae352b15 100644
--- a/app/Repositories/Attachment/AttachmentRepositoryInterface.php
+++ b/app/Repositories/Attachment/AttachmentRepositoryInterface.php
@@ -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);
}
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index 4f49117f7b..02a89deccd 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -96,7 +96,7 @@ class Steam
*
* @return int
*/
- public function phpBytes($string)
+ public function phpBytes($string)
{
$string = strtolower($string);
diff --git a/app/User.php b/app/User.php
index 1a5b93ffbb..2fd0ae8fdf 100644
--- a/app/User.php
+++ b/app/User.php
@@ -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.
*
diff --git a/config/twigbridge.php b/config/twigbridge.php
index ee32836a9e..04826b5504 100644
--- a/config/twigbridge.php
+++ b/config/twigbridge.php
@@ -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'
]
],
],
diff --git a/database/migrations/2015_07_14_204645_changes_for_v349.php b/database/migrations/2015_07_14_204645_changes_for_v349.php
index 2cd99ab8c4..3f2538c339 100644
--- a/database/migrations/2015_07_14_204645_changes_for_v349.php
+++ b/database/migrations/2015_07_14_204645_changes_for_v349.php
@@ -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()
- {
- //
- }
}
diff --git a/database/migrations/2015_07_17_190438_changes_for_v3410.php b/database/migrations/2015_07_17_190438_changes_for_v3410.php
index 33aafe2a19..c8e64213d9 100644
--- a/database/migrations/2015_07_17_190438_changes_for_v3410.php
+++ b/database/migrations/2015_07_17_190438_changes_for_v3410.php
@@ -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');
-
- }
}
diff --git a/resources/lang/en/form.php b/resources/lang/en/form.php
index b25407d9f9..37a0df20a1 100644
--- a/resources/lang/en/form.php
+++ b/resources/lang/en/form.php
@@ -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.',
];
diff --git a/resources/twig/accounts/delete.twig b/resources/twig/accounts/delete.twig
index a3ccf25444..81b16c4b4b 100644
--- a/resources/twig/accounts/delete.twig
+++ b/resources/twig/accounts/delete.twig
@@ -30,9 +30,11 @@
{{ Lang.choice('form.also_delete_piggyBanks', account.piggyBanks|length, {count: account.piggyBanks|length}) }}
{% endif %}
+
{{ 'save_transactions_by_moving'|_ }}
+
{{ Form.select('move_account_before_delete', accountList, null, {class: 'form-control'}) }}
diff --git a/resources/twig/accounts/show.twig b/resources/twig/accounts/show.twig
index b61f7ccce7..278701207e 100644
--- a/resources/twig/accounts/show.twig
+++ b/resources/twig/accounts/show.twig
@@ -25,7 +25,7 @@
{% if Config.get('firefly.chart') == 'google' %}
-
+
{% endif %}
{% if Config.get('firefly.chart') == 'chartjs' %}
diff --git a/resources/twig/attachments/edit.twig b/resources/twig/attachments/edit.twig
index 515168b2ab..9ca2c1139f 100644
--- a/resources/twig/attachments/edit.twig
+++ b/resources/twig/attachments/edit.twig
@@ -55,6 +55,5 @@
-
{% endblock %}
diff --git a/resources/twig/auth/register.twig b/resources/twig/auth/register.twig
index 98e69fa60d..1855e5f248 100644
--- a/resources/twig/auth/register.twig
+++ b/resources/twig/auth/register.twig
@@ -18,8 +18,8 @@
Register a new account
{% if host == 'geld.nder.be' %}
-
Please note that an account on this site will only
- work for one (1) week.
+
Please note that an account on this site will only
+ work for one (1) week.
{% endif %}