From 7c94eb6c877d5c1613a968f344ae42cc6d2c6735 Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 30 Mar 2011 12:59:13 +0000 Subject: Temporarily revert multiuser journal commits. --- server/src/journal_uploadserver.cc | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'server/src') diff --git a/server/src/journal_uploadserver.cc b/server/src/journal_uploadserver.cc index 8bc6e2d..06882b5 100644 --- a/server/src/journal_uploadserver.cc +++ b/server/src/journal_uploadserver.cc @@ -29,6 +29,8 @@ #include "journal_commit.h" +//#define USE_MULTIPLE_USERS + static inline bool iswhitespace(char c) { return c == ' ' || c == '\n' || c == '\t' || c == '\r'; @@ -162,6 +164,7 @@ JournalUploadServer::JournalUploadServer(std::string host, void JournalUploadServer::commit() { +#ifdef USE_MULTIPLE_USERS std::string resume; std::string olduser; @@ -174,7 +177,6 @@ void JournalUploadServer::commit() } if(i->second.user != olduser && olduser != "" && resume != "") { - // Connect to praxisuploadserver and commit all resumes in one bulk. journal_commit(patientID().c_str(), olduser.c_str(), host.c_str(), port, resume.c_str(), resume.size()); @@ -191,10 +193,37 @@ void JournalUploadServer::commit() if(resume == "") return; - // Connect to praxisuploadserver and commit all resumes in one bulk. journal_commit(patientID().c_str(), olduser.c_str(), host.c_str(), port, resume.c_str(), resume.size()); +#else + std::string resume; + std::string user; + + // Iterate through all resumes, and create a string containing them all. + std::map< int, ResumeEntry >::iterator i = entrylist.begin(); + while(i != entrylist.end()) { + if(i->second.dirty) { + i++; + continue; + } + + if(user == "") { + user = i->second.user; + } + + if(resume != "") resume += "\n\n"; + resume += stripTrailingWhitepace(addNewlines(i->second.resume, 60)); + i++; + } + + if(resume == "") return; + + // Connect to praxisuploadserver and commit all resumes in one bulk. + journal_commit(patientID().c_str(), user.c_str(), + host.c_str(), port, + resume.c_str(), resume.size()); +#endif/*USE_MULTIPLE_USERS*/ } -- cgit v1.2.3