From 601381c7ba468613af30454f705c8e481226f3c0 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Wed, 28 Oct 2026 14:49:07 +0900 Subject: [PATCH] =?UTF-8?q?261028=5F02=5FENH:=20=EC=83=88=EB=A1=9C?= =?UTF-8?q?=EC=9A=B4=20=EC=B9=B4=ED=8A=B8=20=EC=97=B0=EA=B2=B0=ED=95=98?= =?UTF-8?q?=EB=A9=B4=EC=84=9C=20=EA=B5=AC=EB=B2=84=EC=A0=84=20kfunc=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=98=A4=EB=A5=98=20=EC=9E=A1=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectTemplate/include/Header.asp | 5 +- include/ajax_crud.asp | 206 +++++++++++++++-------------- module/survey.js | 70 ++++++---- 3 files changed, 154 insertions(+), 127 deletions(-) diff --git a/ProjectTemplate/include/Header.asp b/ProjectTemplate/include/Header.asp index 7952979..290d2e3 100644 --- a/ProjectTemplate/include/Header.asp +++ b/ProjectTemplate/include/Header.asp @@ -16,7 +16,7 @@ - + @@ -41,6 +41,9 @@ + + + <% '//--- 프로젝트 정보 호출 diff --git a/include/ajax_crud.asp b/include/ajax_crud.asp index ad49ed4..23f2c55 100644 --- a/include/ajax_crud.asp +++ b/include/ajax_crud.asp @@ -41,7 +41,7 @@ Dim allRaw : allRaw = Request.ServerVariables("ALL_RAW") ' 원본 헤더 Dim requestBody : requestBody = ReadRequestBodySafe() Dim remoteIpAddr : remoteIpAddr = Request.ServerVariables("REMOTE_ADDR") - + requestUrl = Replace(requestUrl, "'", "''") qs = Replace(qs, "'", "''") allRaw = Replace(allRaw, "'", "''") @@ -109,8 +109,18 @@ END IF '-- 20251029 박준성 당분간 모든 요청에 대해서 서버에 로그를 쌓기' + On Error Resume Next + + Err.Clear CALL INSERT_REQUEST_LOG(IsReject) + If Err.Number <> 0 Then + Response.AppendToLog " LogInsertError=" & CStr(Err.Number) + Err.Clear + End If + + On Error GoTo 0 + If IsReject = "1" Then Response.Status = "401 Unauthorized" Response.AddHeader "Cache-Control", "no-store" @@ -122,14 +132,14 @@ SELECT CASE CRUD '-- CREATE ' - CASE "CREATE" + CASE "CREATE" SELECT CASE COMMAND - + END SELECT '-- SELECT ' - CASE "SELECT" + CASE "SELECT" SELECT CASE COMMAND - + CASE "INTRANETPROJECT" '-- project2 dbo 프로젝트 선택' response.ContentType = "application/json" Call DBConnect1() @@ -138,7 +148,7 @@ IF REQUEST("NAME") <> "" THEN SQL = SQL & " or p_subject like '%"& request("NAME") &"%' " SQL = SQL & " group by p_sn,p_subject " Rcset.Open SQL,DBConn,3,1,1 - + IF Rcset.eof or Rcset.bof THEN response.write "{}" ELSE @@ -146,15 +156,15 @@ END IF response.end CASE "SETPROJECTCODE" '-- 프로젝트 코드 A ~ ZZ까지 부여' - + response.ContentType = "text/plain" SQL = " select top 1 PKEY from PROJECT where LEFT(PKEY,7) = '"& PKEY &"' order by id desc " - + Rcset.Open SQL,DBConn,3,1,1 IF Rcset.eof or Rcset.bof THEN response.write PKEY &"_"&"A" ELSE - Dim LASTCODE + Dim LASTCODE LASTCODE = Split(Rcset("PKEY"),"_")(1) IF LEN(LASTCODE) = 1 THEN IF ASC(LASTCODE) = 90 THEN @@ -165,7 +175,7 @@ ELSE DIM LEFTC : LEFTC = LEFT(LASTCODE,1) DIM RIGHTC : RIGHTC = RIGHT(LASTCODE,1) - IF ASC(RIGHTC) < 90 THEN + IF ASC(RIGHTC) < 90 THEN response.write PKEY &"_"& LEFTC & CHR(ASC(RIGHTC) + 1) ELSE response.write PKEY &"_"& CHR(ASC(LEFTC) + 1) & "A" @@ -188,26 +198,26 @@ SQL = " select * from ( " SQL = SQL & " select [key],JSON_VALUE([value],'$.stype') as [type], ISNULL(JSON_QUERY([value],'$.option'),'""""') as opt from OPENJSON((select OPTIONJSON from kon.dbo.QOPTION WHERE PKEY='"& PKEY &"' and OTYPE ='qgroup' )) where [key] in ( "& request("list") &" ) " SQL = SQL & " ) a FOR JSON AUTO " - + Rcset.Open SQL,DBConn,3,1,1 IF Rcset.eof or Rcset.bof THEN response.write "[]" ELSE - while not Rcset.eof + while not Rcset.eof response.write Rcset(0) Rcset.movenext - wend + wend END IF - + Response.end CASE "QUESTION_LANGUAGE_FORM" ' response.ContentType = "application/json" SQL = " select QID,JSON_VALUE(QUESTIONJSON,'$.variable') as variable,JSON_QUERY(QUESTIONJSON ,'$.dataset') as dataset,JSON_VALUE(QUESTIONJSON,'$.title') as title, JSON_VALUE(QUESTIONJSON,'$.description') as description,JSON_QUERY(QUESTIONJSON,'$.datagroup') as datagroup from QUESTION where PKEY = '"& PKEY &"' order by Qorder FOR JSON AUTO " Rcset.Open SQL,DBConn,3,1,1 - while not Rcset.eof + while not Rcset.eof response.write Rcset(0) Rcset.movenext - wend + wend Response.end CASE "MYUN_PROJECT_DATA" '--면접원 프로젝트 진행 목록 가져오기' @@ -337,7 +347,7 @@ SQL = SQL & " FROM Kon.dbo.[DATA] DT" & vbcrlf SQL = SQL & " WHERE PKEY = '" & PKEY & "' AND DT.IDKEY = DA.IDKEY" & vbcrlf SQL = SQL & " AND DT.Status = '10' AND DT.SURVEY_TYPE = 'CAPI'" & vbcrlf - SQL = SQL & " ), '') AS QUOTA_VALUE" + SQL = SQL & " ), '') AS QUOTA_VALUE" ELSEIF PKEY = "2504037_D" THEN SQL = SQL & " ,ISNULL((" & vbcrlf SQL = SQL & " SELECT TOP 1" & vbcrlf @@ -445,7 +455,7 @@ ELSE SQL = SQL & " ,ISNULL(STRING_AGG(JSON_VALUE(QS.[VALUE], '$.label'), ' / ') WITHIN GROUP (ORDER BY QORDER), '') AS QUOTA_VALUE" END IF - + SQL = SQL & " from [DATA] DA WITH(NOLOCK) " SQL = SQL & " cross apply openjson(DA.DATJSON) DJ " SQL = SQL & " cross apply openjson(DJ.[VALUE]) DV " @@ -492,10 +502,10 @@ IF Rcset.eof or Rcset.bof THEN response.write "[]" ELSE - while not Rcset.eof + while not Rcset.eof response.write Rcset(0) Rcset.movenext - wend + wend END IF Response.end @@ -510,28 +520,28 @@ SQL = SQL + ", JSON_VALUE(PROJECTJSON,'$.must.companytype') as companytype " SQL = SQL + ", GKEY " SQL = SQL + ", MKEY " - SQL = SQL + ", convert(varchar(10),create_date,120) c_date " + SQL = SQL + ", convert(varchar(10),create_date,120) c_date " SQL = SQL + ", isnull((select top 1 concat(p_name,' ',left(p_rank_name,5)) from [No.6].project2.dbo.V_PERSON WITH(NOLOCK) where p_resign = 0 and p_user_mail = mkey),'_') p_name " SQL = SQL + " from PROJECT " 'SQL = SQL + " WHERE 1=1 " '20221115 박준성 수정 삭제 되지 않은 프로젝트만 가져오기 SQL = SQL + " WHERE 1=1 AND IS_DELETE = 0" IF LEFT(request("teamname"),1) = "R" THEN - 'SQL = SQL & " AND GKEY = '"&request("teamname") &"' " + 'SQL = SQL & " AND GKEY = '"&request("teamname") &"' " '//-- 2021-01-21 hwkim 타부서에서 열람가능해야하는 직원 이메일 추가 SQL = SQL & " AND ( GKEY = '"&request("teamname") &"' OR pkey IN ( SELECT PKEY FROM PROJECT_EXTERNAL pe WHERE MKEY = '"& session("name") &"' ) ) " END IF ''' 내부 조사 보안용 2023-02-17 박준성 - IF session("name") <> "jspark@kric.com" AND session("name") <> "jelee@kric.com" AND session("name") <> "yjjeon@kric.com" THEN + IF session("name") <> "jspark@kric.com" AND session("name") <> "choins@kric.com" AND session("name") <> "joohee@kric.com" THEN SQL = SQL & " AND GKEY <> 'M101' " END IF - ''' 내부 조사 보안용 2023-02-17 박준성 + ''' 내부 조사 보안용 2023-02-17 박준성 ''' 개발 그룹 프로젝트는 DCO에만 오픈 2023-05-15 박준성 IF SESSION("team") <> "S301" AND SESSION("team") <> "S401" AND SESSION("team") <> "S501" AND session("name") <> "jwseo@kric.com" then SQL = SQL & " AND GKEY <> 'S401' " END IF - ''' 개발 그룹 프로젝트는 DCO에만 오픈 2023-05-15 박준성 + ''' 개발 그룹 프로젝트는 DCO에만 오픈 2023-05-15 박준성 SQL = SQL & "order by id desc FOR JSON AUTO " @@ -551,10 +561,10 @@ response.ContentType = "application/json" SQL = " select GKEY,JSON_QUERY(PROJECTJSON,'$.must') as JSON from PROJECT where PKEY = '"&PKEY&"' FOR JSON AUTO " Rcset.Open SQL,DBConn,3,1,1 - while not Rcset.eof + while not Rcset.eof response.write Rcset(0) Rcset.movenext - wend + wend response.end CASE "QUESTIONLIST" '--문항 리스트' response.ContentType = "application/json" @@ -563,12 +573,12 @@ IF Rcset.eof or Rcset.bof THEN response.write "[]" ELSE - while not Rcset.eof + while not Rcset.eof response.write Rcset(0) Rcset.movenext - wend + wend END IF - Response.end + Response.end CASE "GROUP" '-- 그룹 정보 response.ContentType = "application/json" SQL = " select QID,JSON_QUERY(QUESTIONJSON) as qx, CASE WHEN LOGICJSON <> '' THEN JSON_QUERY(LOGICJSON) ELSE '' END as jx, Qorder from kon.dbo.QUESTION where PKEY = '"&PKEY&"' and JSON_VALUE(QUESTIONJSON,'$.qgroup') = '"&REQUEST("GROUP")&"' order by Qorder FOR JSON AUTO " @@ -576,14 +586,14 @@ IF Rcset.eof or Rcset.bof THEN response.write "[]" ELSE - while not Rcset.eof + while not Rcset.eof response.write Rcset(0) Rcset.movenext - wend + wend END IF - Response.end + Response.end CASE "GROUPLIST" - + response.ContentType = "application/json" SQL = " select OPTIONJSON from QOPTION where PKEY = '"&PKEY&"' and OTYPE = 'qgroup' " Rcset.Open SQL,DBConn,3,1,1 @@ -592,9 +602,9 @@ ELSE Response.Write Rcset("OPTIONJSON") END IF - - Response.end - + + Response.end + CASE "OPTIONSELECTED" '-- 문항택된 문항들만' response.ContentType = "application/json" SQL = " select QID," @@ -609,13 +619,13 @@ IF Rcset.eof or Rcset.bof THEN response.write "[]" ELSE - while not Rcset.eof + while not Rcset.eof response.write Rcset(0) Rcset.movenext - wend + wend END IF - - Response.end + + Response.end CASE "QUESTION" '--문항 정보' response.ContentType = "application/json" SQL = " select JSON_QUERY(QUESTIONJSON,'$') as JSON from QUESTION where PKEY = '"&PKEY&"' and QID = '"&QID&"' " @@ -639,17 +649,17 @@ SQL = SQL & " JSON_QUERY(QUESTIONJSON,'$.dataset') as dataset " &vbcrlf SQL = SQL & " from kon.dbo.QUESTION WHERE PKEY = '"&PKEY&"' order by Qorder FOR JSON AUTO " &vbcrlf Rcset.Open SQL,DBConn,3,1,1 - while not Rcset.eof + while not Rcset.eof response.write Rcset(0) Rcset.movenext - wend - + wend + response.end - + CASE "LOGININFO" '--로그인 정보 project2 dbo ' response.ContentType = "application/json" - Call DBConnect1() + Call DBConnect1() SQL = " select p_user_mail,p_pass_new,p_depart_now + p_team_now as team from project2.dbo.V_PERSON where p_resign = '0' and p_pass_new is not null " SQL = SQL & " and p_user_mail = '"&request("id")&"' and p_pass_new = '"&request("pw")&"' " @@ -668,14 +678,14 @@ response.end CASE "COMPANYGROUPLIST" '--그룹 정보 project2 dbo ' response.ContentType = "application/json" - Call DBConnect1() + Call DBConnect1() SQL = " select T_Name as label,Code as value from project2.dbo.v_Department WHERE LEFT(CODE,1) in ('R','S','M','T') order by Code " Rcset.Open SQL,DBConn,3,1,1 - + 'SQL = " select 'DCO_DS' as label, 'S401' as value " 'SQL = " SELECT DISTINCT p_team_name as label, p_team as value FROM Kon.dbo.KON_USER with(nolock) " 'Rcset.Open SQL,DBConn,3,1,1 - + response.write RecordToJson(Rcset) response.end @@ -691,7 +701,7 @@ ELSE response.write Rcset(0) END IF - response.end + response.end CASE "LOGIC" '-- 로직 정보 ' SQL = " select CASE WHEN LOGICJSON = '' THEN '' ELSE JSON_QUERY( LOGICJSON,'$') END as JSON from QUESTION where QID = '"&QID&"' and PKEY = '"&PKEY&"' " Rcset.Open SQL,DBConn,3,1,1 @@ -702,10 +712,10 @@ response.ContentType = "text/plain" response.write "" END IF - response.end + response.end CASE "TOTALDATA" '-- 총 부수 SQL = " SELECT COUNT(*) as cnt FROM [DATA] where PKEY = '"& PKEY &"' AND Status='10' and SURVEY_TYPE <> 'TEST' " - + Rcset.Open SQL,DBConn,3,1,1 IF Rcset.eof or Rcset.bof THEN response.write "0" @@ -715,7 +725,7 @@ response.end CASE "DATA" - + response.ContentType = "application/json" Response.Buffer = true '--버퍼 사용' Dim buffer_cnt : buffer_cnt = 0 @@ -763,9 +773,9 @@ SQL = SQL & " ) a FOR JSON AUTO " & vbcrlf ' -- response.write sql - + Rcset.Open SQL,DBConn,3,1,1 - + IF Rcset.eof or Rcset.bof THEN response.write "[]" ELSE @@ -776,7 +786,7 @@ Response.flush END IF buffer_cnt = buffer_cnt + 1 - Rcset.movenext : wend + Rcset.movenext : wend END IF response.end CASE "DATA_BASE" '-- 기본 데이터 셋 구하기' @@ -785,19 +795,19 @@ PKEY = "DIN_GANG" ' ELSEIF Request("QC") = "Y" THEN ' PKEY = "DCOQR2" - END IF - + END IF + SQL = " select [key] as qid ,variable,REPLACE(SUBSTRING([value],2,LEN([value])-2),'""','') as [value] from OPENJSON((SELECT TOP(1) QINFO fROM [STRUCTURE] where PKEY = '" & PKEY & "' order by create_date desc)) A CROSS APPLY( " SQL = SQL & " SELECT QORDER,JSON_VALUE(QUESTIONJSON,'$.variable') as variable FROM QUESTION B WHERE PKEY = '"& PKEY &"' and A.[key] collate Korean_Wansung_CI_AS = B.QID " SQL = SQL & " ) C where [value] <> '[]' ORDER BY QORDER FOR JSON AUTO" - + Rcset.Open SQL,DBConn,3,1,1 IF Rcset.eof or Rcset.bof THEN response.write "[]" ELSE While not Rcset.eof response.write Rcset(0) - Rcset.movenext : wend + Rcset.movenext : wend END IF response.end @@ -810,7 +820,7 @@ ELSE response.write Rcset("addColumn") END IF - response.end + response.end CASE "ATTENDEE" '-- GANG 참석자 정보 가져오기' response.ContentType = "application/json" @@ -822,7 +832,7 @@ ELSE While not Rcset.eof response.write Rcset(0) - Rcset.movenext : wend + Rcset.movenext : wend END IF response.end CASE "GANG_HEAD" '--GANG 필요 정보 가져오기' @@ -835,7 +845,7 @@ ELSE While not Rcset.eof response.write Rcset(0) - Rcset.movenext : wend + Rcset.movenext : wend END IF response.end @@ -849,7 +859,7 @@ ELSE While not Rcset.eof response.write Rcset(0) - Rcset.movenext : wend + Rcset.movenext : wend END IF response.end @@ -863,9 +873,9 @@ ELSE While not Rcset.eof response.write Rcset(0) - Rcset.movenext : wend + Rcset.movenext : wend END IF - response.end + response.end CASE "MYUN_TO_CAPI" '--CAPI에 배정된 면접원 확인' response.ContentType = "application/json" SQL = " select PKEY,a.USERID,b.USERNAME,b.USERPHONE from KON_CAPI_ASSIGN_TB a LEFT JOIN KON_CAPI_TB b on a.USERID = b.USERID WHERE PKEY = '" & PKEY & "' and del_flag = '0' FOR JSON PATH " @@ -876,10 +886,10 @@ ELSE While not Rcset.eof response.write Rcset(0) - Rcset.movenext : wend + Rcset.movenext : wend END IF - response.end - + response.end + CASE "COMPLETE_IDKEY" '-- 완료된 IDKEY' response.ContentType = "application/json" SQL = " select IDKEY, status ,b.[value] as end_time,CONVERT(CHAR(10), b.[value], 23) as end_date from [DATA] a " & vbcrlf @@ -894,9 +904,9 @@ ELSE While not Rcset.eof response.write Rcset(0) - Rcset.movenext : wend + Rcset.movenext : wend END IF - response.end + response.end CASE "DATA_FOR_MODIFY"'-- 수정을 위한 데이터 리스트 목록' response.ContentType = "application/json" @@ -908,13 +918,13 @@ .Parameters.Append .CreateParameter("@IDKEY", adVarWChar, adParamInput, 100) .Parameters("@PKEY") = PKEY .Parameters("@IDKEY") = REQUEST("IDKEY") - Set Rcset = .execute + Set Rcset = .execute End With - While Not Rcset.eof + While Not Rcset.eof response.write Rcset(0) Rcset.movenext - WEND + WEND Response.end CASE "USER_DATA_ONE" '--요청 IDKEY 데이터 전송' @@ -931,10 +941,10 @@ ELSE While not Rcset.eof response.write Rcset(0) - Rcset.movenext : wend + Rcset.movenext : wend END IF response.end - + CASE "PROJECT_LANGUAGE_VALUE" '--프로젝트 언어 변환' response.ContentType = "application/json" SQL ="select B.label, B.value from [project] A " &vbcrlf @@ -950,7 +960,7 @@ ELSE While not Rcset.eof response.write Rcset(0) - Rcset.movenext : wend + Rcset.movenext : wend END IF response.end @@ -968,7 +978,7 @@ response.end CASE "HARD_CODE_EXPLAIN" '-- 하드코딩 설명 가져오기 ' - + SQL = " select hard_explain from [KON_HARD_BOARD] WHERE ID = '"& request("id") &"' " Rcset.Open SQL,DBConn,3,1,1 IF Rcset.eof or Rcset.bof THEN @@ -985,7 +995,7 @@ ELSE response.write Rcset(0) END IF - response.end + response.end CASE "HARD_CODE" '-- 하드코딩 정보 전부 가져오기 ' response.ContentType = "application/json" SQL = " select id, hard_title, PKEY_CD, QID_CD, hard_tag, hard_explain, hard_code from [KON_HARD_BOARD] WHERE ID = '"& request("id") &"' FOR JSON PATH " @@ -1090,9 +1100,9 @@ SQL = SQL & " SELECT '"&PKEY&"' as PKEY, GKEY, '"& request("INAME") &"' as MKEY "&vbcrlf IF Root = "DIN_GANG" THEN SQL = SQL & " , JSON_MODIFY(JSON_MODIFY(JSON_MODIFY(PROJECTJSON,'$.must.title',N'"& request("title") &"' ),'$.must.title_inner',N'"& request("title_inner") &"'),'$.must.companytype',N'4') "&vbcrlf - ELSEIF Root = "DIN_QC" THEN + ELSEIF Root = "DIN_QC" THEN SQL = SQL & " , JSON_MODIFY(JSON_MODIFY(JSON_MODIFY(PROJECTJSON,'$.must.title',N'"& request("title") &"' ),'$.must.title_inner',N'"& request("title_inner") &"'),'$.must.companytype',N'5') "&vbcrlf - ELSE + ELSE SQL = SQL & " , JSON_MODIFY(JSON_MODIFY(PROJECTJSON,'$.must.title',N'"& request("title") &"' ),'$.must.title_inner',N'"& request("title_inner") &"') "&vbcrlf END IF 'SQL = SQL & " , JSON_MODIFY(PROJECTJSON,'$.must.title',N'"& request("title") &"' ) "&vbcrlf @@ -1126,8 +1136,8 @@ NEXT SQL = SQL & ";" DBConn.Execute SQL - wend - + wend + CASE "HARD_CODE" '--하드 코딩 게시판에 넣어주기' Dim hardcode: hardcode = request("hardcode") @@ -1137,7 +1147,7 @@ Dim hardtag: hardtag = request("hardtag") Dim hardexplain: hardexplain = request("hardexplain") Dim person_name: person_name = request("person_name") - + SQL = "INSERT INTO [KON_HARD_BOARD] (hard_title, PKEY_CD, QID_CD, charge_person_nm, hard_explain, hard_code, hard_tag, create_date) VALUES " SQL = SQL & "(" SQL = SQL & "'"& hardtitle & "'," @@ -1149,11 +1159,11 @@ SQL = SQL & "'"& hardtag &"'," SQL = SQL & " convert(CHAR(23), getDate(), 21)" SQL = SQL & ");" - + DBConn.Execute SQL - - + + END SELECT '-- UPDATE ' CASE "UPDATE" @@ -1189,7 +1199,7 @@ SQL = SQL & " USER_PW = '"& request("PW")&"', " &vbcrlf SQL = SQL & " USER_INFO_JSON = '" & request("INFO") & "' " &vbcrlf SQL = SQL & " where USER_ID = '" &request("PREVID")& "' and USER_PW = '"& request("PREVPW")&"' and PKEY_CD = '"&PKEY&"' " - + DBConn.Execute SQL CASE "QNUMBER" '-- 문항 개수 카운트 후 수정 ' @@ -1211,10 +1221,10 @@ SQL = SQL & " UPDATE kon.dbo.QUESTION set QUESTIONJSON = " SQL = SQL & " JSON_MODIFY (" SQL = SQL & " JSON_MODIFY(QUESTIONJSON , '$.stype' , '"& STYPE(iCnt) &"' ) " - SQL = SQL & " , '$.option' , JSON_QUERY(N'"&OPTIONS(iCnt)&"') ) " + SQL = SQL & " , '$.option' , JSON_QUERY(N'"&OPTIONS(iCnt)&"') ) " SQL = SQL & " where QID = '"&QIDARR(iCnt)&"' and PKEY = '"& PKEY &"'; " NEXT - + DBConn.Execute SQL response.end CASE "OPTIONGROUP" '-- 문항 디자인 수정 그룹' @@ -1228,10 +1238,10 @@ SQL = SQL & " JSON_MODIFY(OPTIONJSON , '$."&CHR(34)& QIDARR(iCnt) &CHR(34)&".stype' , N'"& STYPE(iCnt) &"' ) " SQL = SQL & " ,'$."&CHR(34)& QIDARR(iCnt) &CHR(34)&".option' , JSON_QUERY(N'"& OPTIONS(iCnt) &"') ) " SQL = SQL & " where PKEY = '"& PKEY &"' and OTYPE = 'qgroup'; " - NEXT - + NEXT + DBConn.Execute SQL - response.end + response.end CASE "QADMIN" '-- 문항 관리 - 로테이션, 그룹 설정을 문항 테이블에 수정 ' QIDARR = split(QID,"@") NAME = split(Request("NAME"),"@") @@ -1250,14 +1260,14 @@ SQL = SQL & " JSON_MODIFY(QUESTIONJSON , '$."& request("TYPE") &"' , '' ) " &vbcrlf SQL = SQL & " where PKEY = '"& PKEY &"'; " &vbcrlf END IF - + DBConn.Execute SQL response.end CASE "QOPTION" '--문항 관리 - 로테이션 그룹 설정을 옵션 테이블에 수정' QIDARR = split(QID,"@") NAME = split(Request("NAME"),"@") - DIM OPTION_JSON + DIM OPTION_JSON SQL = " SELECT * FROM kon.dbo.QOPTION WHERE PKEY = '"& PKEY &"' and OTYPE = '"& request("TYPE") &"' " Rcset.Open SQL,DBConn,3,1,1 @@ -1297,7 +1307,7 @@ SQL = SQL & " FROM QUESTION where PKEY = '"& PKEY &"' ORDER BY Qorder " SQL = SQL & " FOR XML PATH('') " SQL = SQL & " ),1,1,' ') + '}' AS VALUE " - + Rcset.Open SQL,DBConn,3,1,1 SAVEJSON "/project/"& PKEY & "/include/var_qid.json",Rcset(0) @@ -1310,11 +1320,11 @@ SQL = "UPDATE [DATA] set Status ='999', IDKEY = 'DEL_'+IDKEY WHERE PKEY = '"&PKEY&"' AND IDKEY = '" & request("IDKEY")& "' " DBCONN.EXECUTE SQL response.end - + CASE "MYUN" '-- 면접원 정보 수정 ' SQL = "UPDATE [KON_CAPI_TB] set USERNAME ='" & request("USERNAME") & "', USERPHONE ='" & request("USERPHONE") & "' WHERE USERID = '"& request("USERID") &"'" DBCONN.EXECUTE SQL - response.end + response.end CASE "DATA_COMPLETE" '--데이터 완료 처리' SQL = "UPDATE [DATA] set Status ='10' WHERE PKEY = '"&PKEY&"' AND IDKEY = '" & request("IDKEY")& "' " diff --git a/module/survey.js b/module/survey.js index e0b0aba..4ce0613 100644 --- a/module/survey.js +++ b/module/survey.js @@ -136,15 +136,24 @@ kon.survey = (function () { } function submitNextPage(form, waits) { + + // undefined 또는 잘못된 Promise 제거 + waits = waits.filter(function (wait) { + return wait && typeof wait.always === "function"; + }); + var remaining = waits.length; + if (remaining === 0) { form.attr("onsubmit", ""); form.submit(); return; } + waits.forEach(function (wait) { wait.always(function () { remaining--; + if (remaining === 0) { form.attr("onsubmit", ""); form.submit(); @@ -193,38 +202,43 @@ kon.survey = (function () { } function callKartDerived(pkey, idkey) { - var url = KART_BASE_URL - + "/project/" + KART_PROJECT_TYPE - + "/" + encodeURIComponent(pkey) - + "/derived/respondent/" + encodeURIComponent(idkey) - + "/recalculate"; + try{ + var url = KART_BASE_URL + + "/project/" + KART_PROJECT_TYPE + + "/" + encodeURIComponent(pkey) + + "/derived/respondent/" + encodeURIComponent(idkey) + + "/recalculate"; - logExternalApi("DERIVED", idkey, "", "REQUEST", ""); + logExternalApi("DERIVED", idkey, "", "REQUEST", ""); - return $.ajax({ - url: url, - type: "POST", - headers: { - "X-API-Key": KON_API_KEY - }, - dataType: "json", - cache: false, - timeout: 60000, + return $.ajax({ + url: url, + type: "POST", + headers: { + "X-API-Key": KON_API_KEY + }, + dataType: "json", + cache: false, + timeout: 60000, - success: function (data, status, xhr) { - logExternalApi( - "DERIVED", idkey, "", "SUCCESS", - "HTTP " + xhr.status - ); - }, + success: function (data, status, xhr) { + logExternalApi( + "DERIVED", idkey, "", "SUCCESS", + "HTTP " + xhr.status + ); + }, - error: function (xhr, status) { - logExternalApi( - "DERIVED", idkey, "", "FAIL", - "HTTP " + xhr.status + " / " + status - ); - } - }); + error: function (xhr, status) { + logExternalApi( + "DERIVED", idkey, "", "FAIL", + "HTTP " + xhr.status + " / " + status + ); + } + }); + } + catch(ex){ + return $.Deferred().resolve().promise(); + } } function callContactStatusApi(contactMappingList, idkey, statuses) {