Skip to content

Commit

Permalink
modified termination interface to include latest suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
sibow committed Jul 10, 2024
1 parent d6fface commit 10e0393
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ private String notifyManagers(){
if(document != null){
payPeriod = document.getPayPeriod();
}
// if(activeMail){
if(true){
if(activeMail){
// if(true){
String to = "", cc="", email_from="", subject="", message="";
getUser();
if(user != null){
Expand Down Expand Up @@ -143,7 +143,7 @@ private String notifyManagers(){
message,
debug
);
// back = mail.send();
back = mail.send();
}
else{
back = "email activity flag is turned off, if you need to send email this flag need to be turned on in your configuration file";
Expand Down
36 changes: 28 additions & 8 deletions src/main/java/in/bloomington/timer/action/TerminateJobAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public String execute(){
else if(action.startsWith("Next")){
//
if(selected_job_ids != null &&
!last_day_of_work.isEmpty() &&
!last_pay_period_date.isEmpty()){
!last_day_of_work.isEmpty()){
getTerm();
findLastPayPeriodDate();
if(emp_id.isEmpty()){
getJob(); // to get emp_id
}
Expand All @@ -105,9 +105,12 @@ else if(action.startsWith("Next")){
addError(back);
}
id = term.getId();
back += findMatchingJobsInNW();
back = findMatchingJobsInNW();
if(back.isEmpty() && jobTerms.size() > 0){
term.setJobTerms(jobTerms);
}
else{ // no jobs found

}
back = term.populateOneJob();
if(!back.isEmpty()){
Expand All @@ -126,8 +129,6 @@ else if(action.startsWith("Next")){
}
}
else{
if(last_pay_period_date.isEmpty())
addError("last pay period date not set");
if(last_day_of_work.isEmpty())
addError("Last day of work not set");
if(selected_job_ids == null)
Expand Down Expand Up @@ -181,7 +182,20 @@ else if(action.startsWith("Send")){
}
return ret;
}

void findLastPayPeriodDate(){
if(!last_day_of_work.isEmpty()){
if(last_day_of_work.indexOf("-") > -1){
last_day_of_work = Helper.changeDateFormat(last_day_of_work);
}
PayPeriod pp = new PayPeriod();
pp.setDate(last_day_of_work);
String back = pp.find();
if(back.isEmpty()){
last_pay_period_date = pp.getEndDate();
}
}
System.err.println(" last pay period date "+last_pay_period_date);
}
String findMatchingJobsInNW(){
String back = "";
getEmp();
Expand Down Expand Up @@ -419,8 +433,14 @@ public String getEmp_id(){
return emp_id;
}
public void setLast_pay_period_date(String val){
if(val != null && !val.isEmpty() && !val.equals("-1"))
last_pay_period_date = val;
if(val != null && !val.isEmpty() && !val.equals("-1")){
if(val.indexOf("-") > 0){
last_pay_period_date = Helper.changeDateFormat(val);
}
else{
last_pay_period_date = val;
}
}
}
public void setLast_day_of_work(String val){
if(val != null && !val.isEmpty())
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/in/bloomington/timer/bean/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ public String getLine_2(){
return line_2;
}
public String getLineAddress(){
String ret = line_1;
if(!line_2.isEmpty()){
ret += " "+line_2;
String ret = "";
if(line_1 != null && !line_1.isEmpty()){
ret = line_1;
}
if(line_2 != null && !line_2.isEmpty()){
if(!ret.isEmpty()) ret += " ";
ret += line_2;
}
return ret;
}
Expand Down
22 changes: 19 additions & 3 deletions src/main/java/in/bloomington/timer/bean/Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class Document implements Serializable{
Employee initiater = null;
Workflow lastWorkflow = null;
List<TimeAction> timeActions = null;
List<TimeAction> validTimeActions = null;
List<Triplet<String, String, String>> unscheduleds = null;
//
Map<JobType, Map<Integer, String>> daily = null;
Expand Down Expand Up @@ -238,6 +239,21 @@ public List<TimeAction> getTimeActions(){
}
return timeActions;
}
public List<TimeAction> getValidTimeActions(){
if(validTimeActions == null && !id.isEmpty()){
TimeActionList tal = new TimeActionList(id);
tal.setActiveOnly();
tal.setSortby("a.id desc");
String back = tal.find();
if(back.isEmpty()){
List<TimeAction> ones = tal.getTimeActions();
if(ones != null && ones.size() > 0){
validTimeActions = ones;
}
}
}
return validTimeActions;
}
public TimeAction getLastTimeAction(){
if(hasTimeBlocks() && lastTimeAcion == null){
getTimeActions();
Expand Down Expand Up @@ -441,9 +457,9 @@ public boolean canBeApproved(){
return false;
}
public boolean isApproved(){
getTimeActions();
if(timeActions != null){
for(TimeAction one:timeActions){
getValidTimeActions();
if(validTimeActions != null){
for(TimeAction one:validTimeActions){
Workflow wf = one.getWorkflow();
if(wf.isApproved()){
return true;
Expand Down
134 changes: 85 additions & 49 deletions src/main/java/in/bloomington/timer/bean/EmpTerminate.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class EmpTerminate{
List<DepartmentEmployee> departmentEmployees = null;
List<GroupManager> groupManagers = null;
List<JobTask> jobs = null;
List<JobTask> otherJobs = null;
List<JobTerminate> jobTerms = null;
List<Document> documents = null;
List<JobTerminate> jobTerminates = null;
Expand Down Expand Up @@ -481,26 +482,43 @@ public List<JobTerminate> getJobTerms(){
}
String findJobs(){
String back = "";
if(jobs == null && jobTerms != null){
for(JobTerminate jt:jobTerms){
JobTask one = new JobTask(jt.getJob_id());
back = one.doSelect();
if(back.isEmpty()){
if(one != null){
if(job == null)
one = job;
if(jobs == null)
jobs = new ArrayList<>();
jobs.add(one);
if(jobs == null){
if(jobTerms != null && jobTerms.size() > 0){
for(JobTerminate jt:jobTerms){
JobTask one = new JobTask(jt.getJob_id());
back = one.doSelect();
if(back.isEmpty()){
if(one != null){
if(job == null)
job = one;
if(jobs == null)
jobs = new ArrayList<>();
jobs.add(one);
}
}
else{
System.err.println(" back "+back);
}
}
else{
System.err.println(" back "+back);
}
else if(job_ids != null){
for(String str:job_ids){
JobTask one = new JobTask(str);
back = one.doSelect();
if(back.isEmpty()){
if(one != null){
if(job == null)
job = one;
if(jobs == null)
jobs = new ArrayList<>();
jobs.add(one);
}
}
}
}
}
else{
back = "No job term found";
else{
back = "No job term found";
}
}
return back;
}
Expand Down Expand Up @@ -563,34 +581,55 @@ public String doCleanUp(){
}
return back;
}
/**
public String findAllJobs(){
private String findOtherJobs(){
String back = "";
if(jobs == null && !job_id.isEmpty()){
JobTask one = new JobTask(job_id);
back = one.doSelect();
if(back.isEmpty()){
job = one;
}
if(employee_id.isEmpty()){
employee_id = job.getEmployee_id();
List<JobTask> allJobs = null;
JobTaskList jl = new JobTaskList();
jl.setEmployee_id(employee_id);
jl.setNotExpired();
back = jl.find();
if(back.isEmpty()){
List<JobTask> ones = jl.getJobs();
if(ones != null){
if(ones.size() > 0){
allJobs = ones;
}
}
JobTaskList jl = new JobTaskList();
jl.setEmployee_id(employee_id);
jl.setNotExpired();
back = jl.find();
if(back.isEmpty()){
List<JobTask> ones = jl.getJobs();
if(ones != null){
if(ones.size() > 0){
jobs = ones;
}
// System.err.println(" all jobs "+allJobs.size());
if(allJobs != null && allJobs.size() > 0){
if(jobs == null)
findJobs();
if(jobs != null && jobs.size() > 0){
for(JobTask aj:allJobs){
boolean found = false;
for(JobTask jj:jobs){
if(jj.getId().equals(aj.getId())){
found = true;
break;
}
}
if(!found){
if(otherJobs == null)
otherJobs = new ArrayList<>();
otherJobs.add(aj);
}
}
}
}
return back;
}
*/
public boolean hasOtherJobs(){
if(job != null && !job.getSalaryGroup().isTemporary()) return false;
if(otherJobs == null || otherJobs.size() == 0){
findOtherJobs();
}
return otherJobs != null && otherJobs.size() > 0;

}
public boolean isPartialTermination(){
return hasOtherJobs();
}
public String findEmployeeAddress(){
String back = "";
if(emp == null){
Expand All @@ -599,14 +638,16 @@ public String findEmployeeAddress(){
if(emp != null){
back = emp.findAddress();
if(back.isEmpty()){
addr = emp.getAddress();
emp_address = addr.getLineAddress();
emp_city = addr.getCity();
emp_state = addr.getState();
emp_zip = addr.getZip();
date_of_birth = emp.getDob();
Address one = emp.getAddress();
if(one != null){
addr = one;
emp_address = addr.getLineAddress();
emp_city = addr.getCity();
emp_state = addr.getState();
emp_zip = addr.getZip();
date_of_birth = emp.getDob();
}
}
// System.err.println(" addr "+addr);
}
return back;
}
Expand Down Expand Up @@ -1117,11 +1158,6 @@ public String doSave(){
Helper.databaseDisconnect(rs, pstmt, pstmt2);
UnoConnect.databaseDisconnect(con);
}
/**
if(back.isEmpty()){
back = saveJobTerms();
}
*/
return back;
}
public String saveJobTerms(){
Expand Down Expand Up @@ -1538,7 +1574,7 @@ zoom_to_email varchar(80),
submitted_by_id int unsigned,
submitted_date date,
term_status enum('Started','Ready','Completed'),
process_status enum('Started','Ready','Completed'),
recipients_informed char(1),
primary key(id),
foreign key(employee_id) references employees(id),
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/in/bloomington/timer/bean/TermNotification.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ String composeEmailText(){
employee = term.getEmployee();

text = "Employee Job(s) Termination \n\n";
if(term.isPartialTermination()){
text += "Note: Partial Termination \n\n";
}
text += "Employee: "+term.getFull_name()+"\n";
text += "Employment Type: "+term.getEmployment_type()+"\n";
String emp_type = term.getEmployment_type().toLowerCase();
Expand Down
Loading

0 comments on commit 10e0393

Please sign in to comment.