失去变量。元素在VARIABLES中未定义

时间:2015-12-08 19:22:18

标签: coldfusion cfml

我们在生产中的ColdFusion 9和ColdFusion 11服务器中都遇到此错误。我原本以为与ColdFusion 9和JavaHeap空间有关或内存不足。我们将这个过程转移到一个全新的服务器(ColdFusion 11)上运行,其中没有其他任何东西正在运行并且有大量内存,我们仍然得到错误。以下是此cfm页面的一些代码:

<cfset variables.email_count = 0>
<!--- email notifications --->
<cfoutput query="getOrdersForNotification" group="order_id">

    <cfset variables.inv = "">
    <cfset variables.usePdf = false>
    <cfif isDefined("application.feature_list_using_pdf_attachment")
            and listFindNoCase(application.feature_list_using_pdf_attachment, "injection scheduler", ",")
        >
        <cfset variables.usePdf = true>
    </cfif>

    <cfthread name="InjectionSchdEmail#dateFormat(now(), 'mmdd')#_#timeFormat(now(), 'HHmmss')#_#getOrdersForNotification.order_id#"
        threadOrderId="#getOrdersForNotification.order_id#"
        threadMemberId="#getOrdersForNotification.member_id#"
        threadNotificationEmail="#getOrdersForNotification.notification_email#"
        threadDateReq="#getOrdersForNotification.date_req#"
        threadStoreCode="#getOrdersForNotification.store_code#"
        threadStoreName="#getOrdersForNotification.store_name#"
        threadToGoLabel="#application.togo_label#"
        threadOrderTotal="#getOrdersForNotification.order_total#"
        threadDelTimeValueFront="#getOrdersForNotification.del_time_value_front#"       
        threadSubject="#variables.subjectAndBodyTemplates.subject#"
        threadBody="#variables.subjectAndBodyTemplates.body#"
        threadFromEmail="#variables.fromEmail#"
        threadLocalNow="#variables.localNow#"
        threadLocalNowInt="#variables.localNowInt#"
        threadDs="#ds#"
        threadUsePdf="#variables.usePdf#"
        >
        <cftry>
            <cfset url.order_id = threadOrderId>
            <cfset url.member_id = threadMemberId>
            <cfsavecontent variable="variables.inv">
                <cfinclude template="invoicedeska.cfm">
            </cfsavecontent>

            <cfset variables.order_day=dateFormat(application.UdfService.toSlashDate(threadDateReq), 'mmm dd')>

            <cfset local.subject = threadSubject>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Store Code]", threadStoreCode, "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Takeout Label]", threadToGoLabel, "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Order ID]", threadOrderId, "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Order Total]", NumberFormat(threadOrderTotal,"9,999.99"), "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Required Time]", threadDelTimeValueFront, "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Required Date]", variables.order_day, "all")>

            <cfset local.body = threadBody>
            <cfset local.body = ReplaceNoCase(local.body, "[Store Code]", threadStoreCode, "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Store Name]", threadStoreName, "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Order ID]", threadOrderId, "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Order Total]", NumberFormat(threadOrderTotal,"9,999.99"), "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Required Time]", threadDelTimeValueFront, "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Required Date]", variables.order_day, "all")>
            <cfset local.body = "<span style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: ##000000'>#application.UdfService.multiLiner(local.body)#</span>">

            <cfif threadUsePdf>
                <!--- PDF version --->
                <cfdocument 
                    format="PDF" 
                    name="variables.attachment" 
                    localURL="#application.pdf_localURL#" 
                    orientation="#application.pdf_orientation#"
                    marginleft="#application.pdf_marginleft#" 
                    marginright="#application.pdf_marginright#" 
                    margintop="#application.pdf_margintop#" 
                    marginbottom="#application.pdf_marginbottom#" 
                    unit="#application.pdf_unit#" 
                    scale="#application.pdf_scale#"
                >
                    #variables.inv#
                </cfdocument>
            <cfelse>
                <!--- HTML version --->
                <cfset variables.attachment = variables.inv>
            </cfif>

            <cfmail to="#threadNotificationEmail#" from="#threadFromEmail#" subject="#local.subject#" type="html">
                #local.body#
                <cfif isDefined("variables.attachment") and threadUsePdf eq false>
                    <cfmailparam
                        file="invoice_#threadOrderId#_#threadLocalNowInt#.html"
                        type="application/html"
                        content="#variables.attachment#"
                        />
                <cfelseif isDefined("variables.attachment") and threadUsePdf>
                    <cfmailparam
                        file="invoice_#threadOrderId#_#threadLocalNowInt#.pdf"
                        type="application/pdf"
                        content="#variables.attachment#"
                        />
                </cfif>
            </cfmail>

            <cfset invoice_emailed = application.MessageService.setEmailedInvoice(orderId = threadOrderId, localNow = threadLocalNow, emailAddress = threadNotificationEmail, datasource = threadDs)>

            <cfcatch type="any">
                <cfset variables.attachment = "">
                <cfmail from="erroralerts@monkeymediasoftware.com" to="erroralerts@monkeymediasoftware.com" type="html" subject="POS injection notification email faliure">
                    <cfif isDefined("cgi.server_name")>
                        Server: <b>#cgi.server_name#</b>
                    </cfif>
                    <cfdump var="#cfcatch#" label="cfcatch"><br />
                    <cfdump var="#threadOrderId#" label="threadOrderId"><br />
                    <cfdump var="#threadMemberId#" label="threadMemberId"><br />
                    <cfdump var="#threadNotificationEmail#" label="threadNotificationEmail"><br />
                    <cfdump var="#threadDateReq#" label="threadDateReq"><br />
                    <cfdump var="#threadStoreCode#" label="threadStoreCode"><br />
                    <cfdump var="#threadStoreName#" label="threadStoreName"><br />
                    <cfdump var="#threadToGoLabel#" label="threadToGoLabel"><br />
                    <cfdump var="#threadOrderTotal#" label="threadOrderTotal"><br />
                    <cfdump var="#threadDelTimeValueFront#" label="threadDelTimeValueFront"><br />
                    <cfdump var="#local.subject#" label="local.subject"><br />
                    <cfdump var="#local.body#" label="local.body"><br />
                    <cfdump var="#threadFromEmail#" label="threadFromEmail"><br />
                    <cfdump var="#threadLocalNow#" label="threadLocalNow"><br />
                    <cfdump var="#threadLocalNowInt#" label="threadLocalNowInt"><br />
                    <cfdump var="#threadDs#" label="threadDs"><br />
                    <cfdump var="#threadUsePdf#" label="threadUsePdf"><br />
                    <cfdump var="#variables.inv#" label="variables.inv"><br />
                </cfmail>
                <cfrethrow />
            </cfcatch>
        </cftry>
    </cfthread>

    <cfset variables.email_count = variables.email_count + 1>
</cfoutput>

<p></p><cfoutput>#variables.email_count# emails sent @ #local_now()#</cfoutput>

错误:

  

元素EMAIL_COUNT在VARIABLES中未定义。
  错误发生在

0 个答案:

没有答案