Subversion Repositories DevTools

Rev

Rev 5513 | Rev 5958 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
 
89
 
90
	'/* Revert Versions */
91
	On Error Resume Next
92
 
5955 dpurdie 93
	OraDatabase.Parameters.Add "BOM_ID", parBom_id,		ORAPARM_INPUT, ORATYPE_NUMBER 
94
	OraDatabase.Parameters.Add "COMPARE_BOM_ID", objFormCollector.Item("parent_bom_id"), ORAPARM_INPUT, ORATYPE_NUMBER  
5355 dpurdie 95
	OraDatabase.Parameters.Add "OLD_PROD_ID", 	0, 	ORAPARM_INPUT, ORATYPE_NUMBER 
96
	OraDatabase.Parameters.Add "NEW_PROD_ID", 	0, 	ORAPARM_INPUT, ORATYPE_NUMBER 
97
	OraDatabase.Parameters.Add "OS_ID", 		0, 	ORAPARM_INPUT, ORATYPE_NUMBER 
98
	OraDatabase.Parameters.Add "USER_ID", 		objAccessControl.UserId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
99
 
100
	Set OraParameter = OraDatabase.Parameters
101
 
102
 
103
 
104
	objEH.TryORA ( OraSession )
105
 
106
	numOfRows = UBound( aDiffList, 2 )
107
 
108
 
109
	For rowNum = 0 To numOfRows
110
 
111
		If Request("revert_"& aDiffList( os_id_column, rowNum ) &"_"& aDiffList( old_prod_id_column, rowNum ) ) <> "" Then
112
			OraParameter("OLD_PROD_ID").Value = aDiffList( old_prod_id_column, rowNum )
113
			OraParameter("NEW_PROD_ID").Value = Request("revert_"& aDiffList( os_id_column, rowNum ) &"_"& aDiffList( old_prod_id_column, rowNum ) )
114
			OraParameter("OS_ID").Value = aDiffList( os_id_column, rowNum )
115
 
116
			OraDatabase.ExecuteSQL "BEGIN   pk_Product.Replace_Product ( :OLD_PROD_ID, :NEW_PROD_ID, :OS_ID, :USER_ID );   END;"
117
		End If
118
 
119
	Next
120
 
121
 
122
	'--- Log Action ---
123
	'objEH.LogAction  _
124
	'objAccessControl.UserId, _
125
	'enumAT_EVENT_COMMENT, _
126
	'"Sub UpdateProducts for OS list="& Request("spos_id_list"), _
127
	'SCRIPT_NAME, _
128
	'"Updated Products with new versions.", _
129
	'OraDatabase
130
 
131
 
132
	objEH.CatchORA ( OraSession )	
133
 
134
	OraDatabase.Parameters.Remove "BOM_ID"
5955 dpurdie 135
	OraDatabase.Parameters.Remove "COMPARE_BOM_ID"
5355 dpurdie 136
	OraDatabase.Parameters.Remove "OLD_PROD_ID"
137
	OraDatabase.Parameters.Remove "NEW_PROD_ID"
138
	OraDatabase.Parameters.Remove "OS_ID"
139
	OraDatabase.Parameters.Remove "USER_ID"
140
End Sub
141
'----------------------------------------------------------------------------------------------------------------------------------
142
Function Get_Bom_Name( nBomId )
143
 
144
	OraDatabase.Parameters.Add "BOM_ID", 	nBomId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
145
 
146
	Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("BomDetails.sql"), ORADYN_DEFAULT )
147
 
148
	Get_Bom_Name = rsQry("bom_name") + VBNewLine + rsQry("bom_version") + "." + rsQry("bom_lifecycle")
149
 
150
	rsQry.Close()
151
 
152
	Set rsQry = Nothing
153
 
154
	OraDatabase.Parameters.Remove "BOM_ID"
155
 
156
End Function
157
'----------------------------------------------------------------------------------------------------------------------------------
158
%>
159
<%
160
'------------ RUN BEFORE PAGE RENDER ----------
161
Call GetFormDetails ( parBom_id, objFormCollector )
162
 
163
If Request("action") <> "" Then	
164
	' --- Form is Valid ---
165
	Call RevertProducts()
166
 
167
	If objEH.Finally Then
168
		Call OpenInParentWindow ( Request("rfile") &"?UPDATED=OK"& objPMod.ComposeURLWithout("rfile") )
169
		Call CloseWindow()
170
	End If
171
End If
172
 
173
'----------------------------------------------
174
%>
175
 
176
 
177
<html>
178
<head>
179
<SCRIPT LANGUAGE="JavaScript">
180
<!-- Begin
181
var checkflag = "false";
182
function check(field) {
183
if (checkflag == "false") {
184
  for (i = 0; i < field.length; i++) {
185
  field[i].checked = true;}
186
  checkflag = "true";
187
  return "Uncheck all"; }
188
else {
189
  for (i = 0; i < field.length; i++) {
190
  field[i].checked = false; }
191
  checkflag = "false";
192
  return "Check all"; }
193
}
194
//  End -->
195
</script>
196
 
197
<title>Deployment Manager</title>
198
<link rel="shortcut icon" href="<%=FavIcon%>"/>
199
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
200
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
201
<link href="scripts/deployment_manager.css" rel="stylesheet" type="text/css">
202
<script language="JavaScript" src="scripts/common.js"></script>
203
<style type="text/css">
204
<!--
205
.style8 {font-size: 12px}
206
-->
207
</style>
208
</head>
209
 
210
<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" onLoad="self.focus();">
211
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
212
  <tr>
213
    <td bgcolor="#FFFFFF" class="body_txt"><span class="body_h1"><img src="icons/i_linkarrow_black.gif" width="11" height="11" align="absmiddle">&nbsp;Revert Products </span> <br>
214
    Revert Products, selecting the latest from the Parent BOM.
215
    </td>
216
  </tr>	
217
<%
218
'-- FROM START --------------------------------------------------------------------------------------------------------------
219
objFormComponent.FormName = "FormName"
220
objFormComponent.Action = SCRIPT_NAME
221
objFormComponent.OnSubmit = "ShowProgress();"
222
Call objFormComponent.FormStart()
223
%>    
224
  <tr>
225
    <td background="images/bg_login.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
226
      <tr>
227
        <td><%=ProgressBar()%>
228
          <input name="btn" type="submit" class="form_btn" value="Revert">
229
          <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();"></td>
230
        <td align="left">&nbsp;        </td>
231
      </tr>
232
    </table></td>
233
  </tr>
234
  <tr>
235
    <td>
236
<!-- PRODUCT NAME RESULTS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->		
237
	<table width="100%"  border="0" cellspacing="10" cellpadding="0">
238
      <tr>
239
        <td width="100%" valign="top" nowrap class="body_txt">
240
		  <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->	
241
		  <!--#include file="messages/_msg_inline.asp"-->
242
		  <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
243
		  <%
244
		  If objFormCollector.Item("parent_bom_id") = "" Then
245
			Call Messenger ( "This BOM does not have Parent BOM Reference release.", 1, "100%" )
246
		  End If
247
		  %>
248
		  <!-- REVERT PRODUCTS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
249
		  Select Products and click Revert.
250
          <table width="100%"  border="0" cellspacing="3" cellpadding="0">
251
            <tr>
252
			  <td width="1%" nowrap background="images/bg_bage_0h.gif" class="body_col">Revert</td>
253
              <td width="40%" align="right" nowrap background="images/bg_bage_0h.gif" class="body_col"><div align="left">Location</div></td>
254
              <td width="20%" align="right" nowrap background="images/bg_bage_0h.gif" class="body_col"><div align="left">Current Version</div></td>
255
              <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>
256
              </tr>	  
257
			<%
258
			OraDatabase.Parameters.Add "BOM_ID", parBom_id,		ORAPARM_INPUT, ORATYPE_NUMBER 
259
			OraDatabase.Parameters.Add "COMPARE_BOM_ID", objFormCollector.Item("parent_bom_id"), ORAPARM_INPUT, ORATYPE_NUMBER 
260
 
261
			Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("RevertProducts.sql"), ORADYN_DEFAULT )
262
			currPkg_id = 0
263
			%>
264
			<%If rsQry.RecordCount < 1 Then%>
265
			<tr>
266
              <td colspan="5" class="body_row">No Products to Revert.                 </td>
267
            </tr>
268
			<%End If%>
269
			<%
270
			While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
271
 
272
 
273
 
274
			%>
275
			<%If currPkg_id <> rsQry("pkg_id") Then%>
276
            <tr>
277
			  <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>
278
              <td nowrap></td>
279
              <td nowrap class="body_row">&nbsp;</td>
280
              <td nowrap class="body_row"><div align="center"></div></td>
281
              <td nowrap class="body_row"></td>
282
              </tr>
283
			<tr>
284
              <td colspan="5" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
285
            </tr>
286
			<%currPkg_id = rsQry("pkg_id")%>
287
			<%End If%>
288
 
289
            <tr>
290
              <td align="center" nowrap><input type="checkbox" name="revert_<%=rsQry("os_id") &"_"& rsQry("prod_id")%>" value="<%=rsQry("old_prod_id")%>"> </td>
291
              <td nowrap class="body_row"><img hspace="2" src="icons/<%=rsQry("node_icon")%>" align="absmiddle" border="0"><%=rsQry("prod_location")%></td>
292
              <td nowrap class="body_row"><%=rsQry("prod_version")%></td>
293
              <td nowrap class="body_row"><span class="body_txtr"><%=rsQry("old_pkg_version")%></span></td>
294
              </tr>
295
			<tr>
296
              <td colspan="5" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
297
            </tr>			
298
            <%rsQry.MoveNext
299
			Wend
300
			%>
301
 
302
 
303
 
304
			<tr>
305
              <td colspan="5" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="3"></td>
306
            </tr>
307
          </table>
308
 
309
 
310
		  <%
311
		  OraDatabase.Parameters.Remove "COMPARE_BOM_ID"
312
		  OraDatabase.Parameters.Remove "BOM_ID"
313
		  rsQry.Close
314
		  Set rsQry = Nothing
315
		  %>		  </td>
316
        </tr>
317
    </table>
318
	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
319
    </td>
320
  </tr>
321
  <%=objPMod.ComposeHiddenTags()%>
322
  <input type="hidden" name="action" value="true">
323
<%
324
Call objFormComponent.FormEnd()
325
'-- FROM END ----------------------------------------------------------------------------------------------------------------
326
%>
327
</table>
328
</body>
329
</html>
330
<%
331
'------------ RUN AFTER PAGE RENDER -----------
332
'----------------------------------------------
333
%><!--#include file="common/globals_destructor.asp"-->