User by default fixed for logs

This commit is contained in:
Misha 2015-12-10 15:48:16 +02:00
parent 5c51cb0876
commit df55e1bd19
4 changed files with 14 additions and 1 deletions

View file

@ -81,6 +81,7 @@ public class IssueLogCRUDController extends BaseCRUDController<IssueLog> {
initializeOrderComponent(); initializeOrderComponent();
initializeUserComponent(); initializeUserComponent();
bdProjectIssueLog.setDisabled(!LogsController.getProjectNameVisibility()); bdProjectIssueLog.setDisabled(!LogsController.getProjectNameVisibility());
bdUserIssueLog.setDisabled(true);
} }
/** /**

View file

@ -39,6 +39,7 @@ import org.libreplan.business.users.daos.IUserDAO;
import org.libreplan.business.users.entities.User; import org.libreplan.business.users.entities.User;
import org.libreplan.web.common.IntegrationEntityModel; import org.libreplan.web.common.IntegrationEntityModel;
import org.libreplan.web.common.concurrentdetection.OnConcurrentModification; import org.libreplan.web.common.concurrentdetection.OnConcurrentModification;
import org.libreplan.web.security.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
@ -102,6 +103,11 @@ public class IssueLogModel extends IntegrationEntityModel implements
if (codeGenerated) { if (codeGenerated) {
issueLog.setCodeAutogenerated(codeGenerated); issueLog.setCodeAutogenerated(codeGenerated);
setDefaultCode(); setDefaultCode();
try {
issueLog.setCreatedBy(userDAO.findByLoginName(SecurityUtils.getSessionUserLoginName()));
} catch (InstanceNotFoundException e) {
e.printStackTrace();
}
} }
} }

View file

@ -78,6 +78,7 @@ public class RiskLogCRUDController extends BaseCRUDController<RiskLog> {
initializeOrderComponent(); initializeOrderComponent();
initializeUserComponent(); initializeUserComponent();
bdProjectRiskLog.setDisabled(!LogsController.getProjectNameVisibility()); bdProjectRiskLog.setDisabled(!LogsController.getProjectNameVisibility());
bdUserRiskLog.setDisabled(true);
} }
/** /**

View file

@ -34,11 +34,11 @@ import org.libreplan.business.logs.daos.IRiskLogDAO;
import org.libreplan.business.logs.entities.RiskLog; import org.libreplan.business.logs.entities.RiskLog;
import org.libreplan.business.orders.daos.IOrderDAO; import org.libreplan.business.orders.daos.IOrderDAO;
import org.libreplan.business.orders.entities.Order; import org.libreplan.business.orders.entities.Order;
import org.libreplan.business.scenarios.IScenarioManager;
import org.libreplan.business.users.daos.IUserDAO; import org.libreplan.business.users.daos.IUserDAO;
import org.libreplan.business.users.entities.User; import org.libreplan.business.users.entities.User;
import org.libreplan.web.common.IntegrationEntityModel; import org.libreplan.web.common.IntegrationEntityModel;
import org.libreplan.web.common.concurrentdetection.OnConcurrentModification; import org.libreplan.web.common.concurrentdetection.OnConcurrentModification;
import org.libreplan.web.security.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
@ -102,6 +102,11 @@ public class RiskLogModel extends IntegrationEntityModel implements
if (codeGenerated) { if (codeGenerated) {
riskLog.setCodeAutogenerated(codeGenerated); riskLog.setCodeAutogenerated(codeGenerated);
setDefaultCode(); setDefaultCode();
try {
riskLog.setCreatedBy(userDAO.findByLoginName(SecurityUtils.getSessionUserLoginName()));
} catch (InstanceNotFoundException e) {
e.printStackTrace();
}
} }
} }