+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
protected $_skipPermission = FALSE;
/**
- * The contact id that we are editing
+ * The contact id that we are editing.
*
* @var int
*/
protected $_id;
/**
- * The group id that we are editing
+ * The group id that we are editing.
*
* @var int
*/
protected $_ufGroup = array('name' => 'unknown');
/**
- * The group id that we are passing in url
+ * The group id that we are passing in url.
*
* @var int
*/
public $_grid;
/**
- * Name of button for saving matching contacts
+ * Name of button for saving matching contacts.
* @var
*/
protected $_duplicateButtonName;
/**
- * The title of the category we are editing
+ * The title of the category we are editing.
*
* @var string
*/
protected $_title;
/**
- * The fields needed to build this form
+ * The fields needed to build this form.
*
* @var array
*/
public $_fields;
/**
- * store contact details
+ * store contact details.
*
* @var array
*/
protected $_contact;
/**
- * Do we allow updates of the contact
+ * Do we allow updates of the contact.
*
* @var int
*/
public $_isUpdateDupe = 0;
+ /**
+ * Dedupe using a specific rule (CRM-6131).
+ * Not currently exposed in profile settings, but can be set in a buildForm hook.
+ */
+ public $_ruleGroupID = NULL;
+
public $_isAddCaptcha = FALSE;
protected $_isPermissionedChecksum = FALSE;
protected $_context;
/**
- * THe contact type for registration case
+ * THe contact type for registration case.
*
* @var string
*/
protected $_ctype = NULL;
- protected $_defaults = NULL;
-
/**
* Store profile ids if multiple profile ids are passed using comma separated.
* Currently lets implement this functionality only for dialog mode
protected $_isContactActivityProfile = FALSE;
/**
- * Activity Id connected to the profile
+ * Activity Id connected to the profile.
*
* @var string
*/
protected $_currentUserID = NULL;
protected $_session = NULL;
+ /**
+ * Explicitly declare the entity api name.
+ */
+ public function getDefaultEntity() {
+ return 'Profile';
+ }
+
/**
* Pre processing work done here.
*
$this->_recordId = NULL;
$this->set('recordId', NULL);
}
- //record id is neccessary for _multiRecord view and update/edit action
+ //record id is necessary for _multiRecord view and update/edit action
if (!$this->_recordId
&& ($this->_multiRecord == CRM_Core_Action::UPDATE || $this->_multiRecord == CRM_Core_Action::DELETE)
) {
elseif (!empty($this->_multiRecordFields)
&& (!$this->_multiRecord || !in_array($this->_multiRecord, array(
CRM_Core_Action::DELETE,
- CRM_Core_Action::UPDATE
+ CRM_Core_Action::UPDATE,
)))
) {
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
}
/**
- * Build the form object
+ * Build the form object.
*
* @return void
*/
) {
$return = TRUE;
if (!$statusMessage) {
- $statusMessage =
- ts("This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types.",
+ $statusMessage = ts("This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types.",
array(1 => $profileSubType ? $profileSubType : $profileType));
}
}
}
/**
- * Validate profile and provided activity Id
+ * Validate profile and provided activity Id.
*
* @param int $activityId
* @param int $contactId
}
/**
- * Global form rule
+ * Global form rule.
*
* @param array $fields
* The input form values.
$ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams,
$ctype,
$ruleType,
- $exceptions
+ $exceptions,
+ $form->_ruleGroupID
);
if ($ids) {
if ($form->_isUpdateDupe == 2) {
$duplicateContactsLinks = '<div class="matching-contacts-found">';
$duplicateContactsLinks .= ts('One matching contact was found. ', array(
'count' => count($contactLinks['rows']),
- 'plural' => '%count matching contacts were found.<br />'
+ 'plural' => '%count matching contacts were found.<br />',
));
if ($contactLinks['msg'] == 'view') {
$duplicateContactsLinks .= ts('You can View the existing contact.', array(
'count' => count($contactLinks['rows']),
- 'plural' => 'You can View the existing contacts.'
+ 'plural' => 'You can View the existing contacts.',
));
}
else {
$duplicateContactsLinks .= ts('You can View or Edit the existing contact.', array(
'count' => count($contactLinks['rows']),
- 'plural' => 'You can View or Edit the existing contacts.'
+ 'plural' => 'You can View or Edit the existing contacts.',
));
}
$duplicateContactsLinks .= '</div>';
$duplicateContactsLinks .= '<table class="matching-contacts-actions">';
$row = '';
- for ($i = 0; $i < sizeof($contactLinks['rows']); $i++) {
+ for ($i = 0; $i < count($contactLinks['rows']); $i++) {
$row .= ' <tr> ';
$row .= ' <td class="matching-contacts-name"> ';
$row .= $contactLinks['rows'][$i]['display_name'];
}
/**
- * Use the form name to create the tpl file name
+ * Use the form name to create the tpl file name.
*
* @return string
*/
$fileName = $this->checkTemplateFileExists('extra.');
return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
}
+
}