Compare commits

..

No commits in common. "d6f64d6d3d38e94eb666efeaf6b11c39e7752983" and "8689f05ce5b10dfdf5eab6523332e68b8c01332e" have entirely different histories.

2 changed files with 14 additions and 88 deletions

View File

@ -1359,57 +1359,7 @@ private function populateNominativiStoriciFallback(): void
return;
}
if ($this->hasImportConnection() && DbSchema::connection('gescon_import')->hasTable('condomin_mirror')) {
$codStabile = trim((string) ($this->unita->stabile?->codice_stabile ?? ''));
$scala = trim((string) ($this->unita->scala ?? ''));
$interno = trim((string) ($this->unita->interno ?? ''));
if ($codStabile !== '' && $interno !== '') {
$q = DB::connection('gescon_import')
->table('condomin_mirror')
->where('cod_stabile', $codStabile)
->where('interno', $interno);
if ($scala !== '') {
$q->where('scala', $scala);
}
$mirrorRows = $q->orderBy('source_year')->get();
foreach ($mirrorRows as $m) {
$yLabel = match ($m->source_year) {
'0004' => '2026 (Gestione 0004)',
'0003' => '2025 (Gestione 0003)',
'0001' => '2024 (Gestione 0001)',
default => 'Gestione ' . $m->source_year,
};
$owner = trim((string) ($m->nom_cond ?? $m->proprietario ?? ''));
if ($owner !== '') {
$fallbackList[] = [
'ruolo' => 'Proprietario',
'nominativo' => $owner,
'periodo' => $yLabel,
'percentuale' => '100,00%',
'fonte' => 'Archivio storico legacy',
'detail' => ! empty($m->codice_fiscale) ? ('CF: ' . $m->codice_fiscale) : null,
];
}
$inquil = trim((string) ($m->inquilino ?? $m->inquil_nome ?? ''));
if ($inquil !== '') {
$fallbackList[] = [
'ruolo' => 'Inquilino',
'nominativo' => $inquil,
'periodo' => $yLabel,
'percentuale' => '100,00%',
'fonte' => 'Archivio storico legacy',
'detail' => null,
];
}
}
}
}
if (empty($fallbackList) && DbSchema::hasTable('persone_unita_relazioni') && DbSchema::hasTable('persone')) {
if (DbSchema::hasTable('persone_unita_relazioni') && DbSchema::hasTable('persone')) {
$purRows = DB::table('persone_unita_relazioni as pur')
->join('persone as p', 'pur.persona_id', '=', 'p.id')
->where('pur.unita_id', $this->unita->id)
@ -3251,38 +3201,16 @@ protected function hydrateRelazioni(): void
$inquilini = $inquilini->filter(fn($r) => $isRelazioneCorrenteNelAnno($r, $activeAnno))->values();
}
$legacyRow = $this->getLegacyCondominRow();
$legacyInqName = trim((string) ($legacyRow?->inquil_nome ?? $legacyRow?->inquilino ?? ''));
if ($legacyInqName !== '') {
$inqNameUpper = strtoupper($legacyInqName);
$matchedInquilini = $inquilini->filter(function (array $i) use ($inqNameUpper): bool {
$nome = strtoupper(trim((string) ($i['nome'] ?? '')));
return $nome !== '' && (str_contains($nome, $inqNameUpper) || str_contains($inqNameUpper, $nome));
})->values();
$unmatchedInquilini = $inquilini->reject(function (array $i) use ($inqNameUpper): bool {
$nome = strtoupper(trim((string) ($i['nome'] ?? '')));
return $nome !== '' && (str_contains($nome, $inqNameUpper) || str_contains($inqNameUpper, $nome));
})->values()->all();
if ($matchedInquilini->isNotEmpty()) {
$inquilini = $matchedInquilini;
$relazioniStoriche = array_values(array_unique(array_merge($relazioniStoriche, $unmatchedInquilini), SORT_REGULAR));
}
}
$inqArr = $inquilini->values()->all();
$inqArr = $inquilini->values()->all();
$inqCount = count($inqArr);
if ($inqCount > 0) {
$equalQuota = round(100.0 / $inqCount, 2);
$equalQuota = round(100.0 / $inqCount, 2);
$startOfYearDate = '01/01/' . $activeAnno;
foreach ($inqArr as $idx => $inq) {
if ($inq['quota'] === null || (float) $inq['quota'] <= 0 || $inqCount === 1) {
$inqQuota = $inqCount === 1 ? 100.0 : $equalQuota;
$inqArr[$idx]['quota'] = $inqQuota;
$inqArr[$idx]['quota_label'] = number_format($inqQuota, 2, ',', '.');
if ($inq['quota'] === null || (float)$inq['quota'] <= 0) {
$inqArr[$idx]['quota'] = $equalQuota;
$inqArr[$idx]['quota_label'] = number_format($equalQuota, 2, ',', '.');
}
$dInizio = trim((string) ($inq['data_inizio'] ?? ''));
if ($dInizio === '' || $dInizio === 'Da 01/01/2000' || $dInizio === '01/01/2000') {
@ -3519,8 +3447,6 @@ private function getLegacyCondominRow(): ?object
'inquil_dal',
'inquil_al',
'nom_cond',
'proprietario',
'inquilino',
'codice_fiscale',
'cond_cod_fisc',
'inquil_nome',

View File

@ -6,7 +6,7 @@ # CURRENT-205
## Obiettivo
Hotfix: Anagrafica Unica canonica, storico audit, CRUD protetto, ricerca per nominativo, isolamento deterministico inquilini e quote 100% per anno gestione dal mirror legacy condomin.
Hotfix: Anagrafica Unica canonica, storico audit, CRUD protetto, ricerca per nominativo, ripartizione equa quote inquilini e popolazione timeline fallback in Unità Immobiliare.
## Output del Giro Operativo
@ -14,7 +14,7 @@ ## Output del Giro Operativo
TASK_ID: task-d095b0e23b
REPOSITORY: ssh://git@git.netgescon.it:2222/michele/netgescon-day0.git
BRANCH: stabilization/205-zero
COMMIT: edb6398b16fa4fc7928ee83fca3ffbc26ddc360b
COMMIT: dadee626ffea9e8fdc8eaebfc6017367807759a2
FILE_O_AREE_TOCCATE:
- app/Livewire/Gescon/RubricaUniversaleTable.php
- app/Models/RubricaUniversale.php
@ -29,8 +29,9 @@ ## Output del Giro Operativo
- ./scripts/ops/antigravity-cli/test_runner_and_parser.sh (6/6 passed)
GATE_STATISTICS:
- DANIELA_BENEDETTO_CANONICAL_RUBRICA: 697 (000000JC / BNDDNL86M58H224O)
- INQUILINI_PER_GESTIONE_ISOLATION: 100% (2024=PINTO LUIGI 100%, 2025/2026=MEDOSI ALESSANDRO 100%)
- TIMELINE_FALLBACK_POPULATION: true (Anagrafica / Rubrica / Legacy condomin mirror)
- TIMELINE_FALLBACK_POPULATION: true (Anagrafica / Rubrica / Relazioni attive)
- INQUILINI_QUOTA_EQUAL_SPLIT: 50% / 50% (Ripartizione automatica quote mancanti)
- INQUILINI_DATA_INIZIO_GESTION_ALIGNED: 01/01/2026 (Allineata ad inizio anno gestione attiva)
- SEARCH_BY_NOMINATIVO_UNITA_PICKER: enabled
- ATER_BENEDETTO_SUBENTRO_DATE: 08/06/2026 (Gestione 0004 / 2026)
- VISTA_STATO_FILTER_WORKING: true
@ -41,7 +42,6 @@ ## Output del Giro Operativo
## Prossimo Passo per .200 (Validazione)
- Eseguire il checkout del branch `stabilization/205-zero` al commit `edb6398b16fa4fc7928ee83fca3ffbc26ddc360b`.
- Verificare che nell'anno 2024 (`0001`) appaia sotto Inquilini solo PINTO LUIGI con Quota 100%.
- Verificare che negli anni 2025 (`0003`) e 2026 (`0004`) appaia solo MEDOSI ALESSANDRO con Quota 100%.
- Verificare che la timeline mostri la sequenza esatta degli avvicendamenti per ciascuna gestione.
- Eseguire il checkout del branch `stabilization/205-zero` al commit `dadee626ffea9e8fdc8eaebfc6017367807759a2`.
- Verificare nella scheda dell'unità immobiliare (`/admin-filament/unita-immobiliare`) che la sezione "Timeline Subentri e Gestioni Anteriore" mostri sempre la cronistoria dei titolari.
- Verificare che la ripartizione degli inquilini (es. Pinto Luigi e Medosi Alessandro) assegni automaticamente il 50,00% ciascuno con decorrenza dall'inizio della gestione.