<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
public $_contactId;
/**
- * the default group id passed in via the url
+ * The default group id passed in via the url
*
* @var int
*/
public $_gid;
/**
- * the default tag id passed in via the url
+ * The default tag id passed in via the url
*
* @var int
*/
public $_tid;
/**
- * name of de-dupe button
+ * Name of de-dupe button
*
* @var string
- * @access protected
*/
protected $_dedupeButtonName;
/**
- * name of optional save duplicate button
+ * Name of optional save duplicate button
*
* @var string
- * @access protected
*/
protected $_duplicateButtonName;
public $_parseStreetAddress;
/**
- * check contact has a subtype or not
+ * Check contact has a subtype or not
*/
public $_isContactSubType;
public $_preEditValues;
/**
- * build all the data structures needed to build the form
+ * Build all the data structures needed to build the form
*
* @return void
- * @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
$this->_dedupeButtonName = $this->getButtonName('refresh', 'dedupe');
}
/**
- * This function sets the default values for the form. Note that in edit/view mode
+ * Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @access public
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_values;
$params = array();
}
/**
- * do the set default related to location type id,
+ * Do the set default related to location type id,
* primary location, default country
*
*/
- function blockSetDefaults(&$defaults) {
+ public function blockSetDefaults(&$defaults) {
$locationTypeKeys = array_filter(array_keys(CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')), 'is_int');
sort($locationTypeKeys);
* All local rules are added near the element
*
* @return void
- * @access public
* @see valid_date
*/
- function addRules() {
+ public function addRules() {
// skip adding formRules when custom data is build
if ($this->_addBlockName || ($this->_action & CRM_Core_Action::DELETE)) {
return;
}
/**
- * global validation rules for the form
+ * Global validation rules for the form
*
* @param array $fields posted values of the form
* @param array $errors list of errors to be posted back to the form
* @param int $contactId contact id if doing update.
*
* @return bool $primaryID email/openId@static
- * @access public
*/
- static function formRule($fields, &$errors, $contactId = NULL) {
+ public static function formRule($fields, &$errors, $contactId = NULL) {
$config = CRM_Core_Config::singleton();
// validations.
}
/**
- * Function to actually build the form
+ * Build the form object
*
* @return void
- * @access public
*/
public function buildQuickForm() {
//load form for child blocks
'subName' => 'view',
'isDefault' => TRUE,
),
- array(
+ );
+ if (CRM_Core_Permission::check('add contacts')) {
+ $buttons[] = array(
'type' => 'upload',
'name' => ts('Save and New'),
'spacing' => ' ',
'subName' => 'new',
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
+ );
+ }
+ $buttons[] = array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
);
if (!empty($this->_values['contact_sub_type'])) {
/**
* Form submission of new/edit contact is processed.
*
- * @access public
*
* @return void
*/
}
/**
- * is there any real significant data in the hierarchical location array
+ * Is there any real significant data in the hierarchical location array
*
* @param array $fields the hierarchical value representation of this location
*
* @return boolean true if data exists, false otherwise
* @static
- * @access public
*/
- static function blockDataExists(&$fields) {
+ public static function blockDataExists(&$fields) {
if (!is_array($fields)) {
return FALSE;
}
}
/**
- * Function to that checks for duplicate contacts
+ * That checks for duplicate contacts
*
* @param array $fields fields array which are submitted
* @param $errors
* @param int $contactID contact id
* @param string $contactType contact type
*
- * @internal param array $error error message array
*/
- static function checkDuplicateContacts(&$fields, &$errors, $contactID, $contactType) {
+ public static function checkDuplicateContacts(&$fields, &$errors, $contactID, $contactType) {
// if this is a forced save, ignore find duplicate rule
if (empty($fields['_qf_Contact_upload_duplicate'])) {
/**
* Use the form name to create the tpl file name
*
- * @return string
- * @access public
- */
- /**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if ($this->_contactSubType) {
$templateFile = "CRM/Contact/Form/Edit/SubType/{$this->_contactSubType}.tpl";
$template = CRM_Core_Form::getTemplate();
* This function either parse street address in to child
* elements or build street address from child elements.
*
- * @params $params an array of key value consist of address blocks.
- *
- * @param $params
+ * @param $params array of key value consist of address blocks.
*
* @return array $parseSuccess as array of sucess/fails for each address block@static
*/
- function parseAddress(&$params) {
+ public function parseAddress(&$params) {
$parseSuccess = $parsedFields = array();
if (!is_array($params['address']) ||
CRM_Utils_System::isNull($params['address'])
}
/**
- * check parse result and if some address block fails then this
+ * Check parse result and if some address block fails then this
* function return the status message for all address blocks.
*
* @param $parseResult an array of address blk instance and its status.
*
* @return null|string $statusMsg string status message for all address blocks.@static
*/
- static function parseAddressStatusMsg($parseResult) {
+ public static function parseAddressStatusMsg($parseResult) {
$statusMsg = NULL;
if (!is_array($parseResult) || empty($parseResult)) {
return $statusMsg;
* @return ordinal number for given number.
* @static
*/
- static function ordinalNumber($number) {
+ public static function ordinalNumber($number) {
if (empty($number)) {
return NULL;
}
*
* @return null|string $updateMembershipMsg string status message for updated membership.
*/
- function updateMembershipStatus($deceasedParams) {
+ public function updateMembershipStatus($deceasedParams) {
$updateMembershipMsg = NULL;
$contactId = CRM_Utils_Array::value('contact_id', $deceasedParams);
$deceasedDate = CRM_Utils_Array::value('deceased_date', $deceasedParams);
return $updateMembershipMsg;
}
}
-