Commit c661444b by Nilu

Job List: Extend expiration

parent e98b0149
......@@ -2,7 +2,6 @@ package performa.form;
import com.stripe.Stripe;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.objstore.StorageException;
......
package performa.form;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.logging.LoggingArea;
import oneit.objstore.ObjectTransaction;
import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.security.SecUser;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.MultiException;
import performa.orm.CompanyUser;
import performa.orm.JobApplication;
import performa.orm.Note;
import oneit.utils.DateDiff;
import oneit.utils.math.NullArith;
import performa.orm.HiringTeam;
import performa.orm.Job;
import performa.utils.StripeUtils;
public class ExtendJobFP extends SaveFP
......@@ -25,33 +25,33 @@ public class ExtendJobFP extends SaveFP
private static final LoggingArea LOG = LoggingArea.createLoggingArea("ExtendJobFP");
@Override
public void validate(ORMProcessState process, SubmissionDetails submission, MultiException exceptions, Map params) throws StorageException
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
Job job = (Job) request.getAttribute("Job");
HiringTeam hiringTeam = job.getHiringTeam();
HiringTeam billingTeam = hiringTeam.getManageOwnBilling() ? hiringTeam : hiringTeam.getBilledByTeam();
super.validate(process, submission, exceptions, params);
}
LogMgr.log(LOG, LogLevel.PROCESSING1, "Start of Extend job : ", job);
job.setApplyBy(DateDiff.add(job.getApplyBy(), Calendar.DATE, 30));
job.setLastEdited(new Date());
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
if (billingTeam.canCreateJob())
{
ObjectTransaction objTran = process.getTransaction();
HttpServletRequest request = submission.getRequest();
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
// LogMgr.log(LOG, LogLevel.PROCESSING1, "Adding note to job application : ", jobApplication);
//
// Note note = Note.createNote(objTran);
// SecUser secUser = SecUser.getTXUser(process.getTransaction());
// CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
//
// note.setComment(jobApplication.getNote());
// note.setCreatedUser(companyUser);
// note.setJobApplication(jobApplication);
//
// LogMgr.log(LOG, LogLevel.PROCESSING1, "New note added : ", note);
billingTeam.setUsedCredits(NullArith.add(billingTeam.getUsedCredits(), 1).intValue());
if(billingTeam.getUsedCredits() > billingTeam.getAvailableCredits())
{
StripeUtils.recordUsage(billingTeam);
}
}
else if(billingTeam.getIsPPJ())
{
StripeUtils.makePayment(hiringTeam, job);
}
LogMgr.log(LOG, LogLevel.PROCESSING1, "Job Extended. Apply by date : ", job.getApplyBy());
return super.processForm(process, submission, params);
}
......
......@@ -35,6 +35,7 @@
<FORM name="*.loadCultureFromTemplate" factory="Participant" class="performa.form.LoadCultureFromTemplateFP"/>
<FORM name="*.changeApplicationStatus" factory="Participant" class="performa.form.ChangeApplicationStatusFP"/>
<FORM name="*.addNote" factory="Participant" class="performa.form.AddNoteFP"/>
<FORM name="*.extendJob" factory="Participant" class="performa.form.ExtendJobFP"/>
<FORM name="*.bulkupdate" factory="Participant" class="performa.form.BulkUpdateFP"/>
<FORM name="*.navigateBetweenStatus" factory="Participant" class="performa.form.NavigateBetweenStatusFP"/>
<FORM name="*.sendCompanyUserInvites" factory="Participant" class="performa.form.SendCompanyUserInvitesFP">
......
......@@ -88,6 +88,8 @@
</style>
<div class="main-job-list">
<oneit:button skin="link" value=" " name="extendJob" cssClass="hide"
requestAttribs="<%= CollectionUtils.EMPTY_MAP %>" />
<%
ObjectTransaction objTran = process.getTransaction ();
CompanyUser companyUser = SecUser.getTXUser(objTran).getExtension(CompanyUser.REFERENCE_CompanyUser);
......@@ -177,7 +179,8 @@
Are you sure you want to extend this job?
</h3>
<div class="extend-job-info">
Extending this Job will add an additional 30 days for applicants to apply. By confirming the new close date for this job will be 13 September 2018.
Extending this Job will add an additional 30 days for applicants to apply. By confirming the new close date for this job will be
<oneit:toString value="<%= DateDiff.add(job.getApplyBy(), Calendar.DATE, 30) %>" mode="LongDate" />.
Would you like to continue?
</div>
</div>
......@@ -185,7 +188,7 @@
<a class="change-plan-no-button popup-no-button">No</a>
<oneit:button skin="link" value="Yes" name="extendJob" cssClass="change-plan-yes-button"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", homePage)
.mapEntry("procParams", CollectionUtils.mapEntry("Job", job).mapEntry("ApplicationStatus", ApplicationStatus.SHORTLISTED).toMap())
.mapEntry("Job", job)
.toMap() %>" />
</div>
......
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