diff options
Diffstat (limited to 'server/src/journal_commit.cc')
-rw-r--r-- | server/src/journal_commit.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/server/src/journal_commit.cc b/server/src/journal_commit.cc index e0db705..414fa20 100644 --- a/server/src/journal_commit.cc +++ b/server/src/journal_commit.cc @@ -207,12 +207,8 @@ JournalWriter::JournalWriter(std::string host, unsigned short int port) } void JournalWriter::addEntry(Transaction &transaction, Commit &commit, - std::string resume, std::string templname) + std::string resume, Template *templ) { - TemplateParser tp(templname); - tp.parse(); - Template *templ = tp.getTemplate(); - size_t index = 0; std::vector< Macro >::iterator i = templ->macros.begin(); while(i != templ->macros.end()) { @@ -224,21 +220,21 @@ void JournalWriter::addEntry(Transaction &transaction, Commit &commit, if(index >= templ->macros.size()) { PRACRO_ERR(journal, "Could not find macro %s in template %s\n", - commit.macro.c_str(), templname.c_str()); + commit.macro.c_str(), templ->attributes["name"].c_str()); // return; } else { PRACRO_DEBUG(journal, "Found macro %s as index %u in template %s\n", - commit.macro.c_str(), index, templname.c_str()); + commit.macro.c_str(), index, templ->attributes["name"].c_str()); } // First run - initialize username and cpr. if(currentuser == "" && entrylist.size() == 0) currentuser = transaction.user; if(currentcpr == "" && entrylist.size() == 0) currentcpr = transaction.cpr; - PRACRO_DEBUG(journal, "addEntry: template(%s)\n", templname.c_str()); + PRACRO_DEBUG(journal, "addEntry: template(%s)\n", templ->attributes["name"].c_str()); // Add the template resume as the header (ie. first entry) of the journal entry. - if(entrylist.size() == 0 && templname != "") { + if(entrylist.size() == 0 && templ->attributes["name"] != "") { std::string template_resume = templ->attributes["resume"]; PRACRO_DEBUG(journal, "TemplateResume: %s\n", template_resume.c_str()); |