mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-31 00:37:47 +03:00
fix(meta): emit attribute properties based on stored/non-stored object context
DataProcessor/Report attributes incorrectly included Indexing, FullTextSearch, DataHistory, FillFromFillingValue, FillValue, and Use properties. Added "processor" and "processor-tabular" contexts to both meta-compile and meta-edit. Also fixed Use emitted for Document (should be Catalog-only). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
e29c184f8e
commit
7003a46ad0
@@ -577,7 +577,7 @@ function Emit-TabularStandardAttributes {
|
||||
|
||||
function Emit-Attribute {
|
||||
param([string]$indent, $parsed, [string]$context)
|
||||
# $context: "catalog", "document", "tabular", "register"
|
||||
# $context: "catalog", "document", "object", "processor", "tabular", "processor-tabular", "register"
|
||||
$uuid = New-Guid-String
|
||||
X "$indent<Attribute uuid=`"$uuid`">"
|
||||
X "$indent`t<Properties>"
|
||||
@@ -607,13 +607,13 @@ function Emit-Attribute {
|
||||
X "$indent`t`t<MinValue xsi:nil=`"true`"/>"
|
||||
X "$indent`t`t<MaxValue xsi:nil=`"true`"/>"
|
||||
|
||||
# FillFromFillingValue — not for tabular section attributes
|
||||
if ($context -ne "tabular") {
|
||||
# FillFromFillingValue — not for tabular/processor (non-stored objects don't have these)
|
||||
if ($context -notin @("tabular", "processor")) {
|
||||
X "$indent`t`t<FillFromFillingValue>false</FillFromFillingValue>"
|
||||
}
|
||||
|
||||
# FillValue — not for tabular section attributes
|
||||
if ($context -ne "tabular") {
|
||||
# FillValue — not for tabular/processor
|
||||
if ($context -notin @("tabular", "processor")) {
|
||||
Emit-FillValue "$indent`t`t" $typeStr
|
||||
}
|
||||
|
||||
@@ -632,20 +632,22 @@ function Emit-Attribute {
|
||||
X "$indent`t`t<LinkByType/>"
|
||||
X "$indent`t`t<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>"
|
||||
|
||||
# Use — only for catalog/document top-level attributes
|
||||
if ($context -eq "catalog" -or $context -eq "document") {
|
||||
# Use — only for catalog top-level attributes
|
||||
if ($context -eq "catalog") {
|
||||
X "$indent`t`t<Use>ForItem</Use>"
|
||||
}
|
||||
|
||||
# Indexing
|
||||
$indexing = "DontIndex"
|
||||
if ($parsed.flags -contains "index") { $indexing = "Index" }
|
||||
if ($parsed.flags -contains "indexadditional") { $indexing = "IndexWithAdditionalOrder" }
|
||||
if ($parsed.indexing) { $indexing = $parsed.indexing }
|
||||
X "$indent`t`t<Indexing>$indexing</Indexing>"
|
||||
# Indexing/FullTextSearch/DataHistory — not for non-stored objects (processor, processor-tabular)
|
||||
if ($context -notin @("processor", "processor-tabular")) {
|
||||
$indexing = "DontIndex"
|
||||
if ($parsed.flags -contains "index") { $indexing = "Index" }
|
||||
if ($parsed.flags -contains "indexadditional") { $indexing = "IndexWithAdditionalOrder" }
|
||||
if ($parsed.indexing) { $indexing = $parsed.indexing }
|
||||
X "$indent`t`t<Indexing>$indexing</Indexing>"
|
||||
|
||||
X "$indent`t`t<FullTextSearch>Use</FullTextSearch>"
|
||||
X "$indent`t`t<DataHistory>Use</DataHistory>"
|
||||
X "$indent`t`t<FullTextSearch>Use</FullTextSearch>"
|
||||
X "$indent`t`t<DataHistory>Use</DataHistory>"
|
||||
}
|
||||
|
||||
X "$indent`t</Properties>"
|
||||
X "$indent</Attribute>"
|
||||
@@ -688,10 +690,11 @@ function Emit-TabularSection {
|
||||
}
|
||||
X "$indent`t</Properties>"
|
||||
|
||||
$tsContext = if ($objectType -in @("DataProcessor","Report")) { "processor-tabular" } else { "tabular" }
|
||||
X "$indent`t<ChildObjects>"
|
||||
foreach ($col in $columns) {
|
||||
$parsed = Parse-AttributeShorthand $col
|
||||
Emit-Attribute "$indent`t`t" $parsed "tabular"
|
||||
Emit-Attribute "$indent`t`t" $parsed $tsContext
|
||||
}
|
||||
X "$indent`t</ChildObjects>"
|
||||
|
||||
@@ -2447,6 +2450,7 @@ if ($objType -in $typesWithAttrTS) {
|
||||
$context = switch ($objType) {
|
||||
"Catalog" { "catalog" }
|
||||
"Document" { "document" }
|
||||
{ $_ -in @("DataProcessor","Report") } { "processor" }
|
||||
default { "object" }
|
||||
}
|
||||
foreach ($a in $attrs) {
|
||||
|
||||
@@ -660,6 +660,7 @@ function Get-AttributeContext {
|
||||
"Catalog" { return "catalog" }
|
||||
"Document" { return "document" }
|
||||
{ $_ -in @("InformationRegister","AccumulationRegister","AccountingRegister","CalculationRegister") } { return "register" }
|
||||
{ $_ -in @("DataProcessor","Report","ExternalDataProcessor","ExternalReport") } { return "processor" }
|
||||
default { return "object" }
|
||||
}
|
||||
}
|
||||
@@ -698,8 +699,8 @@ function Build-AttributeFragment {
|
||||
$sb.AppendLine("$indent`t`t<MinValue xsi:nil=`"true`"/>") | Out-Null
|
||||
$sb.AppendLine("$indent`t`t<MaxValue xsi:nil=`"true`"/>") | Out-Null
|
||||
|
||||
# FillFromFillingValue — for catalog/document/object contexts
|
||||
if ($context -ne "register") {
|
||||
# FillFromFillingValue/FillValue — not for register, tabular (config TS), or processor (non-stored top-level)
|
||||
if ($context -notin @("register", "tabular", "processor")) {
|
||||
$sb.AppendLine("$indent`t`t<FillFromFillingValue>false</FillFromFillingValue>") | Out-Null
|
||||
$sb.AppendLine($(Build-FillValueXml "$indent`t`t" $typeStr)) | Out-Null
|
||||
}
|
||||
@@ -719,20 +720,22 @@ function Build-AttributeFragment {
|
||||
$sb.AppendLine("$indent`t`t<LinkByType/>") | Out-Null
|
||||
$sb.AppendLine("$indent`t`t<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>") | Out-Null
|
||||
|
||||
# Use — catalog/document only
|
||||
if ($context -eq "catalog" -or $context -eq "document") {
|
||||
# Use — catalog only
|
||||
if ($context -eq "catalog") {
|
||||
$sb.AppendLine("$indent`t`t<Use>ForItem</Use>") | Out-Null
|
||||
}
|
||||
|
||||
# Indexing
|
||||
$indexing = "DontIndex"
|
||||
if ($parsed.flags -contains "index") { $indexing = "Index" }
|
||||
if ($parsed.flags -contains "indexadditional") { $indexing = "IndexWithAdditionalOrder" }
|
||||
if ($parsed.indexing) { $indexing = $parsed.indexing }
|
||||
$sb.AppendLine("$indent`t`t<Indexing>$indexing</Indexing>") | Out-Null
|
||||
# Indexing/FullTextSearch/DataHistory — not for non-stored objects (processor, processor-tabular)
|
||||
if ($context -notin @("processor", "processor-tabular")) {
|
||||
$indexing = "DontIndex"
|
||||
if ($parsed.flags -contains "index") { $indexing = "Index" }
|
||||
if ($parsed.flags -contains "indexadditional") { $indexing = "IndexWithAdditionalOrder" }
|
||||
if ($parsed.indexing) { $indexing = $parsed.indexing }
|
||||
$sb.AppendLine("$indent`t`t<Indexing>$indexing</Indexing>") | Out-Null
|
||||
|
||||
$sb.AppendLine("$indent`t`t<FullTextSearch>Use</FullTextSearch>") | Out-Null
|
||||
$sb.AppendLine("$indent`t`t<DataHistory>Use</DataHistory>") | Out-Null
|
||||
$sb.AppendLine("$indent`t`t<FullTextSearch>Use</FullTextSearch>") | Out-Null
|
||||
$sb.AppendLine("$indent`t`t<DataHistory>Use</DataHistory>") | Out-Null
|
||||
}
|
||||
|
||||
$sb.AppendLine("$indent`t</Properties>") | Out-Null
|
||||
$sb.Append("$indent</Attribute>") | Out-Null
|
||||
@@ -804,8 +807,8 @@ function Build-TabularSectionFragment {
|
||||
$sb.AppendLine("$indent`t`t`t</xr:StandardAttribute>") | Out-Null
|
||||
$sb.AppendLine("$indent`t`t</StandardAttributes>") | Out-Null
|
||||
|
||||
# Use — catalog/document only
|
||||
if ($objType -in @("Catalog","Document")) {
|
||||
# Use — catalog only
|
||||
if ($objType -eq "Catalog") {
|
||||
$sb.AppendLine("$indent`t`t<Use>ForItem</Use>") | Out-Null
|
||||
}
|
||||
|
||||
@@ -817,11 +820,12 @@ function Build-TabularSectionFragment {
|
||||
elseif ($tsDef.attributes) { $columns = @($tsDef.attributes) }
|
||||
elseif ($tsDef.реквизиты) { $columns = @($tsDef.реквизиты) }
|
||||
|
||||
$tsAttrContext = if ($script:objType -in @("DataProcessor","Report","ExternalDataProcessor","ExternalReport")) { "processor-tabular" } else { "tabular" }
|
||||
if ($columns.Count -gt 0) {
|
||||
$sb.AppendLine("$indent`t<ChildObjects>") | Out-Null
|
||||
foreach ($col in $columns) {
|
||||
$colParsed = Parse-AttributeShorthand $col
|
||||
$sb.AppendLine($(Build-AttributeFragment $colParsed "tabular" "$indent`t`t")) | Out-Null
|
||||
$sb.AppendLine($(Build-AttributeFragment $colParsed $tsAttrContext "$indent`t`t")) | Out-Null
|
||||
}
|
||||
$sb.AppendLine("$indent`t</ChildObjects>") | Out-Null
|
||||
} else {
|
||||
@@ -1816,7 +1820,8 @@ function Modify-ChildElements($modifyDef, [string]$childType) {
|
||||
continue
|
||||
}
|
||||
$tsAttrIndent = Get-ChildIndent $tsChildObjEl
|
||||
$fragmentXml = Build-AttributeFragment $parsed "tabular" $tsAttrIndent
|
||||
$tsAttrContext = if ($script:objType -in @("DataProcessor","Report","ExternalDataProcessor","ExternalReport")) { "processor-tabular" } else { "tabular" }
|
||||
$fragmentXml = Build-AttributeFragment $parsed $tsAttrContext $tsAttrIndent
|
||||
$nodes = Import-Fragment $fragmentXml
|
||||
$savedCO = $script:childObjectsEl
|
||||
$script:childObjectsEl = $tsChildObjEl
|
||||
|
||||
Reference in New Issue
Block a user