Commit 547d800d authored by Md Suleman's avatar Md Suleman

changed validations for adding resource to the project

parent 532a5f5e
......@@ -133,27 +133,13 @@ public class ResourceService implements IResourceService {
if (resource != null) {
if(!resourceReq.getStatus().equalsIgnoreCase(MyTeamUtils.STATUS_RELEASED)){
Resource latestAllocation = this.getLatestAllocation(resourceRepo.findByEmployeeId(resourceReq.getEmployeeId()));
if(latestAllocation!=null && !latestAllocation.getProjectId().equalsIgnoreCase(resourceReq.getProjectId())&&
!latestAllocation.getBillingStartDate().after(resourceReq.getBillingEndDate())) {
respMap.put("statusCode", 811);
respMap.put("message", "Resource is already allocated after "+latestAllocation.getBillingStartDate());
}else{
// if (resourceReq.getBillingEndDate().compareTo(new Date()) < 0) {
// resourceReq.setStatus(MyTeamUtils.RELEASED_STATUS);//update Status of allocation
// Resource resourceBench = new Resource();
// resourceBench.setProjectId(MyTeamUtils.BENCH_PROJECT_ID);
// resourceBench.setEmployeeId(resourceReq.getEmployeeId());
// resourceBench.setResourceRole(resourceReq.getResourceRole());
// resourceBench.setStatus(MyTeamUtils.RELEASED_STATUS);//add alocation status as Released
// resourceBench.setBillingStartDate(MyTeamDateUtils.getDayMoreThanDate(resourceReq.getBillingEndDate()));
// resourceBench.setBillingEndDate(projectService.getProjectByProjectId(MyTeamUtils.BENCH_PROJECT_ID).getProjectEndDate());
// resourceBench.setBillableStatus(MyTeamUtils.BENCH_BILLABILITY_STATUS);
// resourceBench.setAuditFields(loginEmpId, MyTeamUtils.CREATE);
// resourceRepo.save(resourceBench);
// }
this.updateExistedResource(resourceReq);
if(isDatesAvailableForAllocation(resourceReq)) {
Resource latestBenchAlloc = getLatestAllocation(resourceRepo.findByEmployeeIdAndProjectId(resourceReq.getEmployeeId(),MyTeamUtils.BENCH_PROJECT_ID));
this.updateExistedResource(resourceReq);
}
}else{
respMap.put("statusCode", 811);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment