continue;
}
$value = CRM_Core_DAO::VALUE_SEPARATOR . $dao->{$column} . CRM_Core_DAO::VALUE_SEPARATOR;
- $params = array(1 => array((string)$value, 'String'),
+ $params = array(
+ 1 => array((string) $value, 'String'),
2 => array($dao->id, 'Integer'),
);
CRM_Core_DAO::executeQuery($updateSql, $params);
$dao = CRM_Core_DAO::executeQuery($selectSql);
while ($dao->fetch()) {
$values = self::explode($dao->{$column});
- $params = array(1 => array((string)array_shift($values), 'String'),
+ $params = array(
+ 1 => array((string) array_shift($values), 'String'),
2 => array($dao->id, 'Integer'),
);
CRM_Core_DAO::executeQuery($updateSql, $params);
* @param null|string $subName
* @param null|string $subType
* @param null|int $groupCount
- * @param null|String $type
+ * @param string $type
* @param null|int $entityID
* @param null $onlySubType
*
public function preProcess() {
$this->_id = $this->get('id');
-
$defaults = array();
$params = array('id' => $this->_id);
CRM_Core_BAO_CustomField::retrieve($params, $defaults);
if (self::$_dataToLabels == NULL) {
self::$_dataToLabels = array(
- array('Text' => ts('Text'), 'Select' => ts('Select'),
- 'Radio' => ts('Radio'), 'CheckBox' => ts('CheckBox'), 'Multi-Select' => ts('Multi-Select'),
+ array(
+ 'Text' => ts('Text'),
+ 'Select' => ts('Select'),
+ 'Radio' => ts('Radio'),
+ 'CheckBox' => ts('CheckBox'),
+ 'Multi-Select' => ts('Multi-Select'),
'AdvMulti-Select' => ts('Adv Multi-Select (obsolete)'),
'Autocomplete-Select' => ts('Autocomplete-Select'),
),
- array('Text' => ts('Text'), 'Select' => ts('Select'),
+ array(
+ 'Text' => ts('Text'),
+ 'Select' => ts('Select'),
'Radio' => ts('Radio'),
),
- array('Text' => ts('Text'), 'Select' => ts('Select'),
+ array(
+ 'Text' => ts('Text'),
+ 'Select' => ts('Select'),
'Radio' => ts('Radio'),
),
- array('Text' => ts('Text'), 'Select' => ts('Select'),
+ array(
+ 'Text' => ts('Text'),
+ 'Select' => ts('Select'),
'Radio' => ts('Radio'),
),
array('TextArea' => ts('TextArea'), 'RichTextEditor' => ts('Rich Text Editor')),
$optionTypes = array('1' => ts('Create a new set of options'));
}
else {
- $optionTypes = array('1' => ts('Create a new set of options'),
+ $optionTypes = array(
+ '1' => ts('Create a new set of options'),
'2' => ts('Reuse an existing set'),
);
'onclick' => "showOptionSelect();"), '<br/>'
);
-
$contactGroups = CRM_Core_PseudoConstant::group();
asort($contactGroups);
$name = CRM_Utils_String::munge($title, '_', 64);
$gId = $self->_gid; // CRM-7564
$query = 'select count(*) from civicrm_custom_field where ( name like %1 OR label like %2 ) and id != %3 and custom_group_id = %4';
- $fldCnt = CRM_Core_DAO::singleValueQuery($query, array(1 => array($name, 'String'),
+ $fldCnt = CRM_Core_DAO::singleValueQuery($query, array(
+ 1 => array($name, 'String'),
2 => array($title, 'String'),
- 3 => array((int)$self->_id, 'Integer'),
+ 3 => array((int) $self->_id, 'Integer'),
4 => array($gId, 'Integer'),
));
if ($fldCnt) {
$title = $fields['title'];
$name = CRM_Utils_String::munge($title, '_', 64);
$query = 'select count(*) from civicrm_custom_group where ( name like %1 OR title like %2 ) and id != %3';
- $grpCnt = CRM_Core_DAO::singleValueQuery($query, array(1 => array($name, 'String'),
+ $grpCnt = CRM_Core_DAO::singleValueQuery($query, array(
+ 1 => array($name, 'String'),
2 => array($title, 'String'),
- 3 => array((int)$self->_id, 'Integer'),
+ 3 => array((int) $self->_id, 'Integer'),
));
if ($grpCnt) {
$errors['title'] = ts('Custom group \'%1\' already exists in Database.', array(1 => $title));
}
if (!empty($fields['is_multiple'])) {
- $self->assign('showMultiple', TRUE);
+ $self->assign('showMultiple', TRUE);
}
if (empty($fields['is_multiple']) && $fields['style'] == 'Tab with table') {
)
);
-
// if view mode pls freeze it with the done button.
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
public function buildQuickForm() {
parent::buildQuickForm();
$this->addFormRule(array('CRM_Custom_Import_Form_MapField', 'formRule'));
- }
+ }
/**
* Global validation rules for the form
fclose($fd);
-
if ($mode == self::MODE_PREVIEW || $mode == self::MODE_IMPORT) {
$customHeaders = $mapper;
* @see CRM_Custom_Import_Parser_BaseClass::summary()
*/
public function summary(&$values) {
- $erroneousField = NULL;
- $response = $this->setActiveFieldValues($values, $erroneousField);
- $errorRequired = FALSE;
- $missingField = '';
- $this->_params = &$this->getActiveFieldParams();
-
- $formatted = $this->_params;
- $this->_updateWithId = FALSE;
- $this->_parseStreetAddress = CRM_Utils_Array::value('street_address_parsing', CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'address_options'), FALSE);
-
- $this->_params = $this->getActiveFieldParams();
- foreach ($this->_requiredFields as $requiredField) {
- if (empty($this->_params[$requiredField])) {
- $errorRequired = TRUE;
- $missingField .= ' ' . $requiredField;
- CRM_Contact_Import_Parser_Contact::addToErrorMsg($this->_entity, $requiredField);
- }
- }
-
- if ($errorRequired) {
- array_unshift($values, ts('Missing required field(s) :') . $missingField);
- return CRM_Import_Parser::ERROR;
- }
-
- $errorMessage = NULL;
-
- $contactType = $this->_contactType ? $this->_contactType : 'Organization';
- CRM_Contact_Import_Parser_Contact::isErrorInCustomData($this->_params , $errorMessage, $contactType, NULL);
-
- // pseudoconstants
- if ($errorMessage) {
- $tempMsg = "Invalid value for field(s) : $errorMessage";
- array_unshift($values, $tempMsg);
- $errorMessage = NULL;
- return CRM_Import_Parser::ERROR;
- }
- return CRM_Import_Parser::VALID;
+ $erroneousField = NULL;
+ $response = $this->setActiveFieldValues($values, $erroneousField);
+ $errorRequired = FALSE;
+ $missingField = '';
+ $this->_params = &$this->getActiveFieldParams();
+
+ $formatted = $this->_params;
+ $this->_updateWithId = FALSE;
+ $this->_parseStreetAddress = CRM_Utils_Array::value('street_address_parsing', CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'address_options'), FALSE);
+
+ $this->_params = $this->getActiveFieldParams();
+ foreach ($this->_requiredFields as $requiredField) {
+ if (empty($this->_params[$requiredField])) {
+ $errorRequired = TRUE;
+ $missingField .= ' ' . $requiredField;
+ CRM_Contact_Import_Parser_Contact::addToErrorMsg($this->_entity, $requiredField);
+ }
+ }
+
+ if ($errorRequired) {
+ array_unshift($values, ts('Missing required field(s) :') . $missingField);
+ return CRM_Import_Parser::ERROR;
+ }
+
+ $errorMessage = NULL;
+
+ $contactType = $this->_contactType ? $this->_contactType : 'Organization';
+ CRM_Contact_Import_Parser_Contact::isErrorInCustomData($this->_params, $errorMessage, $contactType, NULL);
+
+ // pseudoconstants
+ if ($errorMessage) {
+ $tempMsg = "Invalid value for field(s) : $errorMessage";
+ array_unshift($values, $tempMsg);
+ $errorMessage = NULL;
+ return CRM_Import_Parser::ERROR;
+ }
+ return CRM_Import_Parser::VALID;
}
/**
$formatted['id'] = $this->_params['contact_id'];
$setDateFields = array_intersect_key($this->_params, array_flip($this->_dateFields));
- CRM_Contact_Import_Parser_Contact::formatCommonData($this->_params, $formatted, $formatted) ;
+ CRM_Contact_Import_Parser_Contact::formatCommonData($this->_params, $formatted, $formatted);
foreach($formatted['custom'] as $key => $val) {
$this->_params['custom_'.$key] = $val[-1]['value'];
}
*
* @return void
*/
- public function fini() {}
+ public function fini() {
+ }
/**
* Return the field ids and names (with groups) for import purpose.
*
* @static
*/
- public function getGroupFieldsForImport( $id ) {
+ public function getGroupFieldsForImport($id) {
$importableFields = array();
$params = array('custom_group_id' => $id);
$allFields = civicrm_api3('custom_field', 'get', $params);
*/
public function run() {
-
$id = CRM_Utils_Request::retrieve('id', 'Positive',
$this, FALSE, 0
);
$subTypes = array();
$subTypes['Activity'] = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
- $subTypes['Contribution'] = CRM_Contribute_PseudoConstant::financialType( );
+ $subTypes['Contribution'] = CRM_Contribute_PseudoConstant::financialType( );
$subTypes['Membership'] = CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE);
$subTypes['Event'] = CRM_Core_OptionGroup::values('event_type');
$subTypes['Grant'] = CRM_Core_OptionGroup::values('grant_type');
$subTypes['Household'] = CRM_Contact_BAO_ContactType::subTypePairs('Household', FALSE, NULL);
$subTypes['Organization'] = CRM_Contact_BAO_ContactType::subTypePairs('Organization', FALSE, NULL);
-
$relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Individual');
$relTypeOrg = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Organization');
$relTypeHou = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Household');
SELECT id, label
FROM civicrm_custom_field
WHERE option_group_id = %1";
- $params = array(1 => array($optionGroupID, 'Integer'),
+ $params = array(
+ 1 => array($optionGroupID, 'Integer'),
2 => array($this->_fid, 'Integer'),
);
$dao = CRM_Core_DAO::executeQuery($query, $params);
}
//as url contain $gid so append breadcrumb dynamically.
- $breadcrumb = array(array('title' => ts('Custom Data Fields'),
+ $breadcrumb = array(array(
+ 'title' => ts('Custom Data Fields'),
'url' => CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&gid=' . $this->_gid),
));
CRM_Utils_System::appendBreadCrumb($breadcrumb);
$this, FALSE, 0
);
-
// what action to take ?
- if (($action &
- (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD |
+ if (($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD |
CRM_Core_Action::VIEW | CRM_Core_Action::DELETE
)
) ||