Commit 0b5a7203 by Nilu

Adding country to hiring team creation screens. Initial sign up no default for…

Adding country to hiring team creation screens. Initial sign up no default for country. additional hiring team creation should default to selected hiring teams country.

If a hiring team doesn't have billing set up, it shouldn't appear on billing teams drop down for "Billing managed by another team"
parent 3ecd2258
......@@ -14,7 +14,7 @@
<column name="industry" type="String" nullable="true" length="200"/>
<column name="time_zone" type="String" nullable="true" length="200"/>
<column name="state" type="String" nullable="true" length="200"/>
<column name="country" type="String" nullable="false" length="200"/>
<column name="country" type="String" nullable="true" length="200"/>
<column name="post_code" type="String" nullable="true" length="10"/>
<column name="city" type="String" nullable="true" length="100"/>
<column name="has_client_support" type="Boolean" nullable="true"/>
......
......@@ -14,7 +14,7 @@ CREATE TABLE tl_hiring_team (
industry varchar(200) NULL,
time_zone varchar(200) NULL,
state varchar(200) NULL,
country varchar(200) NOT NULL,
country varchar(200) NULL,
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
......
......@@ -15,7 +15,7 @@ CREATE TABLE tl_hiring_team (
industry varchar2(200) NULL,
time_zone varchar2(200) NULL,
state varchar2(200) NULL,
country varchar2(200) NOT NULL,
country varchar2(200) NULL,
post_code varchar2(10) NULL,
city varchar2(100) NULL,
has_client_support char(1) NULL,
......
......@@ -15,7 +15,7 @@ CREATE TABLE tl_hiring_team (
industry varchar(200) NULL,
time_zone varchar(200) NULL,
state varchar(200) NULL,
country varchar(200) NOT NULL,
country varchar(200) NULL,
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
......
......@@ -33,12 +33,13 @@ public class AddHiringTeamFP extends SaveFP
BusinessObjectParser.assertFieldCondition(company.getHiringTeamName() != null, company, Company.FIELD_HiringTeamName, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(company.getOwner() != null, company, Company.SINGLEREFERENCE_Owner, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(company.getHTCountry() != null, company, Company.FIELD_HTCountry, "mandatory", exceptions, true, request);
if(!company.getManageOwnBilling())
{
BusinessObjectParser.assertFieldCondition(company.getBillingTeam() != null, company, Company.SINGLEREFERENCE_BillingTeam, "mandatory", exceptions, true, request);
}
super.validate(process, submission, exceptions, params);
}
......@@ -57,6 +58,7 @@ public class AddHiringTeamFP extends SaveFP
hiringTeam.setAddedByUser(company.getOwner());
hiringTeam.setCompany(company);
hiringTeam.setManageOwnBilling(company.getManageOwnBilling());
hiringTeam.setCountry(company.getHTCountry());
CompanyUserHiringTeamLink link = CompanyUserHiringTeamLink.createCompanyUserHiringTeamLink(objTran);
......
package performa.form;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.servlets.forms.NavigationFP;
import oneit.servlets.forms.SubmissionDetails;
import oneit.utils.MultiException;
import performa.orm.HiringTeam;
public class NavigateToInviteTeammatesFP extends NavigationFP
{
@Override
protected Map validate(SubmissionDetails submission, MultiException exceptions)
{
HttpServletRequest request = submission.getRequest();
HiringTeam hiringTeam = (HiringTeam)request.getAttribute("HiringTeam");
BusinessObjectParser.assertFieldCondition(hiringTeam.getCountry() != null, hiringTeam, HiringTeam.FIELD_Country, exceptions);
return super.validate(submission, exceptions);
}
}
\ No newline at end of file
......@@ -62,6 +62,7 @@ public abstract class BaseCompany extends BaseBusinessClass
public static final String FIELD_UsedCredits = "UsedCredits";
public static final String FIELD_HiringTeamName = "HiringTeamName";
public static final String FIELD_ManageOwnBilling = "ManageOwnBilling";
public static final String FIELD_HTCountry = "HTCountry";
public static final String FIELD_IsLogoDeleted = "IsLogoDeleted";
public static final String FIELD_CompletedProfile = "CompletedProfile";
public static final String FIELD_PaymentJobCount = "PaymentJobCount";
......@@ -103,6 +104,7 @@ public abstract class BaseCompany extends BaseBusinessClass
private static final DefaultAttributeHelper<Company> HELPER_UsedCredits = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_HiringTeamName = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_ManageOwnBilling = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper<Company, Countries> HELPER_HTCountry = new EnumeratedAttributeHelper<Company, Countries> (Countries.FACTORY_Countries);
private static final DefaultAttributeHelper<Company> HELPER_IsLogoDeleted = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_CompletedProfile = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_PaymentJobCount = DefaultAttributeHelper.INSTANCE;
......@@ -131,6 +133,7 @@ public abstract class BaseCompany extends BaseBusinessClass
private Integer _UsedCredits;
private String _HiringTeamName;
private Boolean _ManageOwnBilling;
private Countries _HTCountry;
private Boolean _IsLogoDeleted;
private Boolean _CompletedProfile;
private Integer _PaymentJobCount;
......@@ -157,6 +160,7 @@ public abstract class BaseCompany extends BaseBusinessClass
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_HiringTeamName_Validators;
private static final AttributeValidator[] FIELD_ManageOwnBilling_Validators;
private static final AttributeValidator[] FIELD_HTCountry_Validators;
private static final AttributeValidator[] FIELD_IsLogoDeleted_Validators;
private static final AttributeValidator[] FIELD_CompletedProfile_Validators;
private static final AttributeValidator[] FIELD_PaymentJobCount_Validators;
......@@ -205,6 +209,7 @@ public abstract class BaseCompany extends BaseBusinessClass
setupAssocMetaData_PaymentPlan();
FIELD_HiringTeamName_Validators = (AttributeValidator[])setupAttribMetaData_HiringTeamName(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ManageOwnBilling_Validators = (AttributeValidator[])setupAttribMetaData_ManageOwnBilling(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HTCountry_Validators = (AttributeValidator[])setupAttribMetaData_HTCountry(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_IsLogoDeleted_Validators = (AttributeValidator[])setupAttribMetaData_IsLogoDeleted(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_CompletedProfile_Validators = (AttributeValidator[])setupAttribMetaData_CompletedProfile(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_PaymentJobCount_Validators = (AttributeValidator[])setupAttribMetaData_PaymentJobCount(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -376,6 +381,24 @@ public abstract class BaseCompany extends BaseBusinessClass
}
// Meta Info setup
private static List setupAttribMetaData_HTCountry(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("name", "HTCountry");
metaInfo.put ("type", "Countries");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Company.HTCountry:", metaInfo);
ATTRIBUTES_METADATA_Company.put (FIELD_HTCountry, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Company.class, "HTCountry", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Company.HTCountry:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_IsLogoDeleted(Map validatorMapping)
{
Map metaInfo = new HashMap ();
......@@ -864,6 +887,7 @@ public abstract class BaseCompany extends BaseBusinessClass
_UsedCredits = (Integer)(HELPER_UsedCredits.initialise (_UsedCredits));
_HiringTeamName = (String)(HELPER_HiringTeamName.initialise (_HiringTeamName));
_ManageOwnBilling = (Boolean)(Boolean.FALSE);
_HTCountry = (Countries)(HELPER_HTCountry.initialise (_HTCountry));
_IsLogoDeleted = (Boolean)(Boolean.FALSE);
_CompletedProfile = (Boolean)(Boolean.FALSE);
_PaymentJobCount = (Integer)(HELPER_PaymentJobCount.initialise (_PaymentJobCount));
......@@ -2869,6 +2893,104 @@ public abstract class BaseCompany extends BaseBusinessClass
}
/**
* Get the attribute HTCountry
*/
public Countries getHTCountry ()
{
assertValid();
Countries valToReturn = _HTCountry;
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
valToReturn = bhd.getHTCountry ((Company)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute 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 preHTCountryChange (Countries newHTCountry) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postHTCountryChange () throws FieldException
{
}
public FieldWriteability getWriteability_HTCountry ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute HTCountry. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setHTCountry (Countries newHTCountry) throws FieldException
{
boolean oldAndNewIdentical = HELPER_HTCountry.compare (_HTCountry, newHTCountry);
try
{
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
newHTCountry = bhd.setHTCountry ((Company)this, newHTCountry);
oldAndNewIdentical = HELPER_HTCountry.compare (_HTCountry, newHTCountry);
}
if (FIELD_HTCountry_Validators.length > 0)
{
Object newHTCountryObj = HELPER_HTCountry.toObject (newHTCountry);
if (newHTCountryObj != null)
{
int loopMax = FIELD_HTCountry_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Company.get (FIELD_HTCountry);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_HTCountry_Validators[v].checkAttribute (this, FIELD_HTCountry, metadata, newHTCountryObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_HTCountry () != FieldWriteability.FALSE, "Field HTCountry is not writeable");
preHTCountryChange (newHTCountry);
markFieldChange (FIELD_HTCountry);
_HTCountry = newHTCountry;
postFieldChange (FIELD_HTCountry);
postHTCountryChange ();
}
}
/**
* Get the attribute IsLogoDeleted
*/
public Boolean getIsLogoDeleted ()
......@@ -4699,6 +4821,7 @@ public abstract class BaseCompany extends BaseBusinessClass
_UsedCredits = sourceCompany._UsedCredits;
_HiringTeamName = sourceCompany._HiringTeamName;
_ManageOwnBilling = sourceCompany._ManageOwnBilling;
_HTCountry = sourceCompany._HTCountry;
_IsLogoDeleted = sourceCompany._IsLogoDeleted;
_CompletedProfile = sourceCompany._CompletedProfile;
_PaymentJobCount = sourceCompany._PaymentJobCount;
......@@ -4785,6 +4908,7 @@ public abstract class BaseCompany extends BaseBusinessClass
_UsedCredits = (Integer)(HELPER_UsedCredits.readExternal (_UsedCredits, vals.get(FIELD_UsedCredits))); //
_HiringTeamName = (String)(HELPER_HiringTeamName.readExternal (_HiringTeamName, vals.get(FIELD_HiringTeamName))); //
_ManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.readExternal (_ManageOwnBilling, vals.get(FIELD_ManageOwnBilling))); //
_HTCountry = (Countries)(HELPER_HTCountry.readExternal (_HTCountry, vals.get(FIELD_HTCountry))); //
_IsLogoDeleted = (Boolean)(HELPER_IsLogoDeleted.readExternal (_IsLogoDeleted, vals.get(FIELD_IsLogoDeleted))); //
_CompletedProfile = (Boolean)(HELPER_CompletedProfile.readExternal (_CompletedProfile, vals.get(FIELD_CompletedProfile))); //
_PaymentJobCount = (Integer)(HELPER_PaymentJobCount.readExternal (_PaymentJobCount, vals.get(FIELD_PaymentJobCount))); //
......@@ -4828,6 +4952,7 @@ public abstract class BaseCompany extends BaseBusinessClass
vals.put (FIELD_UsedCredits, HELPER_UsedCredits.writeExternal (_UsedCredits));
vals.put (FIELD_HiringTeamName, HELPER_HiringTeamName.writeExternal (_HiringTeamName));
vals.put (FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.writeExternal (_ManageOwnBilling));
vals.put (FIELD_HTCountry, HELPER_HTCountry.writeExternal (_HTCountry));
vals.put (FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.writeExternal (_IsLogoDeleted));
vals.put (FIELD_CompletedProfile, HELPER_CompletedProfile.writeExternal (_CompletedProfile));
vals.put (FIELD_PaymentJobCount, HELPER_PaymentJobCount.writeExternal (_PaymentJobCount));
......@@ -4948,6 +5073,7 @@ public abstract class BaseCompany extends BaseBusinessClass
visitor.visitField(this, FIELD_HiringTeamName, HELPER_HiringTeamName.toObject(getHiringTeamName()));
visitor.visitField(this, FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.toObject(getManageOwnBilling()));
visitor.visitField(this, FIELD_HTCountry, HELPER_HTCountry.toObject(getHTCountry()));
visitor.visitField(this, FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.toObject(getIsLogoDeleted()));
visitor.visitField(this, FIELD_CompletedProfile, HELPER_CompletedProfile.toObject(getCompletedProfile()));
visitor.visitField(this, FIELD_PaymentJobCount, HELPER_PaymentJobCount.toObject(getPaymentJobCount()));
......@@ -5393,6 +5519,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return HELPER_ManageOwnBilling.toObject (getManageOwnBilling ());
}
else if (attribName.equals (FIELD_HTCountry))
{
return HELPER_HTCountry.toObject (getHTCountry ());
}
else if (attribName.equals (FIELD_IsLogoDeleted))
{
return HELPER_IsLogoDeleted.toObject (getIsLogoDeleted ());
......@@ -5506,6 +5636,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return HELPER_ManageOwnBilling;
}
else if (attribName.equals (FIELD_HTCountry))
{
return HELPER_HTCountry;
}
else if (attribName.equals (FIELD_IsLogoDeleted))
{
return HELPER_IsLogoDeleted;
......@@ -5619,6 +5753,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{
setManageOwnBilling ((Boolean)(HELPER_ManageOwnBilling.fromObject (_ManageOwnBilling, attribValue)));
}
else if (attribName.equals (FIELD_HTCountry))
{
setHTCountry ((Countries)(HELPER_HTCountry.fromObject (_HTCountry, attribValue)));
}
else if (attribName.equals (FIELD_IsLogoDeleted))
{
setIsLogoDeleted ((Boolean)(HELPER_IsLogoDeleted.fromObject (_IsLogoDeleted, attribValue)));
......@@ -5759,6 +5897,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return getWriteability_ManageOwnBilling ();
}
else if (fieldName.equals (FIELD_HTCountry))
{
return getWriteability_HTCountry ();
}
else if (fieldName.equals (FIELD_IsLogoDeleted))
{
return getWriteability_IsLogoDeleted ();
......@@ -5897,6 +6039,11 @@ public abstract class BaseCompany extends BaseBusinessClass
fields.add (FIELD_ManageOwnBilling);
}
if (getWriteability_HTCountry () != FieldWriteability.TRUE)
{
fields.add (FIELD_HTCountry);
}
if (getWriteability_IsLogoDeleted () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsLogoDeleted);
......@@ -5951,6 +6098,7 @@ public abstract class BaseCompany extends BaseBusinessClass
result.add(HELPER_UsedCredits.getAttribObject (getClass (), _UsedCredits, false, FIELD_UsedCredits));
result.add(HELPER_HiringTeamName.getAttribObject (getClass (), _HiringTeamName, false, FIELD_HiringTeamName));
result.add(HELPER_ManageOwnBilling.getAttribObject (getClass (), _ManageOwnBilling, false, FIELD_ManageOwnBilling));
result.add(HELPER_HTCountry.getAttribObject (getClass (), _HTCountry, false, FIELD_HTCountry));
result.add(HELPER_IsLogoDeleted.getAttribObject (getClass (), _IsLogoDeleted, false, FIELD_IsLogoDeleted));
result.add(HELPER_CompletedProfile.getAttribObject (getClass (), _CompletedProfile, false, FIELD_CompletedProfile));
result.add(HELPER_PaymentJobCount.getAttribObject (getClass (), _PaymentJobCount, false, FIELD_PaymentJobCount));
......@@ -6385,6 +6533,24 @@ public abstract class BaseCompany extends BaseBusinessClass
}
/**
* Get the attribute HTCountry
*/
public Countries getHTCountry (Company obj, Countries original)
{
return original;
}
/**
* Change the value set for attribute HTCountry.
* May modify the field beforehand
* Occurs before validation.
*/
public Countries setHTCountry (Company obj, Countries newHTCountry) throws FieldException
{
return newHTCountry;
}
/**
* Get the attribute IsLogoDeleted
*/
public Boolean getIsLogoDeleted (Company obj, Boolean original)
......@@ -6546,6 +6712,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return toManageOwnBilling ();
}
if (name.equals ("HTCountry"))
{
return toHTCountry ();
}
if (name.equals ("IsLogoDeleted"))
{
return toIsLogoDeleted ();
......@@ -6664,6 +6834,8 @@ public abstract class BaseCompany extends BaseBusinessClass
public PipeLine<From, Boolean> toManageOwnBilling () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_ManageOwnBilling)); }
public PipeLine<From, Countries> toHTCountry () { return pipe(new ORMAttributePipe<Me, Countries>(FIELD_HTCountry)); }
public PipeLine<From, Boolean> toIsLogoDeleted () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsLogoDeleted)); }
public PipeLine<From, Boolean> toCompletedProfile () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_CompletedProfile)); }
......@@ -6767,6 +6939,11 @@ public abstract class BaseCompany extends BaseBusinessClass
return true;
}
if(CollectionUtils.equals(attribName, "HTCountry"))
{
return true;
}
if(CollectionUtils.equals(attribName, "IsLogoDeleted"))
{
return true;
......
......@@ -90,6 +90,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
public static final String SEARCH_BillingTeams = "BillingTeams";
// Static constants corresponding to attribute helpers
......@@ -603,8 +604,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "country");
metaInfo.put ("defaultValue", "Countries.AU");
metaInfo.put ("mandatory", "true");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "Country");
metaInfo.put ("type", "Countries");
......@@ -1047,7 +1047,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Industry = (Industry)(HELPER_Industry.initialise (_Industry));
_TimeZone = (TimeZone)(HELPER_TimeZone.initialise (_TimeZone));
_State = (State)(State.WA);
_Country = (Countries)(Countries.AU);
_Country = (Countries)(HELPER_Country.initialise (_Country));
_PostCode = (String)(HELPER_PostCode.initialise (_PostCode));
_City = (String)(HELPER_City.initialise (_City));
_HasClientSupport = (Boolean)(Boolean.FALSE);
......@@ -1760,7 +1760,6 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
oldAndNewIdentical = HELPER_Country.compare (_Country, newCountry);
}
BusinessObjectParser.assertFieldCondition (newCountry != null, this, FIELD_Country, "mandatory");
if (FIELD_Country_Validators.length > 0)
......@@ -6698,6 +6697,255 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
.search (transaction);
}
public static SearchBillingTeams SearchByBillingTeams () { return new SearchBillingTeams (); }
public static class SearchBillingTeams extends SearchObject<HiringTeam>
{
public SearchBillingTeams andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_hiring_team.object_id", FIELD_ObjectID);
return this;
}
public SearchBillingTeams andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_hiring_team.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchBillingTeams andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_hiring_team.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchBillingTeams andHiringTeamName (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.hiring_team_name", "HiringTeamName");
return this;
}
public SearchBillingTeams andHiringTeamLogo (QueryFilter<BinaryContent> filter)
{
filter.addFilter (context, "tl_hiring_team.hiring_team_logo", "HiringTeamLogo");
return this;
}
public SearchBillingTeams andHiringTeamType (QueryFilter<HiringTeamType> filter)
{
filter.addFilter (context, "tl_hiring_team.hiring_team_type", "HiringTeamType");
return this;
}
public SearchBillingTeams andIndustry (QueryFilter<Industry> filter)
{
filter.addFilter (context, "tl_hiring_team.industry", "Industry");
return this;
}
public SearchBillingTeams andTimeZone (QueryFilter<TimeZone> filter)
{
filter.addFilter (context, "tl_hiring_team.time_zone", "TimeZone");
return this;
}
public SearchBillingTeams andState (QueryFilter<State> filter)
{
filter.addFilter (context, "tl_hiring_team.state", "State");
return this;
}
public SearchBillingTeams andCountry (QueryFilter<Countries> filter)
{
filter.addFilter (context, "tl_hiring_team.country", "Country");
return this;
}
public SearchBillingTeams andPostCode (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.post_code", "PostCode");
return this;
}
public SearchBillingTeams andCity (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.city", "City");
return this;
}
public SearchBillingTeams andHasClientSupport (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_hiring_team.has_client_support", "HasClientSupport");
return this;
}
public SearchBillingTeams andManageOwnBilling (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_hiring_team.manage_own_billing", "ManageOwnBilling");
return this;
}
public SearchBillingTeams andStripeReference (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.stripe_reference", "StripeReference");
return this;
}
public SearchBillingTeams andStripeSubscription (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.stripe_subscription", "StripeSubscription");
return this;
}
public SearchBillingTeams andStripeFixedSubItem (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.stripe_fixed_sub_item", "StripeFixedSubItem");
return this;
}
public SearchBillingTeams andStripeMeteredSubItem (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.stripe_metered_sub_item", "StripeMeteredSubItem");
return this;
}
public SearchBillingTeams andNameOnCard (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.name_on_card", "NameOnCard");
return this;
}
public SearchBillingTeams andCardPostCode (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.card_post_code", "CardPostCode");
return this;
}
public SearchBillingTeams andCardID (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.card_id", "CardID");
return this;
}
public SearchBillingTeams andPlanRenewedOn (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_hiring_team.plan_renewed_on", "PlanRenewedOn");
return this;
}
public SearchBillingTeams andUsedCredits (QueryFilter<Integer> filter)
{
filter.addFilter (context, "tl_hiring_team.used_credits", "UsedCredits");
return this;
}
public SearchBillingTeams andAvailableCredits (QueryFilter<Integer> filter)
{
filter.addFilter (context, "tl_hiring_team.available_credits", "AvailableCredits");
return this;
}
public SearchBillingTeams andIsPPJ (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_hiring_team.is_ppj", "IsPPJ");
return this;
}
public SearchBillingTeams andHasCap (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_hiring_team.has_cap", "HasCap");
return this;
}
public SearchBillingTeams andMaxCap (QueryFilter<Integer> filter)
{
filter.addFilter (context, "tl_hiring_team.max_cap", "MaxCap");
return this;
}
public SearchBillingTeams andCouponExpiryDate (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_hiring_team.coupon_expiry_date", "CouponExpiryDate");
return this;
}
public SearchBillingTeams andLastPlanAmount (QueryFilter<Double> filter)
{
filter.addFilter (context, "tl_hiring_team.last_plan_amount", "LastPlanAmount");
return this;
}
public SearchBillingTeams andGoogleAddressText (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_hiring_team.google_address_text", "GoogleAddressText");
return this;
}
public SearchBillingTeams andPlanCancelled (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_hiring_team.plan_cancelled", "PlanCancelled");
return this;
}
public SearchBillingTeams andCompany (QueryFilter<Company> filter)
{
filter.addFilter (context, "tl_hiring_team.company_id", "Company");
return this;
}
public SearchBillingTeams andBilledByTeam (QueryFilter<HiringTeam> filter)
{
filter.addFilter (context, "tl_hiring_team.billing_team_id", "BilledByTeam");
return this;
}
public SearchBillingTeams andAddedByUser (QueryFilter<CompanyUser> filter)
{
filter.addFilter (context, "tl_hiring_team.added_by_user_id", "AddedByUser");
return this;
}
public SearchBillingTeams andPaymentPlan (QueryFilter<PaymentPlan> filter)
{
filter.addFilter (context, "tl_hiring_team.payment_plan_id", "PaymentPlan");
return this;
}
public SearchBillingTeams andCoupon (QueryFilter<StripeCoupon> filter)
{
filter.addFilter (context, "tl_hiring_team.coupon_id", "Coupon");
return this;
}
public HiringTeam[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_HiringTeam, SEARCH_BillingTeams, criteria);
Set<HiringTeam> typedResults = new LinkedHashSet <HiringTeam> ();
for (BaseBusinessClass bbcResult : results)
{
HiringTeam aResult = (HiringTeam)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new HiringTeam[0]);
}
}
public static HiringTeam[]
searchBillingTeams (ObjectTransaction transaction) throws StorageException
{
return SearchByBillingTeams ()
.search (transaction);
}
public Object getAttribute (String attribName)
......@@ -7481,7 +7729,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add(HELPER_Industry.getAttribObject (getClass (), _Industry, false, FIELD_Industry));
result.add(HELPER_TimeZone.getAttribObject (getClass (), _TimeZone, false, FIELD_TimeZone));
result.add(HELPER_State.getAttribObject (getClass (), _State, false, FIELD_State));
result.add(HELPER_Country.getAttribObject (getClass (), _Country, true, FIELD_Country));
result.add(HELPER_Country.getAttribObject (getClass (), _Country, false, FIELD_Country));
result.add(HELPER_PostCode.getAttribObject (getClass (), _PostCode, false, FIELD_PostCode));
result.add(HELPER_City.getAttribObject (getClass (), _City, false, FIELD_City));
result.add(HELPER_HasClientSupport.getAttribObject (getClass (), _HasClientSupport, false, FIELD_HasClientSupport));
......
package performa.orm;
import java.util.HashSet;
import java.util.Set;
import oneit.logging.LoggingArea;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.objstore.rdbms.filters.IsNotNullFilter;
import oneit.objstore.rdbms.filters.NotEqualsFilter;
import oneit.security.SecUser;
import oneit.utils.BusinessException;
import oneit.utils.CollectionUtils;
import oneit.utils.StringUtils;
import oneit.utils.filter.Filter;
import oneit.utils.math.NullArith;
import oneit.utils.parsers.FieldException;
import performa.orm.types.JobStatus;
......@@ -164,4 +169,13 @@ public class Company extends BaseCompany
{
return getHiringTeamsCount() > 0 ? getHiringTeamsAt(0) : null;
}
public Set<HiringTeam> getBillingTeams()
{
Filter<HiringTeam> filter = HiringTeam.SearchByBillingTeams()
.andCardID(new IsNotNullFilter<>())
.andManageOwnBilling(new EqualsFilter<>(Boolean.TRUE));
return pipelineCompany().toHiringTeams(filter).uniqueVals();
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@
<TRANSIENT name="HiringTeamName" type="String" />
<TRANSIENT name="ManageOwnBilling" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="HTCountry" type="Countries" attribHelper="EnumeratedAttributeHelper"/>
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="CompletedProfile" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="PaymentJobCount" type="Integer" />
......
......@@ -14,7 +14,6 @@ import oneit.utils.DateDiff;
import oneit.utils.StringUtils;
import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException;
import performa.orm.types.AssessmentType;
import performa.orm.types.CurrencyType;
import performa.orm.types.RoleType;
import performa.utils.StripeUtils;
......@@ -38,17 +37,6 @@ public class HiringTeam extends BaseHiringTeam
}
@Override
public void validate(ValidationContext context)
{
// if(getStatus() != ObjectStatus.NEW)
// {
// context.check(getHiringTeamType() != null , this, FIELD_HiringTeamType, "mandatory");
// }
super.validate(context);
}
@Override
public String getToString()
{
return StringUtils.subNulls(getHiringTeamName(), super.getToString());
......
......@@ -24,7 +24,7 @@
<ATTRIB name="Industry" type="Industry" dbcol="industry" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="TimeZone" type="TimeZone" dbcol="time_zone" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="State" type="State" dbcol="state" mandatory="false" defaultValue="State.WA" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="Country" type="Countries" dbcol="country" mandatory="true" defaultValue="Countries.AU" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="Country" type="Countries" dbcol="country" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="PostCode" type="String" dbcol="post_code" mandatory="false" length="10"/>
<ATTRIB name="City" type="String" dbcol="city" mandatory="false" length="100"/>
<ATTRIB name="HasClientSupport" type="Boolean" dbcol="has_client_support" mandatory="false" defaultValue="Boolean.FALSE"/>
......@@ -58,6 +58,9 @@
<SEARCH type="All" paramFilter="tl_hiring_team.object_id is not null" >
</SEARCH>
<SEARCH type="BillingTeams" paramFilter="tl_hiring_team.object_id is not null and (is_ppj = 'Y' or (is_ppj = 'N' and payment_plan_id is not null))" >
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -388,6 +388,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public ResultSet executeSearchQueryBillingTeams (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryBillingTeams");
}
......@@ -537,6 +541,44 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (HiringTeam.SEARCH_BillingTeams))
{
// Local scope for transformed variables
{
}
String orderBy = " ";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_hiring_team.object_id is not null and (is_ppj = 'Y' or (is_ppj = 'N' and payment_plan_id is not null))
String preFilter = "(tl_hiring_team.object_id is not null and (is_ppj = 'Y' or (is_ppj = 'N' and payment_plan_id is not null)))"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_hiring_team " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
......@@ -582,7 +582,10 @@ public class Utils
public static HiringTeam[] getHiringTeamsWithOwnBilling(HiringTeam hiringTeam)
{
Filter<HiringTeam> filter = HiringTeam.SearchByAll().andManageOwnBilling(new EqualsFilter<>(Boolean.TRUE));
Filter<HiringTeam> filter = HiringTeam.SearchByBillingTeams()
.andManageOwnBilling(new EqualsFilter<>(Boolean.TRUE))
.andCardID(new IsNotNullFilter<>())
.andObjectID(new NotEqualsFilter<>(hiringTeam.getID().longID()));
return hiringTeam.pipelineHiringTeam().toCompany().toHiringTeams(filter).uniqueVals().toArray(new HiringTeam[0]);
}
......
......@@ -65,6 +65,7 @@
<FORM name="*.selectHiringTeam" factory="Participant" class="performa.form.SelectHiringTeamFP"/>
<FORM name="*.additionalTeam" factory="Participant" class="performa.form.AddAdditionalHiringTeamFP"/>
<FORM name="*.gotoCreateJob" factory="Participant" class="performa.form.NavigateToCreateJobFP"/>
<FORM name="*.gotoInviteTeammates" factory="Participant" class="performa.form.NavigateToInviteTeammatesFP"/>
<FORM name="*.search" factory="Participant" class="oneit.servlets.orm.RunSearchExecutorFP"/>
<DATA class="oneit.servlets.orm.RunSearchExecutorDF"/>
</NODE>
......
......@@ -91,11 +91,18 @@
<label><oneit:label GUIName="Time zone" /></label>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="TimeZone" cssClass="form-control"/>
</div>
<div class="form-group">
<label><oneit:label GUIName="Country" /></label>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Country" cssClass="form-control"/>
</div>
</div>
<div class="text-center company-profile-btn">
<oneit:button value="Confirm details & invite teammates" name="gotoPage" cssClass="btn btn-primary box-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>"/>
<oneit:button value="Confirm details & invite teammates" name="gotoInviteTeammates" cssClass="btn btn-primary box-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("HiringTeam", hiringTeam)
.toMap() %>"/>
</div>
</div>
......
......@@ -16,6 +16,7 @@
UserSortOption userSortOpt = (UserSortOption) process.getAttribute("UserSortOption");
Collection<CompanyUser> companyUsers = (Collection<CompanyUser>) process.getAttribute("CompanyUsers");
boolean readOnly = !comUser.isOwner();
HiringTeam selectedTeam = comUser.getActiveHiringTeam();
if(company == null)
{
......@@ -41,7 +42,9 @@
}
process.setAttribute("UserSortOption", userSortOpt);
company.setHTCountry(selectedTeam.getCountry());
Collection<HiringTeam> sortedHiringTeams = Utils.getHiringTeamsSorted(Arrays.asList(Utils.getHiringTeamsByUser(comUser)), userSortOpt);
%>
<oneit:form name="listHiringTeams" method="post" enctype="multipart/form-data">
......@@ -85,7 +88,6 @@
%>
<div class="user-list-row">
<div class="m-user-left">
<!--TODO: add hiring team icon-->
<div class="m-user-icon"><img src="images/hireteam-list-icon.png"></div>
<div class="m-user-info">
<div class="m-user-name">
......@@ -144,10 +146,14 @@
<oneit:recalcClass htmlTag="div" classScript="company.showTeamManagesOwnBilling() ? 'hide': 'show'" company="<%= company %>">
<label><oneit:label GUIName="Select Billing Team" /></label>
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= company %>" assocName="BillingTeam" options="<%= !readOnly ? company.getHiringTeamsSet().toArray(new HiringTeam[0]) : new HiringTeam[0] %>"/>
<tagfile:ormsingleasso_select obj="<%= company %>" assocName="BillingTeam" options="<%= !readOnly ? company.getBillingTeams().toArray(new HiringTeam[0]) : new HiringTeam[0] %>"/>
</div>
</oneit:recalcClass>
</div>
<div class="form-group">
<label><oneit:label GUIName="Country" /></label>
<oneit:ormEnum obj="<%= company %>" attributeName="HTCountry" cssClass="form-control"/>
</div>
<oneit:recalcClass htmlTag="div" classScript="readOnly ? 'hide': 'show'" readOnly="<%= readOnly%>">
<oneit:button value="Add Team" name="addHiringTeam" cssClass="btn btn-invite"
......
......@@ -41,6 +41,7 @@ Company.HiringTeamType = Hiring Team
Company.CompanyName = Hiring Team Name
Company.PaymentPlan = Payment Plan
Company.ManageOwnBilling = Team manages its own billing
Company.HTCountry = Country
HiringTeam.TimeZone = Time zone
HiringTeam.HasClientSupport = We help clients with hiring
......
......@@ -17,6 +17,7 @@
Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company");
boolean readOnly = hiringTeam.getObjectWriteability() == FieldWriteability.NOT_IN_GUI;
boolean assumedUser = Utils.isAssumedUser(request);
%>
<script type="text/javascript">
......@@ -220,21 +221,34 @@
<div class="form-group row own-billing">
<div class="col-md-6">
<div class="radio radio-primary second-radio-primary oneit-radio">
<label >
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="true"/>Yes
<label>
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="true" readonly="<%= !assumedUser %>"/>Yes
</label>
</div>
<div class="radio radio-primary second-radio-primary oneit-radio">
<label>
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="false"/>No
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="false" readonly="<%= !assumedUser %>"/>No
</label>
</div>
</div>
<div class="col-md-6">
<oneit:recalcClass htmlTag="div" classScript="hiringTeam.getManageOwnBilling() ? 'hide': 'show'" hiringTeam="<%= hiringTeam %>">
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= hiringTeam %>" assocName="BilledByTeam" options="<%= Utils.getHiringTeamsWithOwnBilling(hiringTeam) %>"/>
</div>
<%
if(assumedUser)
{
%>
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= hiringTeam %>" assocName="BilledByTeam" options="<%= Utils.getHiringTeamsWithOwnBilling(hiringTeam) %>"/>
</div>
<%
}
else
{
%>
<oneit:toString value="<%= hiringTeam.getBilledByTeam() %>" mode="EscapeHTML"/>
<%
}
%>
</oneit:recalcClass>
</div>
</div>
......@@ -252,7 +266,7 @@
<div class="form-group row">
<div class="col-md-6">
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="Country" /></label>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Country" cssClass="form-control"/>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Country" cssClass="form-control" readonly="true"/>
</div>
<%-- <div class="col-md-4">
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="State" /></label>
......
-- @AutoRun
ALTER TABLE tl_hiring_team ALTER COLUMN country DROP NOT NULL;
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