Merge pull request #7128 from firefly-iii/fix-7127

Fix 7127
This commit is contained in:
James Cole 2023-03-04 22:19:17 +01:00 committed by GitHub
commit 8807f04599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 7 deletions

View File

@ -94,19 +94,39 @@ class DestroyController extends Controller
case 'object_groups':
$this->destroyObjectGroups();
break;
case 'not_assets_liabilities':
$this->destroyAccounts(
[
AccountType::BENEFICIARY,
AccountType::CASH,
AccountType::CREDITCARD,
AccountType::DEFAULT,
AccountType::EXPENSE,
AccountType::IMPORT,
AccountType::INITIAL_BALANCE,
AccountType::LIABILITY_CREDIT,
AccountType::RECONCILIATION,
AccountType::REVENUE,
]
);
break;
case 'accounts':
$this->destroyAccounts(
[
AccountType::ASSET,
AccountType::DEFAULT,
AccountType::BENEFICIARY,
AccountType::EXPENSE,
AccountType::REVENUE,
AccountType::INITIAL_BALANCE,
AccountType::CASH,
AccountType::CREDITCARD,
AccountType::DEBT,
AccountType::DEFAULT,
AccountType::EXPENSE,
AccountType::IMPORT,
AccountType::INITIAL_BALANCE,
AccountType::LIABILITY_CREDIT,
AccountType::LOAN,
AccountType::MORTGAGE,
AccountType::CREDITCARD,
AccountType::RECONCILIATION,
AccountType::REVENUE,
]
);
break;

View File

@ -53,7 +53,8 @@ class DestroyRequest extends FormRequest
public function rules(): array
{
$valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups'.
',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers';
',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers'.
',not_assets_liabilities';
return [
'objects' => sprintf('required|min:1|string|in:%s', $valid),

View File

@ -318,7 +318,7 @@
url = '{{ route('api.v1.data.purge') }}';
}
if (link.data('type') === 'unused_accounts') {
url = deleteAPIRoute + '?objects=accounts&unused=true';
url = deleteAPIRoute + '?objects=not_assets_liabilities&unused=true';
}
// replace icon with loading thing