*/
public $_ruleGroupID = NULL;
- public $_isAddCaptcha = FALSE;
-
protected $_isPermissionedChecksum = FALSE;
/**
* @return array
*/
public function getUFGroupIDs() {
- if (empty($this->_profileIds)) {
- $dao = new CRM_Core_DAO_UFGroup();
- $dao->id = $this->_gid;
- $this->_profileIds = (array) $dao;
- }
- return $this->_profileIds;
+ return [$this->_gid];
}
/**
}
$this->_duplicateButtonName = $this->getButtonName('upload', 'duplicate');
- $gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0));
+ $gids = explode(',', (CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0) ?? ''));
if ((count($gids) > 1) && !$this->_profileIds && empty($this->_profileIds)) {
if (!empty($gids)) {
}
$this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
- //get values for ufGroupName, captcha and dupe update.
+ //get values for ufGroupName and dupe update.
if ($this->_gid) {
$dao = new CRM_Core_DAO_UFGroup();
$dao->id = $this->_gid;
if ($dao->find(TRUE)) {
$this->_isUpdateDupe = $dao->is_update_dupe;
- $this->_isAddCaptcha = $dao->add_captcha;
$this->_ufGroup = (array) $dao;
}
* Build the form object.
*
*/
- public function buildQuickForm() {
+ public function buildQuickForm(): void {
$this->add('hidden', 'gid', $this->_gid);
+ $this->assign('deleteRecord', $this->isDeleteMode());
switch ($this->_mode) {
case self::MODE_CREATE:
return;
}
- if (($this->_multiRecord & CRM_Core_Action::DELETE)) {
+ if ($this->isDeleteMode()) {
if (!$this->_recordExists) {
CRM_Core_Session::setStatus(ts('The record %1 doesnot exists', [1 => $this->_recordId]), ts('Record doesnot exists'), 'alert');
}
- else {
- $this->assign('deleteRecord', TRUE);
- }
return;
}
//lets have single status message,
$this->assign('statusMessage', $statusMessage);
if ($return) {
- return FALSE;
+ return;
}
$this->assign('id', $this->_id);
}
$this->assign('anonUser', $anonUser);
- $addCaptcha = [];
$emailPresent = FALSE;
// add the form elements
continue;
}
- list($prefixName, $index) = CRM_Utils_System::explode('-', $name, 2);
+ [$prefixName, $index] = CRM_Utils_System::explode('-', $name, 2);
CRM_Core_BAO_UFGroup::buildProfile($this, $field, $this->_mode);
$addToGroupId = $field['add_to_group_id'];
}
- //build array for captcha
- if ($field['add_captcha']) {
- $addCaptcha[$field['group_id']] = $field['add_captcha'];
- }
-
if (($name == 'email-Primary') || ($name == 'email-' . ($primaryLocationType ?? ""))) {
$emailPresent = TRUE;
$this->_mail = $name;
}
}
- // add captcha only for create mode.
if ($this->_mode == self::MODE_CREATE) {
- // suppress captcha for logged in users only
- if ($this->_currentUserID) {
- $this->_isAddCaptcha = FALSE;
- }
- elseif (!$this->_isAddCaptcha && !empty($addCaptcha)) {
- $this->_isAddCaptcha = TRUE;
- }
-
if ($this->_gid) {
$dao = new CRM_Core_DAO_UFGroup();
$dao->id = $this->_gid;
}
}
}
- else {
- $this->_isAddCaptcha = FALSE;
- }
-
- //finally add captcha to form.
- if ($this->_isAddCaptcha) {
- CRM_Utils_ReCAPTCHA::enableCaptchaOnForm($this);
- }
if ($this->_mode != self::MODE_SEARCH) {
if (isset($addToGroupId)) {
}
foreach ($fields as $key => $value) {
- list($fieldName, $locTypeId, $phoneTypeId) = CRM_Utils_System::explode('-', $key, 3);
+ [$fieldName, $locTypeId, $phoneTypeId] = CRM_Utils_System::explode('-', $key, 3);
if ($fieldName == 'state_province' && !empty($fields["country-{$locTypeId}"])) {
// Validate Country - State list
$countryId = $fields["country-{$locTypeId}"];
$params['customRecordValues'][$this->_recordId] = array_keys($this->_multiRecordFields);
}
+ // sudoman hack: re-insert filtered group memberships
+ $params = CRM_Contact_Form_Edit_TagsAndGroups::reInsertFilteredGroupMemberships([$this->_gid], $this->_id, TRUE, $params);
+
$this->_id = CRM_Contact_BAO_Contact::createProfileContact(
$params,
$profileFields,
}
/**
- * @param null $suffix
+ * Check template file exists.
*
- * @return null|string
+ * @param string|null $suffix
+ *
+ * @return string|null
+ * Template file path, else null
*/
public function checkTemplateFileExists($suffix = NULL) {
if ($this->_gid) {
return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
}
+ /**
+ * @return int|string
+ */
+ private function isDeleteMode() {
+ return ($this->_multiRecord & CRM_Core_Action::DELETE);
+ }
+
}