class MisattachedBalances

Finds and moves Balances that were attached to the wrong Reporting Period.

Before 7.0.0 current_reporting_period ignored year_start, so from January until the month before year_start it returned the period labelled with the current calendar year, which is that of the next financial year. Balance::save() defaults reporting_period_id to that period, so a Balance saved in those months without an explicit period landed a year late. Transactions were not affected, as they resolve their period from their own date.

That leaves a precise fingerprint: a Balance created before year_start whose period is labelled with the calendar year it was created in. A Balance given that period on purpose looks the same, so the findings need reviewing before they are applied.

Constants

CLOSED_PERIOD

Why a finding cannot be moved.

MISSING_PERIOD

Methods

static Collection
find(Entity|null $entity = null)

Find the Balances attached to the wrong Reporting Period.

static int
repair(Collection $findings)

Move the Balances found to the Reporting Period they belong to, leaving those that cannot be moved.

Details

at line 53
static Collection find(Entity|null $entity = null)

Find the Balances attached to the wrong Reporting Period.

Parameters

Entity|null $entity

Return Value

Collection

at line 70
static int repair(Collection $findings)

Move the Balances found to the Reporting Period they belong to, leaving those that cannot be moved.

Parameters

Collection $findings

Return Value

int

The number of Balances moved