forked from CiviWare/com.dpci.constituentsonly
		
	fixed indentation and styling
This commit is contained in:
		@@ -8,7 +8,8 @@ class CRM_ConstituentsOnly_BAO_Query extends CRM_Contact_BAO_Query_Interface {
 | 
				
			|||||||
    return self::$_networkFields;
 | 
					    return self::$_networkFields;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public function select(&$query) { }
 | 
					  public function select(&$query) {
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * Build where clause for ConstituentsOnly
 | 
					   * Build where clause for ConstituentsOnly
 | 
				
			||||||
@@ -43,4 +44,3 @@ class CRM_ConstituentsOnly_BAO_Query extends CRM_Contact_BAO_Query_Interface {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,7 +43,8 @@ class CRM_Utils_API_ConstituentsOnlyAPIWrapper implements API_Wrapper {
 | 
				
			|||||||
            'sequential' => 1,
 | 
					            'sequential' => 1,
 | 
				
			||||||
            'contact_id' => array('=' => $api_result['id']),
 | 
					            'contact_id' => array('=' => $api_result['id']),
 | 
				
			||||||
          ));
 | 
					          ));
 | 
				
			||||||
        } catch (CiviCRM_API3_Exception $e) {
 | 
					        }
 | 
				
			||||||
 | 
					        catch (CiviCRM_API3_Exception $e) {
 | 
				
			||||||
          $error = $e->getMessage();
 | 
					          $error = $e->getMessage();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -58,4 +59,5 @@ class CRM_Utils_API_ConstituentsOnlyAPIWrapper implements API_Wrapper {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return $result;
 | 
					    return $result;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,57 +3,6 @@
 | 
				
			|||||||
require_once 'constituentsonly.civix.php';
 | 
					require_once 'constituentsonly.civix.php';
 | 
				
			||||||
use CRM_ConstituentsOnly_ExtensionUtil as E;
 | 
					use CRM_ConstituentsOnly_ExtensionUtil as E;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Implements hook_civicrm_queryObjects().
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
function constituentsonly_civicrm_queryObjects(&$queryObjects, $type) {
 | 
					 | 
				
			||||||
  if ($type == 'Contact') {
 | 
					 | 
				
			||||||
    $queryObjects[] = new CRM_ConstituentsOnly_BAO_Query();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Implements hook_civicrm_apiWrappers().
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
function constituentsonly_civicrm_apiWrappers(&$wrappers, $apiRequest) {
 | 
					 | 
				
			||||||
  if ($apiRequest['entity'] == 'Contact' && $apiRequest['action'] == 'getquick') {
 | 
					 | 
				
			||||||
    $wrappers[] = new CRM_Utils_API_ConstituentsOnlyAPIWrapper();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Implementation of hook_civicrm_alterReportVar().
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
function constituentsonly_civicrm_alterReportVar($varType, &$var, &$object) {
 | 
					 | 
				
			||||||
  $instanceValue = $object->getVar('_instanceValues');
 | 
					 | 
				
			||||||
  if (!empty($instanceValue) &&
 | 
					 | 
				
			||||||
    in_array(
 | 
					 | 
				
			||||||
      $instanceValue['report_id'],
 | 
					 | 
				
			||||||
      array(
 | 
					 | 
				
			||||||
        'contact/summary',
 | 
					 | 
				
			||||||
        'contact/detail',
 | 
					 | 
				
			||||||
        'contact/currentEmployer',
 | 
					 | 
				
			||||||
      )
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
  ) {
 | 
					 | 
				
			||||||
    if ($varType == 'sql') {
 | 
					 | 
				
			||||||
      $var->_columnHeaders['civicrm_contact_do_not_trade'] = array(
 | 
					 | 
				
			||||||
        'type' => 1,
 | 
					 | 
				
			||||||
        'title' => 'Constituent',
 | 
					 | 
				
			||||||
        'no_display' => TRUE,
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      $var->_select .= ' , contact_civireport.do_not_trade as civicrm_contact_do_not_trade ';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      $where = $var->getVar('_where');
 | 
					 | 
				
			||||||
      $where .= ' AND contact_civireport.do_not_trade <> 1';
 | 
					 | 
				
			||||||
      $var->setVar('_where', $where);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Implements hook_civicrm_config().
 | 
					 * Implements hook_civicrm_config().
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -174,30 +123,56 @@ function constituentsonly_civicrm_alterSettingsFolders(&$metaDataFolders = NULL)
 | 
				
			|||||||
  _constituentsonly_civix_civicrm_alterSettingsFolders($metaDataFolders);
 | 
					  _constituentsonly_civix_civicrm_alterSettingsFolders($metaDataFolders);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// --- Functions below this ship commented out. Uncomment as required. ---
 | 
					/**
 | 
				
			||||||
 | 
					 * Implements hook_civicrm_queryObjects().
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_queryObjects
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function constituentsonly_civicrm_queryObjects(&$queryObjects, $type) {
 | 
				
			||||||
 | 
					  if ($type == 'Contact') {
 | 
				
			||||||
 | 
					    $queryObjects[] = new CRM_ConstituentsOnly_BAO_Query();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Implements hook_civicrm_preProcess().
 | 
					 * Implements hook_civicrm_apiWrappers().
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_preProcess
 | 
					 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_apiWrappers
 | 
				
			||||||
 *
 | 
					 */
 | 
				
			||||||
function constituentsonly_civicrm_preProcess($formName, &$form) {
 | 
					function constituentsonly_civicrm_apiWrappers(&$wrappers, $apiRequest) {
 | 
				
			||||||
 | 
					  if ($apiRequest['entity'] == 'Contact' && $apiRequest['action'] == 'getquick') {
 | 
				
			||||||
} // */
 | 
					    $wrappers[] = new CRM_Utils_API_ConstituentsOnlyAPIWrapper();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Implements hook_civicrm_navigationMenu().
 | 
					 * Implements hook_civicrm_alterReportVar().
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_navigationMenu
 | 
					 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterReportVar
 | 
				
			||||||
 *
 | 
					 */
 | 
				
			||||||
function constituentsonly_civicrm_navigationMenu(&$menu) {
 | 
					function constituentsonly_civicrm_alterReportVar($varType, &$var, &$object) {
 | 
				
			||||||
  _constituentsonly_civix_insert_navigation_menu($menu, NULL, array(
 | 
					  $instanceValue = $object->getVar('_instanceValues');
 | 
				
			||||||
    'label' => E::ts('The Page'),
 | 
					  if (!empty($instanceValue) &&
 | 
				
			||||||
    'name' => 'the_page',
 | 
					    in_array(
 | 
				
			||||||
    'url' => 'civicrm/the-page',
 | 
					      $instanceValue['report_id'],
 | 
				
			||||||
    'permission' => 'access CiviReport,access CiviContribute',
 | 
					      array(
 | 
				
			||||||
    'operator' => 'OR',
 | 
					        'contact/summary',
 | 
				
			||||||
    'separator' => 0,
 | 
					        'contact/detail',
 | 
				
			||||||
  ));
 | 
					        'contact/currentEmployer',
 | 
				
			||||||
  _constituentsonly_civix_navigationMenu($menu);
 | 
					      )
 | 
				
			||||||
} // */
 | 
					    )
 | 
				
			||||||
 | 
					  ) {
 | 
				
			||||||
 | 
					    if ($varType == 'sql') {
 | 
				
			||||||
 | 
					      $var->_columnHeaders['civicrm_contact_do_not_trade'] = array(
 | 
				
			||||||
 | 
					        'type' => 1,
 | 
				
			||||||
 | 
					        'title' => 'Constituent',
 | 
				
			||||||
 | 
					        'no_display' => TRUE,
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					      $var->_select .= ' , contact_civireport.do_not_trade as civicrm_contact_do_not_trade ';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      $where = $var->getVar('_where');
 | 
				
			||||||
 | 
					      $where .= ' AND contact_civireport.do_not_trade <> 1';
 | 
				
			||||||
 | 
					      $var->setVar('_where', $where);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user