Feature #2124: New template append action in core

This commit is contained in:
Carlos Martín committed 2013-06-28 18:45:27 +02:00
1 parent 7dda3a27fc
commit c632828876
6 files changed
+155 -4

No files matched your search

+32
View File
@@ -196,6 +196,38 @@ int PoolObjectSQL::replace_template(const string& tmpl_str, string& error)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int PoolObjectSQL::append_template(const string& tmpl_str, string& error)
{
Template * new_tmpl = get_new_template();
if ( new_tmpl == 0 )
{
error = "Cannot allocate a new template";
return -1;
}
if ( new_tmpl->parse_str_or_xml(tmpl_str, error) != 0 )
{
delete new_tmpl;
return -1;
}
if ( obj_template != 0 )
{
obj_template->merge(new_tmpl, error);
delete new_tmpl;
}
else
{
obj_template = new_tmpl;
}
return 0;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
string& PoolObjectSQL::perms_to_xml(string& xml) const
{
ostringstream oss;