Auto commit for release 'branch-v6.2' on 2024-12-26

This commit is contained in:
github-actions
2024-12-26 10:24:39 +01:00
parent 1e8f0adaf8
commit 71cf6c6a5e
7 changed files with 127 additions and 125 deletions

View File

@@ -59,23 +59,23 @@ class BillTransformer extends AbstractTransformer
*/
public function transform(Bill $bill): array
{
$defaultCurrency = $this->parameters->get('defaultCurrency') ?? Amount::getDefaultCurrency();
$defaultCurrency = $this->parameters->get('defaultCurrency') ?? Amount::getDefaultCurrency();
$paidData = $this->paidData($bill);
$lastPaidDate = $this->getLastPaidDate($paidData);
$start = $this->parameters->get('start') ?? today()->subYears(10);
$end = $this->parameters->get('end') ?? today()->addYears(10);
$payDates = $this->calculator->getPayDates($start, $end, $bill->date, $bill->repeat_freq, $bill->skip, $lastPaidDate);
$currency = $bill->transactionCurrency;
$notes = $this->repository->getNoteText($bill);
$notes = '' === $notes ? null : $notes;
$objectGroupId = null;
$objectGroupOrder = null;
$objectGroupTitle = null;
$paidData = $this->paidData($bill);
$lastPaidDate = $this->getLastPaidDate($paidData);
$start = $this->parameters->get('start') ?? today()->subYears(10);
$end = $this->parameters->get('end') ?? today()->addYears(10);
$payDates = $this->calculator->getPayDates($start, $end, $bill->date, $bill->repeat_freq, $bill->skip, $lastPaidDate);
$currency = $bill->transactionCurrency;
$notes = $this->repository->getNoteText($bill);
$notes = '' === $notes ? null : $notes;
$objectGroupId = null;
$objectGroupOrder = null;
$objectGroupTitle = null;
$this->repository->setUser($bill->user);
/** @var null|ObjectGroup $objectGroup */
$objectGroup = $bill->objectGroups->first();
$objectGroup = $bill->objectGroups->first();
if (null !== $objectGroup) {
$objectGroupId = $objectGroup->id;
$objectGroupOrder = $objectGroup->order;
@@ -85,7 +85,7 @@ class BillTransformer extends AbstractTransformer
$paidDataFormatted = [];
$payDatesFormatted = [];
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 (null === $date) {
$date = today(config('app.timezone'));
}
@@ -94,24 +94,24 @@ class BillTransformer extends AbstractTransformer
}
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 (null === $date) {
$date = today(config('app.timezone'));
}
$payDatesFormatted[] = $date->toAtomString();
}
// next expected match
$nem = null;
$nemDate = null;
$nemDiff = trans('firefly.not_expected_period');
$firstPayDate = $payDates[0] ?? null;
$nem = null;
$nemDate = null;
$nemDiff = trans('firefly.not_expected_period');
$firstPayDate = $payDates[0] ?? null;
if (null !== $firstPayDate) {
$nemDate = Carbon::createFromFormat('!Y-m-d', $firstPayDate, config('app.timezone'));
if (null === $nemDate) {
$nemDate = today(config('app.timezone'));
}
$nem = $nemDate->toAtomString();
$nem = $nemDate->toAtomString();
// nullify again when it's outside the current view range.
if (
@@ -132,7 +132,7 @@ class BillTransformer extends AbstractTransformer
$current = $payDatesFormatted[0] ?? null;
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 (null === $temp2) {
$temp2 = today(config('app.timezone'));
}
@@ -174,7 +174,7 @@ class BillTransformer extends AbstractTransformer
'links' => [
[
'rel' => 'self',
'uri' => '/bills/' . $bill->id,
'uri' => '/bills/'.$bill->id,
],
],
];
@@ -196,13 +196,13 @@ class BillTransformer extends AbstractTransformer
// 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.
/** @var Carbon $start */
$start = clone $this->parameters->get('start');
$searchStart = clone $start;
$start = clone $this->parameters->get('start');
$searchStart = clone $start;
$start->subDay();
/** @var Carbon $end */
$end = clone $this->parameters->get('end');
$searchEnd = clone $end;
$end = clone $this->parameters->get('end');
$searchEnd = clone $end;
// move the search dates to the start of the day.
$searchStart->startOfDay();
@@ -212,7 +212,7 @@ class BillTransformer extends AbstractTransformer
app('log')->debug(sprintf('Search parameters are: start: %s', $searchStart->format('Y-m-d')));
// Get from database when bill was paid.
$set = $this->repository->getPaidDatesInRange($bill, $searchStart, $searchEnd);
$set = $this->repository->getPaidDatesInRange($bill, $searchStart, $searchEnd);
app('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.
@@ -221,7 +221,7 @@ class BillTransformer extends AbstractTransformer
app('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.
$result = [];
$result = [];
foreach ($set as $entry) {
$result[] = [
'transaction_group_id' => (string) $entry->transaction_group_id,