[REF] Fix form to call this->setTitle()
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 3 Sep 2021 07:18:49 +0000 (19:18 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 3 Sep 2021 07:18:49 +0000 (19:18 +1200)
CRM/Profile/Form/Edit.php

index b2cfc16bf4477b5cb2ece554fffe62cf017824ab..a466c3b2f7c97259b193c442614e7d9a9196590e 100644 (file)
@@ -104,23 +104,23 @@ class CRM_Profile_Form_Edit extends CRM_Profile_Form {
     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))) {
@@ -141,16 +141,16 @@ SELECT module,is_reserved
 
     // 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'];
 
@@ -160,7 +160,7 @@ SELECT module,is_reserved
       }
 
       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) {
@@ -260,7 +260,7 @@ SELECT module,is_reserved
     }
 
     // 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');
     }