Search…
Hotfix
Unifi can be patched between releases by using a special Script Include called hotfix. If you find a bug in Unifi we may issue a hotfix so you can get the features you need without having to upgrade.

Hotfix Installation

Unifi has a Script Include called hotfix. Simply replace the script in the hotfix Script Include with the one shown below and you will instantly have access to the fixes.
These hotfixes will be shipped as real fixes with the next version of Unifi, so make sure you have the correct hotfix for your version.
1
/**
2
* Executes a child function corresponding to the object's type property.
3
* The object is passed to the child function so methods and properties can be overridden.
4
*
5
* @param {Object} obj The full class object to be patched.
6
*/
7
function hotfix(obj) {
8
var type = typeof obj === 'function' ? obj.prototype.type : obj.type;
9
if (type && typeof hotfix[type] === 'function') {
10
hotfix[type](obj);
11
}
12
}
13
14
hotfix.version = '3.1.1.2';
15
16
hotfix.WsupInclForm = function (WsupInclForm) {
17
WsupInclForm.prototype.getRecordElements = function getRecordElements(gr) {
18
var fields = portal_utils.getRecordElements(gr, portal_utils.getFieldNames(gr, true));
19
for (var name in fields) {
20
fields[name].displayValue = fields[name].display_value;
21
delete fields[name].display_value;
22
}
23
return fields;
24
};
25
};
26
27
hotfix.portal_utils = function (portal_utils) {
28
portal_utils.getRecordElements = function getRecordElements(table, sys_id, field_names) {
29
var tmp = {}, gr;
30
31
if (table.toString().indexOf('GlideRecord') >= 0) {
32
gr = table;
33
field_names = sys_id;
34
} else {
35
gr = new GlideRecordSecure(table);
36
if (!gr.isValid()) {
37
gs.addErrorMessage('Invalid table: ' + table);
38
return;
39
}
40
if (sys_id == '-1') {
41
gr.initialize();
42
} else if (!gr.get(sys_id)) {
43
gs.addErrorMessage('Invalid sys_id for table ' + table + ':' + sys_id);
44
return;
45
}
46
}
47
48
$sp.getRecordElements(tmp, gr, field_names || portal_utils.getFieldNames(gr));
49
50
for (var name in tmp) {
51
tmp[name].readonly = gr.isValidField(name) ? !gr.getElement(name).canWrite() : false;
52
tmp[name].sys_readonly = tmp[name].readonly;
53
}
54
55
return tmp;
56
};
57
};
58
59
hotfix.Message = function (Message) {
60
Message.prototype.evaluateScript = function evaluateScript(record, element, vars) {
61
var source = vars.source;
62
var result;
63
vars.message = this.getRecord();
64
vars.variables = this.getIntegration().getActiveConnection().getVariables();
65
if (vars.stage) {
66
vars.$stage = vars.stage.$stage;
67
}
68
result = utils.evaluateScript(record, element, vars);
69
70
// UN-1003: reset source - GlideScopedEvaluator changes the GlideRecord object
71
// to ScopedGlideRecord which breaks object equality.
72
if (source && source.$model) {
73
source.$model.setRecord(source);
74
}
75
76
return result;
77
};
78
}
Copied!
Export as PDF
Copy link