}
APILocator.getUserAPI().save(user,APILocator.getUserAPI().getSystemUser(),false);
//### CREATE USER_PROXY ###
UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user.getUserId(),APILocator.getUserAPI().getSystemUser(), false);
userProxy.setUserId(user.getUserId());
userProxy.setPrefix(createAccountForm.getPrefix());
userProxy.setSuffix(createAccountForm.getSuffix());
userProxy.setTitle(createAccountForm.getTitle());
userProxy.setSchool(createAccountForm.getSchool());
userProxy.setGraduationYear(createAccountForm.getGraduationYear());
userProxy.setOrganization(createAccountForm.getOrganization());
userProxy.setCompany(createAccountForm.getOrganization());
userProxy.setWebsite(createAccountForm.getWebsite());
userProxy.setHowHeard(createAccountForm.getHowHeard());
userProxy.setVar1(createAccountForm.getVar1());
userProxy.setVar2(createAccountForm.getVar2());
userProxy.setVar3(createAccountForm.getVar3());
userProxy.setVar4(createAccountForm.getVar4());
userProxy.setVar5(createAccountForm.getVar5());
userProxy.setVar6(createAccountForm.getVar6());
userProxy.setVar7(createAccountForm.getVar7());
userProxy.setVar8(createAccountForm.getVar8());
userProxy.setVar9(createAccountForm.getVar9());
userProxy.setVar10(createAccountForm.getVar10());
userProxy.setVar11(createAccountForm.getVar11());
userProxy.setVar12(createAccountForm.getVar12());
userProxy.setVar13(createAccountForm.getVar13());
userProxy.setVar14(createAccountForm.getVar14());
userProxy.setVar15(createAccountForm.getVar15());
userProxy.setVar16(createAccountForm.getVar16());
userProxy.setVar17(createAccountForm.getVar17());
userProxy.setVar18(createAccountForm.getVar18());
userProxy.setVar19(createAccountForm.getVar19());
userProxy.setVar20(createAccountForm.getVar20());
userProxy.setVar21(createAccountForm.getVar21());
userProxy.setVar22(createAccountForm.getVar22());
userProxy.setVar23(createAccountForm.getVar23());
userProxy.setVar24(createAccountForm.getVar24());
userProxy.setVar25(createAccountForm.getVar25());
if (UtilMethods.isSet(createAccountForm.getDescription()) ||
UtilMethods.isSet(createAccountForm.getStreet1()) ||
UtilMethods.isSet(createAccountForm.getStreet2()) ||
UtilMethods.isSet(createAccountForm.getCity()) ||
UtilMethods.isSet(createAccountForm.getState()) ||
UtilMethods.isSet(createAccountForm.getZip()) ||
UtilMethods.isSet(createAccountForm.getCountry()) ||
UtilMethods.isSet(createAccountForm.getPhone()) ||
UtilMethods.isSet(createAccountForm.getFax()) ||
UtilMethods.isSet(createAccountForm.getCell())) {
try {
List<Address> addresses = PublicAddressFactory.getAddressesByUserId(user.getUserId());
Address address = (addresses.size() > 0 ? addresses.get(0) : PublicAddressFactory.getInstance());
address.setDescription(createAccountForm.getDescription() == null ? "" : createAccountForm.getDescription());
address.setStreet1(createAccountForm.getStreet1() == null ? "" : createAccountForm.getStreet1());
address.setStreet2(createAccountForm.getStreet2() == null ? "" : createAccountForm.getStreet2());
address.setCity(createAccountForm.getCity() == null ? "" : createAccountForm.getCity());
address.setState(createAccountForm.getState() == null ? "" : createAccountForm.getState());
address.setZip(createAccountForm.getZip() == null ? "" : createAccountForm.getZip());
address.setCountry(createAccountForm.getCountry() == null ? "" : createAccountForm.getCountry());
address.setPhone(createAccountForm.getPhone() == null ? "" : createAccountForm.getPhone());
address.setFax(createAccountForm.getFax() == null ? "" : createAccountForm.getFax());
address.setCell( createAccountForm.getCell() == null ? "" : createAccountForm.getCell());
address.setUserId(user.getUserId());
address.setCompanyId(company.getCompanyId());
PublicAddressFactory.save(address);
} catch (Exception e) {
Logger.warn(this, e.toString());
}
}
userProxy.setMailSubscription(createAccountForm.isMailSubscription());
com.dotmarketing.business.APILocator.getUserProxyAPI().saveUserProxy(userProxy,APILocator.getUserAPI().getSystemUser(), false);
//### END CRETE USER_PROXY ###
String[] arr = form.getCategories();
if (arr != null) {
for (int i = 0; i < arr.length; i++) {
try {
Category node = (Category) InodeFactory.getInode(arr[i], Category.class);
node.addChild(userProxy);
} catch (Exception e) {
Logger.warn(this, e.toString());
}
}
}
//### END CREATE USER COMMENT###
if(UtilMethods.isSet(form.getComments())){
UserComment userComments = new UserComment();
userComments.setUserId(userProxy.getUserId());
userComments.setCommentUserId(user.getUserId());
userComments.setDate(new java.util.Date());
userComments.setComment(form.getComments());
userComments.setTypeComment("incoming");
userComments.setSubject("User Comment");
userComments.setMethod("Regular");
userComments.setCommunicationId(null);
UserCommentsFactory.saveUserComment(userProxy.getInode(),userComments);
}
if (form.isMailSubscription()) {
//Subscribe to the mailing list
if(UtilMethods.isSet(Config.getStringProperty("CREATE_ACCOUNT_MAILING_LIST"))){
List<MailingList> list = MailingListFactory.getAllMailingLists();