Subversion Repositories DevTools

Rev

Rev 1281 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'                  MAKE UNOFFICIAL
'               --- PROCESS FORM ---
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0   ' always load the page, dont store
%>

<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/common_dbedit.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_project.asp"-->
<%
'------------ Variable Definition -------------
Dim isDLocked
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
'----------------------------------------------
%>
<%
Sub MakeReject ()

   objEH.TryORA ( OraSession )
   On Error Resume Next

   OraDatabase.Parameters.Add "PV_ID",   Request("pv_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "RTAG_ID", Request("rtag_id"),      ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER

   OraDatabase.ExecuteSQL _
   "BEGIN "&_
   " PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); "&_
   "END; "

   objEH.CatchORA ( OraSession )

   OraDatabase.Parameters.Remove "PV_ID"
   OraDatabase.Parameters.Remove "RTAG_ID"
   OraDatabase.Parameters.Remove "USER_ID"

End Sub

Sub RejectAutobuild()

   OraDatabase.Parameters.Add "PV_ID",            Request("pv_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "RTAG_ID",          Request("rtag_id"),      ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "USER_ID",          objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "ACTION_TYPE_NAME", "reject_package",        ORAPARM_INPUT, ORATYPE_VARCHAR2
   OraDatabase.Parameters.Add "DESCRIPTION",      "Rejected manually following autobuild failure", ORAPARM_INPUT, ORATYPE_VARCHAR2

   On Error Resume Next
   objEH.TryORA( OraSession )

   ' Move package back to work-in-progress table (changes dlocked to "R" in doing so)
   OraDatabase.ExecuteSQL _
   "BEGIN "&_
   " PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); "&_
   "END; "

   If Err.Number = 0 Then

      ' Remove the entry from the do not ripple table but only if it is a direct exlusion entry caused by some build problem.
      ' This way, if user has deliberately excluded the package from the build (root_pv_id is null, root_cause is null
      ' and root_file is null) then it will remain exlcuded, as it will if there is some underlying package that has caused
      ' the exclusion.
      OraDatabase.ExecuteSQL ("DELETE FROM do_not_ripple "&_
                              "      WHERE pv_id   = :PV_ID "&_
                              "        AND rtag_id = :RTAG_ID "&_
                              "        AND root_pv_id IS NULL"&_
                              "        AND ((root_cause IS NOT NULL) OR (root_file IS NOT NULL))" )

      If Err.Number = 0 Then

         OraDatabase.ExecuteSQL ("BEGIN Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION ); END;")

      End If

   End If

   objEH.CatchORA( OraSession )

   OraDatabase.Parameters.Remove "PV_ID"
   OraDatabase.Parameters.Remove "RTAG_ID"
   OraDatabase.Parameters.Remove "USER_ID"
   OraDatabase.Parameters.Remove "ACTION_TYPE_NAME"
   OraDatabase.Parameters.Remove "DESCRIPTION"

End Sub

%>
<%
'-----------------------  MAIN LINE  ---------------------------

'--- Process submit ---
If (Request("rtag_id") <> "") AND (Request("pv_id") <> "")  Then


   Call Get_Pkg_Short_Info( Request("pv_id"), NULL, NULL, NULL, NULL, NULL, isDLocked )

   If isDLocked = "A" Then
      'Do the reject operation - this execution path rejects an Approved package version back to Pending

      'We can only do this operation if the build daemon is not going to be doing anything with the entry in
      'the "package versions" table. We can only guarantee this if the Daemon has failed to build the package version
      'and placed an entry for it in the "do not ripple" table, so check this.
      If isInDoNotRippleTable( Request("rtag_id"), Request("pv_id") ) = TRUE Then
         Call RejectAutobuild()
      Else
         Call RaiseMsg(enum_MSG_ERROR, "Cannot reject unless item is certain not to be examined concurrently by a build daemon during the reject operation. Wait for the build to fail.")
      End If
   Else
      'Do the reject operation - this execution path rejects a Pending package version back to Work In Progress
      Call MakeReject()
   End If



   If Request("rfile") <> "" Then
      Response.Redirect ( Request("rfile") &"?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
   Else
      Response.Redirect ( "dependencies?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
   End If

Else
   Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
   Response.write QSTR_All
End If
%>

<!-- DESTRUCTOR ------->
<!--#include file="common/destructor.asp"-->