From 609c59962ccdf3298a44b184d707257c6594d2b6 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 22 May 2013 17:41:07 -0500 Subject: [PATCH] Remove NYSS module CRM-9794 ---------------------------------------- * CRM-9794: http://issues.civicrm.org/jira/browse/CRM-9794 --- .../modules/civicrm_NYSS/civicrm_NYSS.info | 6 - .../modules/civicrm_NYSS/civicrm_NYSS.module | 173 ------------------ .../civicrm_NYSS/sql/civicrm_NYSS.mysql | 7 - 3 files changed, 186 deletions(-) delete mode 100644 tools/drupal/modules/civicrm_NYSS/civicrm_NYSS.info delete mode 100644 tools/drupal/modules/civicrm_NYSS/civicrm_NYSS.module delete mode 100644 tools/drupal/modules/civicrm_NYSS/sql/civicrm_NYSS.mysql diff --git a/tools/drupal/modules/civicrm_NYSS/civicrm_NYSS.info b/tools/drupal/modules/civicrm_NYSS/civicrm_NYSS.info deleted file mode 100644 index 4feec7f816..0000000000 --- a/tools/drupal/modules/civicrm_NYSS/civicrm_NYSS.info +++ /dev/null @@ -1,6 +0,0 @@ -name = CiviCRM NYSS -description = "Do not allow user to edit the addresses of location type 'Board Of Election' through contact edit form" -dependencies[] = civicrm -package = CiviCRM -core = 6.x -version = 3.4 diff --git a/tools/drupal/modules/civicrm_NYSS/civicrm_NYSS.module b/tools/drupal/modules/civicrm_NYSS/civicrm_NYSS.module deleted file mode 100644 index fa96579f25..0000000000 --- a/tools/drupal/modules/civicrm_NYSS/civicrm_NYSS.module +++ /dev/null @@ -1,173 +0,0 @@ - 'email', - 'Phone' => 'phone', - 'IM' => 'im', - 'OpenID' => 'openid', - 'Address' => 'address', - ); - - $blockId = CRM_Utils_Request::retrieve('count', 'Positive', CRM_Core_DAO::$_nullObject); - $blockName = CRM_Utils_Request::retrieve('block', 'String', CRM_Core_DAO::$_nullObject); - $values = $form->_values; - if (!empty($_POST)) { - $values = $_POST; - } - - $locationTypes = CRM_Core_PseudoConstant::locationType(); - $boardOfElectionId = CRM_Utils_Array::key('BOE', $locationTypes); - - $addressOptions = $form->get('addressOptions'); - if (!isset($addressOptions)) { - $addressOptions = CRM_Core_BAO_Preferences::valueOptions('address_options', TRUE, NULL, TRUE); - $form->set('addressOptions', $addressOptions); - } - - //its a first block. - if (!$blockId) { - $blockId = 1; - } - foreach ($blocks as $label => $name) { - if (($blockId != 1) && ($blockName != $label)) { - continue; - } - $freezeElement = $unsetOption = FALSE; - if (CRM_Utils_Array::value($name, $values) && is_array($values[$name]) && - $boardOfElectionId == CRM_Utils_Array::value('location_type_id', - $values[$name][$blockId] - ) - ) { - $freezeElement = TRUE; - } - else { - $unsetOption = TRUE; - } - - if ($name == 'address') { - foreach ($addressOptions as $key => $value) { - if (empty($value)) { - continue; - } - if (in_array($key, array('country', 'state_province')) && $freezeElement) { - $key .= '_id'; - - //we might registered duplicate elements. - if ($key == 'state_province_id') { - if (array_key_exists("address[$blockId][$key]", $form->_duplicateIndex)) { - $duplicateIndexes = $form->_duplicateIndex["address[$blockId][$key]"]; - foreach ($duplicateIndexes as $index) { - $element = $form->_elements[$index]; - $element->freeze(); - } - } - } - } - - //process address data element. - _civicrm_processElement($form, "address[$blockId][$key]", $freezeElement); - } - //hide 'Use Household Address' if location type is 'Board Of Election' - if ($blockId == 1 && $freezeElement) { - $form->removeElement("use_household_address"); - } - } - else { - $dataElementName = "{$name}[$blockId][$name]"; - if ($name == 'im') { - $dataElementName = "{$name}[$blockId][name]"; - _civicrm_processElement($form, "{$name}[$blockId][provider_id]", $freezeElement); - } - elseif ($name == 'phone') { - _civicrm_processElement($form, "{$name}[$blockId][phone_type_id]", $freezeElement); - } - - //process data element. - _civicrm_processElement($form, $dataElementName, $freezeElement); - } - - //process loc type element. - _civicrm_processElement($form, "{$name}[$blockId][location_type_id]", $freezeElement, $unsetOption); - } - } -} - -/** - * process the elements on the form - * - * @return void - * @access public - */ -function _civicrm_processElement(&$form, $elementName, $freezeElement = FALSE, $unsetOption = FALSE) { - if (!$form->elementExists($elementName)) { - return FALSE; - } - - $element = $form->getElement($elementName); - if ($freezeElement) { - $element->freeze(); - } - - if ($unsetOption) { - foreach ($element->_options as $index => $options) { - if ($options['text'] != 'BOE' && - $options['text'] != 'Billing' && - $options['text'] != 'NCOA' - ) { - $newOptions[] = $element->_options[$index]; - } - } - - $element->_options = $newOptions; - } -} - diff --git a/tools/drupal/modules/civicrm_NYSS/sql/civicrm_NYSS.mysql b/tools/drupal/modules/civicrm_NYSS/sql/civicrm_NYSS.mysql deleted file mode 100644 index 353c99d920..0000000000 --- a/tools/drupal/modules/civicrm_NYSS/sql/civicrm_NYSS.mysql +++ /dev/null @@ -1,7 +0,0 @@ --- /********************************************************************** --- * --- * Additional Location Type for civicrm_NYSS module --- * Location Type - Board Of Election --- * --- **********************************************************************/ -INSERT INTO civicrm_location_type( name, vcard_name, description, is_reserved, is_active ) VALUES( 'Board of Election', NULL, 'Board of Election', 0, 1 ); \ No newline at end of file -- 2.25.1