mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
@@ -65,13 +65,11 @@ class BillController extends Controller
|
||||
$data = $request->getData();
|
||||
$result = $this->repository->searchBill($data['query'], $this->parameters->get('limit'));
|
||||
$filtered = $result->map(
|
||||
static function (Bill $item) {
|
||||
return [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
'active' => $item->active,
|
||||
];
|
||||
}
|
||||
static fn(Bill $item) => [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
'active' => $item->active,
|
||||
]
|
||||
);
|
||||
|
||||
return response()->api($filtered->toArray());
|
||||
|
@@ -65,12 +65,10 @@ class BudgetController extends Controller
|
||||
$data = $request->getData();
|
||||
$result = $this->repository->searchBudget($data['query'], $this->parameters->get('limit'));
|
||||
$filtered = $result->map(
|
||||
static function (Budget $item) {
|
||||
return [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
];
|
||||
}
|
||||
static fn(Budget $item) => [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
]
|
||||
);
|
||||
|
||||
return response()->api($filtered->toArray());
|
||||
|
@@ -65,12 +65,10 @@ class CategoryController extends Controller
|
||||
$data = $request->getData();
|
||||
$result = $this->repository->searchCategory($data['query'], $this->parameters->get('limit'));
|
||||
$filtered = $result->map(
|
||||
static function (Category $item) {
|
||||
return [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
];
|
||||
}
|
||||
static fn(Category $item) => [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
]
|
||||
);
|
||||
|
||||
return response()->api($filtered->toArray());
|
||||
|
@@ -193,7 +193,7 @@ class BudgetController extends Controller
|
||||
// var_dump($return);
|
||||
/** @var array $journal */
|
||||
foreach ($currentBudgetArray['transaction_journals'] as $journal) {
|
||||
$return[$currencyId]['spent'] = bcadd($return[$currencyId]['spent'], $journal['amount']);
|
||||
$return[$currencyId]['spent'] = bcadd($return[$currencyId]['spent'], (string) $journal['amount']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,13 +245,13 @@ class BudgetController extends Controller
|
||||
}
|
||||
$result = $this->processExpenses($budget->id, $filtered, $limit->start_date, $end);
|
||||
if (1 === count($result)) {
|
||||
$compare = bccomp($limit->amount, app('steam')->positive($result[$limitCurrencyId]['spent']));
|
||||
$compare = bccomp($limit->amount, (string) app('steam')->positive($result[$limitCurrencyId]['spent']));
|
||||
if (1 === $compare) {
|
||||
// convert this amount into the native currency:
|
||||
$result[$limitCurrencyId]['left'] = bcadd($limit->amount, $result[$limitCurrencyId]['spent']);
|
||||
$result[$limitCurrencyId]['left'] = bcadd($limit->amount, (string) $result[$limitCurrencyId]['spent']);
|
||||
}
|
||||
if ($compare <= 0) {
|
||||
$result[$limitCurrencyId]['overspent'] = app('steam')->positive(bcadd($limit->amount, $result[$limitCurrencyId]['spent']));
|
||||
$result[$limitCurrencyId]['overspent'] = app('steam')->positive(bcadd($limit->amount, (string) $result[$limitCurrencyId]['spent']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -96,7 +96,7 @@ class CategoryController extends Controller
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$currency = $currencies[$currencyId] ?? $this->currencyRepos->find($currencyId);
|
||||
$currencies[$currencyId] = $currency;
|
||||
$categoryName = null === $journal['category_name'] ? (string) trans('firefly.no_category') : $journal['category_name'];
|
||||
$categoryName = $journal['category_name'] ?? (string) trans('firefly.no_category');
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$key = sprintf('%s-%s', $categoryName, $currency->code);
|
||||
// create arrays
|
||||
@@ -114,14 +114,12 @@ class CategoryController extends Controller
|
||||
];
|
||||
|
||||
// add monies
|
||||
$return[$key]['amount'] = bcadd($return[$key]['amount'], $amount);
|
||||
$return[$key]['amount'] = bcadd($return[$key]['amount'], (string) $amount);
|
||||
}
|
||||
$return = array_values($return);
|
||||
|
||||
// order by amount
|
||||
usort($return, static function (array $a, array $b) {
|
||||
return (float) $a['amount'] < (float) $b['amount'] ? 1 : -1;
|
||||
});
|
||||
usort($return, static fn(array $a, array $b) => (float) $a['amount'] < (float) $b['amount'] ? 1 : -1);
|
||||
|
||||
return response()->json($this->clean($return));
|
||||
}
|
||||
|
@@ -89,7 +89,7 @@ class ExportController extends Controller
|
||||
->header('Expires', '0')
|
||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||
->header('Pragma', 'public')
|
||||
->header('Content-Length', (string) strlen($data[$key]))
|
||||
->header('Content-Length', (string) strlen((string) $data[$key]))
|
||||
;
|
||||
|
||||
return $response;
|
||||
|
@@ -160,7 +160,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$response[$key]['difference'] = bcadd($response[$key]['difference'], $journal['amount']);
|
||||
$response[$key]['difference'] = bcadd((string) $response[$key]['difference'], (string) $journal['amount']);
|
||||
$response[$key]['difference_float'] = (float) $response[$key]['difference']; // float but on purpose.
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$response[$foreignKey]['difference'] = bcadd($response[$foreignKey]['difference'], $journal['foreign_amount']);
|
||||
$response[$foreignKey]['difference'] = bcadd((string) $response[$foreignKey]['difference'], (string) $journal['foreign_amount']);
|
||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; // float but on purpose.
|
||||
}
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ class PeriodController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], (string) app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // float but on purpose.
|
||||
}
|
||||
|
||||
|
@@ -100,7 +100,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], (string) app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
||||
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$response[$key]['difference'] = bcadd($response[$key]['difference'], app('steam')->positive($journal['amount']));
|
||||
$response[$key]['difference'] = bcadd((string) $response[$key]['difference'], (string) app('steam')->positive($journal['amount']));
|
||||
$response[$key]['difference_float'] = (float) $response[$key]['difference'];
|
||||
}
|
||||
|
||||
@@ -167,8 +167,8 @@ class TagController extends Controller
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$response[$foreignKey]['difference'] = bcadd(
|
||||
$response[$foreignKey]['difference'],
|
||||
app('steam')->positive($journal['foreign_amount'])
|
||||
(string) $response[$foreignKey]['difference'],
|
||||
(string) app('steam')->positive($journal['foreign_amount'])
|
||||
);
|
||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference'];
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ class PeriodController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], (string) app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
||||
|
||||
}
|
||||
|
@@ -99,7 +99,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], (string) app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
||||
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$response[$key]['difference'] = bcadd($response[$key]['difference'], app('steam')->positive($journal['amount']));
|
||||
$response[$key]['difference'] = bcadd((string) $response[$key]['difference'], (string) app('steam')->positive($journal['amount']));
|
||||
$response[$key]['difference_float'] = (float) $response[$key]['difference'];
|
||||
}
|
||||
|
||||
@@ -166,8 +166,8 @@ class TagController extends Controller
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$response[$foreignKey]['difference'] = bcadd(
|
||||
$response[$foreignKey]['difference'],
|
||||
app('steam')->positive($journal['foreign_amount'])
|
||||
(string) $response[$foreignKey]['difference'],
|
||||
(string) app('steam')->positive($journal['foreign_amount'])
|
||||
);
|
||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; // intentional float
|
||||
}
|
||||
|
@@ -177,9 +177,7 @@ class ListController extends Controller
|
||||
|
||||
// filter and paginate list:
|
||||
$collection = $unfiltered->filter(
|
||||
static function (Bill $bill) use ($currency) {
|
||||
return $bill->transaction_currency_id === $currency->id;
|
||||
}
|
||||
static fn(Bill $bill) => $bill->transaction_currency_id === $currency->id
|
||||
);
|
||||
$count = $collection->count();
|
||||
$bills = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
|
@@ -191,14 +191,14 @@ class BasicController extends Controller
|
||||
|
||||
// if it is the native currency already.
|
||||
if ($entry['currency_id'] === $default->id) {
|
||||
$sums[$default->id]['sum'] = bcadd($entry['sum'], $sums[$default->id]['sum']);
|
||||
$sums[$default->id]['sum'] = bcadd((string) $entry['sum'], $sums[$default->id]['sum']);
|
||||
|
||||
// don't forget to add it to newExpenses and newIncome
|
||||
if (0 === $index) {
|
||||
$newExpenses[$default->id]['sum'] = bcadd($newExpenses[$default->id]['sum'], $entry['sum']);
|
||||
$newExpenses[$default->id]['sum'] = bcadd($newExpenses[$default->id]['sum'], (string) $entry['sum']);
|
||||
}
|
||||
if (1 === $index) {
|
||||
$newIncomes[$default->id]['sum'] = bcadd($newIncomes[$default->id]['sum'], $entry['sum']);
|
||||
$newIncomes[$default->id]['sum'] = bcadd($newIncomes[$default->id]['sum'], (string) $entry['sum']);
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -229,7 +229,7 @@ class BasicController extends Controller
|
||||
'currency_decimal_places' => $entry['currency_decimal_places'],
|
||||
'sum' => '0',
|
||||
];
|
||||
$sums[$currencyId]['sum'] = bcadd($sums[$currencyId]['sum'], $entry['sum']);
|
||||
$sums[$currencyId]['sum'] = bcadd($sums[$currencyId]['sum'], (string) $entry['sum']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -362,7 +362,7 @@ class BasicController extends Controller
|
||||
if (0 === $index) {
|
||||
// paid amount
|
||||
if ($currencyId === $this->nativeCurrency->id) {
|
||||
$newPaidAmount[0]['sum'] = bcadd($newPaidAmount[0]['sum'], $item['sum']);
|
||||
$newPaidAmount[0]['sum'] = bcadd($newPaidAmount[0]['sum'], (string) $item['sum']);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ class BasicController extends Controller
|
||||
}
|
||||
// unpaid amount
|
||||
if ($currencyId === $this->nativeCurrency->id) {
|
||||
$newUnpaidAmount[0]['sum'] = bcadd($newUnpaidAmount[0]['sum'], $item['sum']);
|
||||
$newUnpaidAmount[0]['sum'] = bcadd($newUnpaidAmount[0]['sum'], (string) $item['sum']);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -397,7 +397,7 @@ class BasicController extends Controller
|
||||
* @var array $info
|
||||
*/
|
||||
foreach ($paidAmount as $info) {
|
||||
$amount = bcmul($info['sum'], '-1');
|
||||
$amount = bcmul((string) $info['sum'], '-1');
|
||||
$return[] = [
|
||||
'key' => sprintf('bills-paid-in-%s', $info['code']),
|
||||
'title' => trans('firefly.box_bill_paid_in_currency', ['currency' => $info['symbol']]),
|
||||
@@ -416,7 +416,7 @@ class BasicController extends Controller
|
||||
* @var array $info
|
||||
*/
|
||||
foreach ($unpaidAmount as $info) {
|
||||
$amount = bcmul($info['sum'], '-1');
|
||||
$amount = bcmul((string) $info['sum'], '-1');
|
||||
$return[] = [
|
||||
'key' => sprintf('bills-unpaid-in-%s', $info['code']),
|
||||
'title' => trans('firefly.box_bill_unpaid_in_currency', ['currency' => $info['symbol']]),
|
||||
@@ -513,7 +513,7 @@ class BasicController extends Controller
|
||||
continue;
|
||||
}
|
||||
$spentInCurrency = $row['sum'];
|
||||
$leftToSpend = bcadd($amount, $spentInCurrency);
|
||||
$leftToSpend = bcadd($amount, (string) $spentInCurrency);
|
||||
$perDay = '0';
|
||||
if (0 !== $days && bccomp($leftToSpend, '0') > -1) {
|
||||
$perDay = bcdiv($leftToSpend, (string) $days);
|
||||
@@ -549,8 +549,8 @@ class BasicController extends Controller
|
||||
$currencyId = (int) $row['currency_id'];
|
||||
$spentInCurrency = $row['sum'];
|
||||
$perDay = '0';
|
||||
if (0 !== $days && -1 === bccomp($spentInCurrency, '0')) {
|
||||
$perDay = bcdiv($spentInCurrency, (string) $days);
|
||||
if (0 !== $days && -1 === bccomp((string) $spentInCurrency, '0')) {
|
||||
$perDay = bcdiv((string) $spentInCurrency, (string) $days);
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Spent %s %s', $row['currency_code'], $row['sum']));
|
||||
@@ -631,7 +631,7 @@ class BasicController extends Controller
|
||||
continue;
|
||||
}
|
||||
$amount = $data['balance'];
|
||||
if (0 === bccomp($amount, '0')) {
|
||||
if (0 === bccomp((string) $amount, '0')) {
|
||||
continue;
|
||||
}
|
||||
// return stuff
|
||||
|
@@ -85,7 +85,7 @@ class ChartRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ class MoveTransactionsRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -74,7 +74,7 @@ class TransactionRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -144,7 +144,7 @@ class UpdateRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -58,9 +58,7 @@ class StoreRequest extends FormRequest
|
||||
{
|
||||
$models = config('firefly.valid_attachment_models');
|
||||
$models = array_map(
|
||||
static function (string $className) {
|
||||
return str_replace('FireflyIII\Models\\', '', $className);
|
||||
},
|
||||
static fn(string $className) => str_replace('FireflyIII\Models\\', '', $className),
|
||||
$models
|
||||
);
|
||||
$models = implode(',', $models);
|
||||
|
@@ -60,9 +60,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
$models = config('firefly.valid_attachment_models');
|
||||
$models = array_map(
|
||||
static function (string $className) {
|
||||
return str_replace('FireflyIII\Models\\', '', $className);
|
||||
},
|
||||
static fn(string $className) => str_replace('FireflyIII\Models\\', '', $className),
|
||||
$models
|
||||
);
|
||||
$models = implode(',', $models);
|
||||
|
@@ -90,7 +90,7 @@ class Request extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -129,7 +129,7 @@ class StoreRequest extends FormRequest
|
||||
$failed = false;
|
||||
}
|
||||
if ($failed) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -110,7 +110,7 @@ class UpdateRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ class StoreRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -106,7 +106,7 @@ class UpdateRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -96,7 +96,7 @@ class UpdateRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -126,7 +126,7 @@ class StoreRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -193,7 +193,7 @@ class StoreRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -208,7 +208,7 @@ class UpdateRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -148,7 +148,7 @@ class StoreRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -168,7 +168,7 @@ class UpdateRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -300,7 +300,7 @@ class StoreRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -359,7 +359,7 @@ class UpdateRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ class StoreRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -80,7 +80,7 @@ class UpdateRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -99,7 +99,7 @@ class UserUpdateRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -61,13 +61,11 @@ class CategoryController extends Controller
|
||||
$queryParameters = $request->getParameters();
|
||||
$result = $this->repository->searchCategory($queryParameters['query'], $queryParameters['size']);
|
||||
$filtered = $result->map(
|
||||
static function (Category $item) {
|
||||
return [
|
||||
'id' => (string) $item->id,
|
||||
'title' => $item->name,
|
||||
'meta' => [],
|
||||
];
|
||||
}
|
||||
static fn(Category $item) => [
|
||||
'id' => (string) $item->id,
|
||||
'title' => $item->name,
|
||||
'meta' => [],
|
||||
]
|
||||
);
|
||||
|
||||
return response()->json($filtered);
|
||||
|
@@ -61,15 +61,13 @@ class TagController extends Controller
|
||||
$queryParameters = $request->getParameters();
|
||||
$result = $this->repository->searchTag($queryParameters['query']);
|
||||
$filtered = $result->map(
|
||||
static function (Tag $item) {
|
||||
return [
|
||||
'id' => (string) $item->id,
|
||||
'title' => $item->tag,
|
||||
'value' => (string) $item->id,
|
||||
'label' => $item->tag,
|
||||
'meta' => [],
|
||||
];
|
||||
}
|
||||
static fn(Tag $item) => [
|
||||
'id' => (string) $item->id,
|
||||
'title' => $item->tag,
|
||||
'value' => (string) $item->id,
|
||||
'label' => $item->tag,
|
||||
'meta' => [],
|
||||
]
|
||||
);
|
||||
|
||||
return response()->json($filtered);
|
||||
|
@@ -212,13 +212,13 @@ class BudgetController extends Controller
|
||||
foreach ($currentBudgetArray['transaction_journals'] as $journal) {
|
||||
// convert the amount to the native currency.
|
||||
$rate = $converter->getCurrencyRate($this->currencies[$currencyId], $this->currency, $journal['date']);
|
||||
$convertedAmount = bcmul($journal['amount'], $rate);
|
||||
$convertedAmount = bcmul((string) $journal['amount'], $rate);
|
||||
if ($journal['foreign_currency_id'] === $this->currency->id) {
|
||||
$convertedAmount = $journal['foreign_amount'];
|
||||
}
|
||||
|
||||
$return[$currencyId]['spent'] = bcadd($return[$currencyId]['spent'], $journal['amount']);
|
||||
$return[$currencyId]['native_spent'] = bcadd($return[$currencyId]['native_spent'], $convertedAmount);
|
||||
$return[$currencyId]['spent'] = bcadd($return[$currencyId]['spent'], (string) $journal['amount']);
|
||||
$return[$currencyId]['native_spent'] = bcadd($return[$currencyId]['native_spent'], (string) $convertedAmount);
|
||||
}
|
||||
}
|
||||
$converter->summarize();
|
||||
@@ -275,15 +275,15 @@ class BudgetController extends Controller
|
||||
}
|
||||
$result = $this->processExpenses($budget->id, $filtered, $limit->start_date, $end);
|
||||
if (1 === count($result)) {
|
||||
$compare = bccomp($limit->amount, app('steam')->positive($result[$limitCurrencyId]['spent']));
|
||||
$compare = bccomp($limit->amount, (string) app('steam')->positive($result[$limitCurrencyId]['spent']));
|
||||
if (1 === $compare) {
|
||||
// convert this amount into the native currency:
|
||||
$result[$limitCurrencyId]['left'] = bcadd($limit->amount, $result[$limitCurrencyId]['spent']);
|
||||
$result[$limitCurrencyId]['native_left'] = bcadd($convertedLimitAmount, $result[$limitCurrencyId]['native_spent']);
|
||||
$result[$limitCurrencyId]['left'] = bcadd($limit->amount, (string) $result[$limitCurrencyId]['spent']);
|
||||
$result[$limitCurrencyId]['native_left'] = bcadd($convertedLimitAmount, (string) $result[$limitCurrencyId]['native_spent']);
|
||||
}
|
||||
if ($compare <= 0) {
|
||||
$result[$limitCurrencyId]['overspent'] = app('steam')->positive(bcadd($limit->amount, $result[$limitCurrencyId]['spent']));
|
||||
$result[$limitCurrencyId]['native_overspent'] = app('steam')->positive(bcadd($convertedLimitAmount, $result[$limitCurrencyId]['native_spent']));
|
||||
$result[$limitCurrencyId]['overspent'] = app('steam')->positive(bcadd($limit->amount, (string) $result[$limitCurrencyId]['spent']));
|
||||
$result[$limitCurrencyId]['native_overspent'] = app('steam')->positive(bcadd($convertedLimitAmount, (string) $result[$limitCurrencyId]['native_spent']));
|
||||
}
|
||||
}
|
||||
$converter->summarize();
|
||||
|
@@ -100,7 +100,7 @@ class CategoryController extends Controller
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$currency = $currencies[$currencyId] ?? $this->currencyRepos->find($currencyId);
|
||||
$currencies[$currencyId] = $currency;
|
||||
$categoryName = null === $journal['category_name'] ? (string) trans('firefly.no_category') : $journal['category_name'];
|
||||
$categoryName = $journal['category_name'] ?? (string) trans('firefly.no_category');
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$nativeAmount = $converter->convert($default, $currency, $journal['date'], $amount);
|
||||
$key = sprintf('%s-%s', $categoryName, $currency->code);
|
||||
@@ -128,15 +128,13 @@ class CategoryController extends Controller
|
||||
];
|
||||
|
||||
// add monies
|
||||
$return[$key]['amount'] = bcadd($return[$key]['amount'], $amount);
|
||||
$return[$key]['native_amount'] = bcadd($return[$key]['native_amount'], $nativeAmount);
|
||||
$return[$key]['amount'] = bcadd($return[$key]['amount'], (string) $amount);
|
||||
$return[$key]['native_amount'] = bcadd($return[$key]['native_amount'], (string) $nativeAmount);
|
||||
}
|
||||
$return = array_values($return);
|
||||
|
||||
// order by native amount
|
||||
usort($return, static function (array $a, array $b) {
|
||||
return (float) $a['native_amount'] < (float) $b['native_amount'] ? 1 : -1;
|
||||
});
|
||||
usort($return, static fn(array $a, array $b) => (float) $a['native_amount'] < (float) $b['native_amount'] ? 1 : -1);
|
||||
$converter->summarize();
|
||||
|
||||
return response()->json($this->clean($return));
|
||||
|
@@ -174,8 +174,8 @@ class BasicController extends Controller
|
||||
* @var array $info
|
||||
*/
|
||||
foreach ($paidAmount as $info) {
|
||||
$amount = bcmul($info['sum'], '-1');
|
||||
$nativeAmount = bcmul($info['native_sum'], '-1');
|
||||
$amount = bcmul((string) $info['sum'], '-1');
|
||||
$nativeAmount = bcmul((string) $info['native_sum'], '-1');
|
||||
$return[] = [
|
||||
'key' => sprintf('bills-paid-in-%s', $info['currency_code']),
|
||||
'value' => $amount,
|
||||
@@ -198,8 +198,8 @@ class BasicController extends Controller
|
||||
* @var array $info
|
||||
*/
|
||||
foreach ($unpaidAmount as $info) {
|
||||
$amount = bcmul($info['sum'], '-1');
|
||||
$nativeAmount = bcmul($info['native_sum'], '-1');
|
||||
$amount = bcmul((string) $info['sum'], '-1');
|
||||
$nativeAmount = bcmul((string) $info['native_sum'], '-1');
|
||||
$return[] = [
|
||||
'key' => sprintf('bills-unpaid-in-%s', $info['currency_code']),
|
||||
'value' => $amount,
|
||||
@@ -279,8 +279,8 @@ class BasicController extends Controller
|
||||
if ((int) $journal['foreign_currency_id'] === $default->id) {
|
||||
$amountNative = $journal['foreign_amount'];
|
||||
}
|
||||
$spent = bcadd($spent, $amount);
|
||||
$spentNative = bcadd($spentNative, $amountNative);
|
||||
$spent = bcadd($spent, (string) $amount);
|
||||
$spentNative = bcadd($spentNative, (string) $amountNative);
|
||||
}
|
||||
app('log')->debug(sprintf('Total spent in budget "%s" is %s', $budget['name'], $spent));
|
||||
}
|
||||
|
@@ -84,7 +84,7 @@ class BalanceChartRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ class ChartRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -83,7 +83,7 @@ class DashboardChartRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -311,7 +311,7 @@ class StoreRequest extends FormRequest
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -64,6 +64,7 @@ class UpdateRequest extends Request
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
#[\Override]
|
||||
public function getAll(): array
|
||||
{
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
@@ -247,6 +248,7 @@ class UpdateRequest extends Request
|
||||
/**
|
||||
* The rules that the incoming request must be matched against.
|
||||
*/
|
||||
#[\Override]
|
||||
public function rules(): array
|
||||
{
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
@@ -330,6 +332,7 @@ class UpdateRequest extends Request
|
||||
/**
|
||||
* Configure the validator instance.
|
||||
*/
|
||||
#[\Override]
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
app('log')->debug('Now in withValidator');
|
||||
@@ -361,7 +364,7 @@ class UpdateRequest extends Request
|
||||
}
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -175,7 +175,7 @@ class CorrectsAmounts extends Command
|
||||
{
|
||||
try {
|
||||
$check = bccomp((string) $item->trigger_value, '0');
|
||||
} catch (\ValueError $e) {
|
||||
} catch (\ValueError) {
|
||||
$this->friendlyError(sprintf('Rule #%d contained invalid %s-trigger "%s". The trigger has been removed, and the rule is disabled.', $item->rule_id, $item->trigger_type, $item->trigger_value));
|
||||
$item->rule->active = false;
|
||||
$item->rule->save();
|
||||
|
@@ -115,9 +115,7 @@ class CorrectsCurrencies extends Command
|
||||
$found = array_values(
|
||||
array_filter(
|
||||
$found,
|
||||
static function (int $currencyId) {
|
||||
return 0 !== $currencyId;
|
||||
}
|
||||
static fn(int $currencyId) => 0 !== $currencyId
|
||||
)
|
||||
);
|
||||
|
||||
|
@@ -48,8 +48,8 @@ class CorrectsLongDescriptions extends Command
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
if (strlen($journal->description) > self::MAX_LENGTH) {
|
||||
$journal->description = substr($journal->description, 0, self::MAX_LENGTH);
|
||||
if (strlen((string) $journal->description) > self::MAX_LENGTH) {
|
||||
$journal->description = substr((string) $journal->description, 0, self::MAX_LENGTH);
|
||||
$journal->save();
|
||||
$this->friendlyWarning(sprintf('Truncated description of transaction journal #%d', $journal->id));
|
||||
++$count;
|
||||
@@ -61,7 +61,7 @@ class CorrectsLongDescriptions extends Command
|
||||
/** @var TransactionGroup $group */
|
||||
foreach ($groups as $group) {
|
||||
if (strlen((string) $group->title) > self::MAX_LENGTH) {
|
||||
$group->title = substr($group->title, 0, self::MAX_LENGTH);
|
||||
$group->title = substr((string) $group->title, 0, self::MAX_LENGTH);
|
||||
$group->save();
|
||||
$this->friendlyWarning(sprintf('Truncated description of transaction group #%d', $group->id));
|
||||
++$count;
|
||||
|
@@ -128,9 +128,7 @@ class CorrectsNativeAmounts extends Command
|
||||
$repository->setUserGroup($userGroup);
|
||||
$set = $repository->getPiggyBanks();
|
||||
$set = $set->filter(
|
||||
static function (PiggyBank $piggyBank) use ($currency) {
|
||||
return $currency->id !== $piggyBank->transaction_currency_id;
|
||||
}
|
||||
static fn(PiggyBank $piggyBank) => $currency->id !== $piggyBank->transaction_currency_id
|
||||
);
|
||||
foreach ($set as $piggyBank) {
|
||||
$piggyBank->encrypted = false;
|
||||
|
@@ -100,7 +100,7 @@ class CorrectsRecurringTransactions extends Command
|
||||
$destination = $transaction->destinationAccount;
|
||||
$type = $recurrence->transactionType;
|
||||
$link = config(sprintf('firefly.account_to_transaction.%s.%s', $source->accountType->type, $destination->accountType->type));
|
||||
if (null !== $link && strtolower($type->type) !== strtolower($link)) {
|
||||
if (null !== $link && strtolower((string) $type->type) !== strtolower($link)) {
|
||||
$this->friendlyWarning(
|
||||
sprintf('Recurring transaction #%d should be a "%s" but is a "%s" and will be corrected.', $recurrence->id, $link, $type->type)
|
||||
);
|
||||
|
@@ -115,9 +115,7 @@ class CorrectsTransactionTypes extends Command
|
||||
private function getSourceAccount(TransactionJournal $journal): Account
|
||||
{
|
||||
$collection = $journal->transactions->filter(
|
||||
static function (Transaction $transaction) {
|
||||
return $transaction->amount < 0;
|
||||
}
|
||||
static fn(Transaction $transaction) => $transaction->amount < 0
|
||||
);
|
||||
if (0 === $collection->count()) {
|
||||
throw new FireflyException(sprintf('300001: Journal #%d has no source transaction.', $journal->id));
|
||||
@@ -144,9 +142,7 @@ class CorrectsTransactionTypes extends Command
|
||||
private function getDestinationAccount(TransactionJournal $journal): Account
|
||||
{
|
||||
$collection = $journal->transactions->filter(
|
||||
static function (Transaction $transaction) {
|
||||
return $transaction->amount > 0;
|
||||
}
|
||||
static fn(Transaction $transaction) => $transaction->amount > 0
|
||||
);
|
||||
if (0 === $collection->count()) {
|
||||
throw new FireflyException(sprintf('300004: Journal #%d has no destination transaction.', $journal->id));
|
||||
|
@@ -184,7 +184,7 @@ class CorrectsUnevenAmount extends Command
|
||||
return;
|
||||
}
|
||||
|
||||
$amount = bcmul('-1', $source->amount);
|
||||
$amount = bcmul('-1', (string) $source->amount);
|
||||
|
||||
// fix amount of destination:
|
||||
/** @var null|Transaction $destination */
|
||||
@@ -249,9 +249,9 @@ class CorrectsUnevenAmount extends Command
|
||||
// Log::debug(sprintf('[c] %s', var_export($source->transaction_currency_id === $destination->foreign_currency_id,true)));
|
||||
// Log::debug(sprintf('[d] %s', var_export((int) $destination->transaction_currency_id ===(int) $source->foreign_currency_id, true)));
|
||||
|
||||
if (0 === bccomp(app('steam')->positive($source->amount), app('steam')->positive($destination->foreign_amount))
|
||||
if (0 === bccomp((string) app('steam')->positive($source->amount), (string) app('steam')->positive($destination->foreign_amount))
|
||||
&& $source->transaction_currency_id === $destination->foreign_currency_id
|
||||
&& 0 === bccomp(app('steam')->positive($destination->amount), app('steam')->positive($source->foreign_amount))
|
||||
&& 0 === bccomp((string) app('steam')->positive($destination->amount), (string) app('steam')->positive($source->foreign_amount))
|
||||
&& (int) $destination->transaction_currency_id === (int) $source->foreign_currency_id
|
||||
) {
|
||||
return true;
|
||||
|
@@ -78,8 +78,8 @@ class UpgradesRuleActions extends Command
|
||||
|
||||
/** @var RuleAction $action */
|
||||
foreach ($actions as $action) {
|
||||
if (str_starts_with($action->action_value, '=')) {
|
||||
$action->action_value = sprintf('%s%s', '\=', substr($action->action_value, 1));
|
||||
if (str_starts_with((string) $action->action_value, '=')) {
|
||||
$action->action_value = sprintf('%s%s', '\=', substr((string) $action->action_value, 1));
|
||||
$action->save();
|
||||
++$count;
|
||||
}
|
||||
|
@@ -179,9 +179,7 @@ class UpgradesToGroups extends Command
|
||||
private function getDestinationTransactions(TransactionJournal $journal): Collection
|
||||
{
|
||||
return $journal->transactions->filter(
|
||||
static function (Transaction $transaction) {
|
||||
return $transaction->amount > 0;
|
||||
}
|
||||
static fn(Transaction $transaction) => $transaction->amount > 0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -236,7 +234,7 @@ class UpgradesToGroups extends Command
|
||||
$categoryId = $this->getTransactionCategory($transaction, $opposingTr) ?? $categoryId;
|
||||
|
||||
return [
|
||||
'type' => strtolower($journal->transactionType->type),
|
||||
'type' => strtolower((string) $journal->transactionType->type),
|
||||
'date' => $journal->date,
|
||||
'user' => $journal->user,
|
||||
'user_group' => $journal->user->userGroup,
|
||||
|
@@ -46,12 +46,12 @@ class UpgradesTransferCurrencies extends Command
|
||||
private JournalCLIRepositoryInterface $cliRepos;
|
||||
private int $count;
|
||||
|
||||
private ?Account $destinationAccount;
|
||||
private ?TransactionCurrency $destinationCurrency;
|
||||
private ?Transaction $destinationTransaction;
|
||||
private ?Account $sourceAccount;
|
||||
private ?TransactionCurrency $sourceCurrency;
|
||||
private ?Transaction $sourceTransaction;
|
||||
private ?Account $destinationAccount = null;
|
||||
private ?TransactionCurrency $destinationCurrency = null;
|
||||
private ?Transaction $destinationTransaction = null;
|
||||
private ?Account $sourceAccount = null;
|
||||
private ?TransactionCurrency $sourceCurrency = null;
|
||||
private ?Transaction $sourceTransaction = null;
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
|
@@ -35,6 +35,7 @@ class Kernel extends ConsoleKernel
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*/
|
||||
#[\Override]
|
||||
protected function commands(): void
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
@@ -45,6 +46,7 @@ class Kernel extends ConsoleKernel
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*/
|
||||
#[\Override]
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
$schedule->call(
|
||||
|
@@ -36,15 +36,12 @@ class InvitationCreated extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public InvitedUser $invitee;
|
||||
|
||||
public TransactionGroup $transactionGroup;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(InvitedUser $invitee)
|
||||
public function __construct(public InvitedUser $invitee)
|
||||
{
|
||||
$this->invitee = $invitee;
|
||||
}
|
||||
}
|
||||
|
@@ -34,14 +34,11 @@ class DestroyedTransactionGroup extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public TransactionGroup $transactionGroup;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(TransactionGroup $transactionGroup)
|
||||
public function __construct(public TransactionGroup $transactionGroup)
|
||||
{
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
$this->transactionGroup = $transactionGroup;
|
||||
}
|
||||
}
|
||||
|
@@ -32,15 +32,12 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class DestroyedTransactionLink extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
private TransactionJournalLink $link; // @phpstan-ignore-line
|
||||
use SerializesModels; // @phpstan-ignore-line
|
||||
|
||||
/**
|
||||
* DestroyedTransactionLink constructor.
|
||||
*/
|
||||
public function __construct(TransactionJournalLink $link)
|
||||
public function __construct(private TransactionJournalLink $link)
|
||||
{
|
||||
$this->link = $link;
|
||||
}
|
||||
}
|
||||
|
@@ -34,13 +34,10 @@ class DetectedNewIPAddress extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public User $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance. This event is triggered when a new user registers.
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
public function __construct(public User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
|
@@ -31,10 +31,7 @@ class Updated
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public Account $account;
|
||||
|
||||
public function __construct(Account $account)
|
||||
public function __construct(public Account $account)
|
||||
{
|
||||
$this->account = $account;
|
||||
}
|
||||
}
|
||||
|
@@ -35,10 +35,7 @@ class Created extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public BudgetLimit $budgetLimit;
|
||||
|
||||
public function __construct(BudgetLimit $budgetLimit)
|
||||
public function __construct(public BudgetLimit $budgetLimit)
|
||||
{
|
||||
$this->budgetLimit = $budgetLimit;
|
||||
}
|
||||
}
|
||||
|
@@ -35,10 +35,7 @@ class Deleted extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public BudgetLimit $budgetLimit;
|
||||
|
||||
public function __construct(BudgetLimit $budgetLimit)
|
||||
public function __construct(public BudgetLimit $budgetLimit)
|
||||
{
|
||||
$this->budgetLimit = $budgetLimit;
|
||||
}
|
||||
}
|
||||
|
@@ -35,10 +35,7 @@ class Updated extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public BudgetLimit $budgetLimit;
|
||||
|
||||
public function __construct(BudgetLimit $budgetLimit)
|
||||
public function __construct(public BudgetLimit $budgetLimit)
|
||||
{
|
||||
$this->budgetLimit = $budgetLimit;
|
||||
}
|
||||
}
|
||||
|
@@ -39,18 +39,14 @@ class ChangedAmount extends Event
|
||||
|
||||
public string $amount;
|
||||
public PiggyBank $piggyBank;
|
||||
public ?TransactionGroup $transactionGroup;
|
||||
public ?TransactionJournal $transactionJournal;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(PiggyBank $piggyBank, string $amount, ?TransactionJournal $transactionJournal, ?TransactionGroup $transactionGroup)
|
||||
public function __construct(PiggyBank $piggyBank, string $amount, public ?TransactionJournal $transactionJournal, public ?TransactionGroup $transactionGroup)
|
||||
{
|
||||
app('log')->debug(sprintf('Created piggy bank event for piggy bank #%d with amount %s', $piggyBank->id, $amount));
|
||||
$this->piggyBank = $piggyBank;
|
||||
$this->transactionJournal = $transactionJournal;
|
||||
$this->transactionGroup = $transactionGroup;
|
||||
$this->amount = $amount;
|
||||
}
|
||||
}
|
||||
|
@@ -34,15 +34,8 @@ class RuleActionFailedOnArray
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public string $error;
|
||||
public array $journal;
|
||||
public RuleAction $ruleAction;
|
||||
|
||||
public function __construct(RuleAction $ruleAction, array $journal, string $error)
|
||||
public function __construct(public RuleAction $ruleAction, public array $journal, public string $error)
|
||||
{
|
||||
app('log')->debug('Created new RuleActionFailedOnArray');
|
||||
$this->ruleAction = $ruleAction;
|
||||
$this->journal = $journal;
|
||||
$this->error = $error;
|
||||
}
|
||||
}
|
||||
|
@@ -35,15 +35,8 @@ class RuleActionFailedOnObject
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public string $error;
|
||||
public TransactionJournal $journal;
|
||||
public RuleAction $ruleAction;
|
||||
|
||||
public function __construct(RuleAction $ruleAction, TransactionJournal $journal, string $error)
|
||||
public function __construct(public RuleAction $ruleAction, public TransactionJournal $journal, public string $error)
|
||||
{
|
||||
app('log')->debug('Created new RuleActionFailedOnObject');
|
||||
$this->ruleAction = $ruleAction;
|
||||
$this->journal = $journal;
|
||||
$this->error = $error;
|
||||
}
|
||||
}
|
||||
|
@@ -34,14 +34,11 @@ class NewVersionAvailable extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public string $message;
|
||||
|
||||
/**
|
||||
* Create a new event instance. This event is triggered when a new version is available.
|
||||
*/
|
||||
public function __construct(string $message)
|
||||
public function __construct(public string $message)
|
||||
{
|
||||
Log::debug(__METHOD__);
|
||||
$this->message = $message;
|
||||
}
|
||||
}
|
||||
|
@@ -33,11 +33,8 @@ class UserGroupChangedDefaultCurrency extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public UserGroup $userGroup;
|
||||
|
||||
public function __construct(UserGroup $userGroup)
|
||||
public function __construct(public UserGroup $userGroup)
|
||||
{
|
||||
Log::debug('User group changed default currency.');
|
||||
$this->userGroup = $userGroup;
|
||||
}
|
||||
}
|
||||
|
@@ -35,15 +35,10 @@ class RegisteredUser extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public OwnerNotifiable $owner;
|
||||
public User $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance. This event is triggered when a new user registers.
|
||||
*/
|
||||
public function __construct(OwnerNotifiable $owner, User $user)
|
||||
public function __construct(public OwnerNotifiable $owner, public User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->owner = $owner;
|
||||
}
|
||||
}
|
||||
|
@@ -39,17 +39,12 @@ class RequestedReportOnJournals
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public Collection $groups;
|
||||
public int $userId;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(int $userId, Collection $groups)
|
||||
public function __construct(public int $userId, public Collection $groups)
|
||||
{
|
||||
app('log')->debug('In event RequestedReportOnJournals.');
|
||||
$this->userId = $userId;
|
||||
$this->groups = $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -34,14 +34,11 @@ class RequestedVersionCheckStatus extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public User $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance. This event is triggered when Firefly III wants to know
|
||||
* what the deal is with the version checker.
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
public function __construct(public User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
|
@@ -32,15 +32,12 @@ use Illuminate\Queue\SerializesModels;
|
||||
class MFABackupFewLeft extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public int $count;
|
||||
public User $user;
|
||||
|
||||
public function __construct(null|Authenticatable|User $user, int $count)
|
||||
public function __construct(null|Authenticatable|User $user, public int $count)
|
||||
{
|
||||
if ($user instanceof User) {
|
||||
$this->user = $user;
|
||||
}
|
||||
$this->count = $count;
|
||||
}
|
||||
}
|
||||
|
@@ -32,15 +32,12 @@ use Illuminate\Queue\SerializesModels;
|
||||
class MFAManyFailedAttempts extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public int $count;
|
||||
public User $user;
|
||||
|
||||
public function __construct(null|Authenticatable|User $user, int $count)
|
||||
public function __construct(null|Authenticatable|User $user, public int $count)
|
||||
{
|
||||
if ($user instanceof User) {
|
||||
$this->user = $user;
|
||||
}
|
||||
$this->count = $count;
|
||||
}
|
||||
}
|
||||
|
@@ -30,10 +30,7 @@ class UnknownUserAttemptedLogin
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public string $address;
|
||||
|
||||
public function __construct(string $address)
|
||||
public function __construct(public string $address)
|
||||
{
|
||||
$this->address = $address;
|
||||
}
|
||||
}
|
||||
|
@@ -34,13 +34,10 @@ class StoredAccount extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public Account $account;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(Account $account)
|
||||
public function __construct(public Account $account)
|
||||
{
|
||||
$this->account = $account;
|
||||
}
|
||||
}
|
||||
|
@@ -34,17 +34,10 @@ class StoredTransactionGroup extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public bool $applyRules;
|
||||
public bool $fireWebhooks;
|
||||
public TransactionGroup $transactionGroup;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(TransactionGroup $transactionGroup, bool $applyRules, bool $fireWebhooks)
|
||||
public function __construct(public TransactionGroup $transactionGroup, public bool $applyRules, public bool $fireWebhooks)
|
||||
{
|
||||
$this->transactionGroup = $transactionGroup;
|
||||
$this->fireWebhooks = $fireWebhooks;
|
||||
$this->applyRules = $applyRules;
|
||||
}
|
||||
}
|
||||
|
@@ -32,15 +32,13 @@ class OwnerTestNotificationChannel
|
||||
use SerializesModels;
|
||||
|
||||
public string $channel;
|
||||
public OwnerNotifiable $owner;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(string $channel, OwnerNotifiable $owner)
|
||||
public function __construct(string $channel, public OwnerNotifiable $owner)
|
||||
{
|
||||
app('log')->debug(sprintf('Triggered OwnerTestNotificationChannel("%s")', $channel));
|
||||
$this->owner = $owner;
|
||||
$this->channel = $channel;
|
||||
}
|
||||
}
|
||||
|
@@ -32,15 +32,13 @@ class UserTestNotificationChannel
|
||||
use SerializesModels;
|
||||
|
||||
public string $channel;
|
||||
public User $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(string $channel, User $user)
|
||||
public function __construct(string $channel, public User $user)
|
||||
{
|
||||
app('log')->debug(sprintf('Triggered UserTestNotificationChannel("%s")', $channel));
|
||||
$this->user = $user;
|
||||
$this->channel = $channel;
|
||||
}
|
||||
}
|
||||
|
@@ -34,23 +34,12 @@ class TriggeredAuditLog extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public mixed $after;
|
||||
public Model $auditable;
|
||||
public mixed $before;
|
||||
public Model $changer;
|
||||
public string $field;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @SuppressWarnings("PHPMD.ExcessiveParameterList")
|
||||
*/
|
||||
public function __construct(Model $changer, Model $auditable, string $field, mixed $before, mixed $after)
|
||||
public function __construct(public Model $changer, public Model $auditable, public string $field, public mixed $before, public mixed $after)
|
||||
{
|
||||
$this->changer = $changer;
|
||||
$this->auditable = $auditable;
|
||||
$this->field = $field;
|
||||
$this->before = $before;
|
||||
$this->after = $after;
|
||||
}
|
||||
}
|
||||
|
@@ -34,13 +34,10 @@ class UpdatedAccount extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public Account $account;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(Account $account)
|
||||
public function __construct(public Account $account)
|
||||
{
|
||||
$this->account = $account;
|
||||
}
|
||||
}
|
||||
|
@@ -34,17 +34,10 @@ class UpdatedTransactionGroup extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public bool $applyRules;
|
||||
public bool $fireWebhooks;
|
||||
public TransactionGroup $transactionGroup;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(TransactionGroup $transactionGroup, bool $applyRules, bool $fireWebhooks)
|
||||
public function __construct(public TransactionGroup $transactionGroup, public bool $applyRules, public bool $fireWebhooks)
|
||||
{
|
||||
$this->transactionGroup = $transactionGroup;
|
||||
$this->fireWebhooks = $fireWebhooks;
|
||||
$this->applyRules = $applyRules;
|
||||
}
|
||||
}
|
||||
|
@@ -34,17 +34,10 @@ class UserChangedEmail extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public string $newEmail;
|
||||
public string $oldEmail;
|
||||
public User $user;
|
||||
|
||||
/**
|
||||
* UserChangedEmail constructor.
|
||||
*/
|
||||
public function __construct(User $user, string $newEmail, string $oldEmail)
|
||||
public function __construct(public User $user, public string $newEmail, public string $oldEmail)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->oldEmail = $oldEmail;
|
||||
$this->newEmail = $newEmail;
|
||||
}
|
||||
}
|
||||
|
@@ -34,14 +34,7 @@ class WarnUserAboutBill extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public Bill $bill;
|
||||
public int $diff;
|
||||
public string $field;
|
||||
|
||||
public function __construct(Bill $bill, string $field, int $diff)
|
||||
public function __construct(public Bill $bill, public string $field, public int $diff)
|
||||
{
|
||||
$this->bill = $bill;
|
||||
$this->field = $field;
|
||||
$this->diff = $diff;
|
||||
}
|
||||
}
|
||||
|
@@ -49,6 +49,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
*
|
||||
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
|
||||
*/
|
||||
#[\Override]
|
||||
public function render($request, \Throwable $e): Response
|
||||
{
|
||||
$route = $request->route();
|
||||
@@ -217,7 +218,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
return redirect(route('accounts.index', ['asset']));
|
||||
}
|
||||
|
||||
return redirect(route('transactions.index', [strtolower($type)]));
|
||||
return redirect(route('transactions.index', [strtolower((string) $type)]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -69,6 +69,7 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*/
|
||||
#[\Override]
|
||||
public function register(): void {}
|
||||
|
||||
/**
|
||||
@@ -82,6 +83,7 @@ class Handler extends ExceptionHandler
|
||||
* @SuppressWarnings("PHPMD.NPathComplexity")
|
||||
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
|
||||
*/
|
||||
#[\Override]
|
||||
public function render($request, \Throwable $e): Response
|
||||
{
|
||||
$expectsJson = $request->expectsJson();
|
||||
@@ -149,12 +151,12 @@ class Handler extends ExceptionHandler
|
||||
|
||||
$isDebug = (bool) config('app.debug', false);
|
||||
if ($isDebug) {
|
||||
app('log')->debug(sprintf('Return JSON %s with debug.', get_class($e)));
|
||||
app('log')->debug(sprintf('Return JSON %s with debug.', $e::class));
|
||||
|
||||
return response()->json(
|
||||
[
|
||||
'message' => $e->getMessage(),
|
||||
'exception' => get_class($e),
|
||||
'exception' => $e::class,
|
||||
'line' => $e->getLine(),
|
||||
'file' => $e->getFile(),
|
||||
'trace' => $e->getTrace(),
|
||||
@@ -162,7 +164,7 @@ class Handler extends ExceptionHandler
|
||||
$errorCode
|
||||
);
|
||||
}
|
||||
app('log')->debug(sprintf('Return JSON %s.', get_class($e)));
|
||||
app('log')->debug(sprintf('Return JSON %s.', $e::class));
|
||||
|
||||
return response()->json(
|
||||
['message' => sprintf('Internal Firefly III Exception: %s', $e->getMessage()), 'exception' => 'UndisclosedException'],
|
||||
@@ -192,7 +194,7 @@ class Handler extends ExceptionHandler
|
||||
return response()->view('errors.FireflyException', ['exception' => $e, 'debug' => $isDebug], 500);
|
||||
}
|
||||
|
||||
app('log')->debug(sprintf('Error "%s" has no Firefly III treatment, parent will handle.', get_class($e)));
|
||||
app('log')->debug(sprintf('Error "%s" has no Firefly III treatment, parent will handle.', $e::class));
|
||||
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
@@ -202,6 +204,7 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
#[\Override]
|
||||
public function report(\Throwable $e): void
|
||||
{
|
||||
$doMailError = (bool) config('firefly.send_error_message');
|
||||
@@ -222,7 +225,7 @@ class Handler extends ExceptionHandler
|
||||
$headers = request()->headers->all();
|
||||
|
||||
$data = [
|
||||
'class' => get_class($e),
|
||||
'class' => $e::class,
|
||||
'errorMessage' => $e->getMessage(),
|
||||
'time' => \Safe\date('r'),
|
||||
'stackTrace' => $e->getTraceAsString(),
|
||||
@@ -250,9 +253,7 @@ class Handler extends ExceptionHandler
|
||||
{
|
||||
return null !== Arr::first(
|
||||
$this->dontReport,
|
||||
static function ($type) use ($e) {
|
||||
return $e instanceof $type;
|
||||
}
|
||||
static fn($type) => $e instanceof $type
|
||||
);
|
||||
}
|
||||
|
||||
@@ -261,6 +262,7 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* @param Request $request
|
||||
*/
|
||||
#[\Override]
|
||||
protected function invalid($request, LaravelValidationException $exception): \Illuminate\Http\Response|JsonResponse|RedirectResponse
|
||||
{
|
||||
// protect against open redirect when submitting invalid forms.
|
||||
|
@@ -44,7 +44,7 @@ class AttachmentFactory
|
||||
public function create(array $data): ?Attachment
|
||||
{
|
||||
// append if necessary.
|
||||
$model = !str_contains($data['attachable_type'], 'FireflyIII') ? sprintf('FireflyIII\Models\%s', $data['attachable_type'])
|
||||
$model = !str_contains((string) $data['attachable_type'], 'FireflyIII') ? sprintf('FireflyIII\Models\%s', $data['attachable_type'])
|
||||
: $data['attachable_type'];
|
||||
|
||||
// get journal instead of transaction.
|
||||
|
@@ -59,7 +59,7 @@ class RecurrenceFactory
|
||||
public function create(array $data): Recurrence
|
||||
{
|
||||
try {
|
||||
$type = $this->findTransactionType(ucfirst($data['recurrence']['type']));
|
||||
$type = $this->findTransactionType(ucfirst((string) $data['recurrence']['type']));
|
||||
} catch (FireflyException $e) {
|
||||
$message = sprintf('Cannot make a recurring transaction of type "%s"', $data['recurrence']['type']);
|
||||
app('log')->error($message);
|
||||
|
@@ -77,7 +77,7 @@ class TagFactory
|
||||
$array = [
|
||||
'user_id' => $this->user->id,
|
||||
'user_group_id' => $this->userGroup->id,
|
||||
'tag' => trim($data['tag']),
|
||||
'tag' => trim((string) $data['tag']),
|
||||
'tagMode' => 'nothing',
|
||||
'date' => $data['date'],
|
||||
'description' => $data['description'],
|
||||
|
@@ -41,7 +41,7 @@ class TransactionFactory
|
||||
private Account $account;
|
||||
private array $accountInformation;
|
||||
private TransactionCurrency $currency;
|
||||
private ?TransactionCurrency $foreignCurrency;
|
||||
private ?TransactionCurrency $foreignCurrency = null;
|
||||
private TransactionJournal $journal;
|
||||
private bool $reconciled;
|
||||
|
||||
|
@@ -35,7 +35,7 @@ use FireflyIII\User;
|
||||
*/
|
||||
class TransactionGroupFactory
|
||||
{
|
||||
private TransactionJournalFactory $journalFactory;
|
||||
private readonly TransactionJournalFactory $journalFactory;
|
||||
private User $user;
|
||||
private UserGroup $userGroup;
|
||||
|
||||
@@ -71,7 +71,7 @@ class TransactionGroupFactory
|
||||
$title = '' === $title ? null : $title;
|
||||
|
||||
if (null !== $title) {
|
||||
$title = substr($title, 0, 1000);
|
||||
$title = substr((string) $title, 0, 1000);
|
||||
}
|
||||
if (0 === $collection->count()) {
|
||||
throw new FireflyException('Created zero transaction journals.');
|
||||
|
@@ -31,6 +31,7 @@ class MultiYearReportGenerator extends MonthReportGenerator
|
||||
/**
|
||||
* Returns the preferred period.
|
||||
*/
|
||||
#[\Override]
|
||||
protected function preferredPeriod(): string
|
||||
{
|
||||
return 'year';
|
||||
|
@@ -31,6 +31,7 @@ class YearReportGenerator extends MonthReportGenerator
|
||||
/**
|
||||
* Returns the preferred period.
|
||||
*/
|
||||
#[\Override]
|
||||
protected function preferredPeriod(): string
|
||||
{
|
||||
return 'month';
|
||||
|
@@ -159,7 +159,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
}
|
||||
}
|
||||
|
||||
$newBalance = bcadd($startBalance, $transactionAmount);
|
||||
$newBalance = bcadd((string) $startBalance, (string) $transactionAmount);
|
||||
$journals[$index]['balance_after'] = $newBalance;
|
||||
$startBalance = $newBalance;
|
||||
|
||||
|
@@ -106,7 +106,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
*/
|
||||
private function generateMessage(Webhook $webhook, Model $model): void
|
||||
{
|
||||
$class = get_class($model);
|
||||
$class = $model::class;
|
||||
// Line is ignored because all of Firefly III's Models have an id property.
|
||||
app('log')->debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id));
|
||||
|
||||
|
@@ -194,12 +194,12 @@ class BudgetLimitHandler
|
||||
// if both equal each other, amount from this BL must be added to the AB
|
||||
if ($limitPeriod->equals($abPeriod)) {
|
||||
Log::debug('This budget limit is equal to the available budget period.');
|
||||
$newAmount = bcadd($newAmount, $budgetLimit->amount);
|
||||
$newAmount = bcadd($newAmount, (string) $budgetLimit->amount);
|
||||
}
|
||||
// if budget limit period is inside AB period, it can be added in full.
|
||||
if (!$limitPeriod->equals($abPeriod) && $abPeriod->contains($limitPeriod)) {
|
||||
Log::debug('This budget limit is smaller than the available budget period.');
|
||||
$newAmount = bcadd($newAmount, $budgetLimit->amount);
|
||||
$newAmount = bcadd($newAmount, (string) $budgetLimit->amount);
|
||||
}
|
||||
if (!$limitPeriod->equals($abPeriod) && !$abPeriod->contains($limitPeriod) && $abPeriod->overlapsWith($limitPeriod)) {
|
||||
Log::debug('This budget limit is something else entirely!');
|
||||
|
@@ -42,9 +42,7 @@ class WebhookEventHandler
|
||||
$messages = WebhookMessage::where('webhook_messages.sent', false)
|
||||
->get(['webhook_messages.*'])
|
||||
->filter(
|
||||
static function (WebhookMessage $message) {
|
||||
return $message->webhookAttempts()->count() <= 2;
|
||||
}
|
||||
static fn(WebhookMessage $message) => $message->webhookAttempts()->count() <= 2
|
||||
)->splice(0, 5)
|
||||
;
|
||||
app('log')->debug(sprintf('Found %d webhook message(s) ready to be send.', $messages->count()));
|
||||
|
@@ -185,7 +185,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model)));
|
||||
Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', $model::class));
|
||||
if (is_array($files)) {
|
||||
Log::debug('$files is an array.');
|
||||
|
||||
@@ -335,7 +335,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
{
|
||||
$md5 = \Safe\md5_file($file->getRealPath());
|
||||
$name = $file->getClientOriginalName();
|
||||
$class = get_class($model);
|
||||
$class = $model::class;
|
||||
$count = 0;
|
||||
// ignore lines about polymorphic calls.
|
||||
if ($model instanceof PiggyBank) {
|
||||
|
@@ -264,7 +264,7 @@ trait AccountCollection
|
||||
$date->subSecond();
|
||||
Log::debug(sprintf('accountBalanceIs: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
|
||||
$balance = Steam::finalAccountBalance($account, $date);
|
||||
$result = bccomp($balance['balance'], $value);
|
||||
$result = bccomp((string) $balance['balance'], $value);
|
||||
Log::debug(sprintf('"%s" vs "%s" is %d', $balance['balance'], $value, $result));
|
||||
|
||||
switch ($operator) {
|
||||
|
@@ -51,8 +51,8 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
$result = str_contains(strtolower($attachment['filename']), strtolower($name)) || str_contains(
|
||||
strtolower($attachment['title']),
|
||||
$result = str_contains(strtolower((string) $attachment['filename']), strtolower($name)) || str_contains(
|
||||
strtolower((string) $attachment['title']),
|
||||
strtolower($name)
|
||||
);
|
||||
if (true === $result) {
|
||||
@@ -131,8 +131,8 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
$result = !str_contains(strtolower($attachment['filename']), strtolower($name)) && !str_contains(
|
||||
strtolower($attachment['title']),
|
||||
$result = !str_contains(strtolower((string) $attachment['filename']), strtolower($name)) && !str_contains(
|
||||
strtolower((string) $attachment['title']),
|
||||
strtolower($name)
|
||||
);
|
||||
if (true === $result) {
|
||||
@@ -166,8 +166,8 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
$result = !str_ends_with(strtolower($attachment['filename']), strtolower($name)) && !str_ends_with(
|
||||
strtolower($attachment['title']),
|
||||
$result = !str_ends_with(strtolower((string) $attachment['filename']), strtolower($name)) && !str_ends_with(
|
||||
strtolower((string) $attachment['title']),
|
||||
strtolower($name)
|
||||
);
|
||||
if (true === $result) {
|
||||
@@ -201,8 +201,8 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
$result = !str_starts_with(strtolower($attachment['filename']), strtolower($name)) && !str_starts_with(
|
||||
strtolower($attachment['title']),
|
||||
$result = !str_starts_with(strtolower((string) $attachment['filename']), strtolower($name)) && !str_starts_with(
|
||||
strtolower((string) $attachment['title']),
|
||||
strtolower($name)
|
||||
);
|
||||
if (true === $result) {
|
||||
@@ -227,8 +227,8 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
$result = str_ends_with(strtolower($attachment['filename']), strtolower($name)) || str_ends_with(
|
||||
strtolower($attachment['title']),
|
||||
$result = str_ends_with(strtolower((string) $attachment['filename']), strtolower($name)) || str_ends_with(
|
||||
strtolower((string) $attachment['title']),
|
||||
strtolower($name)
|
||||
);
|
||||
if (true === $result) {
|
||||
@@ -299,8 +299,8 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
$result = str_starts_with(strtolower($attachment['filename']), strtolower($name)) || str_starts_with(
|
||||
strtolower($attachment['title']),
|
||||
$result = str_starts_with(strtolower((string) $attachment['filename']), strtolower($name)) || str_starts_with(
|
||||
strtolower((string) $attachment['title']),
|
||||
strtolower($name)
|
||||
);
|
||||
if (true === $result) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user