Пример #1
0
 private Document newInvoice() {
   Document document = new Invoice();
   document.setAuthor(currentUserName());
   document.setDocType(DocType.INVOICE);
   document.setCreatedDate(new Date());
   return document;
 }
Пример #2
0
 @RequestMapping(value = "/view.htm", method = RequestMethod.GET)
 public String view(ModelMap model, @RequestParam(value = "id", required = true) String id) {
   LOG.debug("viewing doc {} ", id);
   Assert.hasText(id);
   Document doc = docService.getDocument(id);
   model.addAttribute("document", doc);
   List<HistoricTask> hts = this.localTaskSrvc.getTaskHistory(id);
   model.addAttribute("historicTasks", hts);
   if (doc.isEditable(doc.getAuthor(), currentUserName())) {
     return "document/invoice/edit";
   }
   model.addAttribute("msg", "The invoice cannot be edited in its current state.");
   return "document/invoice/view";
 }