<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
* This function provides the HTML form elements that are specific
* to the Individual Contact Type
*
- * @param object $form form object
+ * @param CRM_Core_Form $form form object
* @param int $inlineEditMode ( 1 for contact summary
* top bar form and 2 for display name edit )
*
//prefix
$prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
if (isset($nameFields['Prefix']) && !empty($prefix)) {
- $form->addElement('select', 'prefix_id', ts('Prefix'), array('' => '') + $prefix);
+ $form->addSelect('prefix_id', array('class' => 'eight', 'placeholder' => ' ', 'label' => ts('Prefix')));
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
// suffix
$suffix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id');
if (isset($nameFields['Suffix']) && $suffix) {
- $form->addElement('select', 'suffix_id', ts('Suffix'), array('' => '') + $suffix);
+ $form->addSelect('suffix_id', array('class' => 'eight', 'placeholder' => ' ', 'label' => ts('Suffix')));
}
}
$form->addElement('text', 'job_title', ts('Job Title'), $attributes['job_title'], 'size="30"');
//Current Employer Element
- $employerDataURL = CRM_Utils_System::url('civicrm/ajax/rest', 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=contact&org=1&employee_id=' . $form->_contactId, FALSE, NULL, FALSE);
- $form->assign('employerDataURL', $employerDataURL);
-
- $form->addElement('text', 'current_employer', ts('Current Employer'), '');
- $form->addElement('hidden', 'current_employer_id', '', array('id' => 'current_employer_id'));
+ $props = array(
+ 'api' => array('params' => array('contact_type' => 'Organization')),
+ 'create' => TRUE,
+ );
+ $form->addEntityRef('employer_id', ts('Current Employer'), $props);
+ $attributes['source']['class'] = 'big';
$form->addElement('text', 'contact_source', ts('Source'), CRM_Utils_Array::value('source', $attributes));
}
/**
* global form rule
*
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
- * @param array $options additional user data
+ * @param array $fields the input form values
+ * @param array $files the uploaded files if any
+ * @param null $contactID
+ *
+ * @internal param array $options additional user data
*
* @return true if no errors, else array of errors
* @access public
$primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID);
// make sure that firstName and lastName or a primary OpenID is set
- if (!$primaryID && (!CRM_Utils_Array::value('first_name', $fields) ||
- !CRM_Utils_Array::value('last_name', $fields)
- )) {
+ if (!$primaryID && (empty($fields['first_name']) || empty($fields['last_name']))) {
$errors['_qf_default'] = ts('First Name and Last Name OR an email OR an OpenID in the Primary Location should be set.');
}