public function postProcess() {
CRM_Utils_System::flushCache();
- $params = $this->exportValues();
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Core_BAO_OptionGroup::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected option group has been deleted.'), ts('Record Deleted'), 'success');
}
else {
-
- $params = $ids = array();
// store the submitted values in an array
$params = $this->exportValues();
+ // If we are adding option group via UI it should not be marked reserved.
+ if (!isset($params['is_reserved'])) {
+ $params['is_reserved'] = 0;
+ }
+
if ($this->_action & CRM_Core_Action::UPDATE) {
- $ids['optionGroup'] = $this->_id;
+ $params['id'] = $this->_id;
}
- $optionGroup = CRM_Core_BAO_OptionGroup::add($params, $ids);
+ $optionGroup = CRM_Core_BAO_OptionGroup::add($params);
CRM_Core_Session::setStatus(ts('The Option Group \'%1\' has been saved.', array(1 => $optionGroup->name)), ts('Saved'), 'success');
}
}
{if $rows}
<div id="browseValues">
- {strip}
+ {if $action ne 1 and $action ne 2}
+ <div class="action-link">
+ {crmButton q="action=add&reset=1" id="newOptionGroup" icon="plus-circle"}{ts}Add Option Group{/ts}{/crmButton}
+ {crmButton p="civicrm/admin" q="reset=1" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
+ </div>
+ {/if}
+
+ {strip}
{* handle enable/disable actions*}
{include file="CRM/common/enableDisableApi.tpl"}
<table cellpadding="0" cellspacing="0" border="0">
<tr class="columnheader">
- <th>{ts}Title{/ts}</th>
- <th>{ts}Name{/ts}</th>
- <th></th>
+ <th>{ts}Title{/ts}</th>
+ <th>{ts}Name{/ts}</th>
+ <th>{ts}Reserved{/ts}</th>
+ <th>{ts}Enabled?{/ts}</th>
+ <th></th>
</tr>
{foreach from=$rows item=row}
- <tr id="optionGroup-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
- <td class="crm-admin-optionGroup-title">{if $row.title}{$row.title}{else}( {ts}none{/ts} ){/if}</td>
- <td class="crm-admin-optionGroup-name">{$row.name}</td>
- <td><a href="{crmURL p="civicrm/admin/options" q="gid=`$row.id`&reset=1"}" title="{ts}View and Edit Options{/ts}">{ts}Options{/ts}</a></td>
+ <tr id="optionGroup-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
+ <td class="crm-admin-optionGroup-title">{if $row.title}{$row.title}{else}( {ts}none{/ts} ){/if}</td>
+ <td class="crm-admin-optionGroup-name">{$row.name}</td>
+ <td class="crm-admin-optionGroup-is_reserved">{if $row.is_reserved eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
+ <td class="crm-admin-optionGroup-is_active" id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
+ <td><a href="{crmURL p="civicrm/admin/options" q="gid=`$row.id`&reset=1"}" title="{ts}View and Edit Options{/ts}">{ts}Options{/ts}</a></td>
</tr>
{/foreach}
</table>
<div class="action-link">
{crmButton q="action=add&reset=1" id="newOptionGroup" icon="plus-circle"}{ts}Add Option Group{/ts}{/crmButton}
{crmButton p="civicrm/admin" q="reset=1" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
- </div>
+ </div>
{/if}
</div>
-{elseif $action NEQ 1 && $action NEQ 2}
+{elseif $action ne 1 and $action ne 2}
<div class="messages status no-popup">
<img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"/>
{capture assign=crmURL}{crmURL p='civicrm/admin/optionGroup' q="action=add&reset=1"}{/capture}