Modificare il file:
\Buoni-spesa-OLD\titolare_add.asp
<!--#include file="include/dbcommon.asp"--> <!--#include file="include/titolare_variables.asp"--> <!--#include file="libs/smarty.asp"--> <% Set myRequest = CreateObject("Scripting.Dictionary") Set myRequestFiles = CreateObject("Scripting.Dictionary") if ParseMultiPartForm()=true then parse=1 MaxSizeSet=false '// check if logged in if SESSION("UserID")="" or not CheckSecurity(SESSION("_" & strTableName & "_OwnerID"),"Add") then SESSION("MyURL")=request.ServerVariables("SCRIPT_NAME")&"?"&request.ServerVariables("QUERY_STRING") response.Redirect "login.asp?message=expired" response.End end if filename="" status="" message="" readavalues=false errorhappened=false set showKeys = Server.CreateObject("Scripting.Dictionary") inlineedit = false templatefile = "titolare_add.htm" '//connect database dbConnection="" db_connect() DoEvent "BeforeProcessAdd dbConnection" Set rs = server.CreateObject("ADODB.Recordset") Set rsLookup = server.CreateObject("ADODB.Recordset") '// insert new record if we have to if getRequestForm("a")="added" then set afilename_values = CreateObject("Scripting.Dictionary") set avalues = CreateObject("Scripting.Dictionary") set files_move = CreateObject("Scripting.Dictionary") dim toadd dim thumb '// processing titolare - start value = postvalue("value_titolare") ttype=postvalue("type_titolare") toadd=true if myRequest.Exists("value_titolare") or myRequest.Exists("value_titolare[]") or myRequest.Exists("type_titolare") then value=prepare_for_db("titolare",value,ttype,"") if vartype(value)=11 then if value=false then toadd=false end if if toadd then avalues("titolare")=value end if end if ' processibng titolare - end '// add filenames to values for each akey in afilename_values avalues(akey)=afilename_values(akey) next '// before Add event retval = true DoEvent "retval = BeforeAdd(avalues,message,inlineedit)" if retval then on error resume next rs.Open "select * from " & AddTableWrappers(strOriginalTableName) & " where 1=0", dbConnection, 1,2 rs.Addnew call report_error if IsUpdatable(rs("titolare")) then ' insert titolare field strValue=false if avalues.exists("titolare") then _ strValue = avalues.Item("titolare") if not errorhappened and not (vartype(strValue)=11 and strValue=False) then if isnull(strValue) then strValue="" ctype = GetRequestForm("type_titolare") rs("titolare") = strValue call report_error end if end if if not errorhappened then rs.Update call report_error end if on error goto 0 if not errorhappened then message="<div class=message><<< " & "Il Record e stato aggiunto" & " >>></div>" ' get new key values rs.Close ' after add event DoEvent "AfterAdd avalues,keys,inlineedit" end if else readavalues=true end if end if set defvalues = CreateObject("Scripting.Dictionary") set copykeys = CreateObject("Scripting.Dictionary") copykeys("titolare")=postvalue("copyid1") '// copy record if getRequestForm("copyid1")<>"" then sstrWhere=KeyWhere(copykeys,"") strSQL = gSQLWhereAdd(sstrWhere) LogInfo(strSQL) rs.open strSQL,dbConnection, 1, 2 if not rs.EOF then defvalues("titolare")=dbvalue(rs("titolare")) end if '// clear key fields defvalues("titolare")="" '//call CopyOnLoad event DoEvent "Call CopyOnLoad(defvalues,sstrWhere)" else end if ' save previously enterd values if readavalues then if avalues.exists("titolare") then defvalues("titolare")= avalues("titolare") end if end if for each key in defvalues smarty.Add "value_" & GoodFieldName(key),defvalues(key) next '// include files includes="" '// validation stuff bodyonload="" onsubmit="" if bodyonload<>"" then onsubmit="return validate();" bodyonload="onload=""" & bodyonload & """" end if if useAJAX then includes=includes & "<script language=""JavaScript"" src=""include/jquery.js""></script>" & vbcrlf includes=includes & "<script language=""JavaScript"" src=""include/ajaxsuggest.js""></script>" & vbcrlf end if includes=includes & "<script language=""JavaScript"" src=""include/jsfunctions.js""></script> " & vbcrlf includes=includes & "<script language=""JavaScript""> " & vbcrlf includes=includes & "var locale_dateformat = " & locale_info("LOCALE_IDATE") & "; " & vbcrlf includes=includes & "var locale_datedelimiter = """ & locale_info("LOCALE_SDATE") & """; " & vbcrlf includes=includes & "var bLoading=false; " & vbcrlf includes=includes & "var TEXT_PLEASE_SELECT='" & addslashes("Prego seleziona") & "'; " & vbcrlf if useAJAX then includes=includes & "var AUTOCOMPLETE_TABLE='titolare_autocomplete.asp';" & vbcrlf includes=includes & "var SUGGEST_TABLE='titolare_searchsuggest.asp';" & vbcrlf includes=includes & "var SUGGEST_LOOKUP_TABLE='titolare_lookupsuggest.asp';" & vbcrlf end if includes=includes & "</script> " & vbcrlf if useAJAX then includes=includes & "<div id=""search_suggest""></div>" & vbcrlf end if smarty.Add "includes",includes smarty.Add "bodyonload",bodyonload if len(onsubmit)>0 then onsubmit="onSubmit=""" & onsubmit & """" smarty.Add "onsubmit",onsubmit smarty.Add "message",message smarty.Add "status",status set readonlyfields = CreateObject("Scripting.Dictionary") '// show readonly fields linkdata="" if useAJAX then record_id = postvalue("recordID") linkdata = "<script type=""text/javascript"">" & vbCrLf _ & "$(document).ready(function(){" & vbCrLf _ & linkdata & "});</script>" else end if smarty.Add "linkdata",linkdata DoEvent "BeforeShowAdd smarty,templatefile" smarty_display(templatefile) function report_error if Err.number<>0 then message = "<div class=message><<< " & "Il record non è stato aggiunto" & " >>><br><br>" & Err.Description & "</div>" readavalues=true errorhappened=true err.clear end if end function %>
[
Íàçàä
]