r112 - in trunk/chorem-web/src/main: java/org/chorem/billy/action java/org/chorem/bonzoms resources/i18n webapp/WEB-INF/jsp/billy
Author: vbriand Date: 2011-04-28 11:07:36 +0200 (Thu, 28 Apr 2011) New Revision: 112 Url: http://chorem.org/repositories/revision/chorem/112 Log: Fixed bugs and added supplier and customer on the quotation's page Modified: trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java trunk/chorem-web/src/main/java/org/chorem/bonzoms/EmployeeFull.java trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 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/billy/action/QuotationAction.java 2011-04-28 08:10:35 UTC (rev 111) +++ trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-04-28 09:07:36 UTC (rev 112) @@ -110,6 +110,11 @@ setVta(String.valueOf(quotation.getVTA())); setPostedDate(formatter.format(quotation.getPostedDate())); setProjectId(quotation.getProject()); + setSupplier(EmployeeFull.initEmployee(quotation.getSupplier(), + proxy)); + System.out.println("((("+quotation+")))"); + setCustomer(EmployeeFull.initEmployee(quotation.getCustomer(), + proxy)); } else { result = ERROR; } @@ -167,6 +172,8 @@ protected String quotationId; protected String supplierId; protected String customerId; + protected EmployeeFull customer; + protected EmployeeFull supplier; /** * Returns the project order linked with the quotation (if it exists) @@ -236,7 +243,7 @@ } if (proxy.restore(Person.class, customerId) != null) { - newQuotation.setSupplier(customerId); + newQuotation.setCustomer(customerId); } else { //If the id doesn't exist or is invalid addActionError(getText(n_("chorem.billy.quotation.invalidCustomer"))); result = false; @@ -407,4 +414,32 @@ dayDate = formatter.format(calendar.getTime()); return dayDate; } + + /** + * @return the customer + */ + public EmployeeFull getCustomer() { + return customer; + } + + /** + * @param customer the customer to set + */ + public void setCustomer(EmployeeFull customer) { + this.customer = customer; + } + + /** + * @return the supplier + */ + public EmployeeFull getSupplier() { + return supplier; + } + + /** + * @param supplier the supplier to set + */ + public void setSupplier(EmployeeFull supplier) { + this.supplier = supplier; + } } Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/EmployeeFull.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/bonzoms/EmployeeFull.java 2011-04-28 08:10:35 UTC (rev 111) +++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/EmployeeFull.java 2011-04-28 09:07:36 UTC (rev 112) @@ -17,7 +17,7 @@ protected Person person; /** - * Returns an employee with its links + * Returns a list of employees with their links * * @param employees the list of employees * @param proxy @@ -26,10 +26,11 @@ public static List<EmployeeFull> initEmployeeFullList(List<Employee> employees, ChoremProxy proxy) { Person person; Company company; - EmployeeFull employeeTmp = new EmployeeFull(); + EmployeeFull employeeTmp; List<EmployeeFull> employeesFullList = new ArrayList<EmployeeFull>(); for (Employee employee : employees) { + employeeTmp = new EmployeeFull(); employeeTmp.setEmployee(employee); person = proxy.restore(Person.class, employee.getPerson()); employeeTmp.setPerson(person); @@ -41,8 +42,30 @@ } /** + * Returns an employee with its links + * + * @param employeeId the employee id + * @param proxy * @return the employee */ + public static EmployeeFull initEmployee(String employeeId, ChoremProxy proxy) { + Employee employee = proxy.restore(Employee.class, employeeId); + EmployeeFull employeeFull = new EmployeeFull(); + Person person; + Company company; + + employeeFull.setEmployee(employee); + System.out.println(employeeId+":"+employee+":"+proxy); + person = proxy.restore(Person.class, employee.getPerson()); + employeeFull.setPerson(person); + company = proxy.restore(Company.class, employee.getCompany()); + employeeFull.setCompany(company); + return employeeFull; + } + + /** + * @return the employee + */ public Employee getEmployee() { return employee; } 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-28 08:10:35 UTC (rev 111) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-04-28 09:07:36 UTC (rev 112) @@ -6,6 +6,7 @@ chorem.billy.quotation.addToProject=Add a new quotation to the project "{0}" chorem.billy.quotation.amount=Amount chorem.billy.quotation.backToProjectDetails=Get back to project +chorem.billy.quotation.customer= chorem.billy.quotation.description=Description chorem.billy.quotation.invalidCustomer= chorem.billy.quotation.invalidSupplier= @@ -17,6 +18,7 @@ chorem.billy.quotation.projectOrder.estimatedEndDate= chorem.billy.quotation.projectOrder.type= chorem.billy.quotation.reference=Reference +chorem.billy.quotation.supplier= chorem.billy.quotation.vta=VTA chorem.billy.quotationDetails.title= chorem.bonzoms.companies= Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp 2011-04-28 08:10:35 UTC (rev 111) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp 2011-04-28 09:07:36 UTC (rev 112) @@ -2,6 +2,7 @@ <%@page import="org.chorem.billy.action.QuotationAction" %> <%@page import="org.chorem.entities.ProjectOrder" %> <%@page import="org.chorem.JspUtils" %> +<%@page import="org.chorem.bonzoms.EmployeeFull" %> <%@taglib prefix="s" uri="/struts-tags" %> <html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" @@ -34,6 +35,18 @@ <br /> <s:textfield name="postedDate" key="chorem.billy.quotation.postedDate" labelSeparator=": " size="7" /> <br /> + <% EmployeeFull supplier = QuotationAction.getAction().getSupplier(); %> + <s:url namespace="/bonzoms" action="companyDetails" var="companyDetails"> + <s:param name="companyId"><%= supplier.getCompany().getWikittyId() %></s:param> + </s:url> + <s:text name="chorem.billy.quotation.supplier" />: <a href="${companyDetails}"><%= supplier.getCompany().getName() %></a> - <%= supplier.getPerson().getLastName() %> <%= supplier.getPerson().getFirstName() %> (<%= JspUtils.dateFormat(supplier.getPerson().getBirthDate()) %>) + <br /> + <% EmployeeFull customer = QuotationAction.getAction().getCustomer(); %> + <s:url namespace="/bonzoms" action="companyDetails" var="companyDetails"> + <s:param name="companyId"><%= supplier.getCompany().getWikittyId() %></s:param> + </s:url> + <s:text name="chorem.billy.quotation.customer" />: <a href="${companyDetails}"><%= customer.getCompany().getName() %></a> - <%= customer.getPerson().getLastName() %> <%= customer.getPerson().getFirstName() %> (<%= JspUtils.dateFormat(customer.getPerson().getBirthDate()) %>) + <br /> <s:submit key="chorem.misc.modify" name="modify" /> </p> </form>
participants (1)
-
vbriand@users.chorem.org