Author: vbriand Date: 2011-04-01 16:45:15 +0200 (Fri, 01 Apr 2011) New Revision: 51 Url: http://chorem.org/repositories/revision/chorem/51 Log: The project's quotations are shown on the project's page 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/resources/struts.xml trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.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-01 13:50:42 UTC (rev 50) +++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-04-01 14:45:15 UTC (rev 51) @@ -9,6 +9,7 @@ import org.chorem.action.BaseAction; import org.chorem.entities.Project; import org.chorem.entities.ProjectImpl; +import org.chorem.entities.Quotation; import org.nuiton.wikitty.search.Criteria; import org.nuiton.wikitty.search.PagedResult; import org.nuiton.wikitty.search.Search; @@ -126,13 +127,31 @@ */ public List<Project> getAllProjects() { ChoremProxy proxy = getChoremProxy(); - Criteria criteria = Search.query().isNotNull(Project.EXT_PROJECT).criteria(); - PagedResult<Project> result = proxy.findAllByCriteria(Project.class, criteria); + Search search = Search.query(); + Criteria criteria = search.isNotNull(Project.FQ_FIELD_PROJECT_NAME).criteria(); + PagedResult<Project> result = proxy.findAllByCriteria(Project.class, + criteria); List<Project> projects = result.getAll(); return projects; } /** + * Gets the quotations attached with this project + * + * @return the quotations linked with this project + */ + public List<Quotation> getAttachedQuotations() { + ChoremProxy proxy = getChoremProxy(); + Search search = Search.query(); + Criteria criteria = search.eq(Quotation.FQ_FIELD_QUOTATION_PROJECT, + projectId).criteria(); + PagedResult<Quotation> result = proxy.findAllByCriteria(Quotation.class, + criteria); + List<Quotation> quotations = result.getAll(); + return quotations; + } + + /** * @return the name */ public String getName() { 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-01 13:50:42 UTC (rev 50) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-04-01 14:45:15 UTC (rev 51) @@ -87,6 +87,8 @@ chorem.gepeto.project.description.required=You must describe the project chorem.gepeto.project.name=Project''s name chorem.gepeto.project.name.required=You must enter the project''s name +chorem.gepeto.projectDetails.quotation=Quotation of {0} (ref. {1}) +chorem.gepeto.projectDetails.quotations=Project''s quotations chorem.gepeto.projectDetails.title=Details of project "{0}" chorem.gepeto.projectOrder=Project order chorem.gepeto.projectOrder.add=Add a new project order 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-01 13:50:42 UTC (rev 50) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-04-01 14:45:15 UTC (rev 51) @@ -83,6 +83,8 @@ chorem.gepeto.project.description.required=Vous devez d\u00E9crire le projet chorem.gepeto.project.name=Nom du projet chorem.gepeto.project.name.required=Vous devez renseigner un nom pour le projet +chorem.gepeto.projectDetails.quotation=Devis du {0} (r\u00E9f. {1}) +chorem.gepeto.projectDetails.quotations=Devis du projet chorem.gepeto.projectDetails.title=D\u00E9tails du projet "{0}" chorem.gepeto.projectOrder=Contrat de commande d''un projet chorem.gepeto.projectOrder.add=Ajouter le contrat d''un projet Modified: trunk/chorem-web/src/main/resources/struts.xml =================================================================== --- trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 13:50:42 UTC (rev 50) +++ trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 14:45:15 UTC (rev 51) @@ -104,7 +104,11 @@ <action name="addQuotation" class="org.chorem.billy.action.QuotationAction" method="add"> <result name="input">/WEB-INF/jsp/billy/addQuotation.jsp</result> <result name="error" type="redirectAction">home</result> - <result type="redirectAction">home</result> + <result type="redirectAction"> + <param name="actionName">projectDetails</param> + <param name="namespace">/gepeto</param> + <param name="projectId">${projectId}</param> + </result> </action> </package> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp 2011-04-01 13:50:42 UTC (rev 50) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp 2011-04-01 14:45:15 UTC (rev 51) @@ -25,7 +25,7 @@ </legend> <s:textfield key="chorem.billy.quotation.reference" name="reference" labelSeparator=": " /> <br /> - <s:textfield key="chorem.billy.quotation.description" name="description" labelSeparator=": " /> + <s:textarea key="chorem.billy.quotation.description" name="description" cols="50" rows="10" labelposition="top" labelSeparator=": " /> <br /> <s:textfield key="chorem.billy.quotation.amount" name="amount" labelSeparator=": " /> <br /> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp 2011-04-01 13:50:42 UTC (rev 50) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp 2011-04-01 14:45:15 UTC (rev 51) @@ -16,7 +16,7 @@ <s:textfield key="chorem.bonzoms.employmentContract.type" name="type" labelSeparator=": " /> <br /> <br /> - <s:textarea key="chorem.bonzoms.employmentContract.description" name="description" cols="50" rows="10" labelposition="top" /> + <s:textarea key="chorem.bonzoms.employmentContract.description" name="description" cols="50" rows="10" labelposition="top" labelSeparator=": " /> <br /> <br /> <s:textfield key="chorem.bonzoms.employmentContract.salary" name="salary" labelSeparator=": " /> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp 2011-04-01 13:50:42 UTC (rev 50) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp 2011-04-01 14:45:15 UTC (rev 51) @@ -1,4 +1,6 @@ <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@page import="java.util.List" %> +<%@page import="org.chorem.entities.Quotation" %> <%@page import="org.chorem.gepeto.action.ProjectAction" %> <%@taglib prefix="s" uri="/struts-tags" %> @@ -10,7 +12,7 @@ <s:param><%= ProjectAction.getAction().getName() %></s:param> </s:text> </title> - <!--<s:head />--> + <s:head /> </head> <body> <h2> @@ -22,10 +24,33 @@ <s:textarea readonly="true" name="description" key="chorem.gepeto.project.description" cols="50" rows="10" labelposition="top" /> <br /> <br /> - <s:url namespace="/billy" action="addQuotation_input" var="addQuotation"> + <s:url namespace="/billy" action="addQuotationInput" var="addQuotation"> <s:param name="projectId"><%= ProjectAction.getAction().getProjectId() %></s:param> </s:url> <a href="${addQuotation}"><s:text name="chorem.billy.quotation.add" /></a> </p> + <p> + <s:text name="chorem.gepeto.projectDetails.quotations" /> + <br /> + <br /> + <% + List<Quotation> quotations = ProjectAction.getAction().getAttachedQuotations(); + + for (Quotation quotation : quotations) { + %> + <s:url namespace="/billy" action="quotationDetails" var="quotationDetails"> + <s:param name="quotationId"><%= quotation.getWikittyId() %></s:param> + </s:url> + <s:text name="chorem.gepeto.projectDetails.quotation"> + <s:param> + <%= quotation.getPostedDate() %> + </s:param> + <s:param> + <a href="${quotationDetails}"><%= quotation.getReference() %></a> + </s:param> + </s:text> + <br /> + <% } %> + </p> </body> </html>