fix(catasto-hub): remove automatic fallbacks and prevent overwriting physical scala/interno (task-d095b0e23b)

This commit is contained in:
michele 2026-08-30 20:42:52 +02:00
parent 640665db3a
commit bcb283e0e0

View File

@ -461,14 +461,14 @@ public function loadUnitaList(): void
} }
if (empty($uFoglio) || $uFoglio === '-' || $uFoglio === '0') { if (empty($uFoglio) || $uFoglio === '-' || $uFoglio === '0') {
$uFoglio = $this->stabileAttivo?->foglio ?? $this->stabileAttivo?->foglio_catasto ?? '403'; $uFoglio = $this->stabileAttivo?->foglio ?? $this->stabileAttivo?->foglio_catasto ?? '';
} }
if (empty($uParticella) || $uParticella === '-' || $uParticella === '0') { if (empty($uParticella) || $uParticella === '-' || $uParticella === '0') {
if ($this->stabileAttivo && ($this->stabileAttivo->id == 4 || $this->stabileAttivo->codice_stabile === '0021')) { if ($this->stabileAttivo && ($this->stabileAttivo->id == 4 || $this->stabileAttivo->codice_stabile === '0021')) {
$scalaUpper = strtoupper(trim($u->scala ?: '')); $scalaUpper = strtoupper(trim($u->scala ?: ''));
$uParticella = ($scalaUpper === 'D') ? '253' : '256'; $uParticella = ($scalaUpper === 'D') ? '253' : '256';
} else { } else {
$uParticella = $this->stabileAttivo?->particella_catasto ?? $this->stabileAttivo?->mappale ?? '60'; $uParticella = $this->stabileAttivo?->particella_catasto ?? $this->stabileAttivo?->mappale ?? '';
} }
} }
@ -641,7 +641,7 @@ public function selectUnita(int $unitaId): void
} }
if (empty($uFoglio) || $uFoglio === '-' || $uFoglio === '0') { if (empty($uFoglio) || $uFoglio === '-' || $uFoglio === '0') {
$uFoglio = $this->stabileAttivo?->foglio ?? $this->stabileAttivo?->foglio_catasto ?? '403'; $uFoglio = $this->stabileAttivo?->foglio ?? $this->stabileAttivo?->foglio_catasto ?? '';
} }
if ($this->stabileAttivo && ($this->stabileAttivo->id == 4 || $this->stabileAttivo->codice_stabile === '0021')) { if ($this->stabileAttivo && ($this->stabileAttivo->id == 4 || $this->stabileAttivo->codice_stabile === '0021')) {
$scalaUpper = strtoupper(trim($u->scala ?: '')); $scalaUpper = strtoupper(trim($u->scala ?: ''));
@ -653,7 +653,7 @@ public function selectUnita(int $unitaId): void
} }
} else { } else {
if (empty($uParticella) || $uParticella === '-' || $uParticella === '0') { if (empty($uParticella) || $uParticella === '-' || $uParticella === '0') {
$uParticella = $this->stabileAttivo?->particella_catasto ?? $this->stabileAttivo?->mappale ?? '60'; $uParticella = $this->stabileAttivo?->particella_catasto ?? $this->stabileAttivo?->mappale ?? '';
} }
} }
@ -1605,12 +1605,6 @@ public function applicaECorreggi(): void
$updatePayload['catasto_piano_fisico'] = $scomp['catasto_piano_fisico']; $updatePayload['catasto_piano_fisico'] = $scomp['catasto_piano_fisico'];
} }
if (Schema::hasColumn('unita_immobiliari', 'scala') && !empty($scomp['catasto_scala'])) {
$updatePayload['scala'] = $scomp['catasto_scala'];
}
if (Schema::hasColumn('unita_immobiliari', 'interno') && !empty($scomp['catasto_interno'])) {
$updatePayload['interno'] = $scomp['catasto_interno'];
}
if (Schema::hasColumn('unita_immobiliari', 'indirizzo') && !empty($scomp['catasto_via'])) { if (Schema::hasColumn('unita_immobiliari', 'indirizzo') && !empty($scomp['catasto_via'])) {
$updatePayload['indirizzo'] = $scomp['catasto_via']; $updatePayload['indirizzo'] = $scomp['catasto_via'];
} }