Author: vbriand Date: 2011-04-01 17:22:50 +0200 (Fri, 01 Apr 2011) New Revision: 52 Url: http://chorem.org/repositories/revision/chorem/52 Log: The quotation details can now be seen from the project's page Added: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp Modified: trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 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/gepeto/home.jsp Modified: trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-04-01 14:45:15 UTC (rev 51) +++ trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-04-01 15:22:50 UTC (rev 52) @@ -9,6 +9,7 @@ import org.chorem.ChoremProxy; import org.chorem.action.BaseAction; import org.chorem.entities.Project; +import org.chorem.entities.Quotation; import org.chorem.entities.QuotationImpl; import com.opensymphony.xwork2.ActionContext; @@ -71,6 +72,45 @@ return result; } + /** + * Retrieves the information of the quotation referenced by the + * quotationId + * + * @return SUCCESS if the information have been retrieved + * @return ERROR either if the UUID is invalid or the quotationId doesn't + * exist + */ + public String quotationDetails() { + String result = SUCCESS; + ChoremProxy proxy = getChoremProxy(); + + try { + if (quotationId == null) { + result = ERROR; + } else { + //If quotationId isn't a valid UUID, an exception is thrown + UUID.fromString(quotationId); + + Quotation quotation = proxy.restore(Quotation.class, quotationId); + + if (quotation != null) { //If the quotationId exists + setReference(quotation.getReference()); + setDescription(quotation.getDescription()); + setAmount(String.valueOf(quotation.getAmount())); + setVta(String.valueOf(quotation.getVTA())); + setPostedDate(quotation.getPostedDate().toString()); + setProjectId(quotation.getProject()); + } else { + result = ERROR; + } + } + } catch (IllegalArgumentException e) { + //quotationId is invalid + result = ERROR; + } + return result; + } + protected String projectId; protected String projectName; protected String reference; @@ -78,6 +118,7 @@ protected String amount; protected String vta; protected String postedDate; + protected String quotationId; /** * Stores the new quotation through the proxy @@ -217,4 +258,18 @@ public void setProjectName(String projectName) { this.projectName = projectName; } + + /** + * @return the quotationId + */ + public String getQuotationId() { + return quotationId; + } + + /** + * @param quotationId the quotationId to set + */ + public void setQuotationId(String quotationId) { + this.quotationId = quotationId; + } } 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 14:45:15 UTC (rev 51) +++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-04-01 15:22:50 UTC (rev 52) @@ -86,6 +86,7 @@ } } } catch (IllegalArgumentException e) { + //projectId is invalid result = ERROR; } return result; 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 14:45:15 UTC (rev 51) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-04-01 15:22:50 UTC (rev 52) @@ -3,12 +3,15 @@ chorem.billy.quotation=Quotation chorem.billy.quotation.add=Add a new quotation chorem.billy.quotation.addToProject=Add a new quotation to the project "{0}" +chorem.billy.quotation.amound= chorem.billy.quotation.amount=Amount +chorem.billy.quotation.backToProjectDetails=Get back to project chorem.billy.quotation.create.error=An error occurred while creating your new quotation, please try again. If the problem persists, please contact an administrator chorem.billy.quotation.description=Description chorem.billy.quotation.postedDate=Posted date chorem.billy.quotation.reference=Reference chorem.billy.quotation.vta=VTA +chorem.billy.quotationDetails.title= chorem.bonzoms.company=Company {0} chorem.bonzoms.company.add=Add a new company chorem.bonzoms.company.addressLine1=Address 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 14:45:15 UTC (rev 51) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-04-01 15:22:50 UTC (rev 52) @@ -3,12 +3,15 @@ chorem.billy.quotation=Devis chorem.billy.quotation.add=Ajouter un nouveau devis chorem.billy.quotation.addToProject=Ajouter un nouveau devis au projet "{0}" +chorem.billy.quotation.amound= chorem.billy.quotation.amount=Montant +chorem.billy.quotation.backToProjectDetails=Retourner sur le projet chorem.billy.quotation.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouveau devis, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur chorem.billy.quotation.description=Description chorem.billy.quotation.postedDate=Date de d\u00E9p\u00F4t chorem.billy.quotation.reference=R\u00E9f\u00E9rence chorem.billy.quotation.vta=TVA +chorem.billy.quotationDetails.title= chorem.bonzoms.company=Soci\u00E9t\u00E9 chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9 chorem.bonzoms.company.addressLine1=Adresse Modified: trunk/chorem-web/src/main/resources/struts.xml =================================================================== --- trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 14:45:15 UTC (rev 51) +++ trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 15:22:50 UTC (rev 52) @@ -110,6 +110,10 @@ <param name="projectId">${projectId}</param> </result> </action> + <action name="quotationDetails" class="org.chorem.billy.action.QuotationAction" method="quotationDetails"> + <result name="error" type="redirectAction">home</result> + <result>/WEB-INF/jsp/billy/quotationDetails.jsp</result> + </action> </package> <!--<package name="cash" namespace="/cash" extends="struts-default"> Added: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp (rev 0) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp 2011-04-01 15:22:50 UTC (rev 52) @@ -0,0 +1,38 @@ +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> +<%@page import="org.chorem.billy.action.QuotationAction" %> +<%@taglib prefix="s" uri="/struts-tags" %> + +<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" + xmlns:jsp="http://java.sun.com/JSP/Page"> + <head> + <title> + <s:text name="chorem.billy.quotationDetails.title"> + <s:param><%= QuotationAction.getAction().getReference() %></s:param> + </s:text> + </title> + <s:head /> + </head> + <body> + <h2> + <s:text name="chorem.billy.quotation"> + <s:param><%= QuotationAction.getAction().getReference() %></s:param> + </s:text> + </h2> + <p> + <s:textarea readonly="true" name="description" key="chorem.billy.quotation.description" cols="50" rows="10" labelposition="top" labelSeparator=": " /> + <br /> + <br /> + <s:textfield readonly="true" name="amount" key="chorem.billy.quotation.amount" labelSeparator=": " /> + <br /> + <s:textfield readonly="true" name="vta" key="chorem.billy.quotation.vta" labelSeparator=": " /> + <br /> + <s:textfield readonly="true" name="postedDate" key="chorem.billy.quotation.postedDate" labelSeparator=": " /> + <br /> + <br /> + <s:url namespace="/gepeto" action="projectDetails" var="projectDetails"> + <s:param name="projectId"><%= QuotationAction.getAction().getProjectId() %></s:param> + </s:url> + <a href="${projectDetails}"><s:text name="chorem.billy.quotation.backToProjectDetails" /></a> + </p> + </body> +</html> Property changes on: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp ___________________________________________________________________ Added: svn:mime-type + text/plain 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-01 14:45:15 UTC (rev 51) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp 2011-04-01 15:22:50 UTC (rev 52) @@ -10,6 +10,7 @@ <body> <s:a action="addProject_input"><s:text name="chorem.gepeto.project.add" /></s:a><br /> <s:a action="addProjectOrder_input"><s:text name="chorem.gepeto.projectOrder.add" /></s:a><br /> - <s:a action="addTask_input"><s:text name="chorem.gepeto.task.add" /></s:a> + <s:a action="addTask_input"><s:text name="chorem.gepeto.task.add" /></s:a><br /> + <s:a action="getProjectsByYear"><s:text name="chorem.gepeto.projects" /></s:a><br /> </body> </html>