Various code cleanup.

This commit is contained in:
James Cole 2017-12-29 09:05:35 +01:00
parent cf66ae61e1
commit 3815f9836f
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
135 changed files with 1021 additions and 973 deletions

View File

@ -150,7 +150,9 @@ class CreateImport extends Command
$this->error(sprintf('Error importing line #%d: %s', $index, $error));
}
$this->line(
sprintf('The import has finished. %d transactions have been imported out of %d records.', $routine->getJournals()->count(), $routine->lines)
sprintf(
'The import has finished. %d transactions have been imported out of %d records.', $routine->getJournals()->count(), $routine->getLines()
)
);
}

View File

@ -98,11 +98,13 @@ class Import extends Command
$routine->run();
/** @var MessageBag $error */
foreach ($routine->errors as $index => $error) {
foreach ($routine->getErrors() as $index => $error) {
$this->error(sprintf('Error importing line #%d: %s', $index, $error));
}
$this->line(sprintf('The import has finished. %d transactions have been imported out of %d records.', $routine->journals->count(), $routine->lines));
$this->line(
sprintf('The import has finished. %d transactions have been imported out of %d records.', $routine->getJournals()->count(), $routine->getLines())
);
return;
}

View File

@ -203,7 +203,7 @@ final class Entry
$entry->description = $transaction->transaction_description . '(' . $transaction->description . ')';
}
$entry->currency_code = $transaction->transactionCurrency->code;
$entry->amount = round($transaction->transaction_amount, $transaction->transactionCurrency->decimal_places);
$entry->amount = strval(round($transaction->transaction_amount, $transaction->transactionCurrency->decimal_places));
$entry->foreign_currency_code = null === $transaction->foreign_currency_id ? null : $transaction->foreignCurrency->code;
$entry->foreign_amount = null === $transaction->foreign_currency_id
@ -216,14 +216,14 @@ final class Entry
);
$entry->transaction_type = $transaction->transaction_type_type;
$entry->asset_account_id = $transaction->account_id;
$entry->asset_account_id = strval($transaction->account_id);
$entry->asset_account_name = app('steam')->tryDecrypt($transaction->account_name);
$entry->asset_account_iban = $transaction->account_iban;
$entry->asset_account_number = $transaction->account_number;
$entry->asset_account_bic = $transaction->account_bic;
$entry->asset_currency_code = $transaction->account_currency_code;
$entry->opposing_account_id = $transaction->opposing_account_id;
$entry->opposing_account_id = strval($transaction->opposing_account_id);
$entry->opposing_account_name = app('steam')->tryDecrypt($transaction->opposing_account_name);
$entry->opposing_account_iban = $transaction->opposing_account_iban;
$entry->opposing_account_number = $transaction->opposing_account_number;
@ -231,7 +231,7 @@ final class Entry
$entry->opposing_currency_code = $transaction->opposing_currency_code;
// budget
$entry->budget_id = $transaction->transaction_budget_id;
$entry->budget_id = strval($transaction->transaction_budget_id);
$entry->budget_name = app('steam')->tryDecrypt($transaction->transaction_budget_name);
if (null === $transaction->transaction_budget_id) {
$entry->budget_id = $transaction->transaction_journal_budget_id;
@ -239,7 +239,7 @@ final class Entry
}
// category
$entry->category_id = $transaction->transaction_category_id;
$entry->category_id = strval($transaction->transaction_category_id);
$entry->category_name = app('steam')->tryDecrypt($transaction->transaction_category_name);
if (null === $transaction->transaction_category_id) {
$entry->category_id = $transaction->transaction_journal_category_id;
@ -247,7 +247,7 @@ final class Entry
}
// budget
$entry->bill_id = $transaction->bill_id;
$entry->bill_id = strval($transaction->bill_id);
$entry->bill_name = app('steam')->tryDecrypt($transaction->bill_name);
$entry->tags = $transaction->tags;

View File

@ -24,8 +24,6 @@ namespace FireflyIII\Export\Exporter;
use FireflyIII\Export\Entry\Entry;
use League\Csv\Writer;
use SplFileObject;
use SplTempFileObject;
use Storage;
/**
@ -66,11 +64,8 @@ class CsvExporter extends BasicExporter implements ExporterInterface
$fullPath = storage_path('export') . DIRECTORY_SEPARATOR . $this->fileName;
//we create the CSV into memory
//$writer = Writer::createFromFileObject(new SplTempFileObject());
$writer = Writer::createFromPath($fullPath);
//$writer = Writer::createFromPath(new SplFileObject($fullPath, 'a+'), 'w');
$rows = [];
// get field names for header row:
@ -91,8 +86,6 @@ class CsvExporter extends BasicExporter implements ExporterInterface
$rows[] = $line;
}
$writer->insertAll($rows);
//$writer->output($fullPath);
//$writer->
return true;
}

View File

@ -65,6 +65,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
/**
* @return string
* @throws \Throwable
*/
public function generate(): string
{

View File

@ -76,6 +76,7 @@ class UserEventHandler
{
Log::debug('In checkSingleUserIsAdmin');
/** @var User $user */
$user = $event->user;
$count = User::count();

View File

@ -26,7 +26,6 @@ namespace FireflyIII\Handlers\Events;
use FireflyConfig;
use FireflyIII\Events\RequestedVersionCheckStatus;
use FireflyIII\User;
use Illuminate\Auth\Events\Login;
use Log;
/**

View File

@ -101,13 +101,12 @@ class AccountController extends Controller
}
/**
* @param Request $request
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return View
*/
public function delete(Request $request, AccountRepositoryInterface $repository, Account $account)
public function delete(AccountRepositoryInterface $repository, Account $account)
{
$typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type);
$subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);

View File

@ -102,13 +102,14 @@ class UpdateController extends Controller
/** @var UpdateRequest $request */
$request = app(UpdateRequest::class);
$check = -2;
$first = new Release(['id' => '0', 'title' => '0', 'updated' => '2017-01-01', 'content' => '']);
$string = '';
try {
$request->call();
$releases = $request->getReleases();
// first entry should be the latest entry:
/** @var Release $first */
$first = reset($releases);
$string = '';
$check = version_compare($current, $first->getTitle());
FireflyConfig::set('last_update_check', time());
} catch (FireflyException $e) {
@ -120,7 +121,12 @@ class UpdateController extends Controller
if ($check === -1) {
// there is a new FF version!
$string = strval(trans('firefly.update_new_version_alert', ['your_version' => $current, 'new_version' => $first->getTitle(), 'date' => $first->getUpdated()->formatLocalized($this->monthAndDayFormat)]));
$string = strval(
trans(
'firefly.update_new_version_alert',
['your_version' => $current, 'new_version' => $first->getTitle(), 'date' => $first->getUpdated()->formatLocalized($this->monthAndDayFormat)]
)
);
}
if ($check === 0) {
// you are running the current version!

View File

@ -59,12 +59,11 @@ class AttachmentController extends Controller
}
/**
* @param Request $request
* @param Attachment $attachment
*
* @return View
*/
public function delete(Request $request, Attachment $attachment)
public function delete(Attachment $attachment)
{
$subTitle = trans('firefly.delete_attachment', ['name' => $attachment->filename]);

View File

@ -64,7 +64,7 @@ class LoginController extends Controller
*
* @param Request $request
*
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response|void
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response
*
* @throws \Illuminate\Validation\ValidationException
*/
@ -102,7 +102,7 @@ class LoginController extends Controller
* @param Request $request
* @param CookieJar $cookieJar
*
* @return $this
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function logout(Request $request, CookieJar $cookieJar)
{

View File

@ -91,12 +91,11 @@ class BillController extends Controller
}
/**
* @param Request $request
* @param Bill $bill
*
* @return View
*/
public function delete(Request $request, Bill $bill)
public function delete(Bill $bill)
{
// put previous url in session
$this->rememberPreviousUri('bills.delete.uri');

View File

@ -118,12 +118,11 @@ class BudgetController extends Controller
}
/**
* @param Request $request
* @param Budget $budget
*
* @return View
*/
public function delete(Request $request, Budget $budget)
public function delete(Budget $budget)
{
$subTitle = trans('firefly.delete_budget', ['name' => $budget->name]);

View File

@ -80,12 +80,11 @@ class CategoryController extends Controller
}
/**
* @param Request $request
* @param Category $category
*
* @return View
*/
public function delete(Request $request, Category $category)
public function delete(Category $category)
{
$subTitle = trans('firefly.delete_category', ['name' => $category->name]);

View File

@ -25,6 +25,7 @@ namespace FireflyIII\Http\Controllers;
use Artisan;
use Carbon\Carbon;
use DB;
use Exception;
use FireflyIII\Events\RequestedVersionCheckStatus;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@ -39,7 +40,6 @@ use Illuminate\Support\Collection;
use Log;
use Monolog\Handler\RotatingFileHandler;
use Preferences;
use ReflectionException;
use Response;
use Route as RouteFacade;
use View;
@ -186,7 +186,7 @@ class HomeController extends Controller
Log::debug('Call twig:clean...');
try {
Artisan::call('twig:clean');
} catch (ReflectionException $e) {
} catch (Exception $e) {
// dont care
}
Log::debug('Call view:clear...');

View File

@ -60,7 +60,7 @@ class PrerequisitesController extends Controller
*
* @param string $bank
*
* @return \Illuminate\Http\RedirectResponse|null
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse
*
* @throws FireflyException
*/

View File

@ -108,8 +108,6 @@ class StatusController extends Controller
$result['running'] = true;
}
// TODO cannot handle 'error'
return Response::json($result);
}
}

View File

@ -29,7 +29,6 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use Log;
use Response;
/**

View File

@ -46,6 +46,7 @@ class IntroController
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (0 === count($specificSteps)) {
Log::debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
return Response::json($steps);
}
if ($this->hasOutroStep($route)) {

View File

@ -26,8 +26,8 @@ use FireflyIII\Http\Requests\TokenFormRequest;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Http\Request;
use Google2FA;
use Illuminate\Http\Request;
use Preferences;
use Session;
use View;

View File

@ -231,7 +231,7 @@ class ExpenseController extends Controller
$cache->addProperty($accounts->pluck('id')->toArray());
$cache->addProperty($expense->pluck('id')->toArray());
if ($cache->has()) {
//return $cache->get(); // @codeCoverageIgnore
return $cache->get(); // @codeCoverageIgnore
}
$combined = $this->combineAccounts($expense);
$all = new Collection;

View File

@ -59,12 +59,10 @@ class SplitController extends Controller
/** @var CurrencyRepositoryInterface */
private $currencies;
/** @var JournalTaskerInterface */
private $tasker;
/** @var JournalRepositoryInterface */
private $repository;
/** @var JournalTaskerInterface */
private $tasker;
/**
*

View File

@ -72,6 +72,7 @@ class CsvProcessor implements FileProcessorInterface
* @return bool
*
* @throws \League\Csv\Exception
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function run(): bool
{

View File

@ -330,6 +330,7 @@ class ImportJournal
*/
private function selectAmountInput()
{
$info = [];
$converterClass = '';
if (!is_null($this->amount)) {
Log::debug('Amount value is not NULL, assume this is the correct value.');

View File

@ -236,7 +236,6 @@ class ImportStorage
// match bills if config calls for it.
if (true === $this->matchBills) {
//$this->/applyRules($journal);
Log::info('Cannot match bills (yet).');
$this->matchBills($journal);
}

View File

@ -189,6 +189,7 @@ class Account extends Model
/**
* @codeCoverageIgnore
*
* @param string $fieldName
*
* @return string
@ -206,6 +207,7 @@ class Account extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
@ -299,6 +301,7 @@ class Account extends Model
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param array $types
*/
@ -313,6 +316,7 @@ class Account extends Model
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param string $name
* @param string $value
@ -331,7 +335,9 @@ class Account extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @codeCoverageIgnore
*/
public function setIbanAttribute($value)
@ -341,6 +347,7 @@ class Account extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setNameAttribute($value)
@ -352,7 +359,9 @@ class Account extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @codeCoverageIgnore
*/
public function setVirtualBalanceAttribute($value)

View File

@ -69,6 +69,7 @@ class AccountMeta extends Model
/**
* @param $value
*
* @codeCoverageIgnore
*/
public function setDataAttribute($value)

View File

@ -70,6 +70,7 @@ class Attachment extends Model
/**
* Get all of the owning attachable models.
*
* @codeCoverageIgnore
*
* @return MorphTo
@ -81,6 +82,7 @@ class Attachment extends Model
/**
* Returns the expected filename for this attachment.
*
* @codeCoverageIgnore
* @return string
*/
@ -91,6 +93,7 @@ class Attachment extends Model
/**
* @param $value
*
* @codeCoverageIgnore
* @return null|string
*/
@ -105,6 +108,7 @@ class Attachment extends Model
/**
* @param $value
*
* @codeCoverageIgnore
* @return null|string
*/
@ -119,6 +123,7 @@ class Attachment extends Model
/**
* @param $value
*
* @codeCoverageIgnore
* @return null|string
*/
@ -133,6 +138,7 @@ class Attachment extends Model
/**
* @param $value
*
* @codeCoverageIgnore
* @return null|string
*/
@ -147,6 +153,7 @@ class Attachment extends Model
/**
* @param $value
*
* @codeCoverageIgnore
* @return null|string
*/
@ -161,6 +168,7 @@ class Attachment extends Model
/**
* @codeCoverageIgnore
*
* @param string $value
*/
public function setDescriptionAttribute(string $value)
@ -170,6 +178,7 @@ class Attachment extends Model
/**
* @codeCoverageIgnore
*
* @param string $value
*/
public function setFilenameAttribute(string $value)
@ -179,6 +188,7 @@ class Attachment extends Model
/**
* @codeCoverageIgnore
*
* @param string $value
*/
public function setMimeAttribute(string $value)
@ -188,6 +198,7 @@ class Attachment extends Model
/**
* @codeCoverageIgnore
*
* @param string $value
*/
public function setNotesAttribute(string $value)
@ -197,6 +208,7 @@ class Attachment extends Model
/**
* @codeCoverageIgnore
*
* @param string $value
*/
public function setTitleAttribute(string $value)

View File

@ -96,6 +96,7 @@ class Bill extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
@ -111,6 +112,7 @@ class Bill extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
@ -135,6 +137,7 @@ class Bill extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setAmountMaxAttribute($value)
@ -144,6 +147,7 @@ class Bill extends Model
/**
* @param $value
*
* @codeCoverageIgnore
*/
public function setAmountMinAttribute($value)
@ -153,6 +157,7 @@ class Bill extends Model
/**
* @param $value
*
* @codeCoverageIgnore
*/
public function setMatchAttribute($value)
@ -164,6 +169,7 @@ class Bill extends Model
/**
* @param $value
*
* @codeCoverageIgnore
*/
public function setNameAttribute($value)

View File

@ -84,7 +84,7 @@ class Budget extends Model
}
/**
* @param Budget $value
* @param string $value
*
* @return Budget
*/
@ -111,6 +111,7 @@ class Budget extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
@ -126,6 +127,7 @@ class Budget extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setNameAttribute($value)

View File

@ -77,6 +77,7 @@ class BudgetLimit extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setAmountAttribute($value)

View File

@ -83,7 +83,7 @@ class Category extends Model
}
/**
* @param Category $value
* @param string $value
*
* @return Category
*/
@ -101,6 +101,7 @@ class Category extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
@ -116,6 +117,7 @@ class Category extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setNameAttribute($value)

View File

@ -49,6 +49,7 @@ class Configuration extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return mixed
@ -60,6 +61,7 @@ class Configuration extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setDataAttribute($value)

View File

@ -61,6 +61,7 @@ class ExportJob extends Model
/**
* @codeCoverageIgnore
*
* @param $status
*/
public function change($status)

View File

@ -69,7 +69,7 @@ class PiggyBank extends Model
{
if (auth()->check()) {
$piggyBankId = intval($value);
$piggyBank = PiggyBank::where('piggy_banks.id', $piggyBankId)
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*']);
if (!is_null($piggyBank)) {
@ -111,6 +111,7 @@ class PiggyBank extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
@ -196,6 +197,7 @@ class PiggyBank extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setNameAttribute($value)
@ -207,6 +209,7 @@ class PiggyBank extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setTargetamountAttribute($value)

View File

@ -62,6 +62,7 @@ class PiggyBankEvent extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setAmountAttribute($value)

View File

@ -60,6 +60,7 @@ class PiggyBankRepetition extends Model
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param Carbon $start
* @param Carbon $target
@ -73,6 +74,7 @@ class PiggyBankRepetition extends Model
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param Carbon $date
*
@ -96,6 +98,7 @@ class PiggyBankRepetition extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setCurrentamountAttribute($value)

View File

@ -80,6 +80,7 @@ class Preference extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setDataAttribute($value)

View File

@ -123,6 +123,7 @@ class Tag extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
@ -138,6 +139,7 @@ class Tag extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
@ -171,6 +173,7 @@ class Tag extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setDescriptionAttribute($value)
@ -180,6 +183,7 @@ class Tag extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setTagAttribute($value)

View File

@ -108,6 +108,7 @@ class Transaction extends Model
/**
* @codeCoverageIgnore
*
* @param Builder $query
* @param string $table
*
@ -168,6 +169,7 @@ class Transaction extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return float|int
@ -179,6 +181,7 @@ class Transaction extends Model
/**
* @codeCoverageIgnore
*
* @param Builder $query
* @param Carbon $date
*/
@ -192,6 +195,7 @@ class Transaction extends Model
/**
* @codeCoverageIgnore
*
* @param Builder $query
* @param Carbon $date
*/
@ -205,6 +209,7 @@ class Transaction extends Model
/**
* @codeCoverageIgnore
*
* @param Builder $query
* @param array $types
*/
@ -222,6 +227,7 @@ class Transaction extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setAmountAttribute($value)

View File

@ -59,7 +59,7 @@ class TransactionCurrency extends Model
{
if (auth()->check()) {
$currencyId = intval($value);
$currency = TransactionCurrency::find($currencyId);
$currency = self::find($currencyId);
if (!is_null($currency)) {
return $currency;
}

View File

@ -141,6 +141,7 @@ class TransactionJournal extends Model
/**
* @codeCoverageIgnore
*
* @param string $name
*
* @return bool
@ -163,6 +164,7 @@ class TransactionJournal extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
@ -214,6 +216,7 @@ class TransactionJournal extends Model
/**
* @codeCoverageIgnore
*
* @param string $name
*
* @return bool
@ -311,6 +314,7 @@ class TransactionJournal extends Model
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param Carbon $date
*
@ -323,6 +327,7 @@ class TransactionJournal extends Model
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param Carbon $date
*
@ -335,6 +340,7 @@ class TransactionJournal extends Model
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
*/
public function scopeSortCorrectly(EloquentBuilder $query)
@ -346,6 +352,7 @@ class TransactionJournal extends Model
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param array $types
*/
@ -361,6 +368,7 @@ class TransactionJournal extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setDescriptionAttribute($value)

View File

@ -72,6 +72,7 @@ class TransactionJournalLink extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return null|string
@ -96,6 +97,7 @@ class TransactionJournalLink extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setCommentAttribute($value): void

View File

@ -50,6 +50,7 @@ class TransactionJournalMeta extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return mixed
@ -61,6 +62,7 @@ class TransactionJournalMeta extends Model
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setDataAttribute($value)

View File

@ -26,7 +26,6 @@ use FireflyIII\Models\Account;
use FireflyIII\Models\Note;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionJournalLink;
use FireflyIII\Models\TransactionType;
use FireflyIII\User;
use Illuminate\Support\Collection;
@ -54,13 +53,6 @@ interface JournalRepositoryInterface
*/
public function countTransactions(TransactionJournal $journal): int;
/**
* @param TransactionJournal $journal
*
* @return Note|null
*/
public function getNote(TransactionJournal $journal): ?Note;
/**
* Deletes a journal.
*
@ -107,6 +99,13 @@ interface JournalRepositoryInterface
*/
public function getAssetTransaction(TransactionJournal $journal): ?Transaction;
/**
* @param TransactionJournal $journal
*
* @return Note|null
*/
public function getNote(TransactionJournal $journal): ?Note;
/**
* @return Collection
*/

View File

@ -37,20 +37,6 @@ interface UserRepositoryInterface
*/
public function all(): Collection;
/**
* Returns the first user in the DB. Generally only works when there is just one.
*
* @return null|User
*/
public function first(): ?User;
/**
* @param array $data
*
* @return User
*/
public function store(array $data): User;
/**
* Gives a user a role.
*
@ -119,6 +105,13 @@ interface UserRepositoryInterface
*/
public function findByEmail(string $email): ?User;
/**
* Returns the first user in the DB. Generally only works when there is just one.
*
* @return null|User
*/
public function first(): ?User;
/**
* Return basic user information.
*
@ -136,6 +129,13 @@ interface UserRepositoryInterface
*/
public function hasRole(User $user, string $role): bool;
/**
* @param array $data
*
* @return User
*/
public function store(array $data): User;
/**
* @param User $user
*/

View File

@ -40,8 +40,6 @@ abstract class SpectreRequest
* @var int
*/
protected $expiresAt = 0;
/** @var ServerPublicKey */
protected $serverPublicKey;
/** @var string */
protected $serviceSecret = '';
/** @var string */
@ -104,22 +102,6 @@ abstract class SpectreRequest
return $this->server;
}
/**
* @return ServerPublicKey
*/
public function getServerPublicKey(): ServerPublicKey
{
return $this->serverPublicKey;
}
/**
* @param ServerPublicKey $serverPublicKey
*/
public function setServerPublicKey(ServerPublicKey $serverPublicKey)
{
$this->serverPublicKey = $serverPublicKey;
}
/**
* @return string
*/
@ -144,14 +126,6 @@ abstract class SpectreRequest
$this->privateKey = $privateKey;
}
/**
* @param string $secret
*/
public function setSecret(string $secret)
{
$this->secret = $secret;
}
/**
* @param string $method
* @param string $uri
@ -169,8 +143,6 @@ abstract class SpectreRequest
if ('get' === strtolower($method) || 'delete' === strtolower($method)) {
$data = '';
}
// base64(sha1_signature(private_key, "Expires-at|request_method|original_url|post_body|md5_of_uploaded_file|")))
// Prepare the signature
$toSign = $this->expiresAt . '|' . strtoupper($method) . '|' . $uri . '|' . $data . ''; // no file so no content there.
Log::debug(sprintf('String to sign: "%s"', $toSign));
$signature = '';

View File

@ -202,7 +202,7 @@ class Amount
/**
* @return \FireflyIII\Models\TransactionCurrency
*
* @throws FireflyException
* @throws \FireflyIII\Exceptions\FireflyException
*/
public function getDefaultCurrency(): TransactionCurrency
{
@ -216,7 +216,7 @@ class Amount
*
* @return \FireflyIII\Models\TransactionCurrency
*
* @throws FireflyException
* @throws \FireflyIII\Exceptions\FireflyException
*/
public function getDefaultCurrencyByUser(User $user): TransactionCurrency
{

View File

@ -24,7 +24,6 @@ namespace FireflyIII\Support\Binder;
use Carbon\Carbon;
use Exception;
use FireflyIII\Helpers\FiscalHelper;
use FireflyIII\Helpers\FiscalHelperInterface;
use Illuminate\Routing\Route;
use Log;

View File

@ -25,6 +25,7 @@ namespace FireflyIII\Support;
use Amount as Amt;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use RuntimeException;
@ -36,11 +37,12 @@ use Session;
class ExpandedForm
{
/**
* @param $name
* @param string $name
* @param null $value
* @param array $options
*
* @return string
* @throws \FireflyIII\Exceptions\FireflyException
*/
public function amount(string $name, $value = null, array $options = []): string
{
@ -53,6 +55,7 @@ class ExpandedForm
* @param array $options
*
* @return string
* @throws \FireflyIII\Exceptions\FireflyException
*/
public function amountSmall(string $name, $value = null, array $options = []): string
{
@ -65,6 +68,8 @@ class ExpandedForm
* @param array $options
*
* @return string
* @throws \FireflyIII\Exceptions\FireflyException
*
*/
public function balance(string $name, $value = null, array $options = []): string
{
@ -594,8 +599,7 @@ class ExpandedForm
*
* @return string
*
* @throws \Throwable
* @throws Facades\FireflyException
* @throws \FireflyIII\Exceptions\FireflyException
*/
private function currencyField(string $name, string $view, $value = null, array $options = []): string
{

View File

@ -63,6 +63,7 @@ class BunqInformation implements InformationInterface
* @return array
*
* @throws FireflyException
* @throws \Exception
*/
public function getAccounts(): array
{

View File

@ -473,6 +473,7 @@ class Navigation
$date->subMonths($subtract);
Log::debug(sprintf('%s is in modifier map with value %d, execute subMonths with argument %d', $repeatFreq, $modifierMap[$repeatFreq], $subtract));
Log::debug(sprintf('subtractPeriod: resulting date is %s', $date->format('Y-m-d')));
return $date;
}
// a custom range requires the session start

View File

@ -29,6 +29,7 @@ use FireflyIII\Models\TransactionJournal;
* This class will be magical!
*
* Class AbstractTrigger
* @method triggered
*/
class AbstractTrigger
{
@ -43,15 +44,6 @@ class AbstractTrigger
/** @var string Trigger value */
protected $triggerValue;
/**
* AbstractTrigger constructor.
*
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Make a new trigger from the value given in the string.
*

View File

@ -340,7 +340,7 @@ class FireflyValidator extends Validator
*
* @return bool
*/
public function validateUniqueAccountNumberForUser($attribute, $value, $parameters): bool
public function validateUniqueAccountNumberForUser($attribute, $value): bool
{
$accountId = $this->data['id'] ?? 0;

View File

@ -92,7 +92,6 @@ function storeReconcile() {
transactions: ids,
cleared: cleared,
};
console.log
var uri = overviewUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val());

View File

@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: chartUri, incomeCategoryUri, expenseCategoryUri, expenseBudgetUri */
/** global: chartUri, incomeCategoryUri, expenseCategoryUri, expenseBudgetUri, token */
var fixHelper = function (e, tr) {
"use strict";

View File

@ -18,6 +18,8 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: updateCheckUri */
$(function () {
"use strict";

View File

@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: infoIncomeUri, spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */
/** global: infoIncomeUri, token, spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */
/**
*
*/

View File

@ -35,8 +35,7 @@ function formatLabel(str, maxwidth){
var temp = "";
words.forEach(function (item, index) {
if(temp.length > 0)
{
if (temp.length > 0) {
var concat = temp + ' ' + item;
if (concat.length > maxwidth) {
@ -44,8 +43,7 @@ function formatLabel(str, maxwidth){
temp = "";
}
else {
if(index === (words.length-1))
{
if (index === (words.length - 1)) {
sections.push(concat);
return;
}
@ -56,8 +54,7 @@ function formatLabel(str, maxwidth){
}
}
if(index === (words.length-1))
{
if (index === (words.length - 1)) {
sections.push(item);
return;
}

View File

@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: token */
$(function () {
"use strict";
$('#help').click(showHelp);

View File

@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: langImportSingleError, langImportMultiError, jobStartUrl, langImportTimeOutError, langImportFinished, langImportFatalError */
/** global: job, langImportSingleError, langImportMultiError, jobStartUrl, langImportTimeOutError, langImportFinished, langImportFatalError */
var timeOutId;
var startInterval = 1000;

View File

@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: token */
var fixHelper = function (e, tr) {
"use strict";
var $originals = tr.children();

View File

@ -1,4 +1,3 @@
/*
* month.js
* Copyright (c) 2017 thegrumpydictator@gmail.com
@ -18,10 +17,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: spentUri, categoryUri, budgetUri, expenseUri, incomeUri, mainUri */
$(function () {
"use strict";
drawChart();
doubleYChart(mainUri, 'in-out-chart');
loadAjaxPartial('inOutAccounts', spentUri);
loadAjaxPartial('inOutCategory', categoryUri);
@ -31,9 +30,3 @@ $(function () {
});
function drawChart() {
"use strict";
// month view:
doubleYChart(mainUri, 'in-out-chart');
}

View File

@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: startDate, endDate, accountIds */
function loadAjaxPartial(holder, uri) {
"use strict";
$.get(uri).done(function (data) {

View File

@ -139,7 +139,6 @@ function setOptionalFromCookies() {
$('#inputExpRevAccounts').multiselect(defaultMultiSelect);
}
function catchSubmit() {

View File

@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: token */
var fixHelper = function (e, tr) {
"use strict";
var $originals = tr.children();

View File

@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: searchQuery,searchUri */
/** global: searchQuery,searchUri,token */

View File

@ -48,7 +48,7 @@ $(function () {
}).addTo(mymap);
if (doPlaceMarker) {
var marker = L.marker([latitude, longitude]).addTo(mymap);
L.marker([latitude, longitude]).addTo(mymap);
}
}
});

View File

@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: edit_selected_txt, delete_selected_txt */
/** global: edit_selected_txt, delete_selected_txt, token */
/**
*

View File

@ -27,8 +27,10 @@
<td>
{% if linkType.editable %}
<div class="btn-group btn-group-xs">
<a class="btn btn-default btn-xs" href="{{ route('admin.links.edit',linkType.id) }}"><i class="fa fa-fw fa-pencil"></i></a>
<a class="btn btn-danger btn-xs" href="{{ route('admin.links.delete',linkType.id) }}"><i class="fa fa-fw fa-trash-o"></i></a>
<a class="btn btn-default btn-xs" href="{{ route('admin.links.edit',linkType.id) }}"><i
class="fa fa-fw fa-pencil"></i></a>
<a class="btn btn-danger btn-xs" href="{{ route('admin.links.delete',linkType.id) }}"><i
class="fa fa-fw fa-trash-o"></i></a>
</div>
{% endif %}
</td>

View File

@ -28,7 +28,8 @@
<td>
<div class="btn-group btn-group-xs">
<a href="{{ route('transactions.link.delete', [link.id]) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
<a href="{{ route('transactions.link.switch', [link.id]) }}" class="btn btn-default"><i class="fa fa-fw fa-arrows-h"></i></a>
<a href="{{ route('transactions.link.switch', [link.id]) }}" class="btn btn-default"><i
class="fa fa-fw fa-arrows-h"></i></a>
</div>
</td>
<td data-value="{{ link.source.description }}">

View File

@ -25,7 +25,8 @@
</p>
</div>
<div class="box-footer">
<input type="submit" onclick="return confirm('{{ trans('firefly.are_you_sure')|escape('js') }}');" name="submit" value="{{ trans('form.deletePermanently') }}" class="btn btn-danger pull-right"/>
<input type="submit" onclick="return confirm('{{ trans('firefly.are_you_sure')|escape('js') }}');" name="submit"
value="{{ trans('form.deletePermanently') }}" class="btn btn-danger pull-right"/>
<a href="{{ URL.previous() }}" class="btn-default btn">{{ trans('form.cancel') }}</a>
</div>

View File

@ -129,7 +129,8 @@
{% if overspent %}
{% set pct = (limit.spent != 0 ? (limit.amount / (limit.spent*-1))*100 : 0) %} <!-- must have -1 here -->
<div class="progress progress-striped">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="{{ pct|round }}" aria-valuemin="0"
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="{{ pct|round }}"
aria-valuemin="0"
aria-valuemax="100" style="width: {{ pct|round }}%;"></div>
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="{{ (100-pct)|round }}"
aria-valuemin="0" aria-valuemax="100" style="width: {{ (100-pct)|round }}%;"></div>
@ -137,7 +138,8 @@
{% else %}
{% set pct = (limit.amount != 0 ? (((limit.spent*-1) / limit.amount)*100) : 0) %} <!-- must have -1 here -->
<div class="progress progress-striped">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="{{ pct|round }}" aria-valuemin="0"
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="{{ pct|round }}"
aria-valuemin="0"
aria-valuemax="100" style="width: {{ pct|round }}%;"></div>
</div>
{% endif %}

View File

@ -54,13 +54,16 @@
var mymap;
var marker;
if (typeof {{ latitudevar }} === "undefined") {
var {{ latitudevar }} = "52.3167";
var {{ latitudevar }} =
"52.3167";
}
if (typeof {{ longitudevar }} === "undefined") {
var {{ longitudevar }} = "5.5500";
var {{ longitudevar }} =
"5.5500";
}
if (typeof {{ zoomlevelvar }} === "undefined") {
var {{ zoomlevelvar }} = "6";
var {{ zoomlevelvar }} =
"6";
}
if (typeof mapboxToken === 'undefined') {
@ -91,7 +94,6 @@
}
console.log({{ longitudevar }});
document.addEventListener("DOMContentLoaded", function () {

View File

@ -112,7 +112,8 @@
{# EXPENSE ACCOUNTS #}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><a href="{{ route('accounts.index',['expense']) }}" title="{{ 'expense_accounts'|_ }}">{{ 'expense_accounts'|_ }}</a></h3>
<h3 class="box-title"><a href="{{ route('accounts.index',['expense']) }}" title="{{ 'expense_accounts'|_ }}">{{ 'expense_accounts'|_ }}</a>
</h3>
</div>
<div class="box-body">
@ -123,7 +124,8 @@
{% if showDeps %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><a href="{{ route('accounts.index',['revenue']) }}" title="{{ 'revenue_accounts'|_ }}">{{ 'revenue_accounts'|_ }}</a></h3>
<h3 class="box-title"><a href="{{ route('accounts.index',['revenue']) }}"
title="{{ 'revenue_accounts'|_ }}">{{ 'revenue_accounts'|_ }}</a></h3>
</div>
<div class="box-body">

View File

@ -1,4 +1,3 @@
// date ranges
var ranges = {}
{% for title, range in dateRangeConfig.ranges %}

View File

@ -7,7 +7,8 @@
{% for entry in info %}
<strong>{{ entry.name }}</strong><br/>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{ entry.percentage }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ entry.percentage }}%;">
<div class="progress-bar" role="progressbar" aria-valuenow="{{ entry.percentage }}" aria-valuemin="0" aria-valuemax="100"
style="width: {{ entry.percentage }}%;">
{% if entry.percentage >=20 %}{{ entry.amount|formatAmountPlain }}{% endif %}
</div>
{% if entry.percentage < 20 %}&nbsp;{{ entry.amount|formatAmountPlain }}{% endif %}

View File

@ -185,7 +185,8 @@
<script src="js/lib/daterangepicker.js?v={{ FF_VERSION }}" type="text/javascript"></script>
<script src="lib/adminlte/js/app.min.js?v={{ FF_VERSION }}" type="text/javascript"></script>
<script type="text/javascript" src="js/lib/accounting.min.js?v={{ FF_VERSION }}"></script>
<script src="{{ route('javascript.variables') }}?ext=.js&amp;v={{ FF_VERSION }}{% if account %}&amp;account={{ account.id }}{% endif %}" type="text/javascript"></script>
<script src="{{ route('javascript.variables') }}?ext=.js&amp;v={{ FF_VERSION }}{% if account %}&amp;account={{ account.id }}{% endif %}"
type="text/javascript"></script>
<script type="text/javascript" src="js/ff/firefly.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="js/ff/help.js?v={{ FF_VERSION }}"></script>
{% if not shownDemo %}

View File

@ -21,7 +21,14 @@
{% for account in accounts %}
<tr>
<td class="hidden-sm hidden-xs">
<div class="btn-group btn-group-xs edit_tr_buttons"><a class="btn btn-default btn-xs" title="{{ 'edit'|_ }}" href="{{ route('accounts.edit',account.id) }}"><i class="fa fa-fw fa-pencil"></i></a>{% if what == 'asset' %}<a class="btn btn-default btn-xs" title="{{ 'reconcile_this_account'|_ }}" href="{{ route('accounts.reconcile',account.id) }}"><i class="fa fa-fw fa-check"></i></a>{% endif %}<a class="btn btn-danger btn-xs" title="{{ 'delete'|_ }}" href="{{ route('accounts.delete',account.id) }}"><i class="fa fa-fw fa-trash-o"></i></a></div>
<div class="btn-group btn-group-xs edit_tr_buttons"><a class="btn btn-default btn-xs" title="{{ 'edit'|_ }}"
href="{{ route('accounts.edit',account.id) }}"><i
class="fa fa-fw fa-pencil"></i></a>{% if what == 'asset' %}<a class="btn btn-default btn-xs"
title="{{ 'reconcile_this_account'|_ }}"
href="{{ route('accounts.reconcile',account.id) }}"><i
class="fa fa-fw fa-check"></i></a>{% endif %}<a class="btn btn-danger btn-xs" title="{{ 'delete'|_ }}"
href="{{ route('accounts.delete',account.id) }}"><i
class="fa fa-fw fa-trash-o"></i></a></div>
</td>
<td data-value="{{ account.name }}"><a href="{{ route('accounts.show',account.id) }}">{{ account.name }}</a></td>
{% if what == "asset" %}

View File

@ -19,7 +19,9 @@
{% for entry in bills %}
<tr>
<td class="hidden-sm hidden-xs">
<div class="btn-group btn-group-xs edit_tr_buttons"><a href="{{ route('bills.edit',entry.id) }}" class="btn btn-default btn-xs"><i class="fa fa-fw fa-pencil"></i></a><a href="{{ route('bills.delete',entry.id) }}" class="btn btn-danger btn-xs"><i class="fa fa-fw fa-trash-o"></i></a></div>
<div class="btn-group btn-group-xs edit_tr_buttons"><a href="{{ route('bills.edit',entry.id) }}" class="btn btn-default btn-xs"><i
class="fa fa-fw fa-pencil"></i></a><a href="{{ route('bills.delete',entry.id) }}" class="btn btn-danger btn-xs"><i
class="fa fa-fw fa-trash-o"></i></a></div>
</td>
<td data-value="{{ entry.name }}">
<a href="{{ route('bills.show',entry.id) }}" title="{{ entry.name }}">{{ entry.name }}</a>

View File

@ -49,9 +49,11 @@
></i> {{ 'stop_selection'|_ }}</a>
{% if showReconcile == true %}
{% if moment == 'all' %}
<a href="{{ route('accounts.reconcile', [account.id, start.format('Ymd')]) }}" class="btn btn-info mass_reconcile"><i class="fa fa-fw fa-check"></i> {{ 'reconcile_this_account'|_ }}</a>
<a href="{{ route('accounts.reconcile', [account.id, start.format('Ymd')]) }}" class="btn btn-info mass_reconcile"><i
class="fa fa-fw fa-check"></i> {{ 'reconcile_this_account'|_ }}</a>
{% else %}
<a href="{{ route('accounts.reconcile', [account.id, start.format('Ymd'), end.format('Ymd')]) }}" class="btn btn-info mass_reconcile"><i class="fa fa-fw fa-check"></i> {{ 'reconcile_this_account'|_ }}</a>
<a href="{{ route('accounts.reconcile', [account.id, start.format('Ymd'), end.format('Ymd')]) }}" class="btn btn-info mass_reconcile"><i
class="fa fa-fw fa-check"></i> {{ 'reconcile_this_account'|_ }}</a>
{% endif %}
{% endif %}
</div>

View File

@ -159,7 +159,8 @@
class="fa fa-gear fa-fw"></i> {{ 'preferences'|_ }}</a>
</li>
<li class="{{ activeRoutePartial('currencies') }}">
<a class="{{ activeRoutePartial('currencies') }}" href="{{ route('currencies.index') }}"><i class="fa fa-usd fa-fw"></i> {{ 'currencies'|_ }}</a>
<a class="{{ activeRoutePartial('currencies') }}" href="{{ route('currencies.index') }}"><i class="fa fa-usd fa-fw"></i> {{ 'currencies'|_ }}
</a>
</li>
<!-- admin (if user admin) -->
{% if Auth.user.hasRole('owner') %}

View File

@ -1,11 +1,11 @@
<tr class="drag" data-date="{{ transaction.date.format('Y-m-d') }}" data-id="{{ transaction.journal_id }}"
data-transaction-id="{{ transaction.id }}"
>
{# input buttons #}
<td class="hidden-xs">
<div class="select_single" style="display:none;">
<input name="select_all_single[]" class="select_all_single" data-transaction="{{ transaction.id }}" value="{{ transaction.journal_id }}" type="checkbox"/>
<input name="select_all_single[]" class="select_all_single" data-transaction="{{ transaction.id }}" value="{{ transaction.journal_id }}"
type="checkbox"/>
</div>
<div class="btn-group btn-group-xs edit_buttons edit_tr_buttons">{% if sorting %}<a href="#" class="handle btn btn-default btn-xs"><i
class="fa fa-fw fa-arrows-v"></i></a>{% endif %}<a href="{{ route('transactions.edit',transaction.journal_id) }}"

View File

@ -1,4 +1,3 @@
<table class="table table-hover sortable">
<thead>
<tr>

View File

@ -17,7 +17,8 @@
<td data-value="{{ transaction.date.format('Y-m-d') }}">
{{ transaction.date.formatLocalized(monthAndDayFormat) }}
</td>
<td style="text-align: right;" data-value="{{ transaction.transaction_amount }}"><span style="margin-right:5px;">{{ transaction|transactionAmount }}</span></td>
<td style="text-align: right;" data-value="{{ transaction.transaction_amount }}"><span
style="margin-right:5px;">{{ transaction|transactionAmount }}</span></td>
</tr>
{% endfor %}
</tbody>

View File

@ -107,7 +107,9 @@
<td>
<div class="btn-group btn-group-xs test_buttons">
{# show which transactions would match #}
<a href="#" class="btn btn-default test_rule_triggers" data-id="{{ rule.id }}" title="{{ 'test_rule_triggers'|_ }}"><i data-id="{{ rule.id }}" class="test_rule_triggers fa fa-fw fa-flask"></i></a>
<a href="#" class="btn btn-default test_rule_triggers" data-id="{{ rule.id }}"
title="{{ 'test_rule_triggers'|_ }}"><i data-id="{{ rule.id }}"
class="test_rule_triggers fa fa-fw fa-flask"></i></a>
{# actually execute rule #}
<a href="{{ route('rules.select-transactions',rule.id) }}" class="btn btn-default"

View File

@ -21,7 +21,8 @@
<div class="box-body">
<p class="tagcloud">
{% for tagInfo in entries %}
<a style="font-size:{{ tagInfo.scale }}px;" class="label label-success" href="{{ route('tags.show',tagInfo.tag.id) }}"><i class="fa fa-fw fa-tag"></i> {{ tagInfo.tag.tag }}</a>
<a style="font-size:{{ tagInfo.scale }}px;" class="label label-success"
href="{{ route('tags.show',tagInfo.tag.id) }}"><i class="fa fa-fw fa-tag"></i> {{ tagInfo.tag.tag }}</a>
{% endfor %}
</p>
</div>

View File

@ -32,6 +32,8 @@ use Illuminate\Http\Request;
|
*/
Route::middleware('auth:api')->get('/user', function (Request $request) {
Route::middleware('auth:api')->get(
'/user', function (Request $request) {
return $request->user();
});
}
);

View File

@ -22,7 +22,6 @@ declare(strict_types=1);
use Carbon\Carbon;
use DaveJamesMiller\Breadcrumbs\BreadcrumbsGenerator;
//use DaveJamesMiller\Breadcrumbs\Generator as BreadCrumbsGenerator;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\Attachment;
@ -43,6 +42,8 @@ use FireflyIII\Models\TransactionType;
use FireflyIII\User;
use Illuminate\Support\Collection;
//use DaveJamesMiller\Breadcrumbs\Generator as BreadCrumbsGenerator;
// HOME
Breadcrumbs::register(
'home',
@ -599,7 +600,6 @@ Breadcrumbs::register(
);
// PREFERENCES
Breadcrumbs::register(
'preferences.index',

View File

@ -30,6 +30,8 @@
|
*/
Broadcast::channel('App.User.{id}', function ($user, $id) {
Broadcast::channel(
'App.User.{id}', function ($user, $id) {
return (int)$user->id === (int)$id;
});
}
);

View File

@ -32,6 +32,8 @@ use Illuminate\Foundation\Inspiring;
|
*/
Artisan::command('inspire', function () {
Artisan::command(
'inspire', function () {
$this->comment(Inspiring::quote());
})->describe('Display an inspiring quote');
}
)->describe('Display an inspiring quote');

View File

@ -136,6 +136,30 @@ class UpdateControllerTest extends TestCase
$response->assertSee('the latest available release');
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck
*/
public function testUpdateCheckError()
{
$falseConfig = new Configuration;
$falseConfig->data = false;
FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->once()->andReturn($falseConfig);
$version = config('firefly.version') . '-alpha';
$releases = [
new Release(['id' => 'x', 'title' => $version, 'content' => '', 'updated' => new Carbon]),
];
$updater = $this->mock(UpdateRequest::class);
$updater->shouldReceive('call')->andThrow(FireflyException::class, 'Something broke.');
$updater->shouldReceive('getReleases')->andReturn($releases);
// expect a new release (because of .1)
$this->be($this->user());
$response = $this->post(route('admin.update-check.manual'));
$response->assertStatus(200);
$response->assertSee('An error occurred while checking');
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck
*/
@ -161,28 +185,4 @@ class UpdateControllerTest extends TestCase
$response->assertSee($version);
$response->assertSee('which is newer than the');
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck
*/
public function testUpdateCheckError()
{
$falseConfig = new Configuration;
$falseConfig->data = false;
FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->once()->andReturn($falseConfig);
$version = config('firefly.version') . '-alpha';
$releases = [
new Release(['id' => 'x', 'title' => $version, 'content' => '', 'updated' => new Carbon]),
];
$updater = $this->mock(UpdateRequest::class);
$updater->shouldReceive('call')->andThrow(FireflyException::class, 'Something broke.');
$updater->shouldReceive('getReleases')->andReturn($releases);
// expect a new release (because of .1)
$this->be($this->user());
$response = $this->post(route('admin.update-check.manual'));
$response->assertStatus(200);
$response->assertSee('An error occurred while checking');
}
}

View File

@ -27,10 +27,10 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Google2FA;
use Illuminate\Support\Collection;
use Preferences;
use Tests\TestCase;
use Google2FA;
/**
* Class PreferencesControllerTest

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace Tests\Feature\Controllers\Transaction;
use FireflyIII\Models\LinkType;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionJournalLink;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
@ -64,30 +63,6 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\LinkController::store
*/
public function testStoreAlreadyLinked()
{
$repository = $this->mock(LinkTypeRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$data = [
'link_other' => 8,
'link_type' => '1_inward',
];
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('find')->andReturn(new TransactionJournal);
$repository->shouldReceive('findLink')->andReturn(true);
$this->be($this->user());
$response = $this->post(route('transactions.link.store', [1]), $data);
$response->assertStatus(302);
$response->assertSessionHas('error');
$response->assertRedirect(route('transactions.show', [1]));
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\LinkController::store
*/
@ -113,6 +88,29 @@ class LinkControllerTest extends TestCase
$response->assertRedirect(route('transactions.show', [1]));
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\LinkController::store
*/
public function testStoreAlreadyLinked()
{
$repository = $this->mock(LinkTypeRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$data = [
'link_other' => 8,
'link_type' => '1_inward',
];
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('find')->andReturn(new TransactionJournal);
$repository->shouldReceive('findLink')->andReturn(true);
$this->be($this->user());
$response = $this->post(route('transactions.link.store', [1]), $data);
$response->assertStatus(302);
$response->assertSessionHas('error');
$response->assertRedirect(route('transactions.show', [1]));
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\LinkController::store

View File

@ -207,10 +207,10 @@ class SingleControllerTest extends TestCase
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
*/
public function testEditRedirect()
public function testEditReconcile()
{
$this->be($this->user());
$withdrawal = TransactionJournal::where('transaction_type_id', 1)
$withdrawal = TransactionJournal::where('transaction_type_id', 5)
->whereNull('transaction_journals.deleted_at')
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->groupBy('transaction_journals.id')
@ -224,10 +224,10 @@ class SingleControllerTest extends TestCase
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
*/
public function testEditReconcile()
public function testEditRedirect()
{
$this->be($this->user());
$withdrawal = TransactionJournal::where('transaction_type_id', 5)
$withdrawal = TransactionJournal::where('transaction_type_id', 1)
->whereNull('transaction_journals.deleted_at')
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->groupBy('transaction_journals.id')

View File

@ -41,16 +41,6 @@ class INGDebitCreditTest extends TestCase
$this->assertEquals(-1, $result);
}
/**
* @covers \FireflyIII\Import\Converter\INGDebitCredit::convert()
*/
public function testConvertBij()
{
$converter = new INGDebitCredit;
$result = $converter->convert('Bij');
$this->assertEquals(1, $result);
}
/**
* @covers \FireflyIII\Import\Converter\INGDebitCredit::convert()
*/
@ -60,4 +50,14 @@ class INGDebitCreditTest extends TestCase
$result = $converter->convert('9083jkdkj');
$this->assertEquals(1, $result);
}
/**
* @covers \FireflyIII\Import\Converter\INGDebitCredit::convert()
*/
public function testConvertBij()
{
$converter = new INGDebitCredit;
$result = $converter->convert('Bij');
$this->assertEquals(1, $result);
}
}

View File

@ -103,6 +103,39 @@ class AuthenticateTwoFactorTest extends TestCase
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* tests for user with 2FA and secret and cookie. Continue to page.
*
* 2FA enabled: true
* 2FA secret : 'abcde'
* cookie : false
*
*
* @covers \FireflyIII\Http\Middleware\AuthenticateTwoFactor::handle
*/
public function testMiddlewareTwoFAAuthed()
{
$this->withoutExceptionHandling();
$user = $this->user();
$user->blocked = 0;
$this->be($user);
// pref for has 2fa is true
$preference = new Preference;
$preference->data = true;
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->once()->andReturn($preference);
// pref for twoFactorAuthSecret
$secret = new Preference;
$secret->data = 'SomeSecret';
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->once()->andReturn($secret);
// no cookie
$cookie = ['twoFactorAuthenticated' => 'true'];
$response = $this->call('GET', '/_test/authenticate', [], $cookie);
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* tests for user with 2FA but no secret. 2FA is not fired.
*
@ -168,40 +201,6 @@ class AuthenticateTwoFactorTest extends TestCase
$response->assertRedirect(route('two-factor.index'));
}
/**
* tests for user with 2FA and secret and cookie. Continue to page.
*
* 2FA enabled: true
* 2FA secret : 'abcde'
* cookie : false
*
*
* @covers \FireflyIII\Http\Middleware\AuthenticateTwoFactor::handle
*/
public function testMiddlewareTwoFAAuthed()
{
$this->withoutExceptionHandling();
$user = $this->user();
$user->blocked = 0;
$this->be($user);
// pref for has 2fa is true
$preference = new Preference;
$preference->data = true;
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->once()->andReturn($preference);
// pref for twoFactorAuthSecret
$secret = new Preference;
$secret->data = 'SomeSecret';
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->once()->andReturn($secret);
// no cookie
$cookie = ['twoFactorAuthenticated' => 'true'];
$response = $this->call('GET', '/_test/authenticate', [], $cookie);
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* Set up test
*/

View File

@ -55,17 +55,6 @@ class IsAdminTest extends TestCase
$this->assertEquals(Response::HTTP_UNAUTHORIZED, $response->getStatusCode());
}
/**
* @covers \FireflyIII\Http\Middleware\IsAdmin::handle
*/
public function testMiddlewareOwner()
{
$this->be($this->user());
$this->withoutExceptionHandling();
$response = $this->get('/_test/is-admin');
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* @covers \FireflyIII\Http\Middleware\IsAdmin::handle
*/
@ -78,6 +67,17 @@ class IsAdminTest extends TestCase
$response->assertRedirect(route('home'));
}
/**
* @covers \FireflyIII\Http\Middleware\IsAdmin::handle
*/
public function testMiddlewareOwner()
{
$this->be($this->user());
$this->withoutExceptionHandling();
$response = $this->get('/_test/is-admin');
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* Set up test
*/

View File

@ -33,16 +33,6 @@ use Tests\TestCase;
*/
class IsDemoUserTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Middleware\IsDemoUser::handle
*/
public function testMiddlewareNotAuthenticated()
{
$this->withoutExceptionHandling();
$response = $this->get('/_test/is-demo');
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* @covers \FireflyIII\Http\Middleware\IsDemoUser::handle
*/
@ -68,6 +58,16 @@ class IsDemoUserTest extends TestCase
$response->assertRedirect(route('index'));
}
/**
* @covers \FireflyIII\Http\Middleware\IsDemoUser::handle
*/
public function testMiddlewareNotAuthenticated()
{
$this->withoutExceptionHandling();
$response = $this->get('/_test/is-demo');
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* Set up test
*/

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace Tests\Unit\Helpers;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Http\Middleware\IsSandStormUser;
use Route;
use Symfony\Component\HttpFoundation\Response;

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