diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/StartupApplicationListener.java b/libreplan-webapp/src/main/java/org/libreplan/web/StartupApplicationListener.java index ed2ece06d..f4f87f82c 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/StartupApplicationListener.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/StartupApplicationListener.java @@ -54,8 +54,10 @@ public class StartupApplicationListener implements ApplicationListener { @Override public void onApplicationEvent(ApplicationEvent event) { // Send data to server - if (!SecurityUtils.isGatheredStatsAlreadySent && - configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowToGatherUsageStatsEnabled()) { + if (SecurityUtils.isGatheredStatsAlreadySent) { + return; + } + if (configurationDAO.getConfigurationWithReadOnlyTransaction() == null || configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowToGatherUsageStatsEnabled()) { GatheredUsageStats gatheredUsageStats = new GatheredUsageStats(); gatheredUsageStats.setupNotAutowiredClasses(userDAO, orderModel, workReportModel, workerModel, machineModel, diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java index bd82e3ed7..a7a0d7a8d 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java @@ -27,7 +27,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.cxf.jaxrs.client.WebClient; import org.libreplan.business.calendars.entities.BaseCalendar; import org.libreplan.business.common.daos.IConfigurationDAO; -import org.libreplan.business.common.entities.*; import org.libreplan.business.common.exceptions.ValidationException; import org.libreplan.business.costcategories.entities.TypeOfWorkHours; import org.libreplan.business.users.entities.UserRole; @@ -254,11 +253,10 @@ public class ConfigurationController extends GenericForwardComposer { messages.showMessage(Level.INFO, _("Changes saved")); // Send data to server - if ( !SecurityUtils.isGatheredStatsAlreadySent && - configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowedToGatherUsageStatsEnabled() ) { - - sendDataToServer(); - } + if (!SecurityUtils.isGatheredStatsAlreadySent && + configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowedToGatherUsageStatsEnabled()) { + sendDataToServer(); + } if ( getSelectedConnector() != null && !configurationModel.scheduleOrUnscheduleJobs(getSelectedConnector())) {