🤖 Auto commit for release 'develop' on 2025-07-20

This commit is contained in:
JC5
2025-07-20 18:45:16 +02:00
parent 63b0efcd81
commit 68655d60a6
3 changed files with 46 additions and 46 deletions

View File

@@ -66,23 +66,23 @@ class BillTransformer extends AbstractTransformer
*/ */
public function transform(Bill $bill): array public function transform(Bill $bill): array
{ {
$default = $this->parameters->get('defaultCurrency') ?? $this->default; $default = $this->parameters->get('defaultCurrency') ?? $this->default;
$paidData = $this->paidData($bill); $paidData = $this->paidData($bill);
$lastPaidDate = $this->getLastPaidDate($paidData); $lastPaidDate = $this->getLastPaidDate($paidData);
$start = $this->parameters->get('start') ?? today()->subYears(10); $start = $this->parameters->get('start') ?? today()->subYears(10);
$end = $this->parameters->get('end') ?? today()->addYears(10); $end = $this->parameters->get('end') ?? today()->addYears(10);
$payDates = $this->calculator->getPayDates($start, $end, $bill->date, $bill->repeat_freq, $bill->skip, $lastPaidDate); $payDates = $this->calculator->getPayDates($start, $end, $bill->date, $bill->repeat_freq, $bill->skip, $lastPaidDate);
$currency = $bill->transactionCurrency; $currency = $bill->transactionCurrency;
$notes = $this->repository->getNoteText($bill); $notes = $this->repository->getNoteText($bill);
$notes = '' === $notes ? null : $notes; $notes = '' === $notes ? null : $notes;
$objectGroupId = null; $objectGroupId = null;
$objectGroupOrder = null; $objectGroupOrder = null;
$objectGroupTitle = null; $objectGroupTitle = null;
$this->repository->setUser($bill->user); $this->repository->setUser($bill->user);
/** @var null|ObjectGroup $objectGroup */ /** @var null|ObjectGroup $objectGroup */
$objectGroup = $bill->objectGroups->first(); $objectGroup = $bill->objectGroups->first();
if (null !== $objectGroup) { if (null !== $objectGroup) {
$objectGroupId = $objectGroup->id; $objectGroupId = $objectGroup->id;
$objectGroupOrder = $objectGroup->order; $objectGroupOrder = $objectGroup->order;
@@ -92,7 +92,7 @@ class BillTransformer extends AbstractTransformer
$paidDataFormatted = []; $paidDataFormatted = [];
$payDatesFormatted = []; $payDatesFormatted = [];
foreach ($paidData as $object) { foreach ($paidData as $object) {
$date = Carbon::createFromFormat('!Y-m-d', $object['date'], config('app.timezone')); $date = Carbon::createFromFormat('!Y-m-d', $object['date'], config('app.timezone'));
if (!$date instanceof Carbon) { if (!$date instanceof Carbon) {
$date = today(config('app.timezone')); $date = today(config('app.timezone'));
} }
@@ -101,24 +101,24 @@ class BillTransformer extends AbstractTransformer
} }
foreach ($payDates as $string) { foreach ($payDates as $string) {
$date = Carbon::createFromFormat('!Y-m-d', $string, config('app.timezone')); $date = Carbon::createFromFormat('!Y-m-d', $string, config('app.timezone'));
if (!$date instanceof Carbon) { if (!$date instanceof Carbon) {
$date = today(config('app.timezone')); $date = today(config('app.timezone'));
} }
$payDatesFormatted[] = $date->toAtomString(); $payDatesFormatted[] = $date->toAtomString();
} }
// next expected match // next expected match
$nem = null; $nem = null;
$nemDate = null; $nemDate = null;
$nemDiff = trans('firefly.not_expected_period'); $nemDiff = trans('firefly.not_expected_period');
$firstPayDate = $payDates[0] ?? null; $firstPayDate = $payDates[0] ?? null;
if (null !== $firstPayDate) { if (null !== $firstPayDate) {
$nemDate = Carbon::createFromFormat('!Y-m-d', $firstPayDate, config('app.timezone')); $nemDate = Carbon::createFromFormat('!Y-m-d', $firstPayDate, config('app.timezone'));
if (!$nemDate instanceof Carbon) { if (!$nemDate instanceof Carbon) {
$nemDate = today(config('app.timezone')); $nemDate = today(config('app.timezone'));
} }
$nem = $nemDate->toAtomString(); $nem = $nemDate->toAtomString();
// nullify again when it's outside the current view range. // nullify again when it's outside the current view range.
if ( if (
@@ -139,7 +139,7 @@ class BillTransformer extends AbstractTransformer
$current = $payDatesFormatted[0] ?? null; $current = $payDatesFormatted[0] ?? null;
if (null !== $current && !$nemDate->isToday()) { if (null !== $current && !$nemDate->isToday()) {
$temp2 = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current); $temp2 = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
if (!$temp2 instanceof Carbon) { if (!$temp2 instanceof Carbon) {
$temp2 = today(config('app.timezone')); $temp2 = today(config('app.timezone'));
} }
@@ -185,7 +185,7 @@ class BillTransformer extends AbstractTransformer
'links' => [ 'links' => [
[ [
'rel' => 'self', 'rel' => 'self',
'uri' => '/bills/' . $bill->id, 'uri' => '/bills/'.$bill->id,
], ],
], ],
]; ];
@@ -207,13 +207,13 @@ class BillTransformer extends AbstractTransformer
// 2023-07-18 this particular date is used to search for the last paid date. // 2023-07-18 this particular date is used to search for the last paid date.
// 2023-07-18 the cloned $searchDate is used to grab the correct transactions. // 2023-07-18 the cloned $searchDate is used to grab the correct transactions.
/** @var Carbon $start */ /** @var Carbon $start */
$start = clone $this->parameters->get('start'); $start = clone $this->parameters->get('start');
$searchStart = clone $start; $searchStart = clone $start;
$start->subDay(); $start->subDay();
/** @var Carbon $end */ /** @var Carbon $end */
$end = clone $this->parameters->get('end'); $end = clone $this->parameters->get('end');
$searchEnd = clone $end; $searchEnd = clone $end;
// move the search dates to the start of the day. // move the search dates to the start of the day.
$searchStart->startOfDay(); $searchStart->startOfDay();
@@ -223,7 +223,7 @@ class BillTransformer extends AbstractTransformer
Log::debug(sprintf('Search parameters are: start: %s', $searchStart->format('Y-m-d'))); Log::debug(sprintf('Search parameters are: start: %s', $searchStart->format('Y-m-d')));
// Get from database when bill was paid. // Get from database when bill was paid.
$set = $this->repository->getPaidDatesInRange($bill, $searchStart, $searchEnd); $set = $this->repository->getPaidDatesInRange($bill, $searchStart, $searchEnd);
Log::debug(sprintf('Count %d entries in getPaidDatesInRange()', $set->count())); Log::debug(sprintf('Count %d entries in getPaidDatesInRange()', $set->count()));
// Grab from array the most recent payment. If none exist, fall back to the start date and pretend *that* was the last paid date. // Grab from array the most recent payment. If none exist, fall back to the start date and pretend *that* was the last paid date.
@@ -232,23 +232,23 @@ class BillTransformer extends AbstractTransformer
Log::debug(sprintf('Result of lastPaidDate is %s', $lastPaidDate->format('Y-m-d'))); Log::debug(sprintf('Result of lastPaidDate is %s', $lastPaidDate->format('Y-m-d')));
// At this point the "next match" is exactly after the last time the bill was paid. // At this point the "next match" is exactly after the last time the bill was paid.
$result = []; $result = [];
foreach ($set as $entry) { foreach ($set as $entry) {
$array = [ $array = [
'transaction_group_id' => (string)$entry->transaction_group_id, 'transaction_group_id' => (string)$entry->transaction_group_id,
'transaction_journal_id' => (string)$entry->id, 'transaction_journal_id' => (string)$entry->id,
'date' => $entry->date->format('Y-m-d'), 'date' => $entry->date->format('Y-m-d'),
'date_object' => $entry->date, 'date_object' => $entry->date,
'currency_id' => $entry->transaction_currency_id, 'currency_id' => $entry->transaction_currency_id,
'currency_code' => $entry->transaction_currency_code, 'currency_code' => $entry->transaction_currency_code,
'currency_decimal_places' => $entry->transaction_currency_decimal_places, 'currency_decimal_places' => $entry->transaction_currency_decimal_places,
'amount' => Steam::bcround($entry->amount,$entry->transaction_currency_decimal_places), 'amount' => Steam::bcround($entry->amount, $entry->transaction_currency_decimal_places),
]; ];
if (null !== $entry->foreign_amount && null !== $entry->foreign_currency_code) { if (null !== $entry->foreign_amount && null !== $entry->foreign_currency_code) {
$array['foreign_currency_id'] = $entry->foreign_currency_id; $array['foreign_currency_id'] = $entry->foreign_currency_id;
$array['foreign_currency_code'] = $entry->foreign_currency_code; $array['foreign_currency_code'] = $entry->foreign_currency_code;
$array['foreign_currency_decimal_places'] = $entry->foreign_currency_decimal_places; $array['foreign_currency_decimal_places'] = $entry->foreign_currency_decimal_places;
$array['foreign_amount'] = Steam::bcround($entry->foreign_amount,$entry->foreign_currency_decimal_places); $array['foreign_amount'] = Steam::bcround($entry->foreign_amount, $entry->foreign_currency_decimal_places);
} }
$result[] = $array; $result[] = $array;

12
composer.lock generated
View File

@@ -2619,16 +2619,16 @@
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "2.7.0", "version": "2.7.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/commonmark.git", "url": "https://github.com/thephpleague/commonmark.git",
"reference": "6fbb36d44824ed4091adbcf4c7d4a3923cdb3405" "reference": "10732241927d3971d28e7ea7b5712721fa2296ca"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/6fbb36d44824ed4091adbcf4c7d4a3923cdb3405", "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/10732241927d3971d28e7ea7b5712721fa2296ca",
"reference": "6fbb36d44824ed4091adbcf4c7d4a3923cdb3405", "reference": "10732241927d3971d28e7ea7b5712721fa2296ca",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2657,7 +2657,7 @@
"symfony/process": "^5.4 | ^6.0 | ^7.0", "symfony/process": "^5.4 | ^6.0 | ^7.0",
"symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0", "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0",
"unleashedtech/php-coding-standard": "^3.1.1", "unleashedtech/php-coding-standard": "^3.1.1",
"vimeo/psalm": "^4.24.0 || ^5.0.0" "vimeo/psalm": "^4.24.0 || ^5.0.0 || ^6.0.0"
}, },
"suggest": { "suggest": {
"symfony/yaml": "v2.3+ required if using the Front Matter extension" "symfony/yaml": "v2.3+ required if using the Front Matter extension"
@@ -2722,7 +2722,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-05-05T12:20:28+00:00" "time": "2025-07-20T12:47:49+00:00"
}, },
{ {
"name": "league/config", "name": "league/config",

View File

@@ -79,7 +79,7 @@ return [
// see cer.php for exchange rates feature flag. // see cer.php for exchange rates feature flag.
], ],
'version' => 'develop/2025-07-20', 'version' => 'develop/2025-07-20',
'build_time' => 1753007724, 'build_time' => 1753029815,
'api_version' => '2.1.0', // field is no longer used. 'api_version' => '2.1.0', // field is no longer used.
'db_version' => 26, 'db_version' => 26,