feat: consolidar desenvolvimentos do portal InvestMoz
This commit is contained in:
@@ -326,6 +326,7 @@ class OpportunityProfileWorkflow
|
||||
if (isset($p['business_transaction'])) {
|
||||
abort_unless(in_array($p['business_transaction']['due_diligence_status'], ['data_room_ready', 'in_progress', 'completed', 'exceptions'], true), 422, 'Data room mínimo não preparado.');
|
||||
}
|
||||
$previousMaturity = $context['publication']['maturity'] ?? null;
|
||||
if (isset($context['publication'])) {
|
||||
$context['publication_history'][] = [...$context['publication'],
|
||||
'public_maturity_before_republication' => ['level' => $record->maturity_level, 'label' => $record->maturity_label,
|
||||
@@ -350,6 +351,17 @@ class OpportunityProfileWorkflow
|
||||
$record->maturity_label = $maturity['maturity_label'];
|
||||
$context['publication']['maturity'] = ['catalogue_version' => $maturity['maturity_catalogue_version'],
|
||||
'stage' => $maturity['maturity_stage'], 'level' => $maturity['maturity_level'], 'label' => $maturity['maturity_label']];
|
||||
} elseif (array_key_exists('maturity_stage', $p)) {
|
||||
// An explicitly cleared optional answer must not retain an old
|
||||
// public number or make that number look like a legacy level.
|
||||
$record->maturity_level = null;
|
||||
$record->maturity_label = null;
|
||||
$context['publication']['maturity'] = ['catalogue_version' => OpportunityMaturity::VERSION,
|
||||
'stage' => null, 'level' => null, 'label' => null];
|
||||
} elseif ($previousMaturity !== null) {
|
||||
// No answer was supplied: keep the version with the retained
|
||||
// public values, including records prepared by older editors.
|
||||
$context['publication']['maturity'] = $previousMaturity;
|
||||
}
|
||||
$locations = array_values(array_filter($snapshot['resources']['locations'], fn ($location) => $location['payload']['is_primary'] ?? false));
|
||||
$location = $locations[0]; // The contract requires exactly one primary location.
|
||||
|
||||
Reference in New Issue
Block a user