Skip to content
Snippets Groups Projects
Commit 57465e2a authored by eileen's avatar eileen
Browse files

CRM-13148 minor tidy up - remove smarty from js

parent 4bb1fa8a
Branches
Tags
No related merge requests found
......@@ -100,7 +100,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
$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
......@@ -206,7 +206,9 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
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);
......@@ -217,7 +219,11 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
}
$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');
......
......@@ -174,28 +174,12 @@ function updateContactInfo(blockNo, prefix) {
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment