diff --git a/src/main/java/application/FormController.java b/src/main/java/application/FormController.java index 0b96dfe1e..a08b24006 100644 --- a/src/main/java/application/FormController.java +++ b/src/main/java/application/FormController.java @@ -195,6 +195,13 @@ public SubmitResponseBean submitForm(@RequestBody SubmitRequestBean submitReques } } + if (storageFactory.getPropertyManager().isSyncAfterFormEnabled()) { + //If configured to do so, do a sync with server now to ensure dats is up to date. + //Need to do before end of form nav triggers, since the new data might change the + //validity of the form + restoreFactory.performTimedSync(); + } + if (formEntrySession.getMenuSessionId() != null && !("").equals(formEntrySession.getMenuSessionId().trim())) { Object nav = doEndOfFormNav(menuSessionRepo.findOneWrapped(formEntrySession.getMenuSessionId())); diff --git a/src/main/java/util/FormplayerPropertyManager.java b/src/main/java/util/FormplayerPropertyManager.java index b513cb984..0487214bd 100644 --- a/src/main/java/util/FormplayerPropertyManager.java +++ b/src/main/java/util/FormplayerPropertyManager.java @@ -15,6 +15,8 @@ public class FormplayerPropertyManager extends PropertyManager { public static final String ENABLE_BULK_PERFORMANCE = "cc-enable-bulk-performance"; public static final String AUTO_PURGE_ENABLED = "cc-auto-purge"; + public static final String POST_FORM_SYNC = "cc-sync-after-form"; + /** * Constructor for this PropertyManager * @@ -40,4 +42,8 @@ public boolean isBulkPerformanceEnabled() { public boolean isAutoPurgeEnabled() { return doesPropertyMatch(AUTO_PURGE_ENABLED, NO, YES); } + + public boolean isSyncAfterFormEnabled() { + return doesPropertyMatch(POST_FORM_SYNC, NO, YES); + } }