Update meta data for new release.

This commit is contained in:
James Cole
2021-03-14 20:03:27 +01:00
parent 5eb1f93851
commit 1817160d48
66 changed files with 1578 additions and 1117 deletions

View File

@@ -116,23 +116,26 @@ class UpdateRequest extends FormRequest
/** @var array $repetition */
foreach ($repetitions as $repetition) {
$current = [];
if(array_key_exists('type', $repetition)) {
if (array_key_exists('type', $repetition)) {
$current['type'] = $repetition['type'];
}
if(array_key_exists('moment', $repetition)) {
if (array_key_exists('moment', $repetition)) {
$current['moment'] = (string)$repetition['moment'];
}
if(array_key_exists('skip', $repetition)) {
if (array_key_exists('skip', $repetition)) {
$current['skip'] = (int)$repetition['skip'];
}
if(array_key_exists('weekend', $repetition)) {
$current['weekend'] = (int) $repetition['weekend'];
if (array_key_exists('weekend', $repetition)) {
$current['weekend'] = (int)$repetition['weekend'];
}
$return[] = $current;
}
if (0 === count($return)) {
return null;
}
return $return;
}
@@ -196,7 +199,7 @@ class UpdateRequest extends FormRequest
$validator->after(
function (Validator $validator) {
//$this->validateOneRecurrenceTransaction($validator);
$this->validateOneRepetitionUpdate($validator);
//$this->validateOneRepetitionUpdate($validator);
$this->validateRecurrenceRepetition($validator);
$this->validateRepetitionMoment($validator);
$this->validateForeignCurrencyInformation($validator);

View File

@@ -56,7 +56,7 @@ class BillUpdateService
if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) {
$factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null) ?? app('amount')->getDefaultCurrencyByUser($bill->user);
$currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null) ?? app('amount')->getDefaultCurrencyByUser($bill->user);
// enable the currency if it isn't.
$currency->enabled = true;

View File

@@ -79,15 +79,18 @@ trait CalculateXOccurrencesSince
*/
protected function getXMonthlyOccurrencesSince(Carbon $date, Carbon $afterDate, int $count, int $skipMod, string $moment): array
{
Log::debug(sprintf('Now in %s', __METHOD__));
Log::debug(sprintf('Now in %s(%s, %s, %d)', __METHOD__, $date->format('Y-m-d'), $afterDate->format('Y-m-d'), $count));
$return = [];
$mutator = clone $date;
$total = 0;
$attempts = 0;
$dayOfMonth = (int)$moment;
$dayOfMonth = 0 === $dayOfMonth ? 1 : $dayOfMonth;
if ($mutator->day > $dayOfMonth) {
Log::debug(sprintf('%d is after %d, add a month. Mutator is now', $mutator->day, $dayOfMonth));
// day has passed already, add a month.
$mutator->addMonth();
Log::debug(sprintf('%s', $mutator->format('Y-m-d')));
}
while ($total < $count) {
@@ -98,7 +101,8 @@ trait CalculateXOccurrencesSince
$total++;
}
$attempts++;
$mutator->endOfMonth()->addDay();
$mutator = $mutator->endOfMonth()->addDay();
Log::debug(sprintf('Mutator is now %s', $mutator->format('Y-m-d')));
}
return $return;
@@ -213,7 +217,9 @@ trait CalculateXOccurrencesSince
$date = new Carbon($moment);
$date->year = $mutator->year;
if ($mutator > $date) {
Log::debug(sprintf('mutator (%s) > date (%s), so add a year to date (%s)', $mutator->format('Y-m-d'), $date->format('Y-m-d'), $date->format('Y-m-d'),));
Log::debug(
sprintf('mutator (%s) > date (%s), so add a year to date (%s)', $mutator->format('Y-m-d'), $date->format('Y-m-d'), $date->format('Y-m-d'),)
);
$date->addYear();
Log::debug(sprintf('Date is now %s', $date->format('Y-m-d')));
}