| 5355 |
dpurdie |
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
|
|
2 |
<%
|
|
|
3 |
'=====================================================
|
|
|
4 |
'| |
|
|
|
5 |
'| wRevertProducts |
|
|
|
6 |
'| |
|
|
|
7 |
'=====================================================
|
|
|
8 |
%>
|
|
|
9 |
<%
|
|
|
10 |
Option explicit
|
|
|
11 |
Response.Expires = 0
|
|
|
12 |
%>
|
|
|
13 |
<!--#include file="common/globals.asp"-->
|
|
|
14 |
<!--#include file="common/config.asp"-->
|
|
|
15 |
<!--#include file="common/common_subs.asp"-->
|
|
|
16 |
<!--#include file="common/_popup_window_common.asp"-->
|
|
|
17 |
<%
|
|
|
18 |
'------------ ACCESS CONTROL ------------------
|
|
|
19 |
%>
|
|
|
20 |
<!--#include file="_access_control_general.asp"-->
|
|
|
21 |
<%
|
|
|
22 |
'------------ VARIABLE DEFINITION -------------
|
|
|
23 |
Dim rsQry
|
|
|
24 |
Dim aProducts
|
|
|
25 |
Dim numOfRows
|
|
|
26 |
Dim rowNum
|
|
|
27 |
Dim objFormCollector
|
|
|
28 |
Dim currPkg_id
|
|
|
29 |
'------------ CONSTANTS DECLARATION -----------
|
|
|
30 |
'------------ VARIABLE INIT -------------------
|
|
|
31 |
parBom_id = Request("bom_id")
|
|
|
32 |
Set objFormCollector = CreateObject("Scripting.Dictionary")
|
|
|
33 |
'------------ CONDITIONS ----------------------
|
|
|
34 |
'----------------------------------------------
|
|
|
35 |
%>
|
|
|
36 |
<%
|
|
|
37 |
'----------------------------------------------------------------------------------------------------------------------------------
|
|
|
38 |
Sub GetFormDetails ( nBom_id, ByRef outobjDetails )
|
|
|
39 |
Dim rsQry, query
|
|
|
40 |
OraDatabase.Parameters.Add "BOM_ID", nBom_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
41 |
|
|
|
42 |
query = _
|
|
|
43 |
" SELECT rt.RTAG_ID, "&_
|
|
|
44 |
" rt.RTAG_NAME, "&_
|
|
|
45 |
" bo.PARENT_BOM_ID "&_
|
|
|
46 |
" FROM RELEASE_TAGS rt,"&_
|
|
|
47 |
" BOMS bo"&_
|
|
|
48 |
" WHERE bo.RTAG_ID_FK = rt.RTAG_ID"&_
|
|
|
49 |
" AND bo.BOM_ID = :BOM_ID"
|
|
|
50 |
|
|
|
51 |
Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
|
|
|
52 |
If (NOT rsQry.BOF) AND (NOT rsQry.EOF)Then
|
|
|
53 |
outobjDetails.Item ("rtag_id_fk") = rsQry("rtag_id")
|
|
|
54 |
outobjDetails.Item ("rtag_name") = rsQry("rtag_name")
|
|
|
55 |
outobjDetails.Item ("parent_bom_id") = rsQry("parent_bom_id")
|
|
|
56 |
End If
|
|
|
57 |
|
|
|
58 |
OraDatabase.Parameters.Remove "BOM_ID"
|
|
|
59 |
|
|
|
60 |
rsQry.Close
|
|
|
61 |
Set rsQry = Nothing
|
|
|
62 |
End Sub
|
|
|
63 |
'----------------------------------------------------------------------------------------------------------------------------------
|
|
|
64 |
Sub RevertProducts()
|
|
|
65 |
Dim aDiffList, numOfRows, rowNum, OraParameter
|
|
|
66 |
Const os_id_column = 2
|
|
|
67 |
Const old_prod_id_column = 1
|
|
|
68 |
|
|
|
69 |
'/* Get Updated Versions from Previous BOM */
|
|
|
70 |
OraDatabase.Parameters.Add "BOM_ID", parBom_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
71 |
OraDatabase.Parameters.Add "COMPARE_BOM_ID", objFormCollector.Item("parent_bom_id"), ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
72 |
|
|
|
73 |
Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("RevertProducts.sql"), ORADYN_DEFAULT )
|
|
|
74 |
|
| 5955 |
dpurdie |
75 |
OraDatabase.Parameters.Remove "BOM_ID"
|
|
|
76 |
OraDatabase.Parameters.Remove "COMPARE_BOM_ID"
|
| 5355 |
dpurdie |
77 |
|
|
|
78 |
'-- Get Rows
|
|
|
79 |
If rsQry.RecordCount > 0 Then
|
|
|
80 |
aDiffList = rsQry.GetRows()
|
|
|
81 |
|
|
|
82 |
Else
|
|
|
83 |
'-- No differences compared to Previous BOM, hence exit
|
|
|
84 |
Exit Sub
|
|
|
85 |
|
|
|
86 |
End If
|
|
|
87 |
|
|
|
88 |
'/* Revert Versions */
|
|
|
89 |
On Error Resume Next
|
|
|
90 |
|
|
|
91 |
OraDatabase.Parameters.Add "OLD_PROD_ID", 0, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
92 |
OraDatabase.Parameters.Add "NEW_PROD_ID", 0, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
93 |
OraDatabase.Parameters.Add "OS_ID", 0, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
94 |
OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
95 |
|
|
|
96 |
Set OraParameter = OraDatabase.Parameters
|
|
|
97 |
objEH.TryORA ( OraSession )
|
|
|
98 |
numOfRows = UBound( aDiffList, 2 )
|
|
|
99 |
|
|
|
100 |
For rowNum = 0 To numOfRows
|
|
|
101 |
|
|
|
102 |
If Request("revert_"& aDiffList( os_id_column, rowNum ) &"_"& aDiffList( old_prod_id_column, rowNum ) ) <> "" Then
|
|
|
103 |
OraParameter("OLD_PROD_ID").Value = aDiffList( old_prod_id_column, rowNum )
|
|
|
104 |
OraParameter("NEW_PROD_ID").Value = Request("revert_"& aDiffList( os_id_column, rowNum ) &"_"& aDiffList( old_prod_id_column, rowNum ) )
|
|
|
105 |
OraParameter("OS_ID").Value = aDiffList( os_id_column, rowNum )
|
|
|
106 |
|
|
|
107 |
OraDatabase.ExecuteSQL "BEGIN pk_Product.Replace_Product ( :OLD_PROD_ID, :NEW_PROD_ID, :OS_ID, :USER_ID ); END;"
|
|
|
108 |
End If
|
|
|
109 |
|
|
|
110 |
Next
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
'--- Log Action ---
|
|
|
114 |
'objEH.LogAction _
|
|
|
115 |
'objAccessControl.UserId, _
|
|
|
116 |
'enumAT_EVENT_COMMENT, _
|
|
|
117 |
'"Sub UpdateProducts for OS list="& Request("spos_id_list"), _
|
|
|
118 |
'SCRIPT_NAME, _
|
|
|
119 |
'"Updated Products with new versions.", _
|
|
|
120 |
'OraDatabase
|
|
|
121 |
|
|
|
122 |
OraDatabase.Parameters.Remove "OLD_PROD_ID"
|
|
|
123 |
OraDatabase.Parameters.Remove "NEW_PROD_ID"
|
|
|
124 |
OraDatabase.Parameters.Remove "OS_ID"
|
|
|
125 |
OraDatabase.Parameters.Remove "USER_ID"
|
| 5961 |
dpurdie |
126 |
|
|
|
127 |
objEH.CatchORA ( OraSession )
|
|
|
128 |
|
| 5355 |
dpurdie |
129 |
End Sub
|
|
|
130 |
'----------------------------------------------------------------------------------------------------------------------------------
|
|
|
131 |
Function Get_Bom_Name( nBomId )
|
|
|
132 |
|
|
|
133 |
OraDatabase.Parameters.Add "BOM_ID", nBomId, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
134 |
|
|
|
135 |
Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("BomDetails.sql"), ORADYN_DEFAULT )
|
|
|
136 |
|
|
|
137 |
Get_Bom_Name = rsQry("bom_name") + VBNewLine + rsQry("bom_version") + "." + rsQry("bom_lifecycle")
|
|
|
138 |
|
|
|
139 |
rsQry.Close()
|
|
|
140 |
|
|
|
141 |
Set rsQry = Nothing
|
|
|
142 |
|
|
|
143 |
OraDatabase.Parameters.Remove "BOM_ID"
|
|
|
144 |
|
|
|
145 |
End Function
|
|
|
146 |
'----------------------------------------------------------------------------------------------------------------------------------
|
|
|
147 |
%>
|
|
|
148 |
<%
|
|
|
149 |
'------------ RUN BEFORE PAGE RENDER ----------
|
|
|
150 |
Call GetFormDetails ( parBom_id, objFormCollector )
|
|
|
151 |
|
|
|
152 |
If Request("action") <> "" Then
|
|
|
153 |
' --- Form is Valid ---
|
|
|
154 |
Call RevertProducts()
|
|
|
155 |
|
|
|
156 |
If objEH.Finally Then
|
|
|
157 |
Call OpenInParentWindow ( Request("rfile") &"?UPDATED=OK"& objPMod.ComposeURLWithout("rfile") )
|
|
|
158 |
Call CloseWindow()
|
|
|
159 |
End If
|
|
|
160 |
End If
|
|
|
161 |
|
|
|
162 |
'----------------------------------------------
|
|
|
163 |
%>
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
<html>
|
|
|
167 |
<head>
|
|
|
168 |
<SCRIPT LANGUAGE="JavaScript">
|
|
|
169 |
<!-- Begin
|
|
|
170 |
var checkflag = "false";
|
|
|
171 |
function check(field) {
|
|
|
172 |
if (checkflag == "false") {
|
|
|
173 |
for (i = 0; i < field.length; i++) {
|
|
|
174 |
field[i].checked = true;}
|
|
|
175 |
checkflag = "true";
|
|
|
176 |
return "Uncheck all"; }
|
|
|
177 |
else {
|
|
|
178 |
for (i = 0; i < field.length; i++) {
|
|
|
179 |
field[i].checked = false; }
|
|
|
180 |
checkflag = "false";
|
|
|
181 |
return "Check all"; }
|
|
|
182 |
}
|
|
|
183 |
// End -->
|
|
|
184 |
</script>
|
|
|
185 |
|
|
|
186 |
<title>Deployment Manager</title>
|
|
|
187 |
<link rel="shortcut icon" href="<%=FavIcon%>"/>
|
|
|
188 |
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
|
|
|
189 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
190 |
<link href="scripts/deployment_manager.css" rel="stylesheet" type="text/css">
|
|
|
191 |
<script language="JavaScript" src="scripts/common.js"></script>
|
|
|
192 |
<style type="text/css">
|
|
|
193 |
<!--
|
|
|
194 |
.style8 {font-size: 12px}
|
|
|
195 |
-->
|
|
|
196 |
</style>
|
|
|
197 |
</head>
|
|
|
198 |
|
|
|
199 |
<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" onLoad="self.focus();">
|
|
|
200 |
<table width="100%" border="0" cellspacing="0" cellpadding="10">
|
|
|
201 |
<tr>
|
|
|
202 |
<td bgcolor="#FFFFFF" class="body_txt"><span class="body_h1"><img src="icons/i_linkarrow_black.gif" width="11" height="11" align="absmiddle"> Revert Products </span> <br>
|
|
|
203 |
Revert Products, selecting the latest from the Parent BOM.
|
|
|
204 |
</td>
|
|
|
205 |
</tr>
|
|
|
206 |
<%
|
|
|
207 |
'-- FROM START --------------------------------------------------------------------------------------------------------------
|
|
|
208 |
objFormComponent.FormName = "FormName"
|
|
|
209 |
objFormComponent.Action = SCRIPT_NAME
|
|
|
210 |
objFormComponent.OnSubmit = "ShowProgress();"
|
|
|
211 |
Call objFormComponent.FormStart()
|
|
|
212 |
%>
|
|
|
213 |
<tr>
|
|
|
214 |
<td background="images/bg_login.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
215 |
<tr>
|
|
|
216 |
<td><%=ProgressBar()%>
|
|
|
217 |
<input name="btn" type="submit" class="form_btn" value="Revert">
|
|
|
218 |
<input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();"></td>
|
|
|
219 |
<td align="left"> </td>
|
|
|
220 |
</tr>
|
|
|
221 |
</table></td>
|
|
|
222 |
</tr>
|
|
|
223 |
<tr>
|
|
|
224 |
<td>
|
|
|
225 |
<!-- PRODUCT NAME RESULTS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
226 |
<table width="100%" border="0" cellspacing="10" cellpadding="0">
|
|
|
227 |
<tr>
|
|
|
228 |
<td width="100%" valign="top" nowrap class="body_txt">
|
|
|
229 |
<!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
230 |
<!--#include file="messages/_msg_inline.asp"-->
|
|
|
231 |
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
232 |
<%
|
|
|
233 |
If objFormCollector.Item("parent_bom_id") = "" Then
|
|
|
234 |
Call Messenger ( "This BOM does not have Parent BOM Reference release.", 1, "100%" )
|
|
|
235 |
End If
|
|
|
236 |
%>
|
|
|
237 |
<!-- REVERT PRODUCTS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
238 |
Select Products and click Revert.
|
|
|
239 |
<table width="100%" border="0" cellspacing="3" cellpadding="0">
|
|
|
240 |
<tr>
|
|
|
241 |
<td width="1%" nowrap background="images/bg_bage_0h.gif" class="body_col">Revert</td>
|
|
|
242 |
<td width="40%" align="right" nowrap background="images/bg_bage_0h.gif" class="body_col"><div align="left">Location</div></td>
|
|
|
243 |
<td width="20%" align="right" nowrap background="images/bg_bage_0h.gif" class="body_col"><div align="left">Current Version</div></td>
|
|
|
244 |
<td align="right" background="images/bg_bage_0h.gif" class="body_col"><div align="left"><img src="images/spacer.gif" width="1" height="18" align="absmiddle"><%=Get_Bom_Name(objFormCollector.Item("parent_bom_id"))%></div> <div align="left"></div></td>
|
|
|
245 |
</tr>
|
|
|
246 |
<%
|
|
|
247 |
OraDatabase.Parameters.Add "BOM_ID", parBom_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
248 |
OraDatabase.Parameters.Add "COMPARE_BOM_ID", objFormCollector.Item("parent_bom_id"), ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
249 |
|
|
|
250 |
Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("RevertProducts.sql"), ORADYN_DEFAULT )
|
|
|
251 |
currPkg_id = 0
|
|
|
252 |
%>
|
|
|
253 |
<%If rsQry.RecordCount < 1 Then%>
|
|
|
254 |
<tr>
|
|
|
255 |
<td colspan="5" class="body_row">No Products to Revert. </td>
|
|
|
256 |
</tr>
|
|
|
257 |
<%End If%>
|
|
|
258 |
<%
|
|
|
259 |
While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
%>
|
|
|
264 |
<%If currPkg_id <> rsQry("pkg_id") Then%>
|
|
|
265 |
<tr>
|
|
|
266 |
<td nowrap><div align="left"><span class="body_row"><img src="icons/i_product.gif" width="19" height="19" hspace="2" align="absmiddle"><%=rsQry("prod_name")%> </span></div></td>
|
|
|
267 |
<td nowrap></td>
|
|
|
268 |
<td nowrap class="body_row"> </td>
|
|
|
269 |
<td nowrap class="body_row"><div align="center"></div></td>
|
|
|
270 |
<td nowrap class="body_row"></td>
|
|
|
271 |
</tr>
|
|
|
272 |
<tr>
|
|
|
273 |
<td colspan="5" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
|
|
|
274 |
</tr>
|
|
|
275 |
<%currPkg_id = rsQry("pkg_id")%>
|
|
|
276 |
<%End If%>
|
|
|
277 |
|
|
|
278 |
<tr>
|
|
|
279 |
<td align="center" nowrap><input type="checkbox" name="revert_<%=rsQry("os_id") &"_"& rsQry("prod_id")%>" value="<%=rsQry("old_prod_id")%>"> </td>
|
|
|
280 |
<td nowrap class="body_row"><img hspace="2" src="icons/<%=rsQry("node_icon")%>" align="absmiddle" border="0"><%=rsQry("prod_location")%></td>
|
|
|
281 |
<td nowrap class="body_row"><%=rsQry("prod_version")%></td>
|
|
|
282 |
<td nowrap class="body_row"><span class="body_txtr"><%=rsQry("old_pkg_version")%></span></td>
|
|
|
283 |
</tr>
|
|
|
284 |
<tr>
|
|
|
285 |
<td colspan="5" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
|
|
|
286 |
</tr>
|
|
|
287 |
<%rsQry.MoveNext
|
|
|
288 |
Wend
|
|
|
289 |
%>
|
|
|
290 |
|
|
|
291 |
<tr>
|
|
|
292 |
<td colspan="5" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="3"></td>
|
|
|
293 |
</tr>
|
|
|
294 |
</table>
|
|
|
295 |
|
|
|
296 |
<%
|
|
|
297 |
OraDatabase.Parameters.Remove "COMPARE_BOM_ID"
|
|
|
298 |
OraDatabase.Parameters.Remove "BOM_ID"
|
|
|
299 |
rsQry.Close
|
|
|
300 |
Set rsQry = Nothing
|
|
|
301 |
%> </td>
|
|
|
302 |
</tr>
|
|
|
303 |
</table>
|
|
|
304 |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
305 |
</td>
|
|
|
306 |
</tr>
|
|
|
307 |
<%=objPMod.ComposeHiddenTags()%>
|
|
|
308 |
<input type="hidden" name="action" value="true">
|
|
|
309 |
<%
|
|
|
310 |
Call objFormComponent.FormEnd()
|
|
|
311 |
'-- FROM END ----------------------------------------------------------------------------------------------------------------
|
|
|
312 |
%>
|
|
|
313 |
</table>
|
|
|
314 |
</body>
|
|
|
315 |
</html>
|
| 5958 |
dpurdie |
316 |
<!--#include file="common/globals_destructor.asp"-->
|