Commit 50f544f4 authored by Fabiano Sluzarski's avatar Fabiano Sluzarski

"Proposta em Aberto" added, problem on libraryPubDate fixed and multiple

blank usernames now available.
parent 1d37a693
......@@ -175,6 +175,15 @@ public class Registration {
"r.student = p.id ORDER BY p.name" , Registration.class).getResultList();
}
public static Object findRegistrationsOpenProposalDate(String regKind, String year) {
String sql = "";
if (!year.isEmpty())
sql = sql + "extract (year from start_date)="+year+" and ";
return entityManager().createNativeQuery("SELECT * FROM registration r, person p where "+sql+
" reg_kind = '"+regKind+"' and proposal_date IS NULL and r.student = p.id "+
" order by p.name" , Registration.class).getResultList();
}
public static Registration getAtiveRegistration(Student s) {
Registration reg = null;
......
......@@ -35,8 +35,10 @@ import br.ufpr.c3sl.sapos.models.scholar.enums.RegistrationKind;
public class ProfessorController {
@RequestMapping(method = RequestMethod.POST)
public String create(@Valid Professor professor, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (Professor.entityManager().createNativeQuery("select id, user_name from person where user_name='"+professor.getUserName()+"'", Professor.class).getResultList().size() > 0){
bindingResult.addError(new ObjectError("professor.user_name","Professor "+professor.getUserName()+" already exists."));
if (professor.getUserName() != null && professor.getUserName().length() > 0 ) {
if (Professor.entityManager().createNativeQuery("select id, user_name from person where user_name='"+professor.getUserName()+"'", Professor.class).getResultList().size() > 0){
bindingResult.addError(new ObjectError("professor.user_name","Professor "+professor.getUserName()+" already exists."));
}
}
if (bindingResult.hasErrors()) {
uiModel.addAttribute("professor", professor);
......
......@@ -100,4 +100,17 @@ public class RegistrationController {
Registration.acceptancePdf(r,response);
}
@RequestMapping(value = "openproposaldate", method = RequestMethod.GET)
public String studentsOpenProposalDate() {
return "registrations/openproposaldate";
}
@RequestMapping(value="openproposaldatelist",method = RequestMethod.GET)
public String studentsOpenProposalDateList(@RequestParam(value = "regKind", required = true) String regKind,
@RequestParam(value = "startDate", required = false) String year,
Model model) {
model.addAttribute("registrations", Registration.findRegistrationsOpenProposalDate(regKind, year));
return "registrations/liststudentssimple";
}
}
......@@ -30,8 +30,10 @@ public class StaffController {
@RequestMapping(method = RequestMethod.POST)
public String create(@Valid Staff staff, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (Staff.entityManager().createNativeQuery("select id, user_name from person where user_name='"+staff.getUserName()+"'", Staff.class).getResultList().size() > 0){
bindingResult.addError(new ObjectError("staff.user_name","Staff "+staff.getUserName()+" already exists."));
if (staff.getUserName() != null && staff.getUserName().length() > 0 ) {
if (Staff.entityManager().createNativeQuery("select id, user_name from person where user_name='"+staff.getUserName()+"'", Staff.class).getResultList().size() > 0){
bindingResult.addError(new ObjectError("staff.user_name","Staff "+staff.getUserName()+" already exists."));
}
}
if (bindingResult.hasErrors()) {
uiModel.addAttribute("staff", staff);
......
......@@ -28,8 +28,10 @@ import br.ufpr.c3sl.sapos.models.people.enums.UserKind;
public class StudentController {
@RequestMapping(method = RequestMethod.POST)
public String create(@Valid Student student, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (Student.entityManager().createNativeQuery("select id, user_name from person where user_name='"+student.getUserName()+"'", Student.class).getResultList().size() > 0){
bindingResult.addError(new ObjectError("student.user_name","Student "+student.getUserName()+" already exists."));
if (student.getUserName() != null && student.getUserName().length() > 0 ) {
if (Student.entityManager().createNativeQuery("select id, user_name from person where user_name='"+student.getUserName()+"'", Student.class).getResultList().size() > 0){
bindingResult.addError(new ObjectError("student.user_name","Student "+student.getUserName()+" already exists."));
}
}
if (bindingResult.hasErrors()) {
uiModel.addAttribute("student", student);
......
......@@ -9,6 +9,7 @@ global_menu_statement_student_grant=Student grant statement
global_menu_statement_acceptance=Acceptance statement
global_menu_statement_courses=Ministered Courses statement
global_menu_candidates_to_grant=Candidates to grant
global_menu_blank_proposal=Blank Proposal
global_menu_find=Find by {0}
global_menu_statement=Statement
global_menu_history=History
......
......@@ -18,6 +18,7 @@ global_menu_statement_student_grant=Declara
global_menu_statement_acceptance=Declarao de aceitao
global_menu_statement_courses=Declarao de ministradas
global_menu_candidates_to_grant=Candidatos a bolsa
global_menu_blank_proposal=Proposta em Aberto
global_generic={0}
global_menu_search_meeting_minutes=Procura atas colegiado
change_password=Trocar Senha
......
......@@ -27,6 +27,7 @@
<menu:item id="i_registration_list" messageCode="global_menu_statement" url="/registrations/registrationsstatement" z="user-managed"/>
<menu:item id="i_registration_list" messageCode="global_menu_statement_acceptance" url="/registrations/acceptancestatement" z="user-managed"/>
<menu:item id="i_registration_list" messageCode="global_menu_candidates_to_grant" url="/registrations/candidatestogrant" z="user-managed"/>
<menu:item id="i_registration_list" messageCode="global_menu_blank_proposal" url="/registrations/openproposaldate" z="user-managed"/>
</menu:category>
<menu:category id="c_transcript" z="a8v3h7EFS5CVeUqTWiTRDpYXXJg=">
<menu:item id="i_transcript_new" messageCode="global_menu_new" url="/transcripts?form" z="jWr28guoRI7FAdrnFd1qpcAYEGQ="/>
......
......@@ -23,7 +23,7 @@
<field:datetime dateTimePattern="${registration_startinterruption_date_format}" field="startInterruption" id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_startInterruption" z="qebHmJejHmWZCrzzpJZ06gI5NLc="/>
<field:datetime dateTimePattern="${registration_endinterruption_date_format}" field="endInterruption" id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_endInterruption" z="+tN63DutXYv3FjSA8Cw+n/5e6FI="/>
<field:datetime dateTimePattern="${registration_libraryPubDate_date_format}" field="libraryPubDate" id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_libraryPubDate" z="+tN63DutXYv3FjSA8Cw+n/5e6FI="/>
<field:datetime dateTimePattern="${registration_librarypubdate_date_format}" field="libraryPubDate" id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_libraryPubDate" z="+tN63DutXYv3FjSA8Cw+n/5e6FI="/>
<p/>
<hr/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:field="urn:jsptagdir:/WEB-INF/tags/form/fields" xmlns:form="urn:jsptagdir:/WEB-INF/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:spring="http://www.springframework.org/tags" version="2.0">
<jsp:output omit-xml-declaration="yes"/>
<b>Alunos matriculados com data de defesa da proposta em aberto</b>
<p></p>
<form name="openProposalDate" action="openproposaldatelist" method="get">
<field:select field="regKind" id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_regKind" items="${registrationkinds}"
path="registrationkinds" z="user-managed" disableFormBinding="true"/>
<field:input field="startDate" id="c_br_ufpr_c3sl_sapos_models_schoolar_Registration_startDate" disableFormBinding="true"
z="user-managed"/>
<input type="submit" value="Enviar" />
</form>
<form:dependency dependencies="${dependencies}" id="d_br_ufpr_c3sl_sapos_models_people_Student" render="${not empty dependencies}" z="gW+juyJp3mRm7nWlqYbCfkbtYVo="/>
</div>
......@@ -23,7 +23,7 @@
<field:datetime dateTimePattern="${registration_startinterruption_date_format}" field="startInterruption" id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_startInterruption" z="qebHmJejHmWZCrzzpJZ06gI5NLc="/>
<field:datetime dateTimePattern="${registration_endinterruption_date_format}" field="endInterruption" id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_endInterruption" z="+tN63DutXYv3FjSA8Cw+n/5e6FI="/>
<field:datetime dateTimePattern="${registration_libraryPubDate_date_format}" field="libraryPubDate" id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_libraryPubDate" z="+tN63DutXYv3FjSA8Cw+n/5e6FI="/>
<field:datetime dateTimePattern="${registration_librarypubdate_date_format}" field="libraryPubDate" id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_libraryPubDate" z="+tN63DutXYv3FjSA8Cw+n/5e6FI="/>
<p/>
<hr/>
<b>Dados trabalhistas</b>
......
......@@ -46,4 +46,9 @@
value="/WEB-INF/views/registrations/acceptancestatement.jspx" />
</definition>
<definition extends="default" name="registrations/openproposaldate">
<put-attribute name="body"
value="/WEB-INF/views/registrations/openproposaldate.jspx" />
</definition>
</tiles-definitions>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment