// These types of entityRef don't require any input to open
OPEN_IMMEDIATELY = ['RelationshipType', 'Event', 'Group', 'Tag'],
+ // Actions that don't support fancy operators
+ NO_OPERATORS = ['create', 'update', 'delete', 'setvalue', 'getoptions', 'getactions', 'getfields'],
+
// Operators with special properties
BOOL = ['IS NULL', 'IS NOT NULL'],
TEXT = ['LIKE', 'NOT LIKE'],
* @param name
*/
function addField(name) {
- $('#api-params').append($(fieldTpl({name: name || ''})));
+ $('#api-params').append($(fieldTpl({name: name || '', noOps: _.includes(NO_OPERATORS, action)})));
var $row = $('tr:last-child', '#api-params');
$('input.api-param-name', $row).crmSelect2({
data: fields.concat({id: '-', text: ts('Other') + '...', description: ts('Choose a field not in this list')}),
<tr class="api-param-row">
<td><input style="width: 100%;" class="crm-form-text api-param-name api-input" value="<%= name %>" placeholder="{ts}Parameter{/ts}" /></td>
<td>
- <select class="crm-form-select api-param-op">
- {foreach from=$operators item='op'}
- <option value="{$op|htmlspecialchars}">{$op|htmlspecialchars}</option>
- {/foreach}
- </select>
+ {literal}
+ <% if (noOps) { %>
+ <input class="crm-form-text api-param-op" value="=" readonly="true" title="{/literal}{ts}Other operators not available for this action.{/ts}{literal}" />
+ <% } else { %>
+ {/literal}
+ <select class="crm-form-select api-param-op">
+ {foreach from=$operators item='op'}
+ <option value="{$op|htmlspecialchars}">{$op|htmlspecialchars}</option>
+ {/foreach}
+ </select>
+ {literal}
+ <% } %>
+ {/literal}
</td>
<td>
<input style="width: 85%;" class="crm-form-text api-param-value api-input" placeholder="{ts}Value{/ts}"/>