Hotfixes

Unifi can be patched between releases by using a special Script Include called hotfix. This page contains any hotfixes that have been made for this version. Follow the instructions to apply them.

If you find a bug in Unifi we may issue a hotfix so you can get the features you need without having to upgrade.

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.

/**
* Executes a child function corresponding to the object's type property.
* The object is passed to the child function so methods and properties can be overridden.
*
* @param {Object} obj The full class object to be patched.
*/
function hotfix(obj) {
var type = typeof obj === 'function' ? obj.prototype.type : obj.type;
if (type && typeof hotfix[type] === 'function') {
hotfix[type](obj);
}
}
hotfix.version = '2.2.1.3';
hotfix.EventAction = function (EventAction) {
/**
* Process this Event action given the current record
* @param {[type]} current [description]
* @return {[type]} [description]
*/
EventAction.prototype.process = function process(current) {
// Check if we have condition script, and if so does it match?
if (this.isAdvanced() && !this._runScript('condition_script', { current: current })) {
return;
}
// Check condition filter against the given table, and check if it matches
// the limit
if (!this.isAdvanced() && !this.doesTriageFilterMatch()) {
return;
}
// If either of the above match, run the action script
this._runScript('action_script', { current: current });
};
/**
* Runs the Event Actions filter against its table and checks with the limit field
* to determine if the threshold has been met.
*
* @return {Boolean}
*/
EventAction.prototype.doesTriageFilterMatch = function doesTriageFilterMatch() {
var ga,
count;
// If we do not have a table then we cannot run the filter, detaults to a correct match
if (this.getValue('table') == null) {
ws_console.debug('Table not found, triage matches');
return true;
}
ga = new GlideAggregate(this.getValue('table'));
ga.addEncodedQuery(this.getValue('filter'));
ga.addAggregate('COUNT');
ws_console.logQuery(ga);
count = ga.next() ? ga.getAggregate('COUNT') : 0;
ws_console.debug('Record count is %0', [count]);
return (count >= this.getValue('limit'));
};
/**
* Finds all active event actions that match the given criteria. Each matching Event Action
* is then process to ascertain whether the action should be executed or not, i.e.
* if the conditions have been met.
*
* @param {String} event Event name to find Event Actions for
* @param {GlideRecord} current The GlideRecord that this event was triggered for
* @param {String} integration Integration sys_id
* @param {String} message Message sys_id
*/
EventAction.process = function process(event, current, integration, message) {
var gr,
query = [],
config = new Process().getConfig();
gr = new GlideRecord('x_snd_eb_event_action');
gr.addQuery('event', '=', event);
gr.addQuery('active', '=', 'true');
if (integration) {
query.push('integration=' + integration);
query.push('ORintegrationISEMPTY');
if (message) {
query.push('message=' + message);
query.push('ORmessageISEMPTY');
} else {
query.push('messageISEMPTY');
}
} else {
query.push('integrationISEMPTY');
}
gr.addEncodedQuery(query.join('^'));
gr.orderByDesc('integration');
gr.orderByDesc('message');
ws_console.logQuery(gr);
while(gr.next()) {
new EventAction(config, gr).process(current);
}
};
};
hotfix.Transaction = function (Transaction) {
// Fix transaction/bond domains for inbound create messages
Transaction.prototype.setBond = function setBond(bond) {
this.bond = bond;
this.setValue('bond', bond.getValue('sys_id'));
// The bond will be created in global so we should update it to match
// incoming transactions which are created in the domain of the integration user .
if (bond.getValue('sys_domain') == 'global' && bond.isNew() && this.getValue('direction') == 'Inbound') {
bond.setValue('sys_domain', this.getValue('sys_domain'));
}
this.setValue('sys_domain', bond.getValue('sys_domain'));
};
};