Commit 5fcec587 by Nilu

Accept Payment/Billing - Only permit job status to move from 'Draft' to 'Open'…

Accept Payment/Billing - Only permit job status to move from 'Draft' to 'Open' if there are sufficient credits
parent c51b36af
...@@ -51,9 +51,12 @@ public class SaveJobFP extends SaveFP ...@@ -51,9 +51,12 @@ public class SaveJobFP extends SaveFP
if(status == JobStatus.OPEN) if(status == JobStatus.OPEN)
{ {
if(company.getSelectedPaymentPlan() != null)
{
company.setPaymentPlan(company.getSelectedPaymentPlan()); company.setPaymentPlan(company.getSelectedPaymentPlan());
LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"Company payment plan updated.", job, company, company.getPaymentPlan()); LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"Company payment plan updated.", job, company, company.getPaymentPlan());
}
job.setJobStatus(status); job.setJobStatus(status);
...@@ -95,6 +98,9 @@ public class SaveJobFP extends SaveFP ...@@ -95,6 +98,9 @@ public class SaveJobFP extends SaveFP
Job job = process.getAttribute("Job") != null ? (Job) process.getAttribute("Job") : (Job) request.getAttribute("Job"); Job job = process.getAttribute("Job") != null ? (Job) process.getAttribute("Job") : (Job) request.getAttribute("Job");
Boolean openJob = (Boolean) request.getAttribute("openJob"); Boolean openJob = (Boolean) request.getAttribute("openJob");
JobStatus status = (JobStatus) request.getAttribute("JobStatus"); JobStatus status = (JobStatus) request.getAttribute("JobStatus");
SecUser loggedInUser = SecUser.getTXUser(process.getTransaction());
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
if(job.getJobStatus() != JobStatus.DRAFT || openJob == Boolean.TRUE) if(job.getJobStatus() != JobStatus.DRAFT || openJob == Boolean.TRUE)
{ {
...@@ -107,13 +113,16 @@ public class SaveJobFP extends SaveFP ...@@ -107,13 +113,16 @@ public class SaveJobFP extends SaveFP
} }
//to select payment plan when job open //to select payment plan when job open
if(status!=null && status==JobStatus.OPEN) if(status != null && status == JobStatus.OPEN)
{ {
SecUser loggedInUser = SecUser.getTXUser(process.getTransaction()); BusinessObjectParser.assertFieldCondition(company.getSelectedPaymentPlan() != null || company.getPaymentPlan() != null, company, Company.SINGLEREFERENCE_PaymentPlan, "mandatory", exceptions, true, request);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser); }
Company company = companyUser.getCompany();
if(job.getJobStatus() == JobStatus.OPEN)
{
BusinessObjectParser.assertFieldCondition(company.getCardID() != null , company, Company.FIELD_CardID, "mandatoryCardDetails", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(company.getSelectedPaymentPlan()!= null, company, Company.SINGLEREFERENCE_PaymentPlan, "mandatory", exceptions, true, request); BusinessObjectParser.assertFieldCondition(company.canCreateJob() , job, Job.FIELD_JobStatus, "insufficientCredit", exceptions, true, request);
} }
super.validate(process, submission, exceptions, params); super.validate(process, submission, exceptions, params);
......
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