Commit 5b1b1a74 authored by Fabiano Sluzarski's avatar Fabiano Sluzarski
Browse files

Changes in the alert of concept null in the last semester, on the pdf

for the travel requisition and in the transcript per section pdf. Added
registration requisition pdf for the travel requisition class.
parent 384ce8a8
......@@ -5,6 +5,8 @@ import java.util.List;
import javax.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSender;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
......@@ -19,6 +21,9 @@ import br.ufpr.c3sl.sapos.models.scholar.TravelRequisition;
@RooEntity
public class Configuration {
@Autowired
public transient MailSender mailTemplate;
public static String COORDINATOR_NAME = "coordinator.name";
public static String MASTER_COURSE_NAME = "master.course.name";
public static String PHD_COURSE_NAME = "phd.course.name";
......@@ -68,7 +73,7 @@ public class Configuration {
"(r.defense_date - r.proposal_date)/30 > "+Configuration.findConfigValueByName("month.nb.defense.date.expiring"),Registration.class).getResultList();
}
//- avisar que notas do semestre anterior nao foram preenchidas
//- avisar que conceito do semestre anterior nao foram preenchidas
public static Object findLastPeriodBlankConcepts(){
int year, month, period = 0;
Calendar c = Calendar.getInstance();
......@@ -82,9 +87,9 @@ public class Configuration {
period = 1;
return entityManager().createNativeQuery(
"select * from transcript t, section_pos s, registration r, person p where (t.concept IS NULL or t.concept = 'Nulo') " +
"select * from transcript t, section_pos s, registration r, person p, course c where (t.concept IS NULL or t.concept = 'Nulo') " +
"and t.transcript_section = s.id and s.section_year = "+year+" and s.period = "+period+
" and t.student = r.id and r.student = p.id order by p.name", Transcript.class).getResultList();
" and t.student = r.id and r.student = p.id and s.course = c.id order by c.code", Transcript.class).getResultList();
}
//- alerta para requisicoes de viagem
......
......@@ -88,7 +88,7 @@ public class Transcript {
public static String convertConcept(ConceptTranscript concept) {
if (concept == ConceptTranscript.Nulo)
return "-";
return " ";
else
return concept.toString();
}
......@@ -499,7 +499,7 @@ public class Transcript {
response.setContentType("application/pdf");
//left,right,top,bottom margins
Document document = new Document(PageSize.A4, 80, 80, 80, 80);
float[] colswidth = {2f,1f,1f,1f,1f};
float[] colswidth = {2f,1f,1f,1f};
PdfPTable table = new PdfPTable(colswidth);
Paragraph p;
......@@ -536,9 +536,9 @@ public class Transcript {
cell = new PdfPCell(new Paragraph("Conceito", ReportUtil.getTableTitleTextFont()));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(cell);
cell = new PdfPCell(new Paragraph("Nota", ReportUtil.getTableTitleTextFont()));
/*cell = new PdfPCell(new Paragraph("Nota", ReportUtil.getTableTitleTextFont()));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(cell);
table.addCell(cell);*/
cell = new PdfPCell(new Paragraph("Frequencia", ReportUtil.getTableTitleTextFont()));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(cell);
......@@ -553,9 +553,10 @@ public class Transcript {
cell = new PdfPCell(new Paragraph(convertConcept(t.concept), ReportUtil.getTableTextFont()));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(cell);
cell = new PdfPCell(new Paragraph(t.grade !=null ? t.grade.toString() : "", ReportUtil.getTableTextFont()));
/*cell = new PdfPCell(new Paragraph(t.grade !=null ? t.grade.toString() : "", ReportUtil.getTableTextFont()));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(cell);
table.addCell(cell);*/
cell = new PdfPCell(new Paragraph(t.frequency !=null ? t.frequency.toString() : "", ReportUtil.getTableTextFont()));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
......
package br.ufpr.c3sl.sapos.models.scholar;
import java.awt.Font;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
......@@ -18,17 +19,19 @@ import org.springframework.roo.addon.tostring.RooToString;
import br.ufpr.c3sl.sapos.models.customization.Configuration;
import br.ufpr.c3sl.sapos.models.people.Person;
import br.ufpr.c3sl.sapos.models.people.Student;
import br.ufpr.c3sl.sapos.models.people.enums.UserKind;
import br.ufpr.c3sl.sapos.models.people.Professor;
import br.ufpr.c3sl.sapos.models.report.ReportUtil;
import br.ufpr.c3sl.sapos.models.scholar.enums.RequestStatus;
import br.ufpr.c3sl.sapos.models.scholar.enums.RequesterKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.TicketKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.TripKind;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.FontFactory;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
......@@ -80,6 +83,8 @@ public class TravelRequisition {
@Enumerated(EnumType.STRING)
private RequestStatus requestStatus;
private Float registrationValue;
private String observations;
......@@ -90,6 +95,7 @@ public class TravelRequisition {
Paragraph p = new Paragraph();
Phrase phr = new Phrase();
Calendar c;
try {
try {
......@@ -113,34 +119,85 @@ public class TravelRequisition {
p = new Paragraph("Nome: "+person.getName(), ReportUtil.getNormalTextFont());
document.add(p);
p = new Paragraph();
phr = new Phrase("Cargo/Profissão: "+tr.profession, ReportUtil.getNormalTextFont());
phr = new Phrase("Cargo/Profissão: ", ReportUtil.getNormalTextFont());
p.add(phr);
phr = new Phrase(" Data de nascimento: "+person.getDateOfBirth(), ReportUtil.getNormalTextFont());
if (tr.profession != null) {
phr = new Phrase(tr.profession, ReportUtil.getNormalTextFont());
p.add(phr);
}
phr = new Phrase(" Data de nascimento: ", ReportUtil.getNormalTextFont());
p.add(phr);
if (person.getDateOfBirth() != null) {
c = ReportUtil.convertDateToCalendar(person.getDateOfBirth());
int m = c.get(Calendar.MONTH)+1;
phr = new Phrase(c.get(Calendar.DAY_OF_MONTH)+"/"+m+"/"+c.get(Calendar.YEAR), ReportUtil.getNormalTextFont());
p.add(phr);
}
document.add(p);
//TODO Unidade
phr = new Phrase("Unidade: ", ReportUtil.getNormalTextFont());
p = new Paragraph();
phr = new Phrase("Unidade: ", ReportUtil.getNormalTextFont());
p.add(phr);
//TODO SIAPE
phr = new Phrase(" Matrícula SIAPE: ", ReportUtil.getNormalTextFont());
p.add(phr);
Professor prof = Professor.findProfessor(person.getId());
if (prof != null) {
phr = new Phrase(" Matrícula SIAPE: "+prof.getSiape(), ReportUtil.getNormalTextFont());
p.add(phr);
}
document.add(p);
phr = new Phrase("RG: "+person.getRg(), ReportUtil.getNormalTextFont());
p = new Paragraph();
phr = new Phrase("RG: ", ReportUtil.getNormalTextFont());
p.add(phr);
phr = new Phrase(" CPF: "+person.getCpf(), ReportUtil.getNormalTextFont());
if (person.getRg() != null) {
phr = new Phrase(person.getRg(), ReportUtil.getNormalTextFont());
p.add(phr);
}
phr = new Phrase(" CPF: ", ReportUtil.getNormalTextFont());
p.add(phr);
if (person.getCpf() != null) {
phr = new Phrase(person.getCpf(), ReportUtil.getNormalTextFont());
p.add(phr);
}
document.add(p);
phr = new Phrase("E-mail: "+person.getEmail(), ReportUtil.getNormalTextFont());
p = new Paragraph();
phr = new Phrase("E-mail: ", ReportUtil.getNormalTextFont());
p.add(phr);
phr = new Phrase(" Telefone: "+person.getPhone(), ReportUtil.getNormalTextFont());
if (person.getEmail() != null) {
phr = new Phrase(person.getEmail(), ReportUtil.getNormalTextFont());
p.add(phr);
}
phr = new Phrase(" Telefone: ", ReportUtil.getNormalTextFont());
p.add(phr);
if (person.getPhone() != null) {
phr = new Phrase(person.getPhone(), ReportUtil.getNormalTextFont());
p.add(phr);
}
document.add(p);
phr = new Phrase("Dados Bancários "+person.getBank().getName()+" Conta: "+person.getBankAccount(), ReportUtil.getNormalTextFont());
p = new Paragraph();
phr = new Phrase("Dados Bancários ", ReportUtil.getNormalTextFont());
p.add(phr);
if (person.getBank() != null) {
phr = new Phrase(person.getBank().getName(), ReportUtil.getNormalTextFont());
p.add(phr);
}
phr = new Phrase(" Conta: ", ReportUtil.getNormalTextFont());
p.add(phr);
if (person.getBankAccount() != null) {
phr = new Phrase(person.getBankAccount(), ReportUtil.getNormalTextFont());
p.add(phr);
}
document.add(p);
//1 – BENEFICIÁRIO: ( ) Servidor ( ) Colaborador Eventual ( ) Convidado ( x ) Assessoramento Especial
......@@ -158,8 +215,20 @@ public class TravelRequisition {
phr = new Phrase("Local: "+tr.place, ReportUtil.getNormalTextFont());
p = new Paragraph();
p.add(phr);
phr = new Phrase(" Período "+tr.startDate+" – "+tr.endDate, ReportUtil.getNormalTextFont());
phr = new Phrase(" Período ", ReportUtil.getNormalTextFont());
p.add(phr);
if ((tr.startDate != null) && (tr.endDate != null)) {
c = ReportUtil.convertDateToCalendar(tr.startDate);
int m = c.get(Calendar.MONTH)+1;
phr = new Phrase(c.get(Calendar.DAY_OF_MONTH)+"/"+m+"/"+c.get(Calendar.YEAR), ReportUtil.getNormalTextFont());
p.add(phr);
c = ReportUtil.convertDateToCalendar(tr.endDate);
m = c.get(Calendar.MONTH)+1;
phr = new Phrase(" – "+c.get(Calendar.DAY_OF_MONTH)+"/"+m+"/"+c.get(Calendar.YEAR), ReportUtil.getNormalTextFont());
p.add(phr);
}
document.add(p);
phr = new Phrase("Deslocamento: "+tr.tripKind, ReportUtil.getNormalTextFont());
p = new Paragraph();
......@@ -177,7 +246,15 @@ public class TravelRequisition {
phr = new Phrase(" (Em caso de opção pelo pagamento do Hotel licitado NÃO será pago diárias na conta do beneficiário)", ReportUtil.getNormalTextFont());
p.add(phr);
document.add(p);
p = new Paragraph("N.º de diárias (Depósito em conta) – "+tr.dayNumber, ReportUtil.getNormalTextFont());
p = new Paragraph();
phr = new Phrase("N.º de diárias (Depósito em conta) – ", ReportUtil.getNormalTextFont());
p.add(phr);
if (tr.dayNumber != null) {
phr = new Phrase(tr.dayNumber.toString(), ReportUtil.getNormalTextFont());
p.add(phr);
}
document.add(p);
p = new Paragraph("( ) Pagar diárias no Caravelle Licitado ( ) Apenas efetuar reserva no Hotel Licitado", ReportUtil.getNormalTextFont());
document.add(p);
......@@ -201,14 +278,24 @@ public class TravelRequisition {
document.add(p);
p = new Paragraph("RETORNO: "+tr.tripEndDate, ReportUtil.getNormalTextFont());
document.add(p);
p = new Paragraph("Valor da passagem: "+tr.ticketValue, ReportUtil.getNormalTextFont());
p = new Paragraph();
phr = new Phrase("Valor da passagem: ", ReportUtil.getNormalTextFont());
p.add(phr);
if (tr.ticketValue != null) {
phr = new Phrase(tr.ticketValue.toString(), ReportUtil.getNormalTextFont());
p.add(phr);
}
document.add(p);
p = new Paragraph("4.1 – Reserva efetuada com o menor preço:", ReportUtil.getNormalTextFont());
document.add(p);
document.add(Chunk.NEWLINE);
p = new Paragraph("");
document.add(p);
phr = new Phrase("Data: "+ReportUtil.getTodayDate().get(Calendar.DAY_OF_MONTH)+"/"+ReportUtil.getTodayDate().get(Calendar.MONTH)+1+"/"+ReportUtil.getTodayDate().get(Calendar.YEAR), ReportUtil.getNormalTextFont());
int m = ReportUtil.getTodayDate().get(Calendar.MONTH)+1;
phr = new Phrase("Data: "+ReportUtil.getTodayDate().get(Calendar.DAY_OF_MONTH)+"/"+m+"/"+ReportUtil.getTodayDate().get(Calendar.YEAR), ReportUtil.getNormalTextFont());
p = new Paragraph();
p.add(phr);
phr = new Phrase(" Assinatura e Carimbo", ReportUtil.getNormalTextFont());
......@@ -231,8 +318,8 @@ public class TravelRequisition {
document.add(p);
p = new Paragraph("Nome do chefe: "+Configuration.findConfigValueByName(Configuration.COORDINATOR_NAME), ReportUtil.getNormalTextFont());
document.add(p);
p = new Paragraph("Cargo: ", ReportUtil.getNormalTextFont());
document.add(p);
/*p = new Paragraph("Cargo: ", ReportUtil.getNormalTextFont());
document.add(p);*/
p = new Paragraph("E-mail: "+Configuration.findConfigValueByName("coordinator.email"), ReportUtil.getNormalTextFont());
document.add(p);
p = new Paragraph("Unidade Pós Graduação em Informática", ReportUtil.getNormalTextFont());
......@@ -284,6 +371,94 @@ public class TravelRequisition {
e.printStackTrace();
}
}
public static void registrationRequisitionPdf(TravelRequisition tr, HttpServletResponse response) {
response.setContentType("application/pdf");
//left,right,top,bottom margins
Document document = new Document(PageSize.A4, 80, 80, 80, 80);
Paragraph p = new Paragraph();
Phrase phr = new Phrase();
Calendar c;
try {
try {
ReportUtil.getPdfWriter(document,response);
//PdfWriter writer = ReportUtil.getPdfWriter(document,response);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
document.open();
Person person = tr.person;
ReportUtil.makeHeader(document,"");
p = ReportUtil.mountLongDate();
p.setAlignment(Element.ALIGN_RIGHT);
document.add(p);
document.add(Chunk.NEWLINE);
p = new Paragraph("Do Coordenador do Programa de "+Configuration.findConfigValueByName("graduate.course.name"), ReportUtil.getNormalTextFont());
document.add(p);
p = new Paragraph("Ao Pró-Reitor de Pesquisa e Pós-Graduação", ReportUtil.getNormalTextFont());
document.add(p);
document.add(Chunk.NEWLINE);
p = new Paragraph("Prezado Pró-Reitor", ReportUtil.getNormalTextFont());
document.add(p);
document.add(Chunk.NEWLINE);
c = ReportUtil.convertDateToCalendar(tr.startDate);
String start = c.get(Calendar.DAY_OF_MONTH)+" de "+ReportUtil.getMonthName(c)+" de "+c.get(Calendar.YEAR);
c = ReportUtil.convertDateToCalendar(tr.endDate);
String end = c.get(Calendar.DAY_OF_MONTH)+" de "+ReportUtil.getMonthName(c)+" de "+c.get(Calendar.YEAR);
p = new Paragraph("Venho por meio deste, solicitar o pagamento de 1 (uma) inscrição "+tr.conference+
" – a ser realizado de "+start+" a "+end+", "+tr.place+"."+
" A inscrição se destina à participação de um discente do Programa de "+Configuration.findConfigValueByName("graduate.course.name")+","+
" de acordo com as solicitações em anexo emitidas pela própria coordenação geral do evento." +
" O interessado se enquadra na seguinte situação:", ReportUtil.getNormalTextFont());
ReportUtil.formatParagraph(p);
document.add(p);
document.add(Chunk.NEWLINE);
if (tr.registrationValue != null)
p = new Paragraph("– "+person.getName()+": discente do Programa de "+Configuration.findConfigValueByName("graduate.course.name")+","+
" cujo valor da inscrição é de $"+tr.registrationValue+".", ReportUtil.getNormalTextFont());
else
p = new Paragraph("– "+person.getName()+": discente do Programa de "+Configuration.findConfigValueByName("graduate.course.name")+","+
" cujo valor da inscrição é de $ .", ReportUtil.getNormalTextFont());
p.setAlignment(Element.ALIGN_JUSTIFIED);
p.setFirstLineIndent(30f);
document.add(p);
document.add(Chunk.NEWLINE);
p = new Paragraph("Sem mais, na oportunidade, renovamos nossos manifestos de apreço e distinta consideração.", ReportUtil.getNormalTextFont());
ReportUtil.formatParagraph(p);
document.add(p);
document.add(Chunk.NEWLINE);
p = new Paragraph("Atenciosamente,", ReportUtil.getNormalTextFont());
p.setAlignment(Element.ALIGN_RIGHT);
document.add(p);
document.add(Chunk.NEWLINE);
document.add(new Paragraph(""));
document.add(Chunk.NEWLINE);
p = new Paragraph(Configuration.findConfigValueByName(Configuration.COORDINATOR_NAME), ReportUtil.getNormalTextFont());
p.setAlignment(Element.ALIGN_RIGHT);
document.add(p);
p = new Paragraph("Coordenador da "+Configuration.findConfigValueByName(Configuration.GRADUATE_COURSE_NAME),FontFactory.getFont(FontFactory.TIMES, 8, Font.ROMAN_BASELINE, BaseColor.BLACK));
p.setAlignment(Element.ALIGN_RIGHT);
document.add(p);
document.close();
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
......@@ -100,6 +100,14 @@ privileged aspect TravelRequisition_Roo_JavaBean {
public void TravelRequisition.setTotalValue(Float totalValue) {
this.totalValue = totalValue;
}
public Float TravelRequisition.getRegistrationValue() {
return this.registrationValue;
}
public void TravelRequisition.setRegistrationValue(Float registrationValue) {
this.registrationValue = registrationValue;
}
public TicketKind TravelRequisition.getTicketKind() {
return this.ticketKind;
......
......@@ -18,6 +18,7 @@ privileged aspect TravelRequisition_Roo_ToString {
sb.append("Person: ").append(getPerson()).append(", ");
sb.append("Place: ").append(getPlace()).append(", ");
sb.append("Profession: ").append(getProfession()).append(", ");
sb.append("RegistrationValue: ").append(getRegistrationValue()).append(", ");
sb.append("RequesterKind: ").append(getRequesterKind()).append(", ");
sb.append("RequestStatus: ").append(getRequestStatus()).append(", ");
sb.append("StartDate: ").append(getStartDate()).append(", ");
......
......@@ -100,17 +100,17 @@ public class ConfigurationController {
return "people/accepted";
}
@Autowired
private transient MailSender mailTemplate;
public void sendMessage(/*String mailFrom,*/ String subject, String mailTo, String message) {
//USAGE: sendMessage("[sapos] Teste Email", "exemplo@gmail.com", "Sucesso!!!");
org.springframework.mail.SimpleMailMessage simpleMailMessage = new org.springframework.mail.SimpleMailMessage();
simpleMailMessage.setFrom(Configuration.findConfigValueByName("course.email"));
simpleMailMessage.setSubject(subject);
simpleMailMessage.setTo(mailTo);
simpleMailMessage.setText(message);
mailTemplate.send(simpleMailMessage);
}
public static void sendMessage(/*String mailFrom,*/ String subject, String[] mailTo, String message) {
//USAGE: sendMessage("[sapos] Teste Email", "exemplo@gmail.com", "Sucesso!!!");
org.springframework.mail.SimpleMailMessage simpleMailMessage = new org.springframework.mail.SimpleMailMessage();
simpleMailMessage.setFrom(Configuration.findConfigValueByName("course.email"));
simpleMailMessage.setSubject(subject);
simpleMailMessage.setTo(mailTo);
simpleMailMessage.setText(message);
Configuration cfg = Configuration.findConfigurationByName("email.delivery.active").get(0);
if ( cfg.getValue().equals("true") )
cfg.mailTemplate.send(simpleMailMessage);
}
}
......@@ -49,6 +49,8 @@ public class ProfessorController {
ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
professor.setPassword(encoder.encodePassword(professor.getPassword(), ""));
}
else
professor.setPassword(null);
uiModel.asMap().clear();
professor.persist();
......
......@@ -54,6 +54,8 @@ public class StaffController {
ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
staff.setPassword(encoder.encodePassword(staff.getPassword(), ""));
}
else
staff.setPassword(null);
uiModel.asMap().clear();
staff.persist();
......
......@@ -43,6 +43,8 @@ public class StudentController {
ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
student.setPassword(encoder.encodePassword(student.getPassword(), ""));
}
else
student.setPassword(null);
uiModel.asMap().clear();
student.persist();
......
package br.ufpr.c3sl.sapos.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.springframework.roo.addon.web.mvc.controller.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import br.ufpr.c3sl.sapos.models.people.Person;
import br.ufpr.c3sl.sapos.models.scholar.TravelRequisition;
import br.ufpr.c3sl.sapos.models.scholar.enums.RequestStatus;
@RooWebScaffold( path = "travelrequisitions", formBackingObject = TravelRequisition.class)
@RequestMapping("/travelrequisitions")
@Controller
public class TravelRequisitionController {
@RequestMapping(method = RequestMethod.POST)
public String create(@Valid TravelRequisition travelRequisition, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
uiModel.addAttribute("travelRequisition", travelRequisition);
addDateTimeFormatPatterns(uiModel);
return "travelrequisitions/create";
}
Person p = travelRequisition.getPerson();
String message = new String();
message = "A pessoa "+p.getName()+" criou uma nova requisição de viagem.\n\n\n\n-----------------------\nMensagem automatica enviada pelo Sistema de Apoio a Pós (SAPOS)\nPara desativar envio automatico de emails troque o valor da configuração 'email.delivery.active' para 'false'.";
//TODO mailTo
String[] mailTo = {};
ConfigurationController.sendMessage("[sapos] Nova requisição de viagem adicionada", mailTo, message);
uiModel.asMap().clear();
travelRequisition.persist();
return "redirect:/travelrequisitions/" + encodeUrlPathSegment(travelRequisition.getId().toString(), httpServletRequest);
}
@RequestMapping(method = RequestMethod.PUT)
public String update(@Valid TravelRequisition travelRequisition, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
uiModel.addAttribute("travelRequisition", travelRequisition);
addDateTimeFormatPatterns(uiModel);
return "travelrequisitions/update";
}
if (travelRequisition.getRequestStatus() != RequestStatus.Aberta) {
Person p = travelRequisition.getPerson();
String message = new String();
message = "A requisição de viagem de "+p.getName();
if (travelRequisition.getRequestStatus() == RequestStatus.Anulada)
message += " foi ANULADA.";
else if (travelRequisition.getRequestStatus() == RequestStatus.Negada)
message += " foi NEGADA.";
else if (travelRequisition.getRequestStatus() == RequestStatus.Confirmada)
message += " foi CONFIRMADA.";
message += "\n\n\n\n-----------------------\nMensagem automatica enviada pelo Sistema de Apoio a Pós (SAPOS)";
//TODO mailTo
String[] mailTo = {};
ConfigurationController.sendMessage("[sapos] Atualização de requisição de viagem", mailTo, message);
}
uiModel.asMap().clear();
travelRequisition.merge();
return "redirect:/travelrequisitions/" + encodeUrlPathSegment(travelRequisition.getId().toString(), httpServletRequest);
}