summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/journal_uploadserver.cc33
1 files changed, 31 insertions, 2 deletions
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*/
}