danarashad
Programmer
I am having a problem with an email being mailed twice.
here's my code. I can't find where the problem is. kind of long but i wanted to include everything that is in the code.
<cfif form.status is "sandy">
<cfparam name="form.denied" default="" type="string">
<cfparam name="form.tent" default="" type="string">
<cfquery name="goupdate" datasource="#datasource#">
UPDATE proff SET proff.name = '#form.name#', proff.date1 = '#form.date1#', proff.school = '#form.school#',
proff.assignment = '#form.assignment#', proff.des = '#form.des#', proff.goal = '#form.goal#', proff.checknum = '#form.checknum#',
proff.reg1 = '#form.reg1#', proff.trans1 = '#form.trans1#', proff.lodging1 = '#form.lodging1#',
proff.other1 = '#form.other1#', proff.total1 = '#form.total1#', proff.po = '#form.po#', proff.date6 = '#form.date6#',
proff.budget = '#form.budget#', proff.hours = '#form.hours#', proff.points = '#form.points#',
proff.date7 = '#form.date7#', proff.date8 = '#form.date8#', proff.denied = '#form.denied#', proff.tent = '#form.tent#',
proff.points2 = '#form.points2#', proff.location ='#form.location#'
Where rec_id=#form.rec_id#;
</cfquery>
<cfparam name="form.hard_copy" default="" type="string">
<cfparam name="form.pre_reg" default="" type="string">
<cfparam name="form.pre_reg2" default="" type="string">
<cfparam name="form.reg3" default="" type="string">
<cfparam name="form.reg4" default="" type="string">
<cfparam name="form.principal" default="" type="string">
<cfquery name="groupupdate2" datasource="#datasource#">
UPDATE proff SET proff.pre_reg = '#form.pre_reg#', proff.hard_copy = '#form.hard_copy#',
proff.pre_reg2 ='#form.pre_reg2#',
proff.reg3 = '#form.reg3#', proff.reg4 ='#form.reg4#', proff.principal='form.principal'
Where rec_id=#form.rec_id#;
</cfquery>
<cfquery name="groupupdate3" datasource="#datasource#">
UPDATE fap SET form_id=#rec_id#, keyName=10, teacherID=#sid#,
teacherStatus=2, appraiserStatus=1, saved=2, status='#form.status3#',
appraiserDate=#now()#
Where form_id=#form.rec_id#;
</cfquery>
<cfquery name="appraiserCheck" datasource="#datasource#">
select myAppraiser, myAltAppraiser from demographics where id=#session.auth.userID#;
</cfquery>
<cfif appraiserCheck.myAppraiser GT 0>
<cfset thisAppraiserCheck=appraiserCheck.myAppraiser>
<cfelseif appraiserCheck.myAltAppraiser gt 0>
<cfset thisAppraiserCheck=appraiserCheck.myAltAppraiser>
<cfelse>
<cfset thisAppraiserCheck=0>
</cfif>
<cfquery name="toEmailQRY" datasource="#datasource#">
select username from demographics where id=#thisAppraiserCheck#;</cfquery>
<cfquery name="fromEmailQRY" datasource="#datasource#">
select username, fName, lName from demographics where id=#session.auth.userID#;</cfquery>
<cfquery name="formName" datasource="#datasource#">
select formName from formName where keyName=10
</cfquery>
<cfif siteEmailCheck is 1>
<CFSET toEmail = '#trim(toEmailQRY.userName)#@mail.org'>
<CFSET fromEmail= '#trim(fromEmailQRY.userName)#@mail.org'>
<cfelse>
<CFSET toEmail = 'tas@mail.org'>
<CFSET fromEmail = 'tas@mail.org'>
</cfif>
<CFSET emailsubject = '#formName.formName#'>
<cfif trim(form.emailMessage) is ''>
<cfset messageForm=''>
<cfelse>
<cfset messageForm='Message from #fromEmailQRY.fName#: #trim(form.emailMessage)#'>
</cfif>
<!--- We do not want ColdFusion to suppress whitespace here --->
<CFPROCESSINGDIRECTIVE SUPPRESSWHITESPACE="No">
<CFMAIL
SUBJECT="#emailsubject#"
FROM="from@mail.org"
TO="to@mail.org"
SERVER="#mailserver#"
>
#fromEmailQRY.fName# #fromEmailQRY.lName# has completed the #emailSubject#.
Please login to the system and respond.
#emailNotificationLink#
#messageForm# 2 emails
</CFMAIL>
</CFPROCESSINGDIRECTIVE>
</cfif>
here's my code. I can't find where the problem is. kind of long but i wanted to include everything that is in the code.
<cfif form.status is "sandy">
<cfparam name="form.denied" default="" type="string">
<cfparam name="form.tent" default="" type="string">
<cfquery name="goupdate" datasource="#datasource#">
UPDATE proff SET proff.name = '#form.name#', proff.date1 = '#form.date1#', proff.school = '#form.school#',
proff.assignment = '#form.assignment#', proff.des = '#form.des#', proff.goal = '#form.goal#', proff.checknum = '#form.checknum#',
proff.reg1 = '#form.reg1#', proff.trans1 = '#form.trans1#', proff.lodging1 = '#form.lodging1#',
proff.other1 = '#form.other1#', proff.total1 = '#form.total1#', proff.po = '#form.po#', proff.date6 = '#form.date6#',
proff.budget = '#form.budget#', proff.hours = '#form.hours#', proff.points = '#form.points#',
proff.date7 = '#form.date7#', proff.date8 = '#form.date8#', proff.denied = '#form.denied#', proff.tent = '#form.tent#',
proff.points2 = '#form.points2#', proff.location ='#form.location#'
Where rec_id=#form.rec_id#;
</cfquery>
<cfparam name="form.hard_copy" default="" type="string">
<cfparam name="form.pre_reg" default="" type="string">
<cfparam name="form.pre_reg2" default="" type="string">
<cfparam name="form.reg3" default="" type="string">
<cfparam name="form.reg4" default="" type="string">
<cfparam name="form.principal" default="" type="string">
<cfquery name="groupupdate2" datasource="#datasource#">
UPDATE proff SET proff.pre_reg = '#form.pre_reg#', proff.hard_copy = '#form.hard_copy#',
proff.pre_reg2 ='#form.pre_reg2#',
proff.reg3 = '#form.reg3#', proff.reg4 ='#form.reg4#', proff.principal='form.principal'
Where rec_id=#form.rec_id#;
</cfquery>
<cfquery name="groupupdate3" datasource="#datasource#">
UPDATE fap SET form_id=#rec_id#, keyName=10, teacherID=#sid#,
teacherStatus=2, appraiserStatus=1, saved=2, status='#form.status3#',
appraiserDate=#now()#
Where form_id=#form.rec_id#;
</cfquery>
<cfquery name="appraiserCheck" datasource="#datasource#">
select myAppraiser, myAltAppraiser from demographics where id=#session.auth.userID#;
</cfquery>
<cfif appraiserCheck.myAppraiser GT 0>
<cfset thisAppraiserCheck=appraiserCheck.myAppraiser>
<cfelseif appraiserCheck.myAltAppraiser gt 0>
<cfset thisAppraiserCheck=appraiserCheck.myAltAppraiser>
<cfelse>
<cfset thisAppraiserCheck=0>
</cfif>
<cfquery name="toEmailQRY" datasource="#datasource#">
select username from demographics where id=#thisAppraiserCheck#;</cfquery>
<cfquery name="fromEmailQRY" datasource="#datasource#">
select username, fName, lName from demographics where id=#session.auth.userID#;</cfquery>
<cfquery name="formName" datasource="#datasource#">
select formName from formName where keyName=10
</cfquery>
<cfif siteEmailCheck is 1>
<CFSET toEmail = '#trim(toEmailQRY.userName)#@mail.org'>
<CFSET fromEmail= '#trim(fromEmailQRY.userName)#@mail.org'>
<cfelse>
<CFSET toEmail = 'tas@mail.org'>
<CFSET fromEmail = 'tas@mail.org'>
</cfif>
<CFSET emailsubject = '#formName.formName#'>
<cfif trim(form.emailMessage) is ''>
<cfset messageForm=''>
<cfelse>
<cfset messageForm='Message from #fromEmailQRY.fName#: #trim(form.emailMessage)#'>
</cfif>
<!--- We do not want ColdFusion to suppress whitespace here --->
<CFPROCESSINGDIRECTIVE SUPPRESSWHITESPACE="No">
<CFMAIL
SUBJECT="#emailsubject#"
FROM="from@mail.org"
TO="to@mail.org"
SERVER="#mailserver#"
>
#fromEmailQRY.fName# #fromEmailQRY.lName# has completed the #emailSubject#.
Please login to the system and respond.
#emailNotificationLink#
#messageForm# 2 emails
</CFMAIL>
</CFPROCESSINGDIRECTIVE>
</cfif>