fix(cfe-borrow,form-edit,cfe-patch-method): fix borrowed form structure to match Configurator

- cfe-borrow: keep AutoCommandBar ChildItems (buttons) with CommandName=0
  instead of stripping them — Configurator expects buttons to be present
- form-edit: insert Events section after AutoCommandBar, not before —
  matches Configurator's element ordering
- cfe-patch-method(py): fix \r\r\n double line endings by using
  newline="" in open() calls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-10 21:40:16 +03:00
parent 8584021446
commit 84d078bd05
5 changed files with 28 additions and 13 deletions
+12 -5
View File
@@ -1078,11 +1078,18 @@ if ($def.formEvents -and $def.formEvents.Count -gt 0) {
$eventsSection = $xmlDoc.CreateElement("Events", $formNs)
$insertAfter = $root.SelectSingleNode("f:AutoCommandBar", $nsMgr)
if ($insertAfter) {
$refNode = $insertAfter
$ws = $xmlDoc.CreateWhitespace("`r`n`t")
# Insert before the AutoCommandBar (Events come before AutoCommandBar in 1C)
$root.InsertBefore($ws, $refNode) | Out-Null
$root.InsertBefore($eventsSection, $refNode) | Out-Null
# Insert after AutoCommandBar (Events come after AutoCommandBar in 1C)
$ws1 = $xmlDoc.CreateWhitespace("`r`n`t")
$ws2 = $xmlDoc.CreateWhitespace("`r`n`t")
if ($insertAfter.NextSibling) {
$root.InsertBefore($ws1, $insertAfter.NextSibling) | Out-Null
$root.InsertBefore($eventsSection, $ws1) | Out-Null
$root.InsertBefore($ws2, $eventsSection) | Out-Null
} else {
$root.AppendChild($xmlDoc.CreateWhitespace("`r`n`t")) | Out-Null
$root.AppendChild($eventsSection) | Out-Null
$root.AppendChild($xmlDoc.CreateWhitespace("`r`n")) | Out-Null
}
} else {
$firstChild = $root.FirstChild
if ($firstChild) {