Subversion Repositories DevTools

Rev

Details | 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
 
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
<link rel="shortcut icon" href="<%=FavIcon%>"/>
198
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
199
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
200
<link href="scripts/deployment_manager.css" rel="stylesheet" type="text/css">
201
<script language="JavaScript" src="scripts/common.js"></script>
202
<style type="text/css">
203
<!--
204
.style8 {font-size: 12px}
205
-->
206
</style>
207
</head>
208
 
209
<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" onLoad="self.focus();">
210
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
211
  <tr>
212
    <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>
213
    Revert Products, selecting the latest from the Parent BOM.
214
    </td>
215
  </tr>	
216
<%
217
'-- FROM START --------------------------------------------------------------------------------------------------------------
218
objFormComponent.FormName = "FormName"
219
objFormComponent.Action = SCRIPT_NAME
220
objFormComponent.OnSubmit = "ShowProgress();"
221
Call objFormComponent.FormStart()
222
%>    
223
  <tr>
224
    <td background="images/bg_login.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
225
      <tr>
226
        <td><%=ProgressBar()%>
227
          <input name="btn" type="submit" class="form_btn" value="Revert">
228
          <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();"></td>
229
        <td align="left">&nbsp;        </td>
230
      </tr>
231
    </table></td>
232
  </tr>
233
  <tr>
234
    <td>
235
<!-- PRODUCT NAME RESULTS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->		
236
	<table width="100%"  border="0" cellspacing="10" cellpadding="0">
237
      <tr>
238
        <td width="100%" valign="top" nowrap class="body_txt">
239
		  <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->	
240
		  <!--#include file="messages/_msg_inline.asp"-->
241
		  <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
242
		  <%
243
		  If objFormCollector.Item("parent_bom_id") = "" Then
244
			Call Messenger ( "This BOM does not have Parent BOM Reference release.", 1, "100%" )
245
		  End If
246
		  %>
247
		  <!-- REVERT PRODUCTS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
248
		  Select Products and click Revert.
249
          <table width="100%"  border="0" cellspacing="3" cellpadding="0">
250
            <tr>
251
			  <td width="1%" nowrap background="images/bg_bage_0h.gif" class="body_col">Revert</td>
252
              <td width="40%" align="right" nowrap background="images/bg_bage_0h.gif" class="body_col"><div align="left">Location</div></td>
253
              <td width="20%" align="right" nowrap background="images/bg_bage_0h.gif" class="body_col"><div align="left">Current Version</div></td>
254
              <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>
255
              </tr>	  
256
			<%
257
			OraDatabase.Parameters.Add "BOM_ID", parBom_id,		ORAPARM_INPUT, ORATYPE_NUMBER 
258
			OraDatabase.Parameters.Add "COMPARE_BOM_ID", objFormCollector.Item("parent_bom_id"), ORAPARM_INPUT, ORATYPE_NUMBER 
259
 
260
			Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("RevertProducts.sql"), ORADYN_DEFAULT )
261
			currPkg_id = 0
262
			%>
263
			<%If rsQry.RecordCount < 1 Then%>
264
			<tr>
265
              <td colspan="5" class="body_row">No Products to Revert.                 </td>
266
            </tr>
267
			<%End If%>
268
			<%
269
			While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
270
 
271
 
272
 
273
			%>
274
			<%If currPkg_id <> rsQry("pkg_id") Then%>
275
            <tr>
276
			  <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>
277
              <td nowrap></td>
278
              <td nowrap class="body_row">&nbsp;</td>
279
              <td nowrap class="body_row"><div align="center"></div></td>
280
              <td nowrap class="body_row"></td>
281
              </tr>
282
			<tr>
283
              <td colspan="5" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
284
            </tr>
285
			<%currPkg_id = rsQry("pkg_id")%>
286
			<%End If%>
287
 
288
            <tr>
289
              <td align="center" nowrap><input type="checkbox" name="revert_<%=rsQry("os_id") &"_"& rsQry("prod_id")%>" value="<%=rsQry("old_prod_id")%>"> </td>
290
              <td nowrap class="body_row"><img hspace="2" src="icons/<%=rsQry("node_icon")%>" align="absmiddle" border="0"><%=rsQry("prod_location")%></td>
291
              <td nowrap class="body_row"><%=rsQry("prod_version")%></td>
292
              <td nowrap class="body_row"><span class="body_txtr"><%=rsQry("old_pkg_version")%></span></td>
293
              </tr>
294
			<tr>
295
              <td colspan="5" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
296
            </tr>			
297
            <%rsQry.MoveNext
298
			Wend
299
			%>
300
 
301
 
302
 
303
			<tr>
304
              <td colspan="5" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="3"></td>
305
            </tr>
306
          </table>
307
 
308
 
309
		  <%
310
		  OraDatabase.Parameters.Remove "COMPARE_BOM_ID"
311
		  OraDatabase.Parameters.Remove "BOM_ID"
312
		  rsQry.Close
313
		  Set rsQry = Nothing
314
		  %>		  </td>
315
        </tr>
316
    </table>
317
	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
318
    </td>
319
  </tr>
320
  <%=objPMod.ComposeHiddenTags()%>
321
  <input type="hidden" name="action" value="true">
322
<%
323
Call objFormComponent.FormEnd()
324
'-- FROM END ----------------------------------------------------------------------------------------------------------------
325
%>
326
</table>
327
</body>
328
</html>
329
<%
330
'------------ RUN AFTER PAGE RENDER -----------
331
'----------------------------------------------
332
%><!--#include file="common/globals_destructor.asp"-->