Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
119 ghuddy 1
<%
2
'=====================================================
129 ghuddy 3
'                COMMON DB EDIT
119 ghuddy 4
'=====================================================
5
%>
6
<%
7
Sub Update_Pkg_Category ( SSrtag_id, SSpv_id, SSbase_view_id )
129 ghuddy 8
 
9
   OraDatabase.Parameters.Add "PV_ID",   SSpv_id,        ORAPARM_INPUT, ORATYPE_NUMBER
10
   OraDatabase.Parameters.Add "RTAG_ID", SSrtag_id,      ORAPARM_INPUT, ORATYPE_NUMBER
11
   OraDatabase.Parameters.Add "VIEW_ID", SSbase_view_id, ORAPARM_INPUT, ORATYPE_NUMBER
12
 
13
   objEH.TryORA ( OraSession )
14
   On Error Resume Next
15
   OraDatabase.ExecuteSQL _
16
   "BEGIN PK_ENVIRONMENT.CHANGE_PACKAGE_VIEW ( :PV_ID, :RTAG_ID, :VIEW_ID );  END;"
17
   objEH.CatchORA ( OraSession )
18
 
19
   OraDatabase.Parameters.Remove "PV_ID"
20
   OraDatabase.Parameters.Remove "RTAG_ID"
21
   OraDatabase.Parameters.Remove "VIEW_ID"
22
 
119 ghuddy 23
End Sub
24
'-----------------------------------------------------------------------------------------------------------------------------
25
Sub Seed_Package_Names_Versions ( ARRdep, NNretPV_ID )
129 ghuddy 26
   Dim i
27
   OraDatabase.Parameters.Add "retPV_ID", 0, ORAPARM_OUTPUT, ORATYPE_NUMBER
28
   objEH.TryORA ( OraSession )
29
   On Error Resume Next
30
 
31
   For i = 0 To UBound( ARRdep, 2 )
32
      OraDatabase.ExecuteSQL "BEGIN Seed_Package_Names_Versions ('"& ARRdep(0,i) &"','"& ARRdep(1,i) &"', "& objAccessControl.UserId &", :retPV_ID); END;"
33
   Next
34
   objEH.CatchORA ( OraSession )
35
   OraDatabase.Parameters.Remove "retPV_ID"
119 ghuddy 36
End Sub
37
'-----------------------------------------------------------------------------------------------------------------------------
38
Function IsExtention ( SSstr )
129 ghuddy 39
   Dim objRegEx, Match, Matches, StrReturnStr
40
   Set objRegEx = New RegExp
41
 
42
   objRegEx.IgnoreCase = True
43
   objRegEx.Pattern = "[A-Za-z]+"
44
 
45
   Set Matches = objRegEx.Execute( SSstr )
46
   For Each Match in Matches
47
      IsExtention = true
48
   Next
119 ghuddy 49
End Function
50
'-----------------------------------------------------------------------------------------------------------------------------
51
Function Get_Pkg_Base_View_ID ( NNpv_id, NNrtag_id )
129 ghuddy 52
   Dim rsTemp, Query_String
53
 
54
   If Request("rtag_id") = "" Then
55
      Get_Pkg_Base_View_ID = -1
56
      Exit Function
57
   End If
58
 
59
   Query_String = _
60
   " SELECT rc.base_view_id"&_
61
   "  FROM release_content rc"&_
62
   " WHERE rc.rtag_id = "& NNrtag_id &_
63
   "   AND rc.pv_id = "& NNpv_id
64
 
65
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
66
 
67
   If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
68
      Get_Pkg_Base_View_ID = CInt( rsTemp("base_view_id") )
69
   Else
70
      Get_Pkg_Base_View_ID = NULL
71
   End If
72
 
73
   rsTemp.Close
74
   Set rsTemp = nothing
119 ghuddy 75
End Function
76
'-----------------------------------------------------------------------------------------------------------------------------
77
Function Get_V_EXT ( SSversion )
129 ghuddy 78
   Dim v_ext
79
   v_ext = Right(SSversion, Len(SSversion) - InStrRev( SSversion, "." ))
80
 
81
   If IsExtention ( v_ext ) Then
82
      Get_V_EXT = v_ext
83
   Else
84
      Get_V_EXT = NULL
85
   End If
86
 
119 ghuddy 87
End Function
88
'-----------------------------------------------------------------------------------------------------------------------------
89
Sub Touch_Package ( NNpv_id )
129 ghuddy 90
   If NNpv_id = "" Then Exit Sub
91
 
92
   objEH.TryORA ( OraSession )
93
   On Error Resume Next
94
   OraDatabase.ExecuteSQL " UPDATE package_versions "&_
95
                          " SET modified_stamp = "& ORA_SYSDATETIME  &", modifier_id = "& objAccessControl.UserId &_
96
                          " WHERE pv_id = "& NNpv_id
97
   objEH.CatchORA ( OraSession )
119 ghuddy 98
End Sub
99
'-----------------------------------------------------------------------------------------------------------------------------
129 ghuddy 100
Function Rebuild_Environment_Necessary(NNrtag_id)
101
   Dim Query_String, rsTemp
102
 
103
   Rebuild_Environment_Necessary = FALSE
104
 
105
   If IsNull(NNrtag_id) OR NNrtag_id = "" Then Exit Function     ' Exit if rtag_id is not supplied
106
 
107
   ' Find if rebuild is required
108
   Query_String = "SELECT rebuild_env FROM release_tags WHERE rtag_id = "& NNrtag_id
109
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
110
   If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
111
      If rsTemp("rebuild_env") = "Y" Then
112
         Rebuild_Environment_Necessary = TRUE
113
      End If
114
   End If
115
   rsTemp.Close
116
   Set rsTemp = nothing
117
End Function
118
 
119
'-----------------------------------------------------------------------------------------------------------------------------
119 ghuddy 120
Sub Rebuild_Environment ( NNrtag_id )
129 ghuddy 121
   If Rebuild_Environment_Necessary(NNrtag_id) Then
5176 dpurdie 122
       Call Rebuild_Environment_Body(NNrtag_id, FALSE)
123
   End If
124
End Sub
129 ghuddy 125
 
5176 dpurdie 126
'-----------------------------------------------------------------------------------------------------------------------------
127
Sub Rebuild_Environment_Body ( NNrtag_id , BallStates)
128
    On Error Resume Next
129 ghuddy 129
 
5176 dpurdie 130
    ' It is important to set the flag rebuild_env = 'N' first, 
131
    ' to stop multiple processes doing the same thing
132
    objEH.TryORA ( OraSession )
133
    OraDatabase.ExecuteSQL " UPDATE release_tags "&_
134
                         " SET rebuild_env = 'N'"&_
135
                         " WHERE rtag_id = "& NNrtag_id
136
    objEH.CatchORA ( OraSession )
129 ghuddy 137
 
5176 dpurdie 138
    ' Only proceed if the last update succeeded
139
    If objEH.LastOraFailed = FALSE Then
140
        ' Now rebuild environment
141
        objEH.TryORA ( OraSession )
142
        OraDatabase.ExecuteSQL " BEGIN Rebuild_Environment( "& NNrtag_id &" ); END;"
143
        objEH.CatchORA ( OraSession )
144
    End If
145
 
146
    If BallStates Then
147
        objEH.TryORA ( OraSession )
148
        OraDatabase.ExecuteSQL " BEGIN REBUILD_DEPRECATE_STATE( "& NNrtag_id &" ); END;"
149
        objEH.CatchORA ( OraSession )
150
    End If
151
 
129 ghuddy 152
End Sub
5176 dpurdie 153
 
119 ghuddy 154
'-----------------------------------------------------------------------------------------------------------------------------
155
Sub CheckRequirements ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters, sQuery )
129 ghuddy 156
   Dim rsErr, Query_String
157
   Query_String = sQuery
158
 
159
 
160
   ' --------- SQL PARAMETERS ------------
161
   OraDatabase.Parameters.Add "RTAG_ID",                nRtag_id,               ORAPARM_INPUT, ORATYPE_NUMBER
162
   OraDatabase.Parameters.Add "PV_ID",                  nPv_id,                 ORAPARM_INPUT, ORATYPE_NUMBER
163
   OraDatabase.Parameters.Add "enumPKG_STATE_OK",       enumPKG_STATE_OK,       ORAPARM_INPUT, ORATYPE_NUMBER
164
   OraDatabase.Parameters.Add "enumISSUES_STATE_FIXED", enumISSUES_STATE_FIXED, ORAPARM_INPUT, ORATYPE_NUMBER
165
   ' -------------------------------------
166
   Set rsErr = OraDatabase.DbCreateDynaset( Query_String, cint(0))
167
 
168
   returnERRmsg = NULL
169
   returnALRTmsg = NULL
170
 
171
   If ( nPkgType = enumBASE_VIEW_PRODUCTS ) Then
172
      ' Check Requirement for products
5898 dpurdie 173
       Do While ((NOT rsErr.BOF) AND (NOT rsErr.EOF))
174
          If Not IsNull(rsErr("err_message")) Then
175
             returnERRmsg = rsErr("err_message")
176
             returnALRTmsg = rsErr("products_msg")
177
             returnParameters = "_make_released.asp" &"|"
178
             If returnALRTmsg = "ERROR" Then
179
                returnParameters = rsErr("rfile") &"|"& rsErr("anchor")
180
                Exit Do
181
             End If
182
          End If
129 ghuddy 183
 
5898 dpurdie 184
          rsErr.MoveNext
129 ghuddy 185
      Loop
186
 
187
   Else
188
      ' Check Requirements for other packages
5898 dpurdie 189
 
129 ghuddy 190
      Do While ((NOT rsErr.BOF) AND (NOT rsErr.EOF))
191
         If Not IsNull(rsErr("err_message")) Then
192
            returnERRmsg = rsErr("err_message")
193
            returnParameters = rsErr("rfile") &"|"& rsErr("anchor")
194
            Exit Do
195
         End If
196
 
197
         rsErr.MoveNext
198
      Loop
199
 
200
   End If
201
 
202
   rsErr.Close
203
   Set rsErr = nothing
204
   OraDatabase.Parameters.Remove "RTAG_ID"
205
   OraDatabase.Parameters.Remove "PV_ID"
206
   OraDatabase.Parameters.Remove "enumPKG_STATE_OK"
207
   OraDatabase.Parameters.Remove "enumISSUES_STATE_FIXED"
119 ghuddy 208
End Sub
209
'-----------------------------------------------------------------------------------------------------------------------------
210
Sub CheckRequirementsForMakeRelease ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters )
129 ghuddy 211
   Dim QueryString, rsQry
212
   QueryString = "SELECT pv.IS_PATCH FROM PACKAGE_VERSIONS pv WHERE pv.PV_ID = "& nPv_id
213
   Set rsQry = OraDatabase.DbCreateDynaset( QueryString, cint(0))
214
 
215
   If IsNull(rsQry("is_patch")) Then
216
      ' For Package
1376 dpurdie 217
      Call CheckRequirements ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters, ReadFile( rootPath & "queries\req_make_official.sql" ) )
129 ghuddy 218
   Else
219
      ' For Patch
1376 dpurdie 220
      Call CheckRequirements ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters, ReadFile( rootPath & "queries\req_make_official_patch.sql" ) )
129 ghuddy 221
   End If
222
 
223
   rsQry.Close()
224
   Set rsQry = nothing
225
 
119 ghuddy 226
End Sub
227
'-----------------------------------------------------------------------------------------------------------------------------
228
Sub CheckRequirementsForMakePending ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters )
1376 dpurdie 229
    Call CheckRequirements ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters, ReadFile( rootPath & "queries\req_make_pending.sql" ) )
119 ghuddy 230
End Sub
231
'-----------------------------------------------------------------------------------------------------------------------------
232
Sub CheckRequirementsForMakeApproved ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters )
129 ghuddy 233
   Call CheckRequirements ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters, ReadFile( rootPath & "queries\req_make_approved.sql" ) )
119 ghuddy 234
End Sub
235
'-----------------------------------------------------------------------------------------------------------------------------
129 ghuddy 236
Sub CheckRequirementsForMakeDeployable ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters )
237
   Call CheckRequirements ( nPv_id, nRtag_id, nPkgType, returnERRmsg, returnALRTmsg, returnParameters, ReadFile( rootPath & "queries\req_make_deployable.sql" ) )
119 ghuddy 238
End Sub
239
'-----------------------------------------------------------------------------------------------------------------------------
240
Sub Notify ( NNrtag_id )
129 ghuddy 241
   Dim Query_String, Location_SQL, rsNotify, emailBody, readyPv_id_list, SentTODict, releaseSTR
242
   Dim httpRef, URL_root, headerSTR, footerSTR, oAttachmentsDict
243
 
244
   Set SentTODict = CreateObject("Scripting.Dictionary")
245
   Set oAttachmentsDict = CreateObject("Scripting.Dictionary")
246
 
247
   On Error Resume Next
248
   objEH.TryORA ( OraSession )
249
 
250
   Query_String = ReadFile( rootPath & "queries\to_notify.sql" )
251
   Query_String = Replace( Query_String, "/*PKG_STATE_MAJOR_READY*/", enumPKG_STATE_MAJOR_READY)
252
   Query_String = Replace( Query_String, "/*PKG_STATE_MINOR_READY*/", enumPKG_STATE_MINOR_READY)
253
   Query_String = Replace( Query_String, "/*PKG_STATE_OK*/", enumPKG_STATE_OK)
254
   Query_String = Replace( Query_String, "/*ORA_SYSDATETIME*/", ORA_SYSDATETIME)
255
 
256
   ' --------- SQL PARAMETERS ------------
257
   OraDatabase.Parameters.Add "RTAG_ID", NNrtag_id, ORAPARM_INPUT
258
   OraDatabase.Parameters("RTAG_ID").ServerType = ORATYPE_NUMBER
259
 
260
   OraDatabase.Parameters.Add "CURRENT_USER", objAccessControl.UserId, ORAPARM_INPUT
261
   OraDatabase.Parameters("CURRENT_USER").ServerType = ORATYPE_NUMBER
262
   ' -------------------------------------
263
   'Response.write Query_String
264
   Set rsNotify = OraDatabase.DbCreateDynaset( Query_String, cint(0))
265
 
266
   readyPv_id_list = "-1"
267
   emailBody = ""
268
 
269
   '---- Get notification list ----
270
   If ((NOT rsNotify.BOF) AND (NOT rsNotify.EOF)) Then
271
      httpRef = Request.ServerVariables("HTTP_REFERER")
272
      URL_root = Left( httpRef, InStrRev(httpRef, "/") )
273
 
274
      emailBody = emailBody & "<tr>"
275
      emailBody = emailBody & "<td nowrap bgcolor='#CAC5B8'><font size='1' face='tahoma,sans-serif'><b>Owner</b></font></td>"
276
      emailBody = emailBody & "<td nowrap bgcolor='#CAC5B8'><font size='1' face='tahoma,sans-serif'><b>Package Name</b></font></td>"
277
      emailBody = emailBody & "<td nowrap bgcolor='#CAC5B8'><font size='1' face='tahoma,sans-serif'><b>Version</b></font></td>"
278
      emailBody = emailBody & "</tr>"
279
 
280
      While ((NOT rsNotify.BOF) AND (NOT rsNotify.EOF))
3959 dpurdie 281
         emailBody = emailBody & "<tr>"
129 ghuddy 282
         emailBody = emailBody & "<td nowrap><font size='1' face='tahoma,sans-serif'>"& rsNotify("full_name") &"</font></td>"
283
         emailBody = emailBody & "<td nowrap><font size='1' face='tahoma,sans-serif'><a href='"& URL_root &"dependencies.asp?pv_id="& rsNotify("pv_id") &"&rtag_id="& NNrtag_id &"'>"& rsNotify("pkg_name") &"</a></font></td>"
284
         emailBody = emailBody & "<td nowrap><font size='1' face='tahoma,sans-serif'>"& rsNotify("pkg_version") &"</font></td>"
285
         emailBody = emailBody & "</tr>"
286
 
287
         readyPv_id_list = readyPv_id_list &","& rsNotify("pv_id")
288
 
289
         If NOT SentTODict.Exists (Cstr(rsNotify("user_email"))) Then SentTODict.Add Cstr(rsNotify("user_email")), Cstr(rsNotify("full_name"))
290
 
291
         rsNotify.MoveNext
292
      WEnd
293
 
294
      emailBody = "<table width='50%' border='1' cellspacing='0' cellpadding='1'>" & emailBody & "</table>"
295
 
296
   End If
297
 
298
   rsNotify.Close
299
   Set rsNotify = nothing
300
 
301
 
302
   If readyPv_id_list <> "-1" Then
303
      '---- Header ----
304
      headerSTR = _
305
      "<table width='50%' border='0' cellspacing='0' cellpadding='0'>"&_
306
      "   <tr>"&_
307
      "     <td valign='bottom'><img src='cid:RM-Envelop' width='60' height='30'></td>"&_
308
      "     <td valign='bottom' align='right'><font size='3' face='tahoma,sans-serif'><b>release</b>manager Notifications</font></td>"&_
309
      "   </tr>"&_
310
      "   <tr> "&_
311
      "     <td bgcolor='#003399'></td>"&_
312
      "     <td bgcolor='#003399'></td>"&_
313
      "   </tr>"&_
314
      "</table><br><br>"
315
 
316
      '---- Footer ----
317
      footerSTR = _
318
      "<br><br>"&_
319
      "<table width='50%' border='0' cellspacing='0' cellpadding='0'>"&_
320
      "  <tr>"&_
321
      "    <td colspan='2'><hr size='1' noshade color='#003399'></td>"&_
322
      "  </tr>"&_
323
      "  <tr>"&_
324
      "    <td><img src='cid:RM-MASSlogo' width='22' height='17' hspace='5' align='absmiddle'><font size='1' face='tahoma,sans-serif'>&nbsp;<a href='http://mass.erggroup.com'>mass</a></font></td>"&_
325
      "    <td nowrap align='right'><font size='1' face='tahoma,sans-serif'>ERG Confidential &copy; ERG</font></td>"&_
326
      "  </tr>"&_
327
      "</table>"
328
 
329
 
330
      '---- Get Release loction ----
331
      Location_SQL = _
332
      " SELECT proj.proj_name, rt.rtag_name"&_
333
      "  FROM release_tags rt,"&_
334
      "       projects proj"&_
335
      " WHERE rt.proj_id = proj.proj_id"&_
336
      "   AND rt.rtag_id = :RTAG_ID"
337
 
338
      Set rsNotify = OraDatabase.DbCreateDynaset( Location_SQL, cint(0))
339
      If ((NOT rsNotify.BOF) AND (NOT rsNotify.EOF)) Then
340
      releaseSTR = rsNotify("proj_name")  &" > "& rsNotify("rtag_name")
341
      emailBody = "<font size='1' face='tahoma,sans-serif'>"&_
342
                  "Following packages are ready to build.<br><br>"&_
343
                  rsNotify("proj_name") &" &gt; "& rsNotify("rtag_name") &"<br>"&_
344
                  "<a href='"& URL_root &"dependencies.asp?rtag_id="& NNrtag_id &"'>"& URL_root &"dependencies.asp?rtag_id="& NNrtag_id  &"</a>"&_
345
                  "</font>"&_
346
                  emailBody
347
      End If
348
      rsNotify.Close
349
      Set rsNotify = nothing
350
 
351
      emailBody = headerSTR & emailBody & footerSTR
352
 
353
      '---- Remove pkg from notification history ----
354
      OraDatabase.ExecuteSQL " DELETE FROM notification_history WHERE rtag_id = :RTAG_ID AND pv_id IN ( "& readyPv_id_list &" )"
355
 
356
 
357
      '---- Insert into notification history ----
358
      OraDatabase.ExecuteSQL "INSERT INTO notification_history (rtag_id, pv_id, user_id, date_time_stamp) "&_
359
                             " SELECT ins.rtag_id, ins.pv_id, ins.user_id, ins.date_time_stamp"&_
360
                             "   FROM ("&_
361
                             Query_String &_
362
                             "      ) ins"
363
 
364
   End If
365
 
366
   objEH.CatchORA ( OraSession )
367
 
368
   '================= Send Email ==========================
5357 dpurdie 369
   'Call Send_Email ( "Release Manager Notifications", ADMIN_EMAIL, ADMIN_EMAIL, "Your package is ready to build at "& releaseSTR, emailBody, oAttachmentsDict )
129 ghuddy 370
 
371
   ' ---------- Attachments -------------
372
   oAttachmentsDict.Add "images\i_mail.gif",       "RM-Envelop"
373
   oAttachmentsDict.Add "images\s_masslogo_w.gif", "RM-MASSlogo"
374
 
5357 dpurdie 375
   Call Send_Email ( "Release Manager Notifications", ADMIN_EMAIL, SentTODict, "Your package is ready to build at "& releaseSTR, emailBody, oAttachmentsDict )
129 ghuddy 376
 
377
   OraDatabase.Parameters.Remove "RTAG_ID"
378
   OraDatabase.Parameters.Remove "CURRENT_USER"
379
 
119 ghuddy 380
End Sub
381
'-----------------------------------------------------------------------------------------------------------------------------
382
Function NeedSync ( nPv_id, nRtag_id )
129 ghuddy 383
   Dim rsTemp, Query_String
384
   Query_String = ReadFile( rootPath & "queries\sync_check.sql" )
385
 
386
   ' --------- SQL PARAMETERS ------------
387
   OraDatabase.Parameters.Add "RTAG_ID", nRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER
388
   OraDatabase.Parameters.Add "PV_ID",   nPv_id,   ORAPARM_INPUT, ORATYPE_NUMBER
389
   ' -------------------------------------
390
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
391
 
392
   If rsTemp.RecordCount > 0 Then
393
      NeedSync = TRUE
394
   Else
395
      NeedSync = FALSE
396
   End If
397
 
398
   rsTemp.Close
399
   Set rsTemp = nothing
400
   OraDatabase.Parameters.Remove "RTAG_ID"
401
   OraDatabase.Parameters.Remove "PV_ID"
119 ghuddy 402
End Function
403
'-----------------------------------------------------------------------------------------------------------------------------
404
Function Lookup_Document ( sDocNum, outDocTitle, outDoc_id, outDoc_version, outDoc_created  )
129 ghuddy 405
   Dim rsDocReg
406
 
407
   outDocTitle = NULL
408
   outDoc_id = NULL
409
   outDoc_version = NULL
410
   outDoc_created = NULL
411
 
412
   Set rsDocReg = Server.CreateObject("ADODB.Recordset")
413
   rsDocReg.ActiveConnection = DOCREP_conn
414
 
415
   rsDocReg.Source = "EXEC docregister.dbo.sp_RM_getDocumentFiles '"& sDocNum &"';"
416
   rsDocReg.CursorType = 0
417
   rsDocReg.CursorLocation = 2
418
   rsDocReg.LockType = 3
419
 
420
   On Error Resume Next
421
 
422
   rsDocReg.Open()
423
 
424
   If (NOT rsDocReg.BOF) AND (NOT rsDocReg.EOF)  Then
425
      outDocTitle = rsDocReg("title")
426
      outDoc_id = rsDocReg("id")
427
      outDoc_version = rsDocReg("version")
428
      outDoc_created = rsDocReg("created")
429
   End If
430
 
431
   rsDocReg.Close
432
 
433
   Lookup_Document = Err.Number   ' Return Error number
434
 
435
   Set rsDocReg = nothing
119 ghuddy 436
End Function
437
'-----------------------------------------------------------------------------------------------------------------------------
438
Function Short_Document_Details ( nDocId, outDocTitle, outDoc_version, outDoc_created  )
129 ghuddy 439
   Dim rsDocReg
440
 
441
   outDocTitle = NULL
442
   outDoc_version = NULL
443
   outDoc_created = NULL
444
 
445
   Set rsDocReg = Server.CreateObject("ADODB.Recordset")
446
   rsDocReg.ActiveConnection = DOCREP_conn
447
 
448
   rsDocReg.Source = "EXEC docregister.dbo.sp_RM_getFileDetails "& nDocId &";"
449
   rsDocReg.CursorType = 0
450
   rsDocReg.CursorLocation = 2
451
   rsDocReg.LockType = 3
452
 
453
   On Error Resume Next
454
 
455
   rsDocReg.Open()
456
 
457
   If (NOT rsDocReg.BOF) AND (NOT rsDocReg.EOF)  Then
458
      outDocTitle = rsDocReg("title")
459
      outDoc_version = rsDocReg("version")
460
      outDoc_created = rsDocReg("created")
461
   End If
462
 
463
   rsDocReg.Close
464
 
465
   Short_Document_Details = Err.Number   ' Return Error number
466
 
467
   Set rsDocReg = nothing
119 ghuddy 468
End Function
469
'-----------------------------------------------------------------------------------------------------------------------------
4553 dpurdie 470
'   ClearQuest Interface
471
'   Convert is CQ Issue number into a DEVI Number
472
'
119 ghuddy 473
Function GetIssueNumber ( nIssDB, nIssId )
4553 dpurdie 474
   Dim rsQry, rsSQL
155 ghuddy 475
   GetIssueNumber = ""
129 ghuddy 476
 
477
   If CInt(nIssDB) = enumCLEARQUEST_DEVI_ID Then
4553 dpurdie 478
    rsSQL = "SELECT dbid AS iss_id, new_num AS iss_num " &_
479
	        "  FROM release_manager.cq_software_issue si" &_
480
	        "  WHERE si.dbid = " & nIssId
129 ghuddy 481
 
4553 dpurdie 482
    On Error Resume Next
483
    Set rsQry = OraDatabase.DbCreateDynaset( rsSQL, cint(0))
129 ghuddy 484
 
4553 dpurdie 485
    If (NOT rsQry.BOF) AND (NOT rsQry.EOF)  Then
486
      GetIssueNumber = rsQry("iss_num")
487
    End If
129 ghuddy 488
 
4553 dpurdie 489
    rsQry.Close
490
    Set rsQry = nothing
129 ghuddy 491
 
492
   End If
119 ghuddy 493
End Function
494
'-----------------------------------------------------------------------------------------------------------------------------
495
Sub Log_Action ( nPvId, sActionTypeName, sComments )
129 ghuddy 496
 
497
   OraDatabase.Parameters.Add "PV_ID",            nPvId,                   ORAPARM_INPUT, ORATYPE_NUMBER
498
   OraDatabase.Parameters.Add "USER_ID",          objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
499
   OraDatabase.Parameters.Add "ACTION_TYPE_NAME", sActionTypeName,         ORAPARM_INPUT, ORATYPE_VARCHAR2
500
   OraDatabase.Parameters.Add "COMMENTS",         sComments,               ORAPARM_INPUT, ORATYPE_VARCHAR2
501
 
502
   objEH.TryORA ( OraSession )
503
   On Error Resume Next
504
 
505
   OraDatabase.ExecuteSQL _
506
   "BEGIN  Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :COMMENTS );  END;"
507
 
508
   objEH.CatchORA ( OraSession )
509
 
510
   OraDatabase.Parameters.Remove "PV_ID"
511
   OraDatabase.Parameters.Remove "USER_ID"
512
   OraDatabase.Parameters.Remove "ACTION_TYPE_NAME"
513
   OraDatabase.Parameters.Remove "COMMENTS"
119 ghuddy 514
End Sub
515
'-----------------------------------------------------------------------------------------------------------------------------
516
Function GetUsername ( nUser_id )
129 ghuddy 517
   Dim rsQry, sQuery
119 ghuddy 518
 
129 ghuddy 519
   OraDatabase.Parameters.Add "USER_ID", nUser_id, ORAPARM_INPUT, ORATYPE_VARCHAR2
520
   sQuery = "SELECT full_name FROM users WHERE user_id = :USER_ID"
521
   Set rsQry = OraDatabase.DbCreateDynaset( sQuery, cint(0))
119 ghuddy 522
 
129 ghuddy 523
   If rsQry.RecordCount = 1 Then
524
      GetUsername = rsQry.Fields("full_name").Value
525
   Else
526
      GetUsername = nothing
527
   End If
119 ghuddy 528
 
129 ghuddy 529
   OraDatabase.Parameters.remove "USER_ID"
530
   rsQry.Close
531
   Set rsQry = nothing
119 ghuddy 532
End Function
533
'-----------------------------------------------------------------------------------------------------------------------------
534
Function GetUserEmail ( nUser_id )
129 ghuddy 535
   Dim rsQry, sQuery
119 ghuddy 536
 
129 ghuddy 537
   OraDatabase.Parameters.Add "USER_ID", nUser_id, ORAPARM_INPUT, ORATYPE_VARCHAR2
538
   sQuery = "SELECT user_email FROM users WHERE user_id = :USER_ID"
539
   Set rsQry = OraDatabase.DbCreateDynaset( sQuery, cint(0))
119 ghuddy 540
 
129 ghuddy 541
   If rsQry.RecordCount = 1 Then
542
      GetUserEmail = rsQry.Fields("user_email").Value
543
   Else
544
      GetUserEmail = nothing
545
   End If
119 ghuddy 546
 
129 ghuddy 547
   OraDatabase.Parameters.remove "USER_ID"
548
   rsQry.Close
549
   Set rsQry = nothing
119 ghuddy 550
End Function
129 ghuddy 551
'---------------------------------------------------------------------------------------------------------------------
552
Sub SetIgnoreWarnings (dpvId, pvId, rtagId)
553
 
554
   Dim Query_String, rsTemp
555
 
556
   OraDatabase.Parameters.Add "RTAG_ID",        rtagId,                  ORAPARM_INPUT, ORATYPE_NUMBER
557
   OraDatabase.Parameters.Add "PV_ID",          pvId,                    ORAPARM_INPUT, ORATYPE_NUMBER
558
   OraDatabase.Parameters.Add "USER_ID",        objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
559
   OraDatabase.Parameters.Add "IGNORE_ID_LIST", dpvId,                   ORAPARM_INPUT, ORATYPE_VARCHAR2
560
 
561
   On Error Resume Next
562
 
563
   objEH.TryORA ( OraSession )
564
   OraDatabase.ExecuteSQL _
565
   "BEGIN "&_
566
   " Ignore_Dependency_Warnings( :RTAG_ID, :PV_ID, :IGNORE_ID_LIST, FALSE, :USER_ID ); "&_
567
   "END; "
568
   objEH.CatchORA ( OraSession )
569
 
570
   OraDatabase.Parameters.Remove "USER_ID"
571
   OraDatabase.Parameters.Remove "IGNORE_ID_LIST"
572
 
573
   If objEH.LastOraFailed = FALSE Then
574
      ' DEVI-051154 has prompted the removal of the code to call touch_release from the
575
      ' Ignore_Dependency_Warnings stored procedure, and re-locate it here in the website code, since
576
      ' Ignore_Dependency_Warnings is called internally by other SQL code in the database where
577
      ' we do not want to touch_release. This is what Ignore_Dependency_Warnings used to do:
578
      '     IF PK_ENVIRONMENT.GET_PACKAGE_AREA ( nPvId, nRtagId ) = 2 THEN
579
      '        Touch_Release (nRtagId);
580
      '     END IF;
581
      ' Doing the same in the website code is a bit  more verbose, and we shouldn't do it if it
582
      ' is not necessary.
583
 
584
      ' Get the tab in which the package version resides (0=wip, 1=planned, 2=released)
585
      OraDatabase.Parameters.Add "ENVTAB",  NULL, ORAPARM_OUT, ORATYPE_NUMBER
586
      OraDatabase.ExecuteSQL _
587
      "BEGIN "&_
588
      " :ENVTAB = PK_ENVIRONMENT.GET_PACKAGE_AREA ( :PV_ID, :RTAG_ID ); "&_
589
      "END; "
590
 
591
      ' only need to touch release if it is not already in touched state. The purpose of this is to prevent the
592
      ' code inside the body of this "if-statement" from executing during the period of time when the database schema
593
      ' has yet to be updated to remove the intenral call to touch_release. Once the database schema is updated,
594
      ' the Rebuild_Environment_Necessary call is no longer necessary since it will always return FALSE at this
595
      ' point. Leaving the statement in place post the database schema update will do no harm though.
596
      If Rebuild_Environment_Necessary(rtagId) = FALSE Then
597
         ' If the package version is 'Released' then allow the rebuild of the environment so that the states
598
         ' of higher level packages can be re-evaluated
599
         If OraDatabase.Parameters("ENVTAB").Value = 2 Then
600
            objEH.TryORA ( OraSession )
601
            OraDatabase.ExecuteSQL _
602
            "BEGIN "&_
603
            " Touch_Release ( :RTAG_ID ); "&_
604
            "END; "
605
            objEH.CatchORA ( OraSession )
606
         End If
607
      End If
608
 
609
      OraDatabase.Parameters.Remove "ENVTAB"
610
   End If
611
 
612
   OraDatabase.Parameters.Remove "RTAG_ID"
613
   OraDatabase.Parameters.Remove "PV_ID"
614
End Sub
119 ghuddy 615
'------------------------------------------------------------------------------------------------------------------
151 ghuddy 616
Sub UpdateChangeType (nPvId, nChangeType)
617
   Dim rsTemp, Query_String
618
 
619
   On Error Resume Next
620
   If (NOT IsNull(nChangeType)) AND (nChangeType <> "") AND (NOT IsNull(nPvId)) AND (nPvId <> "") Then
621
 
622
      OraDatabase.Parameters.Add "PV_ID",       nPvId,       ORAPARM_INPUT, ORATYPE_NUMBER
623
      OraDatabase.Parameters.Add "CHANGE_TYPE", nChangeType, ORAPARM_INPUT, ORATYPE_CHAR
624
 
625
      objEH.TryORA ( OraSession )
626
      On Error Resume Next
627
 
628
      OraDatabase.ExecuteSQL _
629
      "UPDATE package_versions pv SET pv.change_type = '"& nChangeType &"' WHERE pv.pv_id = "& nPvId
630
 
631
      objEH.CatchORA ( OraSession )
632
 
633
      OraDatabase.Parameters.Remove "PV_ID"
634
      OraDatabase.Parameters.Remove "CHANGE_TYPE"
635
 
636
      If objEH.LastOraFailed = FALSE Then
637
         '/* Log Action */
638
         If nChangeType = "M" Then
639
            Call Log_Action ( nPvId, "change_type_update", "Major Change" )
640
 
641
         ElseIf nChangeType = "N" Then
642
            Call Log_Action ( nPvId, "change_type_update", "Minor Change" )
643
 
644
         ElseIf nChangeType = "P" Then
645
            Call Log_Action ( nPvId, "change_type_update", "Patch Change" )
646
 
647
         End If
648
      End If
649
   End If
650
End Sub
651
'------------------------------------------------------------------------------------------------------------------
652
Sub UpdateReasonForVersion (nPvId, nReason)
653
   Dim rsTemp, Query_String
654
 
655
   On Error Resume Next
656
   If (NOT IsNull(nReason)) AND (nReason <> "") AND (NOT IsNull(nPvId)) AND (nPvId <> "") Then
657
 
658
      OraDatabase.Parameters.Add "PV_ID",    nPvId,   ORAPARM_INPUT, ORATYPE_NUMBER
659
      OraDatabase.Parameters.Add "COMMENTS", nReason, ORAPARM_INPUT, ORATYPE_VARCHAR2
660
 
661
      objEH.TryORA ( OraSession )
662
      On Error Resume Next
663
 
664
      OraDatabase.ExecuteSQL _
155 ghuddy 665
      "UPDATE package_versions pv SET pv.comments = '"& SQLstring(nReason) &"' WHERE pv.pv_id = "& nPvId
151 ghuddy 666
 
667
      objEH.CatchORA ( OraSession )
668
 
669
      OraDatabase.Parameters.Remove "PV_ID"
670
      OraDatabase.Parameters.Remove "COMMENTS"
671
 
672
      If objEH.LastOraFailed = FALSE Then
673
         '/* Log Action */
674
         Call Log_Action ( nPvId, "reason_for_release", nReason )
675
      End If
676
   End If
677
End Sub
5338 dpurdie 678
 
151 ghuddy 679
'------------------------------------------------------------------------------------------------------------------
5338 dpurdie 680
' Currently used to specify non-vix licence when creating the first veersion of a new package
681
' Negative nLicence iis used to indicate that the user selected 100% vix. This is not stored. It is assumed
682
Sub UpdateLicenceInfo (nPvId, nLicence)
683
   Dim rsTemp, logMsg
151 ghuddy 684
 
5338 dpurdie 685
   On Error Resume Next
686
   If (NOT IsNull(nLicence)) AND (nLicence <> "") AND (nLicence > 0) AND (NOT IsNull(nPvId)) AND (nPvId <> "") Then
687
 
688
      OraDatabase.Parameters.Add "PV_ID",    nPvId,     ORAPARM_INPUT, ORATYPE_NUMBER
689
      OraDatabase.Parameters.Add "LICENCE", nLicence,   ORAPARM_INPUT, ORATYPE_NUMBER
690
 
691
      objEH.TryORA ( OraSession )
692
      On Error Resume Next
693
 
694
      OraDatabase.ExecuteSQL "insert into licencing (pv_id,licence ) values (:PV_ID,:LICENCE)"
695
 
696
      objEH.CatchORA ( OraSession )
697
 
698
      OraDatabase.Parameters.Remove "PV_ID"
699
      OraDatabase.Parameters.Remove "LICENCE"
700
 
701
      If objEH.LastOraFailed = FALSE Then
702
        OraDatabase.Parameters.Add "LICENCE", nLicence,   ORAPARM_INPUT, ORATYPE_NUMBER
703
        Set rsTemp = OraDatabase.DbCreateDynaset("select name from licences where licence = :LICENCE", cint(0))
704
        If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
705
            logMsg = "Set to " & rsTemp("name")
706
        Else
707
            logMsg = "Set to unknown(" & nPvId & ")"
708
        End If
709
        rsTemp.Close()
710
        Set rsTemp = nothing
711
        OraDatabase.Parameters.Remove "LICENCE"
712
 
713
        '/* Log Action */
714
        Call Log_Action ( nPvId, "software_licence", logMsg )
715
      End If
716
 
717
   End If
718
End Sub
719
 
720
'------------------------------------------------------------------------------------------------------------------
721
 
129 ghuddy 722
%>