r88 - in trunk/chorem-web/src/main: java/org/chorem/gepeto/action resources/i18n webapp/WEB-INF/jsp/gepeto
Author: vbriand Date: 2011-04-15 10:54:28 +0200 (Fri, 15 Apr 2011) New Revision: 88 Url: http://chorem.org/repositories/revision/chorem/88 Log: Added a list of projects with quotation but without project order on the page listing the projects by year Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-04-14 16:08:29 UTC (rev 87) +++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-04-15 08:54:28 UTC (rev 88) @@ -203,6 +203,74 @@ } /** + * Gets the projects without project order but with quotation by year + * + * @return the list of projects + */ + public List<Project> getProjectsWithoutProjectOrderByYear() { + ChoremProxy proxy = getChoremProxy(); + Calendar cal = Calendar.getInstance(); + Collection<Quotation> allQuotations = new ArrayList<Quotation>( + getAllQuotations()); + + allQuotations.removeAll(getQuotationsWithProjectOrder()); + List<Project> projects = new ArrayList<Project>(); + Project project; + int quotationYear; + + for (Quotation quotation : allQuotations) { + cal.setTime(quotation.getPostedDate()); + quotationYear = cal.get(Calendar.YEAR); + if (yearInt == quotationYear) { + project = proxy.restore(Project.class, quotation.getProject()); + //If the project isn't already in the list + if (!projects.contains(project)) { + projects.add(project); + } + } + } + return projects; + } + + /** + * Gets all quotations with project order + * + * @return all quotations with project order + */ + public List<Quotation> getQuotationsWithProjectOrder() { + ChoremProxy proxy = getChoremProxy(); + Search search = Search.query(); + Criteria criteria = search.exteq(ProjectOrder.EXT_PROJECTORDER).criteria(); + PagedResult<ProjectOrder> result = proxy. + findAllByCriteria(ProjectOrder.class, criteria); + List<ProjectOrder> projectOrders = result.getAll(); + List<Quotation> quotations = new ArrayList<Quotation>(); + Quotation quotation; + + for (ProjectOrder projectOrder : projectOrders) { + quotation = proxy.restore(Quotation.class, + projectOrder.getQuotation()); + quotations.add(quotation); + } + return quotations; + } + + /** + * Gets all quotations, whether they have a project order or not + * + * @return all quotations + */ + public List<Quotation> getAllQuotations() { + ChoremProxy proxy = getChoremProxy(); + Search search = Search.query(); + Criteria criteria = search.exteq(Quotation.EXT_QUOTATION).criteria(); + PagedResult<Quotation> result = proxy.findAllByCriteria(Quotation.class, + criteria); + List<Quotation> quotations = result.getAll(); + return quotations; + } + + /** * Gets the quotations attached with this project * * @return the quotations linked with this project @@ -241,7 +309,8 @@ * @return the quotations without a project order */ public List<Quotation> getAttachedQuotationsWithoutProjectOrder() { - Collection<Quotation> allQuotations = new ArrayList<Quotation>(getAttachedQuotations()); + Collection<Quotation> allQuotations = new ArrayList<Quotation>( + getAttachedQuotations()); //Gets all quotations and removes the ones with a project order allQuotations.removeAll(getAttachedQuotationsWithProjectOrder()); @@ -261,8 +330,8 @@ Criteria criteria = search.exteq(ProjectOrder.EXT_PROJECTORDER). associated(ProjectOrder.FQ_FIELD_PROJECTORDER_QUOTATION). eq(Quotation.FQ_FIELD_QUOTATION_PROJECT, projectId).criteria(); - PagedResult<ProjectOrder> result = proxy.findAllByCriteria(ProjectOrder.class, - criteria); + PagedResult<ProjectOrder> result = proxy. + findAllByCriteria(ProjectOrder.class, criteria); List<ProjectOrder> projectOrders = result.getAll(); return projectOrders; @@ -280,8 +349,8 @@ Criteria criteria = search.exteq(ProjectOrder.EXT_PROJECTORDER). associated(ProjectOrder.FQ_FIELD_PROJECTORDER_QUOTATION). eq(Quotation.FQ_FIELD_QUOTATION_PROJECT, projectId).criteria(); - PagedResult<ProjectOrder> result = proxy.findAllByCriteria(ProjectOrder.class, - criteria); + PagedResult<ProjectOrder> result = proxy. + findAllByCriteria(ProjectOrder.class, criteria); List<ProjectOrder> projectOrders = result.getAll(); return projectOrders; Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties =================================================================== --- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-04-14 16:08:29 UTC (rev 87) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-04-15 08:54:28 UTC (rev 88) @@ -142,6 +142,7 @@ chorem.gepeto.projectsByYear.thead.name=Name chorem.gepeto.projectsByYear.thead.start=Start chorem.gepeto.projectsByYear.title=Projects of year {0} +chorem.gepeto.projectsWithoutQuotation= chorem.gepeto.results.title=Results by year chorem.gepeto.task=Task {0} chorem.gepeto.task.add=Add a new task Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties =================================================================== --- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-04-14 16:08:29 UTC (rev 87) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-04-15 08:54:28 UTC (rev 88) @@ -138,6 +138,7 @@ chorem.gepeto.projectsByYear.thead.name=Nom chorem.gepeto.projectsByYear.thead.start=D\u00E9but chorem.gepeto.projectsByYear.title=Projets de l''ann\u00E9e {0} +chorem.gepeto.projectsWithoutQuotation= chorem.gepeto.results.title=R\u00E9sultats par ann\u00E0e chorem.gepeto.task=T\u00E2che {0} chorem.gepeto.task.add=Ajouter une nouvelle t\u00E2che Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp 2011-04-14 16:08:29 UTC (rev 87) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp 2011-04-15 08:54:28 UTC (rev 88) @@ -14,6 +14,7 @@ <s:param name="year">2011</s:param> </s:url> <a href="${getProjectsByYear}"><s:text name="chorem.gepeto.projects" /></a><br /> + <s:a action="getProjectsWithoutQuotation"><s:text name="chorem.gepeto.projectsWithoutQuotation" /></s:a><br /> </p> </body> </html> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp 2011-04-14 16:08:29 UTC (rev 87) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp 2011-04-15 08:54:28 UTC (rev 88) @@ -22,6 +22,9 @@ </s:text> </h2> <table> + <caption> + <s:text name="chorem.gepeto.projectsByYear.withProjectOrder" /> + </caption> <thead> <tr> <th><s:text name="chorem.gepeto.projectsByYear.thead.name" /></th> @@ -61,5 +64,50 @@ <% } %> </tbody> </table> + <br /> + <table> + <caption> + <s:text name="chorem.gepeto.projectsByYear.withoutProjectOrder" /> + </caption> + <thead> + <tr> + <th><s:text name="chorem.gepeto.projectsByYear.thead.name" /></th> + <th><s:text name="chorem.gepeto.projectsByYear.thead.company" /></th> + <th><s:text name="chorem.gepeto.projectsByYear.thead.start" /></th> + <th><s:text name="chorem.gepeto.projectsByYear.thead.end" /></th> + </tr> + </thead> + <tbody> + <% + projects = ProjectAction.getAction().getProjectsWithoutProjectOrderByYear(); + + for (Project project : projects) { + %> + <tr> + <s:url action="projectDetails" var="projectDetails"> + <s:param name="projectId"><%= project.getWikittyId() %></s:param> + </s:url> + <td><a href="${projectDetails}"><%= project.getName() %></a></td> + <td> + <% + List<Company> customers = ProjectAction.getAction().getCustomersByYear(project.getWikittyId()); + + for (Company customer : customers) { + %> + <s:url namespace="/bonzoms" action="companyDetails" var="companyDetails"> + <s:param name="companyId"><%= customer.getWikittyId() %></s:param> + </s:url> + <a href="${companyDetails}"><%= customer.getName() %></a> + <% + } + %> + </td> + <td></td> + <td></td> + </tr> + <% } %> + </tbody> + </table> + <br /> </body> </html>
participants (1)
-
vbriand@users.chorem.org