$params = array('id' => $this->_batchId);
CRM_Batch_BAO_Batch::retrieve($params, $this->_batchInfo);
- $this->assign('batchTotal', $this->_batchInfo['total']);
+ $this->assign('batchTotal', !empty($this->_batchInfo['total']) ? $this->_batchInfo['total'] : NULL);
$this->assign('batchType', $this->_batchInfo['type_id']);
// get the profile id associted with this batch type
foreach ($this->_fields as $name => $field) {
if (in_array($field['field_type'], $contactTypes)) {
- $this->_contactFields[$field['name']] = 1;
+ $fld = explode('-', $field['name']);
+ $contactReturnProperties[] = $fld[0];
+ $contactFieldMap[$fld[0]] = $field['name'];
}
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, NULL, FALSE, FALSE, $rowNumber);
}
$this->assign('fields', $this->_fields);
- $this->assign('contactFields', $this->_contactFields);
+ CRM_Core_Resources::singleton()
+ ->addSetting(array('contact' => array(
+ 'return' => implode(',', $contactReturnProperties),
+ 'fieldmap' => $contactFieldMap,
+ )));
// don't set the status message when form is submitted.
$buttonName = $this->controller->getButtonName('submit');
var contactHiddenElement = 'input[name="' + prefix + 'contact_select_id[' + blockNo + ']"]';
var contactId = cj(contactHiddenElement).val();
- var returnProperties = '';
- var profileFields = new Array();
- {/literal}
- {if $contactFields}
- {foreach from=$contactFields item=val key=fldName}
- var fldName = "{$fldName}";
- {literal}
- if (returnProperties) {
- returnProperties = returnProperties + ',';
- }
- var fld = fldName.split('-');
- returnProperties = returnProperties + fld[0];
- profileFields[fld[0]] = fldName;
- {/literal}
- {/foreach}
- {/if}
- {literal}
+ var profileFields = CRM.contact.fieldmap;
CRM.api('Contact', 'get', {
'sequential': '1',
'contact_id': contactId,
- 'return': returnProperties },
+ 'return': CRM.contact.return },
{ success: function (data) {
cj.each(data.values[0], function (key, value) {
// set the values