diff --git a/src/main/java/info/bukova/isspst/security/WorkgroupAwareServiceEvaluator.java b/src/main/java/info/bukova/isspst/security/WorkgroupAwareServiceEvaluator.java index a5bd2e8d..8b1ff9e5 100644 --- a/src/main/java/info/bukova/isspst/security/WorkgroupAwareServiceEvaluator.java +++ b/src/main/java/info/bukova/isspst/security/WorkgroupAwareServiceEvaluator.java @@ -7,6 +7,7 @@ import info.bukova.isspst.data.PermissionType; import info.bukova.isspst.data.Role; import info.bukova.isspst.data.User; import info.bukova.isspst.data.Workgroup; +import info.bukova.isspst.services.Service; import info.bukova.isspst.services.workgroups.WorkgroupService; import java.util.List; @@ -42,13 +43,22 @@ public class WorkgroupAwareServiceEvaluator implements Evaluator { User user = (User)authentication.getPrincipal(); String moduleId = ""; + if (targetDomainObject instanceof Service) { + Service service = (Service)targetDomainObject; + Module mod = service.getModule(); + + if (mod != null) { + moduleId = mod.getId(); + } + } + // TODO - v master větvi je na toto pomocná třída - for (Module m : Constants.MODULES) { + /*for (Module m : Constants.MODULES) { if (m.getServiceClass() != null && m.getServiceClass().isAssignableFrom(targetDomainObject.getClass())) { moduleId = m.getId(); break; } - } + }*/ Permission appPermission = null; for (Permission p : Constants.SPECIAL_PERMISSIONS) { diff --git a/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java b/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java index 39834f49..a9039e0b 100644 --- a/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java @@ -1,9 +1,13 @@ package info.bukova.isspst.services.orders; +import info.bukova.isspst.Constants; +import info.bukova.isspst.Module; import info.bukova.isspst.data.JoinedItem; import info.bukova.isspst.data.RequirementItem; import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.Workgroup; +import info.bukova.isspst.reporting.Report; +import info.bukova.isspst.reporting.ReportType; import info.bukova.isspst.services.AbstractService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.workgroups.WorkgroupService; @@ -55,4 +59,27 @@ public class ApprovedServiceImpl extends AbstractService implements return items; } + + @Override + public Module getModule() { + for (Module m : Constants.MODULES) { + if (m.getId() == Constants.MOD_REQUIREMENTS) { + return m; + } + } + + return null; + } + + @Override + public List getReports() { + Report rep = new Report(); + rep.setType(ReportType.DYNAMIC); + rep.setName(Constants.DYNAMIC_REPORT_NAME); + + List ret = new ArrayList(); + ret.add(rep); + + return ret; + } } diff --git a/src/main/java/info/bukova/isspst/services/requirement/ReqMaterialServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/ReqMaterialServiceImpl.java index cf52e60d..e3096b84 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/ReqMaterialServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/ReqMaterialServiceImpl.java @@ -38,9 +38,8 @@ public class ReqMaterialServiceImpl extends RequirementServiceImpl implements Re @PreAuthorize("hasPermission(this, 'PERM_READ')") public List getMy() { - Query q = dao.getQuery("from " + dao.getEntityName() + " where ownedBy = :owner and state != :state and kind = :kind"); + Query q = dao.getQuery("from " + dao.getEntityName() + " where ownedBy = :owner and kind = :kind"); q.setParameter("owner", getLoggedInUser()); - q.setParameter("state", RequirementState.APPROVED); q.setParameter("kind", Constants.REQ_TYPE_MATERIAL); return q.list(); } @@ -53,9 +52,8 @@ public class ReqMaterialServiceImpl extends RequirementServiceImpl implements Re public List getCentreReq() { List wgList = workgroupService.getUserCentres(getLoggedInUser()); - Query q = dao.getQuery("select tr from " + dao.getEntityName() + " tr join fetch tr.ownedBy join tr.centre c where tr.state != :state and c in (:wgList) and kind = :kind order by tr.numser"); + Query q = dao.getQuery("select tr from " + dao.getEntityName() + " tr join fetch tr.ownedBy join tr.centre c where c in (:wgList) and kind = :kind order by tr.numser"); q.setParameterList("wgList", wgList); - q.setParameter("state", RequirementState.APPROVED); q.setParameter("kind", Constants.REQ_TYPE_MATERIAL); return q.list(); } @@ -70,9 +68,8 @@ public class ReqMaterialServiceImpl extends RequirementServiceImpl implements Re List wgList = workgroupService.getUserWorkgroups(getLoggedInUser()); Query q = dao.getQuery("select tr from " + dao.getEntityName() - + " tr join fetch tr.ownedBy join tr.workgroup w where tr.state != :state and w in (:wgList) and kind = :kind order by tr.numser"); + + " tr join fetch tr.ownedBy join tr.workgroup w where w in (:wgList) and kind = :kind order by tr.numser"); q.setParameterList("wgList", wgList); - q.setParameter("state", RequirementState.APPROVED); q.setParameter("kind", Constants.REQ_TYPE_MATERIAL); return q.list(); } diff --git a/src/main/java/info/bukova/isspst/services/requirement/ReqServicesServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/ReqServicesServiceImpl.java index 46d86338..bafd2fb5 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/ReqServicesServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/ReqServicesServiceImpl.java @@ -38,9 +38,8 @@ public class ReqServicesServiceImpl extends RequirementServiceImpl implements Re @PreAuthorize("hasPermission(this, 'PERM_READ')") public List getMy() { - Query q = dao.getQuery("from " + dao.getEntityName() + " where ownedBy = :owner and state != :state and kind = :kind"); + Query q = dao.getQuery("from " + dao.getEntityName() + " where ownedBy = :owner and kind = :kind"); q.setParameter("owner", getLoggedInUser()); - q.setParameter("state", RequirementState.APPROVED); q.setParameter("kind", Constants.REQ_TYPE_SERVICES); return q.list(); } @@ -53,9 +52,8 @@ public class ReqServicesServiceImpl extends RequirementServiceImpl implements Re public List getCentreReq() { List wgList = workgroupService.getUserCentres(getLoggedInUser()); - Query q = dao.getQuery("select tr from " + dao.getEntityName() + " tr join fetch tr.ownedBy join tr.centre c where tr.state != :state and c in (:wgList) and kind = :kind order by tr.numser"); + Query q = dao.getQuery("select tr from " + dao.getEntityName() + " tr join fetch tr.ownedBy join tr.centre c where c in (:wgList) and kind = :kind order by tr.numser"); q.setParameterList("wgList", wgList); - q.setParameter("state", RequirementState.APPROVED); q.setParameter("kind", Constants.REQ_TYPE_SERVICES); return q.list(); } @@ -70,9 +68,8 @@ public class ReqServicesServiceImpl extends RequirementServiceImpl implements Re List wgList = workgroupService.getUserWorkgroups(getLoggedInUser()); Query q = dao.getQuery("select tr from " + dao.getEntityName() - + " tr join fetch tr.ownedBy join tr.workgroup w where tr.state != :state and w in (:wgList) and kind = :kind order by tr.numser"); + + " tr join fetch tr.ownedBy join tr.workgroup w where w in (:wgList) and kind = :kind order by tr.numser"); q.setParameterList("wgList", wgList); - q.setParameter("state", RequirementState.APPROVED); q.setParameter("kind", Constants.REQ_TYPE_SERVICES); return q.list(); } diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java index 4587eab5..bc44a3f5 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java @@ -334,9 +334,8 @@ public abstract class RequirementBaseServiceImpl exte @PreAuthorize("hasPermission(this, 'PERM_READ')") public List getMy() { - Query q = dao.getQuery("from " + dao.getEntityName() + " where ownedBy = :owner and state != :state"); + Query q = dao.getQuery("from " + dao.getEntityName() + " where ownedBy = :owner"); q.setParameter("owner", getLoggedInUser()); - q.setParameter("state", RequirementState.APPROVED); return q.list(); } @@ -348,9 +347,8 @@ public abstract class RequirementBaseServiceImpl exte public List getCentreReq() { List wgList = workgroupService.getUserCentres(getLoggedInUser()); - Query q = dao.getQuery("select tr from " + dao.getEntityName() + " tr join fetch tr.ownedBy join tr.centre c where tr.state != :state and c in (:wgList) order by tr.numser"); + Query q = dao.getQuery("select tr from " + dao.getEntityName() + " tr join fetch tr.ownedBy join tr.centre c where c in (:wgList) order by tr.numser"); q.setParameterList("wgList", wgList); - q.setParameter("state", RequirementState.APPROVED); return q.list(); } @@ -362,9 +360,8 @@ public abstract class RequirementBaseServiceImpl exte public List getWorkgroupReq() { List wgList = workgroupService.getUserWorkgroups(getLoggedInUser()); - Query q = dao.getQuery("select tr from " + dao.getEntityName() + " tr join fetch tr.ownedBy join tr.workgroup w where tr.state != :state and w in (:wgList) order by tr.numser"); + Query q = dao.getQuery("select tr from " + dao.getEntityName() + " tr join fetch tr.ownedBy join tr.workgroup w where w in (:wgList) order by tr.numser"); q.setParameterList("wgList", wgList); - q.setParameter("state", RequirementState.APPROVED); return q.list(); } diff --git a/src/main/webapp/WEB-INF/reports/tripBill.jasper b/src/main/webapp/WEB-INF/reports/tripBill.jasper index 9d6778f8..a2febae2 100644 Binary files a/src/main/webapp/WEB-INF/reports/tripBill.jasper and b/src/main/webapp/WEB-INF/reports/tripBill.jasper differ diff --git a/src/main/webapp/WEB-INF/reports/tripBill.jrxml b/src/main/webapp/WEB-INF/reports/tripBill.jrxml index 17eaf900..2a937252 100644 --- a/src/main/webapp/WEB-INF/reports/tripBill.jrxml +++ b/src/main/webapp/WEB-INF/reports/tripBill.jrxml @@ -1,8 +1,8 @@ - - + + @@ -50,97 +50,97 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -151,43 +151,43 @@ tuzemské pracovní cesty]]> - + - + - + - + - + - + - + @@ -196,13 +196,13 @@ tuzemské pracovní cesty]]> - + - + - + @@ -220,26 +220,18 @@ tuzemské pracovní cesty]]> - - - - - - - - - - + - + + + - + - + @@ -247,8 +239,27 @@ tuzemské pracovní cesty]]> + + + + + + + + + + + + + + + + + + + - + @@ -256,25 +267,93 @@ tuzemské pracovní cesty]]> + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + - + - - + + + + + + + + + @@ -282,14 +361,24 @@ tuzemské pracovní cesty]]> - + + + + + + + + + + + - + - + @@ -297,97 +386,148 @@ tuzemské pracovní cesty]]> + + + + - - - - - + + + + + + + + - + + + + + + + + - + + + + + + + + - + + + + + + + + + + + + + - + - + + + + - - - + + + + + - - - + + + + + - - - - + + + + - - + + - + - - - - - - - - + + + - + - + - + - + + + + + + + - - - + + + + + - + - + - - - - - - - - - - - - - - - + + + + + + + - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/reports/tripRequirement.jasper b/src/main/webapp/WEB-INF/reports/tripRequirement.jasper index 79f8b7ab..eff4bf30 100644 Binary files a/src/main/webapp/WEB-INF/reports/tripRequirement.jasper and b/src/main/webapp/WEB-INF/reports/tripRequirement.jasper differ diff --git a/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml b/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml index ea605366..e1bbf087 100644 --- a/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml +++ b/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml @@ -97,7 +97,7 @@ - +