[jboss-cvs] JBossAS SVN: r101344 - in projects/snowdrop/examples/trunk/sportsclub/sportsclub-invoicing-webmvc/src/main: webapp/WEB-INF/jsp and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 23 17:12:23 EST 2010
Author: marius.bogoevici
Date: 2010-02-23 17:12:22 -0500 (Tue, 23 Feb 2010)
New Revision: 101344
Modified:
projects/snowdrop/examples/trunk/sportsclub/sportsclub-invoicing-webmvc/src/main/java/org/jboss/snowdrop/samples/sportsclub/springmvc/AccountController.java
projects/snowdrop/examples/trunk/sportsclub/sportsclub-invoicing-webmvc/src/main/webapp/WEB-INF/jsp/accountDetail.jsp
Log:
small fix - hide "generate invoice" text for accounts that have invoices
Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-invoicing-webmvc/src/main/java/org/jboss/snowdrop/samples/sportsclub/springmvc/AccountController.java
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-invoicing-webmvc/src/main/java/org/jboss/snowdrop/samples/sportsclub/springmvc/AccountController.java 2010-02-23 21:40:25 UTC (rev 101343)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-invoicing-webmvc/src/main/java/org/jboss/snowdrop/samples/sportsclub/springmvc/AccountController.java 2010-02-23 22:12:22 UTC (rev 101344)
@@ -12,6 +12,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import javax.ejb.EJB;
+import java.util.Date;
import java.util.List;
/**
@@ -70,12 +71,26 @@
Account account = subscriptionService.findAccountById(Long.parseLong(id));
List<Invoice> invoices = billingService.getInvoices(account);
+
+ boolean hasCurrentInvoice = false;
+ Date currentDate = new Date();
+
+ for (Invoice invoice: invoices)
+ {
+ if (invoice.getBillingPeriod().contains(currentDate))
+ {
+ hasCurrentInvoice = true;
+ break;
+ }
+ }
+
List<Payment> payments = billingService.getPayments(account);
ModelMap model = new ModelMap();
model.addAttribute(account);
model.addAttribute("invoices", invoices);
- model.addAttribute("paymetns", payments);
+ model.addAttribute("payments", payments);
+ model.addAttribute("hasCurrentInvoice",hasCurrentInvoice);
return model;
}
Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-invoicing-webmvc/src/main/webapp/WEB-INF/jsp/accountDetail.jsp
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-invoicing-webmvc/src/main/webapp/WEB-INF/jsp/accountDetail.jsp 2010-02-23 21:40:25 UTC (rev 101343)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-invoicing-webmvc/src/main/webapp/WEB-INF/jsp/accountDetail.jsp 2010-02-23 22:12:22 UTC (rev 101344)
@@ -84,11 +84,14 @@
</table>
<p>
- <form:form action="generateInvoice.do">
- You can create new invoice for this account:
- <input type="hidden" name="id" value="<c:out value="${account.id}"/>">
- <input type="submit" value="Create invoice"/><br/>
- </form:form>
+ <c:if test="${not hasCurrentInvoice}">
+ <form:form action="generateInvoice.do">
+ This account does not have an invoice for the current billing period.<p/>
+ You can create one now:
+ <input type="hidden" name="id" value="<c:out value="${account.id}"/>">
+ <input type="submit" value="Create invoice"/><br/>
+ </form:form>
+ </c:if>
</p>
<table cellspacing="10">
More information about the jboss-cvs-commits
mailing list