Commit 0e300c7e by chenith

J006 - Payment palan for job.

parent e38be188
......@@ -22,6 +22,7 @@
<column name="stripe_reference" type="String" nullable="true" length="100"/>
<column name="stripe_subscription" type="String" nullable="true" length="100"/>
<column name="added_by_user_id" type="Long" length="11" nullable="false"/>
<column name="payment_plan_id" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
......@@ -21,7 +21,8 @@ CREATE TABLE tl_company (
has_client_support char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL,
added_by_user_id numeric(12) NOT NULL
added_by_user_id numeric(12) NOT NULL,
payment_plan_id numeric(12) NULL
);
......
......@@ -22,7 +22,8 @@ CREATE TABLE tl_company (
has_client_support char(1) NULL,
stripe_reference varchar2(100) NULL,
stripe_subscription varchar2(100) NULL,
added_by_user_id number(12) NOT NULL
added_by_user_id number(12) NOT NULL,
payment_plan_id number(12) NULL
);
......
......@@ -22,7 +22,8 @@ CREATE TABLE tl_company (
has_client_support char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL,
added_by_user_id numeric(12) NOT NULL
added_by_user_id numeric(12) NOT NULL,
payment_plan_id numeric(12) NULL
);
......
......@@ -85,6 +85,7 @@ public class SaveJobFP extends SaveFP
HttpServletRequest request = submission.getRequest();
Job job = process.getAttribute("Job") != null ? (Job) process.getAttribute("Job") : (Job) request.getAttribute("Job");
Boolean openJob = (Boolean) request.getAttribute("openJob");
JobStatus status = (JobStatus) request.getAttribute("JobStatus");
if(job.getJobStatus() != JobStatus.DRAFT || openJob == Boolean.TRUE)
{
......@@ -96,6 +97,16 @@ public class SaveJobFP extends SaveFP
}
}
//to select payment plan when job open
if(status!=null && status==JobStatus.OPEN)
{
SecUser loggedInUser = SecUser.getTXUser(process.getTransaction());
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
BusinessObjectParser.assertFieldCondition(company.getPaymentPlan() != null, job , Company.SINGLEREFERENCE_PaymentPlan, "mandatory", exceptions, true, request);
}
super.validate(process, submission, exceptions, params);
}
}
\ No newline at end of file
......@@ -64,6 +64,7 @@ public abstract class BaseCompany extends BaseBusinessClass
public static final String FIELD_IsLogoDeleted = "IsLogoDeleted";
public static final String FIELD_CompletedProfile = "CompletedProfile";
public static final String SINGLEREFERENCE_AddedByUser = "AddedByUser";
public static final String SINGLEREFERENCE_PaymentPlan = "PaymentPlan";
public static final String MULTIPLEREFERENCE_Users = "Users";
public static final String BACKREF_Users = "";
public static final String MULTIPLEREFERENCE_Clients = "Clients";
......@@ -119,6 +120,7 @@ public abstract class BaseCompany extends BaseBusinessClass
// Private attributes corresponding to single references
private SingleAssociation<Company, CompanyUser> _AddedByUser;
private SingleAssociation<Company, PaymentPlan> _PaymentPlan;
// Private attributes corresponding to multiple references
......@@ -167,6 +169,7 @@ public abstract class BaseCompany extends BaseBusinessClass
setupAssocMetaData_Users();
setupAssocMetaData_Clients();
setupAssocMetaData_AddedByUser();
setupAssocMetaData_PaymentPlan();
FIELD_UserEmail_Validators = (AttributeValidator[])setupAttribMetaData_UserEmail(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_FirstName_Validators = (AttributeValidator[])setupAttribMetaData_FirstName(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LastName_Validators = (AttributeValidator[])setupAttribMetaData_LastName(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -244,6 +247,21 @@ public abstract class BaseCompany extends BaseBusinessClass
// Meta Info setup
private static void setupAssocMetaData_PaymentPlan()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "payment_plan_id");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "PaymentPlan");
metaInfo.put ("type", "PaymentPlan");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Company.PaymentPlan:", metaInfo);
ATTRIBUTES_METADATA_Company.put (SINGLEREFERENCE_PaymentPlan, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_UserEmail(Map validatorMapping)
{
Map metaInfo = new HashMap ();
......@@ -665,6 +683,7 @@ public abstract class BaseCompany extends BaseBusinessClass
super._initialiseAssociations ();
_AddedByUser = new SingleAssociation<Company, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_company");
_PaymentPlan = new SingleAssociation<Company, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_company");
_Users = new MultipleAssociation<Company, CompanyUser> (this, MULTIPLEREFERENCE_Users, CompanyUser.SINGLEREFERENCE_Company, CompanyUser.REFERENCE_CompanyUser);
_Clients = new MultipleAssociation<Company, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_Company, Client.REFERENCE_Client);
......@@ -677,6 +696,7 @@ public abstract class BaseCompany extends BaseBusinessClass
super.initialiseReference ();
_AddedByUser = new SingleAssociation<Company, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_company");
_PaymentPlan = new SingleAssociation<Company, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_company");
_Users = new MultipleAssociation<Company, CompanyUser> (this, MULTIPLEREFERENCE_Users, CompanyUser.SINGLEREFERENCE_Company, CompanyUser.REFERENCE_CompanyUser);
_Clients = new MultipleAssociation<Company, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_Company, Client.REFERENCE_Client);
......@@ -2561,6 +2581,8 @@ public abstract class BaseCompany extends BaseBusinessClass
result.add("AddedByUser");
result.add("PaymentPlan");
return result;
}
......@@ -2575,6 +2597,9 @@ public abstract class BaseCompany extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{
return _AddedByUser.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
{
return _PaymentPlan.getReferencedType ();
}
else
{
......@@ -2592,6 +2617,9 @@ public abstract class BaseCompany extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
{
return null ;
}
else
{
......@@ -2609,6 +2637,9 @@ public abstract class BaseCompany extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{
return getAddedByUser ();
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
{
return getPaymentPlan ();
}
else
{
......@@ -2626,6 +2657,9 @@ public abstract class BaseCompany extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{
return getAddedByUser (getType);
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
{
return getPaymentPlan (getType);
}
else
{
......@@ -2643,6 +2677,9 @@ public abstract class BaseCompany extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{
return getAddedByUserID ();
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
{
return getPaymentPlanID ();
}
else
{
......@@ -2660,6 +2697,9 @@ public abstract class BaseCompany extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{
setAddedByUser ((CompanyUser)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
{
setPaymentPlan ((PaymentPlan)(newValue));
}
else
{
......@@ -2765,6 +2805,100 @@ public abstract class BaseCompany extends BaseBusinessClass
}
/**
* Get the reference PaymentPlan
*/
public PaymentPlan getPaymentPlan () throws StorageException
{
assertValid();
try
{
return (PaymentPlan)(_PaymentPlan.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Company:", this.getObjectID (), ", was trying to get PaymentPlan:", getPaymentPlanID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _PaymentPlan.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public PaymentPlan getPaymentPlan (Get getType) throws StorageException
{
assertValid();
return _PaymentPlan.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getPaymentPlanID ()
{
assertValid();
if (_PaymentPlan == null)
{
return null;
}
else
{
return _PaymentPlan.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void prePaymentPlanChange (PaymentPlan newPaymentPlan) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postPaymentPlanChange () throws FieldException
{
}
public FieldWriteability getWriteability_PaymentPlan ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference PaymentPlan. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setPaymentPlan (PaymentPlan newPaymentPlan) throws StorageException, FieldException
{
if (_PaymentPlan.wouldReferencedChange (newPaymentPlan))
{
assertValid();
Debug.assertion (getWriteability_PaymentPlan () != FieldWriteability.FALSE, "Assoc PaymentPlan is not writeable");
prePaymentPlanChange (newPaymentPlan);
_PaymentPlan.set (newPaymentPlan);
postPaymentPlanChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
......@@ -3180,6 +3314,7 @@ public abstract class BaseCompany extends BaseBusinessClass
tl_companyPSet.setAttrib (FIELD_StripeReference, HELPER_StripeReference.toObject (_StripeReference)); //
tl_companyPSet.setAttrib (FIELD_StripeSubscription, HELPER_StripeSubscription.toObject (_StripeSubscription)); //
_AddedByUser.getPersistentSets (allSets);
_PaymentPlan.getPersistentSets (allSets);
}
......@@ -3208,6 +3343,7 @@ public abstract class BaseCompany extends BaseBusinessClass
_StripeReference = (String)(HELPER_StripeReference.fromObject (_StripeReference, tl_companyPSet.getAttrib (FIELD_StripeReference))); //
_StripeSubscription = (String)(HELPER_StripeSubscription.fromObject (_StripeSubscription, tl_companyPSet.getAttrib (FIELD_StripeSubscription))); //
_AddedByUser.setFromPersistentSets (objectID, allSets);
_PaymentPlan.setFromPersistentSets (objectID, allSets);
}
......@@ -3391,6 +3527,7 @@ public abstract class BaseCompany extends BaseBusinessClass
BaseCompany sourceCompany = (BaseCompany)(source);
_AddedByUser.copyFrom (sourceCompany._AddedByUser, linkToGhosts);
_PaymentPlan.copyFrom (sourceCompany._PaymentPlan, linkToGhosts);
}
}
......@@ -3451,6 +3588,7 @@ public abstract class BaseCompany extends BaseBusinessClass
_IsLogoDeleted = (Boolean)(HELPER_IsLogoDeleted.readExternal (_IsLogoDeleted, vals.get(FIELD_IsLogoDeleted))); //
_CompletedProfile = (Boolean)(HELPER_CompletedProfile.readExternal (_CompletedProfile, vals.get(FIELD_CompletedProfile))); //
_AddedByUser.readExternalData(vals.get(SINGLEREFERENCE_AddedByUser));
_PaymentPlan.readExternalData(vals.get(SINGLEREFERENCE_PaymentPlan));
_Users.readExternalData(vals.get(MULTIPLEREFERENCE_Users));
_Clients.readExternalData(vals.get(MULTIPLEREFERENCE_Clients));
......@@ -3484,6 +3622,7 @@ public abstract class BaseCompany extends BaseBusinessClass
vals.put (FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.writeExternal (_IsLogoDeleted));
vals.put (FIELD_CompletedProfile, HELPER_CompletedProfile.writeExternal (_CompletedProfile));
vals.put (SINGLEREFERENCE_AddedByUser, _AddedByUser.writeExternalData());
vals.put (SINGLEREFERENCE_PaymentPlan, _PaymentPlan.writeExternalData());
vals.put (MULTIPLEREFERENCE_Users, _Users.writeExternalData());
vals.put (MULTIPLEREFERENCE_Clients, _Clients.writeExternalData());
......@@ -3554,6 +3693,7 @@ public abstract class BaseCompany extends BaseBusinessClass
// Compare single assocs
_AddedByUser.compare (otherCompany._AddedByUser, listener);
_PaymentPlan.compare (otherCompany._PaymentPlan, listener);
// Compare multiple assocs
......@@ -3596,6 +3736,7 @@ public abstract class BaseCompany extends BaseBusinessClass
visitor.visitField(this, FIELD_StripeReference, HELPER_StripeReference.toObject(getStripeReference()));
visitor.visitField(this, FIELD_StripeSubscription, HELPER_StripeSubscription.toObject(getStripeSubscription()));
visitor.visitAssociation (_AddedByUser);
visitor.visitAssociation (_PaymentPlan);
visitor.visitAssociation (_Users);
visitor.visitAssociation (_Clients);
......@@ -3610,6 +3751,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{
visitor.visit (_AddedByUser);
}
if (scope.includes (_PaymentPlan))
{
visitor.visit (_PaymentPlan);
}
if (scope.includes (_Users))
{
visitor.visit (_Users);
......@@ -3699,6 +3844,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return filter.matches (getAddedByUser ());
}
else if (attribName.equals (SINGLEREFERENCE_PaymentPlan))
{
return filter.matches (getPaymentPlan ());
}
else
{
return super.testFilter (attribName, filter);
......@@ -3814,6 +3963,12 @@ public abstract class BaseCompany extends BaseBusinessClass
return this;
}
public SearchAll andPaymentPlan (QueryFilter<PaymentPlan> filter)
{
filter.addFilter (context, "tl_company.payment_plan_id", "PaymentPlan");
return this;
}
public Company[]
search (ObjectTransaction transaction) throws StorageException
{
......@@ -4187,6 +4342,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return getWriteability_AddedByUser ();
}
else if (fieldName.equals (SINGLEREFERENCE_PaymentPlan))
{
return getWriteability_PaymentPlan ();
}
else if (fieldName.equals (FIELD_UserEmail))
{
return getWriteability_UserEmail ();
......@@ -4894,6 +5053,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return toAddedByUser ();
}
if (name.equals ("PaymentPlan"))
{
return toPaymentPlan ();
}
return super.to(name);
......@@ -4943,6 +5106,12 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return CompanyUser.REFERENCE_CompanyUser.new CompanyUserPipeLineFactory<From, CompanyUser> (this, new ORMSingleAssocPipe<Me, CompanyUser>(SINGLEREFERENCE_AddedByUser, filter));
}
public PaymentPlan.PaymentPlanPipeLineFactory<From, PaymentPlan> toPaymentPlan () { return toPaymentPlan (Filter.ALL); }
public PaymentPlan.PaymentPlanPipeLineFactory<From, PaymentPlan> toPaymentPlan (Filter<PaymentPlan> filter)
{
return PaymentPlan.REFERENCE_PaymentPlan.new PaymentPlanPipeLineFactory<From, PaymentPlan> (this, new ORMSingleAssocPipe<Me, PaymentPlan>(SINGLEREFERENCE_PaymentPlan, filter));
}
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toUsers () { return toUsers(Filter.ALL); }
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toUsers (Filter<CompanyUser> filter)
......@@ -5030,6 +5199,20 @@ class DummyCompany extends Company
return CompanyUser.DUMMY_CompanyUser.getObjectID();
}
public PaymentPlan getPaymentPlan () throws StorageException
{
return (PaymentPlan)(PaymentPlan.DUMMY_PaymentPlan);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getPaymentPlanID ()
{
return PaymentPlan.DUMMY_PaymentPlan.getObjectID();
}
public int getUsersCount () throws StorageException
{
return 0;
......
......@@ -73,4 +73,15 @@ public class Company extends BaseCompany
{
return StringUtils.subNulls(getCompanyName(), super.getToString());
}
public Double getPaymentPlanAmount()
{
if(getPaymentPlan()!=null)
{
return getPaymentPlan().getAmount();
}
return null;
}
}
\ No newline at end of file
......@@ -35,6 +35,7 @@
<ATTRIB name="StripeSubscription" type="String" dbcol="stripe_subscription" length="100"/>
<SINGLEREFERENCE name="AddedByUser" type="CompanyUser" dbcol="added_by_user_id" mandatory="true"/>
<SINGLEREFERENCE name="PaymentPlan" type="PaymentPlan" dbcol="payment_plan_id" mandatory="false"/>
</TABLE>
......
......@@ -80,7 +80,7 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
}
private String SELECT_COLUMNS = "{PREFIX}tl_company.object_id as id, {PREFIX}tl_company.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_company.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_company.company_name, {PREFIX}tl_company.company_logo, {PREFIX}tl_company.hiring_team_type, {PREFIX}tl_company.industry, {PREFIX}tl_company.time_zone, {PREFIX}tl_company.is_verified, {PREFIX}tl_company.state, {PREFIX}tl_company.country, {PREFIX}tl_company.post_code, {PREFIX}tl_company.city, {PREFIX}tl_company.has_client_support, {PREFIX}tl_company.stripe_reference, {PREFIX}tl_company.stripe_subscription, {PREFIX}tl_company.added_by_user_id, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}tl_company.object_id as id, {PREFIX}tl_company.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_company.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_company.company_name, {PREFIX}tl_company.company_logo, {PREFIX}tl_company.hiring_team_type, {PREFIX}tl_company.industry, {PREFIX}tl_company.time_zone, {PREFIX}tl_company.is_verified, {PREFIX}tl_company.state, {PREFIX}tl_company.country, {PREFIX}tl_company.post_code, {PREFIX}tl_company.city, {PREFIX}tl_company.has_client_support, {PREFIX}tl_company.stripe_reference, {PREFIX}tl_company.stripe_subscription, {PREFIX}tl_company.added_by_user_id, {PREFIX}tl_company.payment_plan_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -144,7 +144,8 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
!tl_companyPSet.containsAttrib(Company.FIELD_HasClientSupport)||
!tl_companyPSet.containsAttrib(Company.FIELD_StripeReference)||
!tl_companyPSet.containsAttrib(Company.FIELD_StripeSubscription)||
!tl_companyPSet.containsAttrib(Company.SINGLEREFERENCE_AddedByUser))
!tl_companyPSet.containsAttrib(Company.SINGLEREFERENCE_AddedByUser)||
!tl_companyPSet.containsAttrib(Company.SINGLEREFERENCE_PaymentPlan))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
......@@ -214,10 +215,10 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_company " +
"SET company_name = ?, company_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, is_verified = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, stripe_reference = ?, stripe_subscription = ?, added_by_user_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET company_name = ?, company_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, is_verified = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, stripe_reference = ?, stripe_subscription = ?, added_by_user_id = ? , payment_plan_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_company.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_CompanyName.getForSQL(dummyCompanyName, tl_companyPSet.getAttrib (Company.FIELD_CompanyName))).listEntry (HELPER_CompanyLogo.getForSQL(dummyCompanyLogo, tl_companyPSet.getAttrib (Company.FIELD_CompanyLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_companyPSet.getAttrib (Company.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_companyPSet.getAttrib (Company.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_companyPSet.getAttrib (Company.FIELD_TimeZone))).listEntry (HELPER_IsVerified.getForSQL(dummyIsVerified, tl_companyPSet.getAttrib (Company.FIELD_IsVerified))).listEntry (HELPER_State.getForSQL(dummyState, tl_companyPSet.getAttrib (Company.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_companyPSet.getAttrib (Company.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_companyPSet.getAttrib (Company.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_companyPSet.getAttrib (Company.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_companyPSet.getAttrib (Company.FIELD_HasClientSupport))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_companyPSet.getAttrib (Company.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_companyPSet.getAttrib (Company.FIELD_StripeSubscription))).listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_AddedByUser)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_CompanyName.getForSQL(dummyCompanyName, tl_companyPSet.getAttrib (Company.FIELD_CompanyName))).listEntry (HELPER_CompanyLogo.getForSQL(dummyCompanyLogo, tl_companyPSet.getAttrib (Company.FIELD_CompanyLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_companyPSet.getAttrib (Company.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_companyPSet.getAttrib (Company.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_companyPSet.getAttrib (Company.FIELD_TimeZone))).listEntry (HELPER_IsVerified.getForSQL(dummyIsVerified, tl_companyPSet.getAttrib (Company.FIELD_IsVerified))).listEntry (HELPER_State.getForSQL(dummyState, tl_companyPSet.getAttrib (Company.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_companyPSet.getAttrib (Company.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_companyPSet.getAttrib (Company.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_companyPSet.getAttrib (Company.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_companyPSet.getAttrib (Company.FIELD_HasClientSupport))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_companyPSet.getAttrib (Company.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_companyPSet.getAttrib (Company.FIELD_StripeSubscription))).listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_PaymentPlan)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -488,6 +489,7 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
tl_companyPSet.setAttrib(Company.FIELD_StripeSubscription, HELPER_StripeSubscription.getFromRS(dummyStripeSubscription, r, "stripe_subscription"));
tl_companyPSet.setAttrib(Company.SINGLEREFERENCE_AddedByUser, r.getObject ("added_by_user_id"));
tl_companyPSet.setAttrib(Company.SINGLEREFERENCE_PaymentPlan, r.getObject ("payment_plan_id"));
}
......@@ -504,10 +506,10 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_company " +
" (company_name, company_logo, hiring_team_type, industry, time_zone, is_verified, state, country, post_code, city, has_client_support, stripe_reference, stripe_subscription, added_by_user_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
" (company_name, company_logo, hiring_team_type, industry, time_zone, is_verified, state, country, post_code, city, has_client_support, stripe_reference, stripe_subscription, added_by_user_id, payment_plan_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_CompanyName.getForSQL(dummyCompanyName, tl_companyPSet.getAttrib (Company.FIELD_CompanyName))).listEntry (HELPER_CompanyLogo.getForSQL(dummyCompanyLogo, tl_companyPSet.getAttrib (Company.FIELD_CompanyLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_companyPSet.getAttrib (Company.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_companyPSet.getAttrib (Company.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_companyPSet.getAttrib (Company.FIELD_TimeZone))).listEntry (HELPER_IsVerified.getForSQL(dummyIsVerified, tl_companyPSet.getAttrib (Company.FIELD_IsVerified))).listEntry (HELPER_State.getForSQL(dummyState, tl_companyPSet.getAttrib (Company.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_companyPSet.getAttrib (Company.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_companyPSet.getAttrib (Company.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_companyPSet.getAttrib (Company.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_companyPSet.getAttrib (Company.FIELD_HasClientSupport))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_companyPSet.getAttrib (Company.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_companyPSet.getAttrib (Company.FIELD_StripeSubscription))) .listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_AddedByUser)))) .listEntry (objectID.longID ()).toList().toArray());
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_CompanyName.getForSQL(dummyCompanyName, tl_companyPSet.getAttrib (Company.FIELD_CompanyName))).listEntry (HELPER_CompanyLogo.getForSQL(dummyCompanyLogo, tl_companyPSet.getAttrib (Company.FIELD_CompanyLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_companyPSet.getAttrib (Company.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_companyPSet.getAttrib (Company.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_companyPSet.getAttrib (Company.FIELD_TimeZone))).listEntry (HELPER_IsVerified.getForSQL(dummyIsVerified, tl_companyPSet.getAttrib (Company.FIELD_IsVerified))).listEntry (HELPER_State.getForSQL(dummyState, tl_companyPSet.getAttrib (Company.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_companyPSet.getAttrib (Company.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_companyPSet.getAttrib (Company.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_companyPSet.getAttrib (Company.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_companyPSet.getAttrib (Company.FIELD_HasClientSupport))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_companyPSet.getAttrib (Company.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_companyPSet.getAttrib (Company.FIELD_StripeSubscription))) .listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_PaymentPlan)))) .listEntry (objectID.longID ()).toList().toArray());
tl_companyPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
import performa.orm.types.*;
public class PaymentPlan extends BasePaymentPlan
{
......@@ -24,6 +10,15 @@ public class PaymentPlan extends BasePaymentPlan
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
@Override
public String getToString()
{
if(getActiveJobCount()!=null)
{
return getActiveJobCount().toString();
}
return super.getToString();
}
}
\ No newline at end of file
......@@ -25,6 +25,7 @@ public class WebUtils
public static final String JOB_REVIEW = "JobReview";
public static final String APPLY_JOB = "ApplyJob";
public static final String JOB_APPLICATION = "JobApplication";
public static final String MANAGE_PLAN = "ManagePlan";
public static final String CREATED_JOB = "CreatedJob";
public static final String EDIT_JOB = "EditJob";
public static final String JOBS = "Jobs";
......@@ -147,6 +148,7 @@ public class WebUtils
renderMode.equals(WORKPLACE_CULTURE) ||
renderMode.equals(JOB_MATCH) ||
renderMode.equals(JOB_REVIEW) ||
renderMode.equals(MANAGE_PLAN) ||
renderMode.equals(CREATED_JOB);
}
......
......@@ -5941,3 +5941,106 @@ input{
font-size: 18px;
float: right;
}
.select-payment-optio {
color: #1A2531;
font-family: "Usual-Light";
font-size: 28px;
font-weight: 300;
line-height: 34px;
}
.payment-optio-bg {
text-align: center;
}
.annual-plan {
height: 22px;
color: #4A4A4A;
font-family: "Usual-Bold";
font-size: 18px;
font-weight: 500;
line-height: 22px;
}
.payment-optio-text {
height: 17px;
color: #8D8D8D;
font-family: Usual;
font-size: 14px;
line-height: 17px;
text-align: center;
padding: 12px 0;
}
.payment-optio-sep {
border-top: 1px solid #E6E6E6;
padding: 42px 0;
}
.payment-amt {
color: #418DE0;
font-family: "Usual-Light";
font-size: 40px;
font-weight: 300;
/*line-height: 48px;*/
text-align: center;
}
.payment-type-row{
padding-top: 30px;
padding-bottom: 80px;
}
.active-jobs-per-mont {
width: 66px;
color: #8D8D8D;
font-family: "Usual-Light";
font-size: 12px;
}
.per-job {
width: 21px;
color: #969696;
font-family: "Usual-Light";
font-size: 12px;
font-style: italic;
text-align: center;
display: inline-block;
}
.pay-only-job-btn {
height: 48px;
width: 243px;
border: 1px solid #E2E2E2;
border-radius: 24px;
background-color: #FFFFFF;
}
.pay-only-job-amt{
width: 79px;
color: #6D6D6D;
font-family: "Usual-Light";
font-size: 18px;
line-height: 22px;
}
.pay-only-job-txt {
width: 118px;
color: #8D8D8D;
font-family: "Usual-Light";
font-size: 14px;
line-height: 17px;
}
.payment-cancel{
padding-top: 60px;
}
.payment-job-det {
width: 265px;
color: #777777;
font-family: "Usual-Light";
font-size: 12px;
font-style: italic;
}
\ No newline at end of file
......@@ -40,6 +40,7 @@
<RenderMode name="WorkplaceCulture" preIncludeJSP="extensions/adminportal/workplace_culture.jsp"/>
<RenderMode name="JobMatchAssessment" preIncludeJSP="extensions/adminportal/job_match_assessment.jsp"/>
<RenderMode name="JobReview" preIncludeJSP="extensions/adminportal/job_review_submit.jsp"/>
<RenderMode name="ManagePlan" preIncludeJSP="extensions/adminportal/manage_plan.jsp"/>
<RenderMode name="CardPayment" preIncludeJSP="extensions/adminportal/card_payment.jsp"/>
<RenderMode name="CreatedJob" preIncludeJSP="extensions/adminportal/created_job.jsp"/>
</NODE>
......
......@@ -6,7 +6,7 @@
<oneit:dynIncluded>
<%
Job job = (Job) process.getAttribute("Job");
String nextPage = WebUtils.getSamePageInRenderMode(request, WebUtils.CREATED_JOB) + "&fromJob=true";
String nextPage = WebUtils.getSamePageInRenderMode(request, WebUtils.MANAGE_PLAN);
String firstPage = WebUtils.getSamePageInRenderMode(request, WebUtils.CREATE_JOB);
String secondPage = WebUtils.getSamePageInRenderMode(request, WebUtils.ASSESSMENT_CRITERIA);
String thirdPage = WebUtils.getSamePageInRenderMode(request, WebUtils.WORKPLACE_CULTURE);
......@@ -213,13 +213,8 @@
.mapEntry ("attribNamesToRestore", Collections.singleton("Job"))
.toMap() %>" />
<oneit:button value="Open this job" name="saveJob" cssClass="btn btn-primary btn-green top-margin-25 largeBtn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("fromPage", fifthPage)
.mapEntry("JobStatus", JobStatus.OPEN)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry ("attribNamesToRestore", Collections.singleton("Job"))
.toMap() %>" />
<oneit:button value="Confirm and make payment" name="gotoPage" cssClass="btn btn-primary btn-green top-margin-25 largeBtn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>" />
</div>
</div>
</div>
......
......@@ -6,87 +6,111 @@
<oneit:dynIncluded>
<%
Job job = (Job) process.getAttribute("Job");
SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
Debug.assertion(company != null , "Invalid company in admin portal my company");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Page");
String nextPage = WebUtils.getSamePageInRenderMode(request, WebUtils.CREATED_JOB) + "&fromJob=true";
String jobsPage = WebUtils.getSamePageInRenderMode(request, "Page");
String fromPage = WebUtils.getSamePageInRenderMode(request, WebUtils.MANAGE_PLAN);
%>
<script type="text/javascript">
$(document).ready(function()
{
recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
$("#upload").change(function(){
readURL(this);
});
$("#remove-logo").click(function(){
removeLogo();
});
});
</script>
<div class="container-fluid">
<div class="row content">
<div class="main-content-area">
<h1 class="page-title">My Hiring Team</h1>
<div class="my-company-area">
<oneit:form name="editCompany" method="post" enctype="multipart/form-data">
<oneit:form name="editJob" method="post" enctype="multipart/form-data">
<div style="padding-left: 15px; padding-right: 15px;">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
</div>
<oneit:dynInclude page="/extensions/adminportal/inc/my_company_tabs.jsp" TabNumber="2" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="company-content-area">
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="company-detail">
<div class="tabpage-title">
<label class="label-20">No Current Plan</label><br/>
<label class="label-14">You'll be charged each time you add a new job</label>
<div class="line-break"></div>
<div class="main-created-job">
<h1 class="page-title select-payment-optio">
Select Payment Option
</h1>
<div class="form-page-area payment-optio-bg">
<div class="a-label-row annual-plan">
Annual Plan
</div>
<div>
<label class="label-20">Pay Per Job</label>
<div class="a-label-row payment-optio-text">
<p>Hire for any role, save up to $995.00 / mo</p>
</div>
<div class="a-label-row payment-type-row">
<div class="col-md-1 col-sm-1 col-xs-1 text-right">
</div>
<div class="col-md-2 col-sm-2 col-xs-2 text-right">
<div class="active-jobs-per-mont">
Active Jobs Per Month
</div>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<tagfile:ormsingleasso_select obj="<%= company %>" assocName="PaymentPlan" options="<%= PaymentPlan.searchAll(transaction) %>"/>
</div>
<div class="grey-area">
<div class="text-center">
<label class="label-20">Subscribe and save</label>
<div class="col-md-5 col-sm-5 col-xs-5 text-right">
<oneit:recalcClass htmlTag="span" classScript="company.getPaymentPlanAmount()!=null ? 'show': 'hide'" company="<%= company %>">
<div >
<span class="payment-amt text-right">
<oneit:recalc mode="Currency" script="company.getPaymentPlanAmount()" company="<%= company %>" nullValue=""/>
</span>
<span class="text-left">
<p class="per-job">
Per Job
</p>
</span>
</div>
<div class="text-center">
<label class="label-14">Active Jobs Per Month</label>
<input type="number" min="0" max="10" step="2" value="6" size="6">
<label class="label-14">$300.00</label>
<label class="label-14">Per Job</label>
</oneit:recalcClass>
</div>
<div class="text-center form-group">
<oneit:button value="Upgrade" name="managePlans" cssClass="btn btn-primary btn-green large-btn"
<div class="col-md-1 col-sm-1 col-xs-1 text-right">
</div>
</div>
<div class="a-label-row text-center">
<oneit:button value="Select Plan" name="saveJob" cssClass="btn btn-primary largeBtn btn-green"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Company", company)
.mapEntry ("fromPage", fromPage)
.mapEntry("JobStatus", JobStatus.OPEN)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry ("attribNamesToRestore", Collections.singleton("Job"))
.toMap() %>" />
</div>
<div class="text-center">
<label class="label-14">$1500.00 Monthly for up to 5 jobs / month</label>
<div class="a-label-row text-center">
<div class="col-md-4 col-sm-4 col-xs-4">
</div>
<div class="text-center">
<label class="label-14">Save $995.00 per month</label>
<div class="col-md-4 col-sm-4 col-xs-4 payment-job-det text-center">
$1500.00 Monthly for up to 5 jobs / month Save $995.00 per month
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
</div>
<div class="text-center footer-note">
Looking to cancel your account? Please <a href="#">contact us.</a>
</div>
</div>
<div class="form-page-area payment-optio-sep">
<div class="a-label-row">
<div class="col-md-3 col-sm-3 col-xs-3">
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<div class="annual-plan">Pay Per Job</div>
<div class="">
<span class="pay-only-job-amt">$499.00</span>
<span class="pay-only-job-txt">&ensp;&ensp;Open for 30 Days</span>
</div>
</oneit:form>
</div>
<div class="col-md-6 col-sm-6 col-xs-6">
<oneit:button value="Select Plan" name="" cssClass="btn pay-only-job-btn"/>
</div>
</div>
</div>
</div>
<div class="payment-optio-text text-center payment-cancel">
<oneit:button value="Cancel and go back to Jobs" name="gotoPage" cssClass="" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", jobsPage)
.mapEntry(UpdateMappedObjFP.FAIL_VALIDATION_ERRORS, Boolean.FALSE).toMap() %>"/>
</div>
</oneit:form>
</oneit:dynIncluded>
......@@ -36,3 +36,4 @@ Company.RoleType = Role
Company.CompanyLogo = Logo
Company.HiringTeamType = Hiring Team
Company.CompanyName = Hiring Team Name
Company.PaymentPlan = Payment Plan
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">tl_company</tableName>
<column name="payment_plan_id" type="Long" length="11" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
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