mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 12:43:57 -06:00
Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
This commit is contained in:
commit
5cfa9bcc30
15
.github/ISSUE_TEMPLATE/Custom.md
vendored
15
.github/ISSUE_TEMPLATE/Custom.md
vendored
@ -4,7 +4,7 @@ about: Ask away!
|
||||
|
||||
---
|
||||
|
||||
I am running Firefly III version x.x.x
|
||||
I am running Firefly III version x.x.x.
|
||||
|
||||
**Description**
|
||||
<!-- (if relevant of course) -->
|
||||
@ -13,10 +13,11 @@ I am running Firefly III version x.x.x
|
||||
<!-- Please add extra info here, such as OS, browser, and the output from the `/debug`-page of your Firefly III installation (click the version at the bottom). -->
|
||||
|
||||
**Bonus points**
|
||||
<!-- Earn bonus points by:
|
||||
|
||||
- Add a screenshot
|
||||
- Make a drawing
|
||||
- Donate money (just kidding ;)
|
||||
- Replicate the problem on the demo site https://demo.firefly-iii.org/
|
||||
-->
|
||||
<!-- Complete the following checklist for bonus points -->
|
||||
|
||||
- [ ] I have read the FAQ at https://bit.ly/FF3-FAQ
|
||||
- [ ] I added a screenshot
|
||||
- [ ] I added log files (see https://bit.ly/FF3-get-logs)
|
||||
- [ ] I was able to replicate the issue on the demo site.
|
||||
<!-- - [ ] I donated money (this is a joke :wink:)-->
|
||||
|
@ -125,19 +125,17 @@ class OtherCurrenciesCorrections extends Command
|
||||
if (isset($this->accountCurrencies[$accountId]) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) {
|
||||
return $this->accountCurrencies[$accountId]; // @codeCoverageIgnore
|
||||
}
|
||||
// TODO we can use getAccountCurrency() instead
|
||||
$currencyId = (int)$this->accountRepos->getMetaValue($account, 'currency_id');
|
||||
$result = $this->currencyRepos->findNull($currencyId);
|
||||
if (null === $result) {
|
||||
$currency = $this->accountRepos->getAccountCurrency($account);
|
||||
if (null === $currency) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$this->accountCurrencies[$accountId] = 0;
|
||||
|
||||
return null;
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
$this->accountCurrencies[$accountId] = $result;
|
||||
$this->accountCurrencies[$accountId] = $currency;
|
||||
|
||||
return $result;
|
||||
return $currency;
|
||||
|
||||
|
||||
}
|
||||
|
@ -125,6 +125,14 @@ class AutoCompleteController extends Controller
|
||||
$filtered = $result->unique('description');
|
||||
$limited = $filtered->slice(0, 15);
|
||||
$array = $limited->toArray();
|
||||
// duplicate 'description' value into 'name':
|
||||
$array = array_map(
|
||||
static function (array $journal) {
|
||||
$journal['name'] = $journal['description'];
|
||||
|
||||
return $journal;
|
||||
}, $array
|
||||
);
|
||||
|
||||
return response()->json(array_values($array));
|
||||
}
|
||||
@ -174,6 +182,38 @@ class AutoCompleteController extends Controller
|
||||
return response()->json($array);
|
||||
}
|
||||
|
||||
/**
|
||||
* An auto-complete specifically for asset accounts and liabilities, used when mass updating and for rules mostly.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function assetAccounts(Request $request): JsonResponse
|
||||
{
|
||||
$search = $request->get('search');
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
// filter the account types:
|
||||
$allowedAccountTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
|
||||
Log::debug(sprintf('Now in expenseAccounts(%s). Filtering results.', $search), $allowedAccountTypes);
|
||||
|
||||
$return = [];
|
||||
$result = $repository->searchAccount((string)$search, $allowedAccountTypes);
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($result as $account) {
|
||||
$return[] = [
|
||||
'id' => $account->id,
|
||||
'name' => $account->name,
|
||||
'type' => $account->accountType->type,
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($return);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
@ -283,39 +323,6 @@ class AutoCompleteController extends Controller
|
||||
return response()->json($return);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An auto-complete specifically for asset accounts and liabilities, used when mass updating and for rules mostly.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function assetAccounts(Request $request): JsonResponse
|
||||
{
|
||||
$search = $request->get('search');
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
// filter the account types:
|
||||
$allowedAccountTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
|
||||
Log::debug(sprintf('Now in expenseAccounts(%s). Filtering results.', $search), $allowedAccountTypes);
|
||||
|
||||
$return = [];
|
||||
$result = $repository->searchAccount((string)$search, $allowedAccountTypes);
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($result as $account) {
|
||||
$return[] = [
|
||||
'id' => $account->id,
|
||||
'name' => $account->name,
|
||||
'type' => $account->accountType->type,
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($return);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
|
@ -76,7 +76,7 @@ class PiggyBankFormRequest extends Request
|
||||
$rules = [
|
||||
'name' => $nameRule,
|
||||
'account_id' => 'required|belongsToUser:accounts',
|
||||
'targetamount' => 'required|numeric|more:0|max:1000000000',
|
||||
'targetamount' => 'required|numeric|gte:0.01|max:1000000000',
|
||||
'startdate' => 'date',
|
||||
'targetdate' => 'date|nullable',
|
||||
'order' => 'integer|min:1',
|
||||
|
@ -243,7 +243,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
if ('' !== $query) {
|
||||
$search->where('name', 'LIKE', sprintf('%%%s%%', $query));
|
||||
}
|
||||
$search->orderBy('order', 'DESC')
|
||||
$search->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->where('active', 1);
|
||||
|
||||
return $search->get();
|
||||
|
@ -77,12 +77,7 @@ class PiggyBankTransformer extends AbstractTransformer
|
||||
$this->piggyRepos->setUser($account->user);
|
||||
|
||||
// get currency from account, or use default.
|
||||
// TODO we can use getAccountCurrency() instead
|
||||
$currencyId = (int)$this->accountRepos->getMetaValue($account, 'currency_id');
|
||||
$currency = $this->currencyRepos->findNull($currencyId);
|
||||
if (null === $currency) {
|
||||
$currency = app('amount')->getDefaultCurrencyByUser($account->user);
|
||||
}
|
||||
$currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUser($account->user);
|
||||
|
||||
// note
|
||||
$notes = $this->piggyRepos->getNoteText($piggyBank);
|
||||
@ -99,6 +94,7 @@ class PiggyBankTransformer extends AbstractTransformer
|
||||
|
||||
// target and percentage:
|
||||
$targetAmount = round($piggyBank->targetamount, $currency->decimal_places);
|
||||
$targetAmount = 1 === bccomp('0.01', (string)$targetAmount) ? '0.01' : $targetAmount;
|
||||
$percentage = (int)(0 !== bccomp('0', $currentAmountStr) ? $currentAmount / $targetAmount * 100 : 0);
|
||||
$data = [
|
||||
'id' => (int)$piggyBank->id,
|
||||
|
@ -57,7 +57,7 @@ return [
|
||||
'at_least_one_action' => 'Rule must have at least one action.',
|
||||
'base64' => 'This is not valid base64 encoded data.',
|
||||
'model_id_invalid' => 'The given ID seems invalid for this model.',
|
||||
'more' => ':attribute must be larger than zero.',
|
||||
'more' => ':attribute must be larger than ":more".',
|
||||
'less' => ':attribute must be less than 10,000,000',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
@ -195,4 +195,9 @@ return [
|
||||
|
||||
'generic_invalid_source' => 'You can\'t use this account as the source account.',
|
||||
'generic_invalid_destination' => 'You can\'t use this account as the destination account.',
|
||||
|
||||
'gte.numeric' => 'The :attribute must be greater than or equal to :value.',
|
||||
'gte.file' => 'The :attribute must be greater than or equal to :value kilobytes.',
|
||||
'gte.string' => 'The :attribute must be greater than or equal to :value characters.',
|
||||
'gte.array' => 'The :attribute must have :value items or more.',
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user