Criar Hotel: a actividade escolhida no dossier mantém-se ao longo do percurso
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
Uma oportunidade, sector, parque ou território acrescentado depois só propõe outra actividade; o sector e a actividade do dossier deixam de ser trocados ou apagados sem o investidor o pedir. A pré-visualização mostra «conserva … ; a fonte propõe …» e há uma opção explícita para mudar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jM
This commit is contained in:
@@ -26,6 +26,9 @@ final class InvestorContext
|
||||
|
||||
public const FIELDS = ['promoter_entity_key', 'legal_name', 'legal_form', 'registration_number', 'products_services', 'investment_budget_min', 'investment_budget_max', 'project_title', 'project_summary', 'sector_id', 'sector', 'province_id', 'district_id', 'admin_post_id', 'locality_id', 'province', 'district', 'location', 'currency', 'expected_start_date', 'fiscal_period', 'fiscal_periodicity', 'fiscal_month', 'investor_origin', 'person_type', 'entity_stage', 'tax_residency_country', 'fiscal_residency_country', 'activity_id', 'project_type', 'maturity_stage', 'special_zone_id', 'investment_regime', ...PrivateInvestmentPreparation::FIELDS];
|
||||
|
||||
/** The investor's primary intention: once chosen, later references may only propose a different one. */
|
||||
public const INTENTION_FIELDS = ['sector_id', 'sector', 'activity_id'];
|
||||
|
||||
public function __construct(private readonly VirtualDesk $desk) {}
|
||||
|
||||
/**
|
||||
@@ -674,7 +677,9 @@ final class InvestorContext
|
||||
$provenance[$key] = ['kind' => 'process_declaration', 'actor_id' => $actor->id, 'context_revision' => $old['revision'] + 1];
|
||||
}
|
||||
foreach ($proposed as $key => $value) {
|
||||
if (($fields[$key] ?? '') === '' || (($provenance[$key]['kind'] ?? '') !== 'process_declaration' && ($provenance[$key]['kind'] ?? '') !== 'dossier') || in_array($key, $data['replace_fields'] ?? [], true)) {
|
||||
// A hotel stays a hotel: another activity is only proposed, never swapped in silently.
|
||||
$intention = in_array($key, self::INTENTION_FIELDS, true) && ($fields[$key] ?? '') !== '';
|
||||
if (($fields[$key] ?? '') === '' || (! $intention && ($provenance[$key]['kind'] ?? '') !== 'process_declaration' && ($provenance[$key]['kind'] ?? '') !== 'dossier') || in_array($key, $data['replace_fields'] ?? [], true)) {
|
||||
if (($fields[$key] ?? null) !== $value) {
|
||||
$replaced[] = ['field' => $key, 'before' => $fields[$key] ?? null, 'after' => $value];
|
||||
}$fields[$key] = $value;
|
||||
@@ -685,7 +690,7 @@ final class InvestorContext
|
||||
}
|
||||
// Remove inherited subordinate geography only when its source was actually replaced.
|
||||
foreach ($fields as $key => $value) {
|
||||
if (! array_key_exists($key, $proposed) && in_array($key, ['province_id', 'district_id', 'admin_post_id', 'locality_id', 'province', 'district', 'location', 'sector_id', 'sector', 'special_zone_id', 'investment_regime'], true) && isset($provenance[$key]['key'])) {
|
||||
if (! array_key_exists($key, $proposed) && in_array($key, ['province_id', 'district_id', 'admin_post_id', 'locality_id', 'province', 'district', 'location', 'special_zone_id', 'investment_regime'], true) && isset($provenance[$key]['key'])) {
|
||||
unset($fields[$key],$provenance[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user