Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

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