select a.mskeyvalue, a.mcdisplayname,
case when b1.along is null then to_char(a.MX_USER_PREFS)
else to_char(b1.along) end MX_USER_PREFS from
(select mcmskey, mcMSKEYVALUE as MSKEYVALUE, mcDisplayName, avalue as MX_USER_PREFS
from idmv_value_basic %NOLOCK%, idmv_entry_simple %NOLOCK%
where mcEntryType = 'MX_PERSON' and mcMSKEY = mskey and attrName = 'MX_USER_PREFS') a
left join
(select mskey, avalue, along from mxi_values %NOLOCK% where attr_id =
(select attr_id from mxi_attributes %NOLOCK% where attrname = 'MX_USER_PREFS' )) b1
on a.mcmskey = b1.mskey
/*
* 2018-05-30 SAP NN: Loop through user preferences and remove deleted tasks
* Input: List of preferences
* Output: Cleaned up list of preferences
*/
function z_removeObsoleteUserpreferences(Par) {
if (Par) {
var prefs = uFromBase64(Par);
var result = "";
uWarning("Preferences to be checked: [" + prefs + "]");
/* sample user preferences text data
#--No header--
#Mon May 28 16:41:01 CEST 2018
EntrySearchComp.ResultTable.VisibleRows=50
EntrySearchComp.TableSort.4.sortColumn=column_3
EntrySearchComp.TableSort.4.sortDirection=UP
EntrySearchComp.Favorite.4.4=1011922|-100|Change Identity
EntrySearchComp.Favorite.4.3=1011910|0|Create Identity
EntrySearchComp.Favorite.4.2=1012630|-100|Display Identity
EntrySearchComp.Favorite.1.2=1012693|0|Create Business Role
EntrySearchComp.Favorite.1.1=1012729|-100|Modify Business Role
RequestComp.RequestTable.VisibleRows=50
*/
var prefArray = prefs.split("\n");
result += prefArray[0] + "\n" + prefArray[1]; // first lines static (header and time stamp)
// loop through props and remove obsolete tasks
// start from 3rd line (first 2 lines are static)
// last line is empty
for (ipa = 2; ipa < (prefArray.length - 1); ipa++) {
if (prefArray[ipa].indexOf("EntrySearchComp.Favorite.") != -1) { // only check the value if it is a favorite
var taskid = prefArray[ipa].split("=")[1].split("|")[0];
uInfo("Checking existence of task [" + taskid + "]");
var count = uSelect("select count(taskid) from mxp_tasks where mcObsoletedGuid is Null and taskid = " + taskid);
if (count == "0") {
uWarning("Task [" + taskid + "] got removed from DB");
} else {
uInfo("Task [" + taskid + "] still valid task");
result += "\n" + prefArray[ipa];
}
} else {
uInfo("Entry [" + prefArray[ipa] + "] not a task preference");
result += "\n" + prefArray[ipa];
}
}
result += "\n";
uWarning("Result for [" + prefs + "]: [" + result + "]");
return uToBase64(result);
} else {
uSkip(1, 1, "no prefs on user");
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
26 | |
14 | |
12 | |
11 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 |