%@LANGUAGE="VBSCRIPT"%> <% Option explicit Response.Expires = 0 ' always load the page, dont store %> <% '===================================================== ' _wform_change_owner_bulk.asp '===================================================== %> <% '------------ ACCESS CONTROL ------------------ %> <% '------------ Variable Definition ------------- Dim parPvidList Dim pvidArray '------------ Constants Declaration ----------- '------------ Variable Init ------------------- Set pkgInfoHash = CreateObject("Scripting.Dictionary") parPvidList = QStrPar("pvidList") pvidArray = Split(parPvidList,",") '---------------------------------------------- %> <% Function Users_List ( ) Users_List = _ " SELECT usr.user_id, usr.full_name"&_ " FROM users usr"&_ " WHERE usr.IS_DISABLED IS NULL"&_ " ORDER BY UPPER(usr.full_name)" End Function ' ' Update the owner field on all packages in the pvidArray list ' Sub Update_Owner (NNown_id ) Dim rsTemp, Query_String, sComments, previousOwner Dim pkgList Dim index '-- Get package details Query_String = _ " SELECT pv.pv_id, pv.owner_id, pkg.pkg_name, pv.pkg_version"&_ " FROM package_versions pv, packages pkg"&_ " WHERE pv.pv_id in("& parPvidList &")"&_ " AND pv.pkg_id = pkg.pkg_id" &_ " AND pv.owner_id != " & NNown_id &_ " ORDER by Upper(pkg.pkg_name), Upper(pv.v_ext)" Set rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0)) index = 0 While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) pkgInfoHash.Add "name_" & index, rsTemp("pkg_name") &" " & rsTemp("pkg_version") pkgInfoHash.Add "prev_" & index, rsTemp.Fields("owner_id").Value pkgInfoHash.Add "pvid_" & index, rsTemp.Fields("pv_id").Value index = index+1 rsTemp.MoveNext WEnd rsTemp.Close Set rsTemp = nothing '-- Skip if there is no actual ownership changes If index > 0 Then '-- Update database to change the owner objEH.TryORA ( OraSession ) On Error Resume Next OraDatabase.ExecuteSQL _ " UPDATE PACKAGE_VERSIONS pv SET "&_ " pv.owner_id = "& NNown_id &_ " WHERE pv.pv_id in ("& parPvidList &")" objEH.CatchORA ( OraSession ) If objEH.LastOraFailed = FALSE Then '-- Notify new owner '-- Generate a single email with the list of changed packages index = 0 pkgList = "You are now the owner of the following packages: