mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 15:18:05 +00:00
Update some tests.
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Http\Requests\BillFormRequest;
|
||||
@@ -40,6 +41,7 @@ use League\Fractal\Manager;
|
||||
use League\Fractal\Resource\Item;
|
||||
use League\Fractal\Serializer\DataArraySerializer;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class BillController.
|
||||
@@ -366,8 +368,10 @@ class BillController extends Controller
|
||||
{
|
||||
$billData = $request->getBillData();
|
||||
$billData['active'] = true;
|
||||
$bill = $this->billRepository->store($billData);
|
||||
if (null === $bill) {
|
||||
try {
|
||||
$bill = $this->billRepository->store($billData);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error($e->getMessage());
|
||||
$request->session()->flash('error', (string)trans('firefly.bill_store_error'));
|
||||
|
||||
return redirect(route('bills.create'))->withInput();
|
||||
|
||||
@@ -251,7 +251,7 @@ class BudgetController extends Controller
|
||||
foreach ($result as $combinedId => $info) {
|
||||
$parts = explode('-', $combinedId);
|
||||
$assetId = (int)$parts[0];
|
||||
$title = sprintf('%s (%s)', $names[$assetId], $info['currency_name']);
|
||||
$title = sprintf('%s (%s)', $names[$assetId] ?? '(empty)', $info['currency_name']);
|
||||
$chartData[$title]
|
||||
= [
|
||||
'amount' => $info['amount'],
|
||||
@@ -315,7 +315,7 @@ class BudgetController extends Controller
|
||||
foreach ($result as $combinedId => $info) {
|
||||
$parts = explode('-', $combinedId);
|
||||
$categoryId = (int)$parts[0];
|
||||
$title = sprintf('%s (%s)', $names[$categoryId], $info['currency_name']);
|
||||
$title = sprintf('%s (%s)', $names[$categoryId] ?? '(empty)', $info['currency_name']);
|
||||
$chartData[$title] = [
|
||||
'amount' => $info['amount'],
|
||||
'currency_symbol' => $info['currency_symbol'],
|
||||
|
||||
@@ -359,7 +359,14 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
$data['enabled'] = true;
|
||||
$currency = $this->repository->store($data);
|
||||
try {
|
||||
$currency = $this->repository->store($data);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::channel('audit')->info('Could not store (POST) currency without admin rights.', $data);
|
||||
$request->session()->flash('error', (string)trans('firefly.could_not_store_currency'));
|
||||
$currency = null;
|
||||
}
|
||||
$redirect = redirect($this->getPreviousUri('currencies.create.uri'));
|
||||
|
||||
if (null !== $currency) {
|
||||
@@ -373,10 +380,6 @@ class CurrencyController extends Controller
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
}
|
||||
if (null === $currency) {
|
||||
Log::channel('audit')->info('Could not store (POST) currency without admin rights.', $data);
|
||||
$request->session()->flash('error', (string)trans('firefly.could_not_store_currency'));
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user