| 119 |
ghuddy |
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
|
|
2 |
<%
|
|
|
3 |
'=====================================================
|
| 129 |
ghuddy |
4 |
' Update Issues State
|
| 119 |
ghuddy |
5 |
' --- PROCESS FORM ---
|
|
|
6 |
'=====================================================
|
|
|
7 |
%>
|
|
|
8 |
<%
|
|
|
9 |
Option explicit
|
|
|
10 |
' Good idea to set when using redirect
|
| 129 |
ghuddy |
11 |
Response.Expires = 0 ' always load the page, dont store
|
| 119 |
ghuddy |
12 |
%>
|
|
|
13 |
<!--#include file="common/conf.asp"-->
|
|
|
14 |
<!--#include file="common/globals.asp"-->
|
|
|
15 |
<!--#include file="common/formating.asp"-->
|
|
|
16 |
<!--#include file="common/qstr.asp"-->
|
|
|
17 |
<!--#include file="common/common_subs.asp"-->
|
|
|
18 |
<!--#include file="common/common_dbedit.asp"-->
|
|
|
19 |
<%
|
|
|
20 |
' Set rfile parameter. This is a return page after Login
|
|
|
21 |
Call objPMod.StoreParameter ( "rfile", "fixed_issues.asp" )
|
|
|
22 |
'------------ ACCESS CONTROL ------------------
|
|
|
23 |
%>
|
|
|
24 |
<!--#include file="_access_control_login.asp"-->
|
|
|
25 |
<!--#include file="_access_control_general.asp"-->
|
|
|
26 |
<!--#include file="_access_control_project.asp"-->
|
|
|
27 |
<%
|
|
|
28 |
'------------ Variable Definition -------------
|
|
|
29 |
Dim parPv_id
|
|
|
30 |
Dim parFRfixed
|
|
|
31 |
'------------ Constants Declaration -----------
|
|
|
32 |
'------------ Variable Init -------------------
|
|
|
33 |
parPv_id = QStrPar("pv_id")
|
|
|
34 |
parRtag_id = QStrPar("rtag_id")
|
|
|
35 |
parFRfixed = Request("FRfixed")
|
|
|
36 |
'----------------------------------------------
|
|
|
37 |
%>
|
|
|
38 |
<%
|
|
|
39 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
40 |
Sub GetOldIssueStates ( nPvId, ByRef outobjOldIssStates )
|
| 129 |
ghuddy |
41 |
Dim rsQry, query
|
|
|
42 |
|
|
|
43 |
query = _
|
|
|
44 |
" SELECT cqi.ISS_DB ||'.'|| cqi.ISS_ID AS iss_db_id,"&_
|
|
|
45 |
" cqi.ISS_STATE"&_
|
|
|
46 |
" FROM CQ_ISSUES cqi"&_
|
|
|
47 |
" WHERE cqi.PV_ID = :PV_ID"
|
|
|
48 |
|
|
|
49 |
OraDatabase.Parameters.Add "PV_ID", nPvId, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
50 |
|
|
|
51 |
Set rsQry = OraDatabase.DbCreateDynaset( query , ORADYN_DEFAULT )
|
|
|
52 |
While ((NOT rsQry.BOF) AND (NOT rsQry.EOF))
|
|
|
53 |
outobjOldIssStates.Item ( CStr(rsQry("iss_db_id")) ) = Cstr(rsQry("iss_state"))
|
|
|
54 |
|
|
|
55 |
rsQry.MoveNext()
|
|
|
56 |
WEnd
|
|
|
57 |
|
|
|
58 |
rsQry.Close
|
|
|
59 |
Set rsQry = Nothing
|
|
|
60 |
|
|
|
61 |
OraDatabase.Parameters.Remove "PV_ID"
|
| 119 |
ghuddy |
62 |
End Sub
|
|
|
63 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
64 |
Sub Update_Issues ( NNpv_id, NNfixed_iss_list )
|
| 129 |
ghuddy |
65 |
Dim fixedIssArr, isspkArr, isspk, objOldIssStates, iss_num, outstandingIssArr
|
|
|
66 |
|
|
|
67 |
Set objOldIssStates = CreateObject("Scripting.Dictionary")
|
|
|
68 |
|
|
|
69 |
Call GetOldIssueStates ( NNpv_id, objOldIssStates )
|
|
|
70 |
|
|
|
71 |
objEH.TryORA ( OraSession )
|
|
|
72 |
On Error Resume Next
|
|
|
73 |
|
|
|
74 |
'-- Set all issues to "imported" i.e. "not fixed"
|
|
|
75 |
'OraDatabase.ExecuteSQL _
|
|
|
76 |
' " UPDATE cq_issues "&_
|
|
|
77 |
' " SET iss_state = "& enumISSUES_STATE_IMPORTED &_
|
|
|
78 |
' " WHERE pv_id = "& NNpv_id
|
|
|
79 |
|
|
|
80 |
'-- Now set "fixed" for selected issues
|
|
|
81 |
If NNfixed_iss_list <> "" Then
|
|
|
82 |
fixedIssArr = Split( Replace( NNfixed_iss_list, " ", "" ) , ",")
|
|
|
83 |
|
|
|
84 |
For Each isspk In fixedIssArr
|
|
|
85 |
isspkArr = Split(isspk, ".")
|
|
|
86 |
iss_num = GetIssueNumber ( isspkArr(0), isspkArr(1) )
|
|
|
87 |
|
|
|
88 |
If Err.Number = 0 Then
|
|
|
89 |
OraDatabase.ExecuteSQL _
|
|
|
90 |
" UPDATE cq_issues "&_
|
|
|
91 |
" SET iss_state = "& enumISSUES_STATE_FIXED &_
|
|
|
92 |
" WHERE pv_id = "& NNpv_id &_
|
|
|
93 |
" AND iss_db = "& isspkArr(0) &_
|
|
|
94 |
" AND iss_id = "& isspkArr(1)
|
|
|
95 |
|
|
|
96 |
If Err.Number = 0 Then
|
|
|
97 |
'/* Log Action */
|
|
|
98 |
If CStr( objOldIssStates.Item ( isspk ) ) = CStr(enumISSUES_STATE_IMPORTED) Then
|
|
|
99 |
|
|
|
100 |
OraDatabase.ExecuteSQL _
|
|
|
101 |
"BEGIN Log_Action ( "& NNpv_id &", 'issue_fixed', "& objAccessControl.UserId &", 'Issue number: "& iss_num &"' ); END;"
|
|
|
102 |
End If
|
|
|
103 |
End If
|
|
|
104 |
|
|
|
105 |
'-- Remove this element from objOldIssStates
|
|
|
106 |
objOldIssStates.Remove ( isspk )
|
|
|
107 |
End If
|
|
|
108 |
Next
|
|
|
109 |
End If
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
'/* Log Action */
|
|
|
113 |
'-- Log Set to Outstanding
|
|
|
114 |
outstandingIssArr = objOldIssStates.Keys
|
|
|
115 |
|
|
|
116 |
For Each isspk In outstandingIssArr
|
|
|
117 |
|
|
|
118 |
If CStr( objOldIssStates.Item ( isspk ) ) = CStr(enumISSUES_STATE_FIXED) Then
|
|
|
119 |
isspkArr = Split(isspk, ".")
|
|
|
120 |
iss_num = GetIssueNumber ( isspkArr(0), isspkArr(1) )
|
|
|
121 |
|
|
|
122 |
If Err.Number = 0 Then
|
|
|
123 |
OraDatabase.ExecuteSQL _
|
|
|
124 |
"BEGIN Log_Action ( "& NNpv_id &", 'issue_outstanding', "& objAccessControl.UserId &", 'Issue number: "& iss_num &"' ); END;"
|
|
|
125 |
End If
|
|
|
126 |
End If
|
|
|
127 |
Next
|
|
|
128 |
|
|
|
129 |
objEH.CatchORA ( OraSession )
|
|
|
130 |
|
| 119 |
ghuddy |
131 |
End Sub
|
|
|
132 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
133 |
%>
|
|
|
134 |
<%
|
|
|
135 |
'----------------------- MAIN LINE ---------------------------
|
|
|
136 |
'--- Process submition ---
|
|
|
137 |
If (parPv_id <> "") Then
|
| 1376 |
dpurdie |
138 |
' All mandatory parameters FOUND
|
| 129 |
ghuddy |
139 |
|
|
|
140 |
Call Update_Issues ( parPv_id, parFRfixed )
|
|
|
141 |
|
|
|
142 |
Response.Redirect("fixed_issues.asp?hidenv=true&pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id"))
|
| 119 |
ghuddy |
143 |
Else
|
| 1376 |
dpurdie |
144 |
Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
|
| 4955 |
dpurdie |
145 |
Response.write QSTR_FullQuery
|
| 119 |
ghuddy |
146 |
End If
|
|
|
147 |
%>
|
|
|
148 |
|
|
|
149 |
<!-- DESTRUCTOR ------->
|
| 129 |
ghuddy |
150 |
<!--#include file="common/destructor.asp"-->
|