Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Fix form to call this->setTitle() #21362

Merged
merged 1 commit into from
Sep 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions CRM/Profile/Form/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,23 @@ public function preProcess() {
parent::preProcess();

// and also the profile is of type 'Profile'
$query = "
$query = '
SELECT module,is_reserved
FROM civicrm_uf_group
LEFT JOIN civicrm_uf_join ON uf_group_id = civicrm_uf_group.id
WHERE civicrm_uf_group.id = %1
";
';

$params = [1 => [$this->_gid, 'Integer']];
$dao = CRM_Core_DAO::executeQuery($query, $params);

$isProfile = FALSE;
while ($dao->fetch()) {
$isProfile = ($isProfile || ($dao->module == "Profile"));
$isProfile = ($isProfile || ($dao->module === 'Profile'));
}

//Check that the user has the "add contacts" Permission
$canAdd = CRM_Core_Permission::check("add contacts");
$canAdd = CRM_Core_Permission::check('add contacts');

//Remove need for Profile module type when using reserved profiles [CRM-14488]
if (!$dao->N || (!$isProfile && !($dao->is_reserved && $canAdd))) {
Expand All @@ -141,16 +141,16 @@ public function buildQuickForm() {

// set the title
if ($this->_multiRecord && $this->_customGroupTitle) {
$groupTitle = ($this->_multiRecord & CRM_Core_Action::UPDATE) ? 'Edit ' . $this->_customGroupTitle . ' Record' : $this->_customGroupTitle;
$this->setTitle(($this->_multiRecord & CRM_Core_Action::UPDATE) ? 'Edit ' . $this->_customGroupTitle . ' Record' : $this->_customGroupTitle);

}
else {
$groupTitle = CRM_Core_BAO_UFGroup::getFrontEndTitle($this->_ufGroup['id']);
$this->setTitle(CRM_Core_BAO_UFGroup::getFrontEndTitle($this->_ufGroup['id']));
}
CRM_Utils_System::setTitle($groupTitle);

$this->assign('recentlyViewed', FALSE);

if ($this->_context != 'dialog') {
if ($this->_context !== 'dialog') {
$this->_postURL = $this->_ufGroup['post_URL'];
$this->_cancelURL = $this->_ufGroup['cancel_URL'];

Expand All @@ -160,7 +160,7 @@ public function buildQuickForm() {
}

if (!$this->_postURL) {
if ($this->_context == 'Search') {
if ($this->_context === 'Search') {
$this->_postURL = CRM_Utils_System::url('civicrm/contact/search');
}
elseif ($this->_id && $this->_gid) {
Expand Down Expand Up @@ -260,7 +260,7 @@ public function postProcess() {
}

// When saving (not deleting) and not in an ajax popup
if (empty($_POST[$this->_deleteButtonName]) && $this->_context != 'dialog') {
if (empty($_POST[$this->_deleteButtonName]) && $this->_context !== 'dialog') {
CRM_Core_Session::setStatus(ts('Your information has been saved.'), ts('Thank you.'), 'success');
}

Expand Down