Modificare il file:
\Buoni-spesa-OLD\transizioni_edit.asp
<!--#include file="include/dbcommon.asp"--> <!--#include file="include/transizioni_variables.asp"--> <!--#include file="libs/smarty.asp"--> <% ' check if logged in if SESSION("UserID")="" or not CheckSecurity(SESSION("_" & strTableName & "_OwnerID"),"Edit") then SESSION("MyURL")=request.ServerVariables("SCRIPT_NAME")&"?"&request.ServerVariables("QUERY_STRING") response.Redirect "login.asp?message=expired" response.End end if Set myRequest = CreateObject("Scripting.Dictionary") Set myRequestFiles = CreateObject("Scripting.Dictionary") if ParseMultiPartForm()=true then parse=1 MaxSizeSet=false filename="" status="" message="" readevalues=false errorhappened=false set showKeys = Server.CreateObject("Scripting.Dictionary") inlineedit = false set showValues = Server.CreateObject("Scripting.Dictionary") set showRawValues = Server.CreateObject("Scripting.Dictionary") set showFields = Server.CreateObject("Scripting.Dictionary") set showDetailKeys = Server.CreateObject("Scripting.Dictionary") IsSaved = false HaveData = true if postvalue("editType")="inline" then inlineedit = true templatefile = "transizioni_inline_edit.htm" else inlineedit = false templatefile = "transizioni_edit.htm" end if ' connect database dbConnection="" db_connect() DoEvent "BeforeProcessEdit dbConnection" Set rs = server.CreateObject("ADODB.Recordset") Set rsLookup = server.CreateObject("ADODB.Recordset") set keys = CreateObject("Scripting.Dictionary") keys("N_Buono")=postvalue("editid1") ' prepare data for saving if getRequestForm("a")="edited" then sstrWhere=KeyWhere(keys,"") strSQL = "select * from " & AddTableWrappers(strOriginalTableName) & " where " & sstrWhere set evalues = CreateObject("Scripting.Dictionary") set efilename_values = CreateObject("Scripting.Dictionary") set files_delete = CreateObject("Scripting.Dictionary") set files_move = CreateObject("Scripting.Dictionary") ' processing importo - start value = postvalue("value_importo") ttype=postvalue("type_importo") toedit=true if myRequest.Exists("value_importo") or myRequest.Exists("value_importo[]") or myRequest.Exists("type_importo") then value=prepare_for_db("importo",value,ttype,"") if vartype(value)=11 then if value=false then _ toedit=false end if if toedit then evalues("importo") = value end if end if ' processibng importo - end ' processing data_emissione - start value = postvalue("value_data_emissione") ttype=postvalue("type_data_emissione") toedit=true if myRequest.Exists("value_data_emissione") or myRequest.Exists("value_data_emissione[]") or myRequest.Exists("type_data_emissione") then value=prepare_for_db("data_emissione",value,ttype,"") if vartype(value)=11 then if value=false then _ toedit=false end if if toedit then evalues("data_emissione") = value end if end if ' processibng data_emissione - end for each ekey in efilename_values if evalues.Exists(ekey) then evalues.Remove(ekey) evalues(ekey) = efilename_values.Item(ekey) next ' do event retval=true DoEvent "retval=BeforeEdit(evalues,sstrWhere,rsold,keys,message,inlineedit)" if retval then on error resume next rs.Open strSQL, dbConnection, 1,2 call report_error if IsUpdatable(rs("N_Buono")) then ' update N_Buono field strValue=false if evalues.exists("N_Buono") then _ strValue = evalues.Item("N_Buono") if not errorhappened and not (vartype(strValue)=11 and strValue=False) then if isnull(strValue) then strValue="" ctype = GetRequestForm("type_N_Buono") if strValue<>"" and IsNumeric(strValue) then rs("N_Buono") = CLng(strValue) else rs("N_Buono") = null end if call report_error end if end if ' update importo field strValue=false if evalues.exists("importo") then _ strValue = evalues.Item("importo") if not errorhappened and not (vartype(strValue)=11 and strValue=False) then if isnull(strValue) then strValue="" ctype = GetRequestForm("type_importo") if strValue<>"" then rs("importo") = CSmartDbl(strValue) else rs("importo") = null end if call report_error end if ' update data_emissione field strValue=false if evalues.exists("data_emissione") then _ strValue = evalues.Item("data_emissione") if not errorhappened and not (vartype(strValue)=11 and strValue=False) then if isnull(strValue) then strValue="" ctype = GetRequestForm("type_data_emissione") if strValue="" then rs("data_emissione")=null else rs("data_emissione")=strValue end if call report_error end if if not errorhappened then rs.Update call report_error end if rs.Close ' delete & move files on error goto 0 if not errorhappened then Set fso = CreateObject("Scripting.FileSystemObject") for each file in files_delete if fso.FileExists(file) then fso.DeleteFile(file) next for each file in files_move if fso.FileExists(file) then fso.MoveFile file(0),file(1) next Set fso=nothing if inlineedit then status="UPDATED" message="" & "Recordo aggiornato" & "" IsSaved = true else message="<div class=message><<< " & "Recordo aggiornato" & " >>></div>" end if ' after edit event DoEvent "AfterEdit evalues,rsold,keys,inlineedit" end if else readevalues=true end if end if ' get current values and show edit controls strWhereClause=KeyWhere(keys,"") strSQL = gSQLWhereAdd(strWhereClause) strSQLbak = strSQL DoEvent "BeforeQueryEdit strSQL,strWhereClause" if strSQLbak = strSQL then strSQL = gSQLWhereAdd(strWhereClause) end if LogInfo(strSQL) Set rs = nothing Set rs = server.CreateObject("ADODB.Recordset") rs.Open strSQL,dbConnection,1,2 if rs.EOF then response.redirect "transizioni_list.asp?a=return" response.end end if if not inlineedit then ' include files includes="" ' validation stuff bodyonload="" onsubmit="" includes=includes & "<script language=""JavaScript"" src=""include/validate.js""></script>" includes=includes & "<script language=""JavaScript"">" includes=includes & "var TEXT_FIELDS_REQUIRED='" & addslashes("I seguenti campi sono richiesti") & "';" includes=includes & "var TEXT_FIELDS_ZIPCODES='" & addslashes("") & "';" includes=includes & "var TEXT_FIELDS_EMAILS='" & addslashes("I seguenti campi devono essere email valide") & "';" includes=includes & "var TEXT_FIELDS_NUMBERS='" & addslashes("I seguenti campi devono essere numeri") & "';" includes=includes & "var TEXT_FIELDS_CURRENCY='" & addslashes("I seguenti campi devono essere valuta") & "';" includes=includes & "var TEXT_FIELDS_PHONE='" & addslashes("I seguenti campi devono essere numeri telefonici") & "';" includes=includes & "var TEXT_FIELDS_PASSWORD1='" & addslashes("I campi seguenti devono essere una password corretta") & "';" includes=includes & "var TEXT_FIELDS_PASSWORD2='" & addslashes("lunga almeno 4 caratteri ") & "';" includes=includes & "var TEXT_FIELDS_PASSWORD3='" & addslashes("Non puo essere una password") & "';" includes=includes & "var TEXT_FIELDS_STATE='" & addslashes("I seguenti campi devono essere nome di stato") & "';" includes=includes & "var TEXT_FIELDS_SSN='" & addslashes("") & "';" includes=includes & "var TEXT_FIELDS_DATE='" & addslashes("I seguenti campi devono essere date corrette") & "';" includes=includes & "var TEXT_FIELDS_TIME='" & addslashes("I seguenti campi devono essere nel formato 24 ore per essere validi") & "';" includes=includes & "var TEXT_FIELDS_CC='" & addslashes("I seguenti campi devono essere un valido numero di Carta di Credito") & "';" includes=includes & "var TEXT_FIELDS_SSN='" & addslashes("") & "';" includes=includes & "</script>" validatetype="IsNumeric" if validatetype<>"" then bodyonload=bodyonload & "define('value_importo','" & validatetype & "','importo');" validatetype="" validatetype=validatetype & "IsRequired" if validatetype<>"" then bodyonload=bodyonload & "define('value_data_emissione','" & validatetype & "','data_emissione');" if bodyonload<>"" then onsubmit="return validate();" bodyonload="onload="""& bodyonload & """" end if if useAJAX then includes=includes & "<script language=""JavaScript"" src=""include/jquery.js""></script>" includes=includes & "<script language=""JavaScript"" src=""include/ajaxsuggest.js""></script>" end if includes=includes & "<script language=""JavaScript"" src=""include/jsfunctions.js""></script>" includes=includes & "<script language=""JavaScript"">" & _ "var locale_dateformat = " & locale_info("LOCALE_IDATE") & ";" & _ "var locale_datedelimiter = """ & locale_info("LOCALE_SDATE") & """;" & _ "var bLoading=false;" & _ "var TEXT_PLEASE_SELECT='" & addslashes("Prego seleziona") & "';" if useAJAX then includes=includes & "var AUTOCOMPLETE_TABLE='transizioni_autocomplete.asp';" & vbcrlf includes=includes & "var SUGGEST_TABLE='transizioni_searchsuggest.asp';" & vbcrlf includes=includes & "var SUGGEST_LOOKUP_TABLE='transizioni_lookupsuggest.asp';" & vbcrlf end if includes=includes & "</script>" & vbcrlf if useAJAX then includes=includes & "<div id=""search_suggest""></div>" & vbcrlf end if ' include datepicker files includes=includes & "<script language=""JavaScript"" src=""include/calendar.js""></script>" smarty.Add "includes",includes smarty.Add "bodyonload",bodyonload if len(onsubmit)>0 then onsubmit="onSubmit=""" & onsubmit & """" smarty.Add "onsubmit",onsubmit end if smarty.Add "key1",my_htmlspecialchars(keys("N_Buono")) showKeys.Add "show_key1",server.urlencode(keys("N_Buono")) smarty.Add "show_key1", my_htmlspecialchars(GetData(rs,"N_Buono", "")) smarty.Add "message",message set readonlyfields = CreateObject("Scripting.Dictionary") 'smarty.Add "value_importo",dbvalue(rs("importo")) if readevalues then smarty.Add "value_importo",evalues("importo") else smarty.Add "value_importo",dbvalue(rs("importo")) end if 'smarty.Add "value_data_emissione",dbvalue(rs("data_emissione")) if readevalues then smarty.Add "value_data_emissione",evalues("data_emissione") else smarty.Add "value_data_emissione",dbvalue(rs("data_emissione")) end if linkdata="" if useAJAX then record_id = postvalue("recordID") if inlineedit then if postvalue("browser")="ie" then smarty.Add "browserie",true end if smarty.Add "id",record_id linkdata = replace(linkdata,"&","&") linkdata = replace(linkdata,"<","<") linkdata = replace(linkdata,">",">") else linkdata = "<script type=""text/javascript"">" & vbCrLf _ & "$(document).ready(function(){" & vbCrLf _ & linkdata & "});</script>" end if else end if smarty.Add "linkdata",linkdata where=sstrWhere if getRequestForm("a")="edited" and inlineedit then if rs.EOF then set rs=evalues HaveData = false end if 'Preparation view values ' detail tables keylink="" keylink=keylink & "&key1=" & my_htmlspecialchars(server.urlencode(dbvalue(rs("N_Buono")))) Set fso = CreateObject("Scripting.FileSystemObject") '//////////////////////////////////////////// ' N_Buono - value="" if len(rs("N_Buono"))<>"" then strdata = make_db_value("N_Buono",rs("N_Buono"),"","") LookupSQL="SELECT " LookupSQL=LookupSQL & "[N_Buono]" LookupSQL=LookupSQL & " FROM [buono] WHERE [N_Buono] = " & strdata LogInfo(LookupSQL) rsLookup.Open LookupSQL,dbConnection lookupvalue=rs("N_Buono") if not rsLookup.eof then _ lookupvalue=rsLookup(0) value=ProcessLargeText(GetDataInt(lookupvalue,rs,"N_Buono", ""),"field=N%5FBuono" & keylink,"",MODE_LIST) rsLookup.Close else value="" end if showValues.Add "showValue1",value showFields.Add "showField1","N_Buono" showRawValues.Add "showRawValues1","" '//////////////////////////////////////////// ' importo - Number value="" value = ProcessLargeText(GetData(rs,"importo", "Number"),"","",MODE_LIST) showValues.Add "showValue2",value showFields.Add "showField2","importo" showRawValues.Add "showRawValues2","" '//////////////////////////////////////////// ' data_emissione - Short Date value="" value = ProcessLargeText(GetData(rs,"data_emissione", "Short Date"),"","",MODE_LIST) showValues.Add "showValue3",value showFields.Add "showField3","data_emissione" showRawValues.Add "showRawValues3","" end if if getRequestForm("a")="edited" and inlineedit then response.write "<textarea id=""data"">" if IsSaved and showValues.Count > 0 then if HaveData then response.write "saved" else response.write "savnd" end if print_inline_array showKeys.Items response.write vblf print_inline_array showValues.Items response.write vblf print_inline_array showFields.Items response.write vblf print_inline_array showRawValues.Items response.write vblf print_inline_array showDetailKeys.Keys response.write vblf print_inline_array showDetailKeys.Items else response.write "error" tmpVal = message tmpVal = replace(tmpVal,"&","&") tmpVal = replace(tmpVal,"<","<") tmpVal = replace(tmpVal,"\","\\") tmpVal = replace(tmpVal,vbcr,"\r") tmpVal = replace(tmpVal,vblf,"\n") response.write tmpVal end if response.write "</textarea>" else DoEvent "BeforeShowEdit smarty,templatefile" smarty_display(templatefile) end if sub report_error if Err.number<>0 then if inlineedit then message ="" & "Il record non è stato modificato" & ". " & Err.Description else message = "<div class=message><<< " & "Il record non è stato modificato" & " >>><br><br>" & Err.Description & "</div>" end if readevalues=true errorhappened=true err.clear end if end sub %>
[
Íàçàä
]