diff --git a/src/main/java/in/bloomington/timer/HandleNotification.java b/src/main/java/in/bloomington/timer/HandleNotification.java index 7448b08..2e1a5d8 100644 --- a/src/main/java/in/bloomington/timer/HandleNotification.java +++ b/src/main/java/in/bloomington/timer/HandleNotification.java @@ -82,10 +82,9 @@ public void setDate(String val){ } /** * - select e.first_name,e.last_name,d.id from time_documents d,employees e,jobs j where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and j.clock_time_required is null and j.inactive is null and d.pay_period_id = 549 and e.username not like 'admin' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=549 and a.workflow_id=2) order by 1; - select distinct e.id,e.username,e.first_name,e.last_name,e.email from time_documents d, employees e, jobs j join groups g on g.id=j.group_id where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and g.clock_time_required is null and j.inactive is null and d.pay_period_id = 621 and e.username not like 'admin' and e.email is not null and e.email <> '' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=621 and a.workflow_id=2) order by 2 limit 10; "; - +select distinct e.id,e.username,e.first_name,e.last_name,e.email from time_documents d, employees e, jobs j join groups g on g.id=j.group_id where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and g.include_in_auto_batch is null and j.inactive is null and j.expire_date is null and d.pay_period_id = 682 and e.username not like 'admin' and e.email is not null and e.email <> '' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=682 and a.workflow_id=2) "; + */ // // find all the employees who have initiated document time but @@ -101,7 +100,7 @@ String findToBeNotifiedEmployees(){ // find all non clock employees that have documents for the // specified pay_period_id but not submitted // - String qq = " select distinct e.id,e.username,e.first_name,e.last_name,e.email from time_documents d, employees e, jobs j join groups g on g.id=j.group_id where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and g.clock_time_required is null and j.inactive is null and j.expire_date is null and d.pay_period_id = ? and e.username not like 'admin' and e.email is not null and e.email <> '' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=? and a.workflow_id=2) "; + String qq = " select distinct e.id,e.username,e.first_name,e.last_name,e.email from time_documents d, employees e, jobs j join groups g on g.id=j.group_id where e.id=d.employee_id and e.inactive is null and j.employee_id=e.id and g.include_in_auto_batch is null and j.inactive is null and j.expire_date is null and d.pay_period_id = ? and e.username not like 'admin' and e.email is not null and e.email <> '' and d.id not in (select a.document_id from time_actions a,time_documents d2 where a.document_id=d2.id and d2.pay_period_id=? and a.workflow_id=2) "; // initiated but not submitted for approval try{ con = Helper.getConnection(); diff --git a/src/main/java/in/bloomington/timer/list/CodeReasonConditionList.java b/src/main/java/in/bloomington/timer/list/CodeReasonConditionList.java index 8868166..14cf124 100644 --- a/src/main/java/in/bloomington/timer/list/CodeReasonConditionList.java +++ b/src/main/java/in/bloomington/timer/list/CodeReasonConditionList.java @@ -98,7 +98,7 @@ public String find(){ if(!qw.isEmpty()){ qq += " where "+qw; } - qq += " order by r.description "; + qq += " order by r.name "; con = UnoConnect.getConnection(); if(con == null){ msg = " Could not connect to DB "; @@ -205,7 +205,7 @@ public String lookFor(){ if(!qw.isEmpty()){ qq += " where "+qw; } - qq += " order by r.description "; + qq += " order by r.name "; con = UnoConnect.getConnection(); if(con == null){ msg = " Could not connect to DB "; diff --git a/src/main/java/in/bloomington/timer/list/EarnCodeReasonList.java b/src/main/java/in/bloomington/timer/list/EarnCodeReasonList.java index 85fac4a..809a5ec 100644 --- a/src/main/java/in/bloomington/timer/list/EarnCodeReasonList.java +++ b/src/main/java/in/bloomington/timer/list/EarnCodeReasonList.java @@ -23,102 +23,102 @@ public class EarnCodeReasonList{ String name = "", reason_category_id=""; static final long serialVersionUID = 54L; static Logger logger = LogManager.getLogger(EarnCodeReasonList.class); - boolean active_only = false; + boolean active_only = false; List reasons = null; // public EarnCodeReasonList(){ } public EarnCodeReasonList(boolean deb){ - debug = deb; + debug = deb; } - // usefull for auto complete + // usefull for auto complete public EarnCodeReasonList(String val){ - setName(val); + setName(val); } // public void setName(String val){ - if(val != null) - name = val; + if(val != null) + name = val; } public void setReason_category_id(String val){ - if(val != null && !val.equals("-1")) - reason_category_id = val; + if(val != null && !val.equals("-1")) + reason_category_id = val; } public void setActiveOnly(){ - active_only = true; + active_only = true; } public List getReasons(){ - return reasons; + return reasons; } // // find all matching records // return "" for success or any exception thrown by DB // public String find(){ - // - Connection con = null; - PreparedStatement pstmt = null; - ResultSet rs = null; + // + Connection con = null; + PreparedStatement pstmt = null; + ResultSet rs = null; - String qq = "select h.id,h.name,h.description,h.reason_category_id,h.inactive from "+ - " earn_code_reasons h", qw = ""; - if(!name.isEmpty()){ - qw += " name like ? "; - } - if(!reason_category_id.isEmpty()){ - qw += " reason_category_id = ? "; - } - if(active_only){ - if(!qw.isEmpty()) qw += " and "; - qw += " inactive is null "; - } - if(!qw.isEmpty()){ - qq += " where "+qw; - } - qq += " order by description "; - String back = ""; - con = UnoConnect.getConnection(); - if(con == null){ - back = "Could not connect to DB "; - return back; - } - try{ - if(debug){ - logger.debug(qq); - } - pstmt = con.prepareStatement(qq); - int jj = 1; - if(!name.isEmpty()){ - pstmt.setString(jj,"%"+name+"%"); - } - if(!reason_category_id.isEmpty()){ - pstmt.setString(jj, reason_category_id); - } - rs = pstmt.executeQuery(); - while(rs.next()){ - String str = rs.getString(1); - String str2 = rs.getString(2); - String str3 = rs.getString(3); - String str4 = rs.getString(4); - boolean str5 = rs.getString(5) != null; - if(reasons == null) - reasons = new ArrayList<>(); - EarnCodeReason one = - new EarnCodeReason(debug, str, str2, str3, str4, str5); - if(!reasons.contains(one)) - reasons.add(one); - } - } - catch(Exception ex){ - back += ex; - logger.error(ex+":"+qq); - } - finally{ - Helper.databaseDisconnect(pstmt, rs); - UnoConnect.databaseDisconnect(con); - } - return back; + String qq = "select h.id,h.name,h.description,h.reason_category_id,h.inactive from "+ + " earn_code_reasons h", qw = ""; + if(!name.isEmpty()){ + qw += " name like ? "; + } + if(!reason_category_id.isEmpty()){ + qw += " reason_category_id = ? "; + } + if(active_only){ + if(!qw.isEmpty()) qw += " and "; + qw += " inactive is null "; + } + if(!qw.isEmpty()){ + qq += " where "+qw; + } + qq += " order by name "; + String back = ""; + con = UnoConnect.getConnection(); + if(con == null){ + back = "Could not connect to DB "; + return back; + } + try{ + if(debug){ + logger.debug(qq); + } + pstmt = con.prepareStatement(qq); + int jj = 1; + if(!name.isEmpty()){ + pstmt.setString(jj,"%"+name+"%"); + } + if(!reason_category_id.isEmpty()){ + pstmt.setString(jj, reason_category_id); + } + rs = pstmt.executeQuery(); + while(rs.next()){ + String str = rs.getString(1); + String str2 = rs.getString(2); + String str3 = rs.getString(3); + String str4 = rs.getString(4); + boolean str5 = rs.getString(5) != null; + if(reasons == null) + reasons = new ArrayList<>(); + EarnCodeReason one = + new EarnCodeReason(debug, str, str2, str3, str4, str5); + if(!reasons.contains(one)) + reasons.add(one); + } + } + catch(Exception ex){ + back += ex; + logger.error(ex+":"+qq); + } + finally{ + Helper.databaseDisconnect(pstmt, rs); + UnoConnect.databaseDisconnect(con); + } + return back; } } diff --git a/src/main/webapp/WEB-INF/jsp/calendarFullNew.jsp b/src/main/webapp/WEB-INF/jsp/calendarFullNew.jsp index d5bb463..9ff993a 100644 --- a/src/main/webapp/WEB-INF/jsp/calendarFullNew.jsp +++ b/src/main/webapp/WEB-INF/jsp/calendarFullNew.jsp @@ -79,7 +79,7 @@ data-order-index=""> -
(h)

+
(h)

diff --git a/src/main/webapp/WEB-INF/jsp/calendarFullView.jsp b/src/main/webapp/WEB-INF/jsp/calendarFullView.jsp index cde927b..5efdd6d 100644 --- a/src/main/webapp/WEB-INF/jsp/calendarFullView.jsp +++ b/src/main/webapp/WEB-INF/jsp/calendarFullView.jsp @@ -59,7 +59,7 @@ data-order-index=""> -
(h)

+
(h)