%@ Language=VBScript %>
<%
'Modified to include tblCustomerCompany records and normalized account type records (B2B Mod)
On Error Resume Next
Dim objRegistration 'AldaT Registartion Object
Dim objRegMod 'AldaT B2B Mod Object
Dim locADORecords 'locRecordset
Dim defaultCountry 'default for country list
Dim defaultState 'default for state list
Dim AddCustomer 'AddCustomer return value
Dim AddLocation 'AddLocation return value
Dim AddCompany 'AddCompany return value (B2B Mod)
Dim ErrorFlag 'Flag if string error occurs
Dim ErrorNumber 'Err.number to error.asp
Dim ErrorDescription 'Err.description to error.asp
Dim ErrorSource 'Err.source to error.asp
Dim ErrorPage 'Error source page
Dim ErrorUser 'Error source user
Dim CPUserID, CPEmail, CPPWD, CPLastName, CPFirstName, CPEnabled 'reqired customer record
Dim CPMiddleI, CPTitle, CPAcctType 'optional customer record
Dim CPLocationName, CPType 'required customer location record
Dim CPAddress, CPAddress2, CPZip, CPCountry, CPPhone, CPFax 'optional customer location record
Dim CPVerifyPWD 'copy of verify password field
Dim EmailInSysFlag, EmailInSysWarnedFlag, AddCustomerFlag
Dim CPCustCompany, CPCustomerCompanyID, CPCustExtra1, CPCustExtra2 'args needed to update cust company
Dim CPCustExtra3
Dim objMail 'mail object
Dim MailSubject, MailContent, MailRecipient, MailSender 'mail content and properties
defaultCountry = "United States"
defaultState = "CO"
message = ""
AddCustomerFlag = False
If Request("email_in_sys_warned_flag") <> "" Then
EmailInSysWarnedFlag = CBool(Request("email_in_sys_warned_flag"))
Else
EmailInSysWarnedFlag = False
End If
If Session("CustomerID") <> "" Then
Response.Redirect("menu.asp?urlmessage=" & Server.URLEncode("You are already logged in"))
End If
If Request("add_status")="submit" And Session("Submitted") <> "register" then
'make local copy of form fields
'required customer fields
CPUserID = Trim(UCase((Request("userid"))))
CPEmail = Trim(LCase(Request("email")))
CPPWD = Trim(Request("pwd"))
CPLastName = Trim(Request("last_name"))
CPFirstName = Trim(Request("first_name"))
CPEnabled = Request.Form("enabled").count
'optional customer fields
CPMiddleI = Trim(Request("middlei"))
CPTitle = Trim(Request("title"))
'make local copy of form fields
'required customer location fields
CPLocationName = CPFirstName & " "
If CPMiddleI <> "" Then
CPLocationName = CPLocationName & CPMiddleI & ". "
End If
CPLocationName = CPLocationName & CPLastName
CPType = Trim(Request("loc_type"))
'optional customer location fields
CPAddress = Trim(Request("address"))
CPAddress2 = Trim(Request("address2"))
CPCity = Trim(Request("city"))
CPState = Trim(Request("state"))
CPZip = Trim(Request("zip"))
CPCountry = Trim(Request("country"))
CPPhone = Trim(Request("phone"))
CPFax = Trim(Request("fax"))
'verify password
CPVerifyPWD = Trim(Request("verify_pwd"))
CPAcctType = "Unassigned"
Set objRegistration = Server.CreateObject("aldatRegistration.Customer")
'******BEGIN check for customer account with same email address
'ByVal: vCompanyID, vSearchText, bCustomerID, bEmail, bLastName, bFirstName
'Optional: vOrderBy
If EmailInSysWarnedFlag <> True Then
EmailInSysWarnedFlag = True
Set locADORecords = objRegistration.searchCustomers(Application("Company"), CPEmail, False, True, False, False)
If Err.number > 0 Then
'no customer accounts are using this email address
Err.Clear
EmailInSysFlag = False
Else
EmailInSysFlag = True
message = message & "There is another account using the same email address you provided--see options below.
"
End If
Else
'already warned of duplicate email
EmailInSysFlag = CBool(Request("email_in_sys_flag"))
End If
'******END check for customer account with same email address
'Check for duplicate user id
AddCustomer = objRegistration.duplicateCustomer(Application("Company"), CPUserID)
'Create new customer record
If AddCustomer = "NoDuplicate" Then
If EmailInSysFlag = False Or CBool(Request("email_in_sys_warned_flag")) = True Then
'Request("email_in_sys_flag") = True: indicates customer was warned but still wishes to create account
AddCustomerFlag = True
'ByVal: vCompanyID, vCustomerID, vPWD, vLastName, vFirstName, vOnList
'Optional: vEmail, vMiddleI, vAcctType, vTitle, vPower, vApprovedBy
AddCustomer = objRegistration.addCustomer(Application("Company"), CPUserID, CPPWD, CPLastName, CPFirstName, CPEnabled,_
CPEmail, CPMiddleI, CPAcctType, CPTitle)
'add location
Set objRegistration = Server.CreateObject("aldatRegistration.Location")
'ByVal: vCompanyID, vLocationName, vCustomerID, vType
'Optional: vAddress, vAddress2, vCity, vState, vZip, vCountry, vPhone, vFax
AddLocation = objRegistration.addLocation(Application("Company"), CPLocationName, CPUserID, CPType,_
CPAddress, CPAddress2, CPCity, CPState, CPZip, CPCountry, CPPhone, CPFax)
If InStr(1, AddLocation, "Error", 1) > 0 Then
ErrorNumber = Server.URLEncode("Error: Unknown")
ErrorFlag = true
End If
'************BEGIN customer company
CPCustCompany = Trim(Request("cust_company"))
CPCustExtra1 = ""
CPCustExtra2 = ""
CPCustExtra3 = ""
Set objRegMod = Server.CreateObject("AldatB2BMod.CustCompany")
AddCompany = objRegMod.AddCompany(Application("Company"),CPUserID,CPCustCompany,CPCustExtra1,CPCustExtra2,CPCustExtra3)
If InStr(1, AddCompany, "Error", 1) > 0 Then
ErrorNumber = Server.URLEncode("Error Number: " & Err.number)
ErrorDescription = Server.URLEncode("Error Description: " & AddCompany)
ErrorSource = Server.URLEncode("Error Source: " & "AldatB2BMod")
ErrorPage = Server.URLEncode("Error Page: " & Request.ServerVariables("SCRIPT_NAME"))
ErrorUser = Server.URLEncode("Error User: " & Session("CustomerID"))
Response.Redirect ("error.asp?errornum=" & ErrorNumber & "&errordes=" &_
ErrorDescription & "&errorsrc=" & ErrorSource &_
"&errorpg=" & ErrorPage & "&errorusr=" & ErrorUser)
End If
'************END customer company
End If
Else
DupCustIDFlag = True
message = message & "The User ID you chose is already being used.
"
End If
If InStr(1, AddCustomer, "Expired", 1) > 0 Then
ErrorNumber = Server.URLEncode("Error: AldatRegistration has expired")
ErrorFlag = true
End If
If InStr(1, AddCustomer, "CompanyNotFound", 1) > 0 Then
ErrorNumber = Server.URLEncode("Error: AldatRegistration has not been installed")
ErrorFlag = true
End If
If InStr(1, AddCustomer, "Error", 1) > 0 Then
ErrorNumber = Server.URLEncode("Error: Unknown")
ErrorDescription = Server.URLEncode("Error Description: " & AddCustomer)
ErrorSource = Server.URLEncode("Error Source: " & "AldatRegistration")
ErrorPage = Server.URLEncode("Error Page: " & Request.ServerVariables("SCRIPT_NAME"))
ErrorUser = Server.URLEncode("Error User: " & Session("CustomerID"))
Response.Redirect ("error.asp?errornum=" & ErrorNumber & "&errordes=" &_
ErrorDescription & "&errorsrc=" & ErrorSource &_
"&errorpg=" & ErrorPage & "&errorusr=" & ErrorUser)
End If
If ErrorFlag = true Then
ErrorDescription = Server.URLEncode("Error Description: " & AddCustomer)
ErrorSource = Server.URLEncode("Error Source: " & "AldatRegistration")
ErrorPage = Server.URLEncode("Error Page: " & Request.ServerVariables("SCRIPT_NAME"))
ErrorUser = Server.URLEncode("Error User: " & Session("CustomerID"))
Response.Redirect ("error.asp?errornum=" & ErrorNumber & "&errordes=" &_
ErrorDescription & "&errorsrc=" & ErrorSource &_
"&errorpg=" & ErrorPage & "&errorusr=" & ErrorUser)
End If
If AddCustomerFlag = True Then
If AddCustomer <> "Duplicate" Then
Session("CustomerID") = CPUserID
Session("Submitted") = "register"
'*******BEGIN webstatistics count customer applications
Dim objWebStatistics
Dim IncrementApplication
Set objWebStatistics = Server.CreateObject("aldatWebStatistics.Application")
'ByVal: vCompanyID, vApplicationTypeID, vYear, vMonth, vWeekday
IncrementApplication = objWebStatistics.incrementApplication(Application("Company"), 3, Year(Date()), Month(Date()), Weekday(Date()))
'*******END webstatistics count customer applications
'*******BEGIN email confirmation to registrant
MailSubject = "Notification of " & Application("CompanyDisplay") & " online registration"
MailSender = Application("ContactFrom")
MailContent = CPFirstName & " " & CPLastName & "," & Chr(13) & Chr(13) &_
"Thank you for registering with Parker Medical. We will review your request and send an email response within 24 hours containing your established user level."
MailRecipient = CPEmail
If len(MailRecipient) > 5 Then
'MailSubject, MailContent, MailRecipient, MailSender
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = MailRecipient
objMail.From = Application("ContactFrom")
objMail.subject = MailSubject
objMail.body = MailContent
objMail.send
Set objMail = Nothing
End If
'*******END email confirmation to registrant
'*******BEGIN email notice to employee(s)
'email application employees selected for job listings notifications
MailSubject = Application("CompanyDisplay") & " registration submitted"
MailSender = Application("ContactFrom")
MailContent = "The following person has registered:" & Chr(13) & Chr(13) &_
CPFirstName & " " & CPLastName & Chr(13) &_
"Company: " & CPCustCompany & Chr(13) &_
"User ID: " & CPUserID & Chr(13) &_
"Interested in: " & Request("interested") & Chr(13) & Chr(13) &_
"An enabled " & Application("CompanyDisplay") & " employee, with greater or equal rights in each of the application management areas, must now grant permission to this employee before he/she will able to access the website." & Chr(13) & Chr(13) &_
"The following link will take you to the appropriate back-end manager: " & Application("Secured") & "://" & Application("SiteUrl") & "/registration/reg_mod_report_cust_company.asp" & Chr(13) &_
"You will then be prompted to log-in."
'get employees with registration application option "checked"
Set objRegistration = Server.CreateObject("aldatRegistration.Employee")
Set locADORecords = objRegistration.getEmpActiveAppOption(Application("Company"), 0)
If Err.number > 0 then
'no employees on mailing list
Err.Clear
Else
While Not locADORecords.EOF
MailRecipient = locADORecords("email")
If len(MailRecipient) > 5 Then
'MailSubject, MailContent, MailRecipient, MailSender
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = MailRecipient
objMail.From = Application("ContactFrom")
objMail.subject = MailSubject
objMail.body = MailContent
objMail.send
Set objMail = Nothing
End If
locADORecords.MoveNext()
Wend
End If
'*******END email notice to employee(s)
'Response.Redirect("menu.asp?urlmessage=" & Server.URLEncode("Customer Registered"))
If Session("CurrentPage") = "" Then
Response.Redirect("menu.asp?urlmessage=" & Server.URLEncode("Customer Registered"))
Else
Response.Redirect(Session("CurrentPage") & "?urlmessage=" & Server.URLEncode("Customer Registered"))
End If
End If
End If
Else
Session("Submitted") = ""
End If
Set objRegistration = Server.CreateObject("aldatRegistration.Admin")
%>
The information you provide Parker Medical will be used exclusively for order fulfillment and correspondence with our customers. Information will not be sold or distributed to any third party.
As a security precaution, after 20 minutes of idle time a registered user will be automatically logged out of the Parker Medical website. To regain access, the registered user will be prompted to provide a User ID and Password.
<%=Message%>