@@ -61,6 +61,9 @@ class OpportunityCategoryFields
|
||||
foreach (['markets' => 'marketCreate', 'risks' => 'riskCreate', 'licenses' => 'licenseCreate', 'milestones' => 'milestoneCreate'] as $field => $def) {
|
||||
$common[$field]['items'] = ['$ref' => '#/$defs/'.$def];
|
||||
}
|
||||
// Reuse the existing canonical object definition in both editor and validation.
|
||||
// The extracted Create property was opaque, preventing completion through the UI.
|
||||
$common['environmental_social'] = ['$ref' => '#/$defs/environmentalSocialCreate'];
|
||||
$common['maturity_stage']['enum'] = [...array_keys(OpportunityMaturity::STAGES), null];
|
||||
$common['financial_indicators'] = $this->object(['npv' => ['type' => 'number'], 'irr' => ['type' => 'number'], 'payback_years' => $n, 'scenario' => $s, 'horizon_years' => ['type' => 'integer', 'minimum' => 1], 'currency' => ['type' => 'string', 'pattern' => '^[A-Z]{3}$'], 'discount_rate' => $n, 'model_document_id' => $d], ['npv', 'irr', 'payback_years', 'scenario', 'horizon_years', 'currency', 'discount_rate', 'model_document_id']);
|
||||
$defs['milestoneCreate']['properties'] += ['start_date' => $date, 'end_date' => $date, 'responsible_name' => $s, 'dependencies' => $strings];
|
||||
@@ -219,7 +222,11 @@ class OpportunityCategoryFields
|
||||
}
|
||||
$fail(! $lr['exploitation_plan_required'] || ! empty($lr['exploitation_plan_document_id']), 'land_rights.exploitation_plan_document_id', 'Plano de exploração aplicável exige documento.');
|
||||
$fail(! $lr['communities_affected'] || (! empty($lr['communities']) && ! empty($lr['community_consultation'])), 'land_rights.community_consultation', 'Comunidade afetada exige comunidade, representantes e consulta documentada.');
|
||||
$communityKeys = [];
|
||||
foreach ($lr['communities'] ?? [] as $i => $row) {
|
||||
$key = json_encode([$row['name'] ?? null, $row['location_id'] ?? null]);
|
||||
$fail(! isset($communityKeys[$key]), "land_rights.communities.$i.name", 'A mesma comunidade/localização já está incluída (§27).');
|
||||
$communityKeys[$key] = true;
|
||||
foreach (['representative_name', 'consultation_date', 'location_id'] as $field) {
|
||||
$fail(! empty($row[$field]), "land_rights.communities.$i.$field", 'Identifique representante, data e localização da comunidade.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user