fix: complete InvesteMoz validation and error corrections
This commit is contained in:
@@ -10,7 +10,9 @@ final class OpportunityPublicText
|
||||
public static function description(Opportunity $record, string $text): string
|
||||
{
|
||||
$source = data_get($record->workflow_context, 'corridor_agribusiness');
|
||||
if (! is_array($source) || ($source['source_sha256'] ?? null) !== CorridorAgribusinessOpportunities::SOURCE_HASH) return $text;
|
||||
if (! is_array($source) || ($source['source_sha256'] ?? null) !== CorridorAgribusinessOpportunities::SOURCE_HASH) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
$hash = CorridorAgribusinessOpportunities::SOURCE_HASH;
|
||||
$sourceLine = 'Fonte: '.$source['source'].'; SHA-256 '.$hash;
|
||||
@@ -20,13 +22,20 @@ final class OpportunityPublicText
|
||||
$paragraph = trim($paragraph);
|
||||
if (in_array($paragraph, [$sourceLine, $sourceLine.'.', 'Edição: Não indicada.', 'Data-base: Não indicada.',
|
||||
'Limitações e lacunas: '.CorridorAgribusinessOpportunities::LIMITATIONS,
|
||||
OpportunityPromotion::NOTICE], true)) continue;
|
||||
if ($paragraph === 'Enquadramento documental: '.$source['corridor'].'.') $paragraph = $source['corridor'].'.';
|
||||
OpportunityPromotion::NOTICE], true)) {
|
||||
continue;
|
||||
}
|
||||
if ($paragraph === 'Enquadramento documental: '.$source['corridor'].'.') {
|
||||
$paragraph = $source['corridor'].'.';
|
||||
}
|
||||
if ($paragraph === CorridorAgribusinessOpportunities::LIMITATIONS) {
|
||||
$paragraph = 'A localização exacta, a disponibilidade de terreno e as condições do investimento serão definidas durante a preparação do projecto.';
|
||||
}
|
||||
if ($paragraph !== '') $result[] = $paragraph;
|
||||
if ($paragraph !== '') {
|
||||
$result[] = $paragraph;
|
||||
}
|
||||
}
|
||||
|
||||
return implode("\n\n", $result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user