$groupID = NULL,
$subType = NULL,
$subName = NULL,
- $fromCache = TRUE
+ $fromCache = TRUE,
+ $onlySubType = NULL
) {
if ($entityID) {
$entityID = CRM_Utils_Type::escape($entityID, 'Integer');
$subTypePart = CRM_Core_DAO::VALUE_SEPARATOR . trim($subTypePart, CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
$subTypeClauses[] = "civicrm_custom_group.extends_entity_column_value LIKE '%$subTypePart%'";
}
- $subTypeClause = '(' . implode(' OR ', $subTypeClauses) . " OR civicrm_custom_group.extends_entity_column_value IS NULL )";
+
+ if ($onlySubType) {
+ $subTypeClause = '(' . implode(' OR ', $subTypeClauses) . ')';
+ }
+ else {
+ $subTypeClause = '(' . implode(' OR ', $subTypeClauses) . " OR civicrm_custom_group.extends_entity_column_value IS NULL )";
+ }
}
else {
$subType = CRM_Core_DAO::VALUE_SEPARATOR . trim($subType, CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
- $subTypeClause = "( civicrm_custom_group.extends_entity_column_value LIKE '%$subType%'
- OR civicrm_custom_group.extends_entity_column_value IS NULL )";
+ if ($onlySubType) {
+ $subTypeClause = "( civicrm_custom_group.extends_entity_column_value LIKE '%$subType%' )";
+ }
+ else {
+ $subTypeClause = "( civicrm_custom_group.extends_entity_column_value LIKE '%$subType%'
+ OR civicrm_custom_group.extends_entity_column_value IS NULL )";
+ }
}
$strWhere = "
* @return void
*/
static function preProcess(&$form, $subName = NULL, $subType = NULL,
- $groupCount = NULL, $type = NULL, $entityID = NULL
+ $groupCount = NULL, $type = NULL, $entityID = NULL, $onlySubType = NULL
) {
if ($type) {
$form->_type = $type;
$gid,
$subType,
$form->_subName,
- $getCachedTree
+ $getCachedTree,
+ $onlySubType
);
if (property_exists($form, '_customValueCount') && !empty($groupTree)) {
$this->assign('cdType', FALSE);
if ($this->_cdType) {
$this->assign('cdType', TRUE);
- return CRM_Custom_Form_CustomData::preProcess($this);
+ return CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, NULL, NULL, NULL, TRUE);
}
//check the mode when this form is called either single or as
}
loadData = true;
}
-
- if ( loadData && roleGroupMapper[0] ) {
- var splitGroup = roleGroupMapper[0].split(",");
- for ( i = 0; i < splitGroup.length; i++ ) {
- var roleCustomGroupId = splitGroup[i];
- if ( cj( '#'+roleCustomGroupId ).length > 0 ) {
- cj( '#'+roleCustomGroupId ).remove( );
- }
- }
- }
}
else {
var groupUnload = new Array( );
$this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl);
}
+ /*
+ * Webtest for CRM-10983
+ *
+ */
+ function testCheckDuplicateCustomDataLoad() {
+ $this->webtestLogin();
+
+ $customSets = array(
+ array('entity' => 'ParticipantEventType', 'subEntity' => '- Any -',
+ 'triggerElement' => array('name' => "event_id", 'type' => "select")),
+ array('entity' => 'ParticipantEventName', 'subEntity' => '- Any -',
+ 'triggerElement' => array('name' => "event_id", 'type' => "select")),
+ array('entity' => 'ParticipantEventName', 'subEntity' => 'Rain-forest Cup Youth Soccer Tournament',
+ 'triggerElement' => array('name' => "event_id", 'type' => "select")),
+ array('entity' => 'ParticipantRole', 'subEntity' => '- Any -','triggerElement' => array('type' => "checkbox")),
+ array('entity' => 'ParticipantRole', 'subEntity' => 'Volunteer','triggerElement' => array('type' => "checkbox"))
+ );
+
+ $return = $this->addCustomGroupField($customSets);
+
+ $this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom");
+
+ // Select event.
+ $this->select('event_id', "label=regexp:Rain-forest Cup Youth Soccer Tournament.");
+
+ // Select role.
+ $this->click('role_id[2]');
+
+ foreach($return as $values) {
+ foreach ($values as $entityType => $customData) {
+ //checking for duplicate custom data present or not
+ $this->assertElementPresent("xpath=//div[@id='{$customData['cgtitle']}'][@class='crm-accordion-wrapper ']");
+ $this->assertEquals(1, $this->getXpathCount("//div[@id='{$customData['cgtitle']}'][@class='crm-accordion-wrapper ']"));
+ }
+ }
+ }
+
function _fillParticipantDetails($firstName, $lastName, $processorId) {
$this->select("id=profiles_1", "label=New Individual");
$this->waitForElementPresent('_qf_Edit_next');