From fce451fc72fd57756a8294780c6c1c14e7209551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 4 Mar 2014 12:05:41 +0100 Subject: [PATCH] Feature #2763: Add group/template to onedb import-slave --- src/onedb/import_slave.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/onedb/import_slave.rb b/src/onedb/import_slave.rb index c22c1fcc45..1f7d3ab535 100644 --- a/src/onedb/import_slave.rb +++ b/src/onedb/import_slave.rb @@ -387,6 +387,20 @@ EOT end end + slave_template = slave_doc.root.at_xpath("TEMPLATE") + master_template = master_doc.root.at_xpath("TEMPLATE") + + # Avoid duplicated template attributes, removing + # them from the slave template + master_template.children.each do |e| + if slave_template.at_xpath(e.name) + slave_template.at_xpath(e.name).remove + end + end + + # Add slave template attributes to master template + master_template << slave_template.children + @db[:group_pool].where(:oid => new_group[:oid]).update( :body => master_doc.root.to_s) else