$form->add('text', 'city', ts('City'), $attributes['city']);
$form->add('text', 'postal_code', ts('Zip / Postal Code'), $attributes['postal_code']);
- $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
+ //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
+ // this is loaded onto then replace with something like '__' & test
+ $separator = CRM_Core_DAO::VALUE_SEPARATOR;
+ $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
$form->add('select', 'contact_type', ts('Contact Type(s)'), $contactTypes, FALSE,
array('id' => 'contact_type', 'multiple' => 'multiple', 'class' => 'crm-select2')
);
return !$delimiter ? $pairs : implode($delimiter, $pairs);
}
- static function &getSelectElements($all = FALSE,
- $isSeperator = TRUE,
- $seperator = CRM_Core_DAO::VALUE_SEPARATOR
+ /**
+ * Get a list of elements for select box
+ * Note that this used to default to using the hex(01) character - which results in an invalid character being used in form fields
+ * which was not handled well be anything that loaded & resaved the html (outside core)
+ * The use of this separator is now explicit in the calling functions as a step towards it's removal
+ *
+ * @param bool $all
+ * @param bool $isSeparator
+ * @param string $separator
+ *
+ * @return mixed
+ */
+ static function getSelectElements($all = FALSE,
+ $isSeparator = TRUE,
+ $separator = '__'
) {
static $_cache = NULL;
}
$argString = $all ? 'CRM_CT_GSE_1' : 'CRM_CT_GSE_0';
- $argString .= $isSeperator ? '_1' : '_0';
+ $argString .= $isSeparator ? '_1' : '_0';
if (!array_key_exists($argString, $_cache)) {
$cache = CRM_Utils_Cache::singleton();
$_cache[$argString] = $cache->get($argString);
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
if (!empty($dao->parent_id)) {
- $key = $isSeperator ? $dao->parent_name . $seperator . $dao->child_name : $dao->child_name;
+ $key = $isSeparator ? $dao->parent_name . $separator . $dao->child_name : $dao->child_name;
$label = "- {$dao->child_label}";
$pName = $dao->parent_name;
}
*/
static function getCreateNewList() {
$shortCuts = array();
- $contactTypes = self::getSelectElements();
+ //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
+ // this is loaded onto then replace with something like '__' & test
+ $separator = CRM_Core_DAO::VALUE_SEPARATOR;
+ $contactTypes = self::getSelectElements(FALSE, TRUE, $separator);
foreach ($contactTypes as $key => $value) {
if ($key) {
$typeValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $key);
'advanced_search_options'
);
+ $shortCuts = array();
+ //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
+ // this is loaded onto then replace with something like '__' & test
+ $separator = CRM_Core_DAO::VALUE_SEPARATOR;
if (!empty($searchOptions['contactType'])) {
- $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements();
+ $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
$this->add('select', 'contact_type',
ts('is...'),
$contactTypes,
if ($form->_searchOptions['contactType']) {
// add checkboxes for contact type
- $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
+ //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
+ // this is loaded onto then replace with something like '__' & test
+ $separator = CRM_Core_DAO::VALUE_SEPARATOR;
+ $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
if ($contactTypes) {
$form->add('select', 'contact_type', ts('Contact Type(s)'), $contactTypes, FALSE,
}
function buildForm(&$form) {
- $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements();
+ //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
+ // this is loaded onto then replace with something like '__' & test
+ $separator = CRM_Core_DAO::VALUE_SEPARATOR;
+ $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
$form->add('select', 'contact_type', ts('Find...'), $contactTypes);
// add select for groups
$form->add('text', 'sort_name', ts('Contact Name'), TRUE);
// add select for contact type
- $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements();
+ //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
+ // this is loaded onto then replace with something like '__' & test
+ $separator = CRM_Core_DAO::VALUE_SEPARATOR;
+ $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
$form->add('select', 'contact_type', ts('Find...'), $contactTypes);
// add select for groups
$object->orderBy($key . ' asc');
}
-
- $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
+ //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
+ // this is loaded onto then replace with something like '__' & test
+ $separator = CRM_Core_DAO::VALUE_SEPARATOR;
+ $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
// find all objects
$object->find();
while ($object->fetch()) {