%option explicit%> <% shopcheckadmin "shopa_displayorders.asp" setsess "currenturl","shopa_rma.asp" '************************************************ ' VP-ASP 6.50 ' Form RMA ' Allow merchant to change status, email customer ' input rmaid=xx ' Nov 23, 2006 HK Created ' Dec 6, 2006 Remove arrayemailist '************************************************ Dim sAction, oid, myconn dim my_to, my_toaddress,my_system,my_from,my_fromaddress,my_subject,mailtype dim mailer, my_attachment dim body dim rmaid, rmars dim trackingemail, trackingname, trackingcomment, trackingtemplate dim trackingview dim merchantactions(50), statuslist, actioncount 'VP-ASP 6.50 - removed and put into shopmail.asp 'dim arrayemaillinkscount 'dim arrayemaillinks(50,2) dim currentvalues(10), currentvaluecount dim rc, actionvalue, rmatemplate dim updateflag rmaid=request("rmaid") if rmaid > "" then if not isnumeric(rmaid) then shoperror "rmaid must be numeric" end if else shoperror "RMA not found" end if Openorderdb myconn GetRMARecordset myconn, rmaid, rmars, rc ' GET RMA Details in shoprmasuubs If rc>0 then shopclosedatabase myconn shoperror "RMA not found" else Setuprmavalues rmars 'in shoprmasubs oid=rmaorderid end if sAction=Request("Action") Serror="" adminPageHeader statuslist=getconfig("xrmamerchantactions") If statuslist="" then actioncount=0 else parserecord statuslist,merchantactions,actioncount,"," end if If sAction = "" Then DisplayForm() Else ValidateData() if sError = "" Then PerformRequiredActions Showrmadetails else DisplayForm end if end if ShopCloseDatabase myconn gethelp adminpagetrailer ' Sub DisplayForm() generatedisplayheader getlang("langrma") & " Merchant response" Generatedisplaybodyheader if sError > "" then shopwriteerror "
| " DisplayRmAActions Response.write " | " & vbcrlf response.write "" DisplayRmaTextboxes Response.write " |
| " & "Merchant Action" & vbcrlf response.write " | " GenerateSelectNV merchantactions,rmamerchantaction,"rmamerchantaction", actioncount, Getlang("langcommonselect") Response.write " |
| " & "Merchant Response" & " | " & vbcrlf response.write "|
| " & "Private Notes" & " | " & vbcrlf response.write "
<%=getlang("langcommoncontinue")%>
<% end sub ' Sub SendTrackingEmail If trackingemail<>"Yes" Then exit sub ShopTrackingEmailToCustomer myconn, oid, trackingname end sub ' Sub UpdateTrackingRecord dim sql trackingview=1 trackingname=replace(rmamerchantname,"'","''") trackingcomment=replace(rmamerchantcomment,"'","''") sql="insert into ordertracking (orderid, trackdate, tracktime, trackcomment, trackname, trackview,trackemail) values (" sql= sql & oid & "," & datedelimit(date()) sql= sql & "," & timedelimit(time()) sql = sql & "," & "'" & trackingcomment & "'" sql = sql & "," & "'" & trackingname & "'" sql = sql & "," & trackingview sql = sql & "," & "'" & rmamerchantemail & "'" sql=sql & ")" 'debugwrite sql myconn.execute(sql) end sub Sub PerformRequiredActions dim actions(10),actioncount, i, action dim certificate parserecord actionvalue, actions, actioncount,"," RmaUpdateMerchant ' update record based on form values For i=0 to actioncount-1 action=lcase(actions(i)) select case action case "email" RMAEmailToCustomerFromMerchant myconn, rmaid case "gift" RmaCreategiftcertificate myconn, rmaid, certificate ' in shoprmasubs.asp RMAMailGiftCertificate certificate ' in shoprmasubs shopwriteheader "Gift Certificate created and mailed" case "update" Shopwriteheader "Record updated" case "track" UpdateTrackingRecord shopwriteheader "Tracking record created" case else response.write "unknown action " & action end select next end sub '**************************************************************************** ' create rma record and insert it into database ' first put fields into database ' then use the rmaid to generate the ramid to make it unique ' update the created record with the actual rma '**************************************************************************** Sub RMAUpdateMerchant dim fieldnames, fieldvalues, rs dim sql fieldnames="" Updatefieldnum fieldnames, "rmamerchantdate",datedelimit(date) updatefieldtext fieldnames, "rmamerchantname",rmamerchantname updatefieldtext fieldnames, "rmamerchantemail",rmamerchantemail updatefieldtext fieldnames, "rmamerchantaction",rmamerchantaction updatefieldtext fieldnames, "rmamerchantcomment",rmamerchantcomment updatefieldtext fieldnames, "rmamerchantnotes",rmamerchantnotes updatefieldnum fieldnames, "rmarefundamount",rmarefundamount sql="Update shoprma set " & fieldnames sql=sql & " where rmaid=" & rmaid 'debugwrite sql myconn.execute(sql) end sub Sub UpdateFieldnum (fieldnames, fieldname, fieldvalue) dim tempvalue tempvalue=fieldvalue if fieldvalue="" then tempvalue="NULL" end if if fieldnames<>"" then fieldnames=fieldnames & "," end if fieldnames=fieldnames & fieldname & "=" fieldnames=fieldnames & tempvalue end sub Sub Updatefieldtext (fieldnames, fieldname, fieldvalue) dim tempvalue tempvalue=fieldvalue if fieldnames<>"" then fieldnames=fieldnames & "," end if ' if fieldvalue="" then tempvalue="NULL" fieldnames=fieldnames & fieldname & "=" & tempvalue exit sub else tempvalue=replace(tempvalue,"'","''") end if fieldnames=fieldnames & fieldname & "=" fieldnames=fieldnames & "'" & tempvalue & "'" end sub Sub GenerateLinks %>![]() RMA List |
<%=getlang("langcommonedit")%> |
<%If getconfig("xtracking")="Yes" then%>
<%=getlang("langTracking")%> |
<%end if%>