Various code cleanup and fixed alignments.

This commit is contained in:
James Cole
2024-01-01 14:36:31 +01:00
parent d4488f041b
commit 30bbd0b3a4
6 changed files with 11 additions and 46 deletions

View File

@@ -54,14 +54,9 @@ class MigrateRecurrenceType extends Command
return 0;
}
$this->friendlyWarning('This command has been disabled.');
$this->markAsExecuted();
return 0;
// $this->migrateTypes();
// $this->markAsExecuted();
//
// return 0;
}
private function isExecuted(): bool
@@ -71,37 +66,6 @@ class MigrateRecurrenceType extends Command
return (bool)$configVar?->data;
}
private function migrateTypes(): void
{
$set = Recurrence::get();
/** @var Recurrence $recurrence */
foreach ($set as $recurrence) {
if (TransactionType::INVALID !== $recurrence->transactionType->type) {
$this->migrateRecurrence($recurrence);
}
}
}
private function migrateRecurrence(Recurrence $recurrence): void
{
$originalType = $recurrence->transaction_type_id;
$newType = $this->getInvalidType();
$recurrence->transaction_type_id = $newType->id;
$recurrence->save();
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions as $transaction) {
$transaction->transaction_type_id = $originalType;
$transaction->save();
}
$this->friendlyInfo(sprintf('Updated recurrence #%d to new transaction type model.', $recurrence->id));
}
private function getInvalidType(): TransactionType
{
return TransactionType::whereType(TransactionType::INVALID)->firstOrCreate(['type' => TransactionType::INVALID]);
}
private function markAsExecuted(): void
{

View File

@@ -712,6 +712,7 @@ trait MetaCollection
if (true === $result) {
return $return;
}
return false;
};
$this->postFilters[] = $filter;

View File

@@ -561,7 +561,7 @@ class GroupCollector implements GroupCollectorInterface
if (0 !== count($journalIds)) {
// make all integers.
$integerIDs = array_map('intval', $journalIds);
Log::debug(sprintf('GroupCollector: setJournalIds: %s', join(', ', $integerIDs)));
Log::debug(sprintf('GroupCollector: setJournalIds: %s', implode(', ', $integerIDs)));
$this->query->whereIn('transaction_journals.id', $integerIDs);
}

View File

@@ -60,6 +60,7 @@ class RecurrenceController extends Controller
* Shows all events for a repetition. Used in calendar.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @throws FireflyException
*/

View File

@@ -75,9 +75,8 @@ class BudgetFormStoreRequest extends FormRequest
*/
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors for budget'), $validator->errors()->toArray());
Log::channel('audit')->error('Validation errors for budget', $validator->errors()->toArray());
}
$validator->after(