$fns[] = [
'name' => $className::getName(),
'title' => $className::getTitle(),
+ 'description' => $className::getDescription(),
'params' => $className::getParams(),
'category' => $className::getCategory(),
'dataType' => $className::getDataType(),
*/
abstract public static function getTitle(): string;
+ /**
+ * @return string
+ */
+ abstract public static function getDescription(): string;
+
}
* @return string
*/
public static function getTitle(): string {
- return ts('Absolute');
+ return ts('Absolute value');
+ }
+
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The positive value of a number.');
}
}
return ts('Average');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The mean of all values in the grouping.');
+ }
+
}
return ts('Binary');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Case-sensitive string treatment.');
+ }
+
}
return ts('Coalesce');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The first value that is not null.');
+ }
+
}
* @return string
*/
public static function getTitle(): string {
- return ts('Combine');
+ return ts('Combine text');
+ }
+
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Multiple values concatenated into a single string.');
}
}
return ts('Count');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The number of items in the grouping.');
+ }
+
}
return ts('Now');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The current date.');
+ }
+
}
* @return string
*/
public static function getTitle(): string {
- return ts('Date Only');
+ return ts('Date only');
+ }
+
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Only the date portion of a date/time.');
}
}
return ts('Greatest');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The largest of all provided values.');
+ }
+
}
return ts('List');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('All values in the grouping.');
+ }
+
}
* @return string
*/
public static function getTitle(): string {
- return ts('If');
+ return ts('If/Else');
+ }
+
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('If the field is empty, the first value, otherwise the second.');
}
}
return ts('Is null');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('TRUE if the value is NULL, otherwise FALSE.');
+ }
+
}
return ts('Least');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The smallest of all provided values.');
+ }
+
}
return ts('Lowercase');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Lowercase version of text.');
+ }
+
}
return ts('Max');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The largest value in the grouping.');
+ }
+
}
return ts('Min');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The smallest value in the grouping.');
+ }
+
}
* @return string
*/
public static function getTitle(): string {
- return ts('Null if');
+ return ts('Unequal');
+ }
+
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The first value, only if it is not equal to the second.');
}
}
* @return string
*/
public static function getTitle(): string {
- return ts('Random Number');
+ return ts('Random number');
+ }
+
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Generates a random number between 0 and 1.');
}
}
'min_expr' => 3,
'max_expr' => 3,
'optional' => FALSE,
- 'must_be' => ['SqlField', 'SqlString'],
+ 'must_be' => ['SqlString', 'SqlField'],
],
];
}
* @return string
*/
public static function getTitle(): string {
- return ts('Replace');
+ return ts('Replace text');
+ }
+
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Substitutes one value for another in the text.');
}
}
return [
[
'optional' => FALSE,
- 'must_be' => ['SqlField', 'SqlNumber'],
- ],
- [
- 'optional' => TRUE,
- 'must_be' => ['SqlNumber'],
+ 'min_expr' => 1,
+ 'max_expr' => 2,
+ 'must_be' => ['SqlNumber', 'SqlField'],
],
];
}
return ts('Round');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Number rounded to specified number of decimal places.');
+ }
+
}
return ts('Sum');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('The sum of all values in the grouping.');
+ }
+
}
* @return string
*/
public static function getTitle(): string {
- return ts('Time Only');
+ return ts('Time only');
+ }
+
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Only the time portaion of a date/time.');
}
}
return ts('Uppercase');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Uppercase version of text.');
+ }
+
}
return ts('Year Only');
}
+ /**
+ * @return string
+ */
+ public static function getDescription(): string {
+ return ts('Only the year of a date.');
+ }
+
}
children: _.transform(CRM.vars.api4.functions, function(result, fn) {
result.push({
id: fn.name + '() AS ' + fn.name.toLowerCase(),
- text: fn.name + '()',
- description: fn.name + '(' + describeSqlFn(fn.params) + ')'
+ description: fn.description,
+ text: fn.name + '(' + describeSqlFn(fn.params) + ')'
});
})
};
var desc = ' ';
_.each(params, function(param) {
desc += ' ';
- if (param.prefix) {
- desc += _.filter(param.prefix).join('|') + ' ';
+ if (param.name) {
+ desc += param.name + ' ';
}
- if (param.expr === 1) {
+ if (!_.isEmpty(param.flag_before)) {
+ desc += '[' + _.filter(param.name ? [param.name] : _.keys(param.flag_before)).join('|') + '] ';
+ }
+ if (param.max_expr === 1) {
desc += 'expr ';
- } else if (param.expr > 1) {
+ } else if (param.max_expr > 1) {
desc += 'expr, ... ';
}
- if (param.suffix) {
- desc += ' ' + _.filter(param.suffix).join('|') + ' ';
+ if (!_.isEmpty(param.flag_after)) {
+ desc += ' [' + _.filter(param.flag_after).join('|') + '] ';
}
});
return desc.replace(/[ ]+/g, ' ');
});
functions.push({
text: allTypes[type],
- children: formatForSelect2(allowedFunctions, 'name', 'title')
+ children: formatForSelect2(allowedFunctions, 'name', 'title', ['description'])
});
});
}