Answers.Body: <p>It's defined in CRM_Core_Task, not CRM_Case_Task, so that reference in buildQuickForm maybe should be CRM_Core_Task::TASK_DELETE. I'm not sure off the top of my head how php handles static inheritance for constants. It might be a difference with your version of php, since it seems to work on dmaster.demo.civicrm.org.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-09T17:03:07.583Z
Answers.Text: You're totally right, I swapped out Core for Case in the CRM and it works. I didn't know it would be related to my PHP version. (We are on PHP 5.6.26, testing through Civi 5 so we can move to PHP 7.1)
Answers.UserDisplayName: RayWright
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-09T17:06:51.080Z
Answers.Text: Thank you for the link to the most recent Civi Demo (I was at https://civicrm.org/demo trying to find something.)
Answers.UserDisplayName: RayWright
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-09T16:57:53.227Z
Answers.LastActivityDate: 2018-10-09T16:57:53.227Z
Answers.UserDisplayName: Demerit
Body: <p>In Civi 5.5.3 (Drupal 7.59) I'm running into an error trying to search for deleted cases. In case search with our without additional parameters set, if I check the "Deleted Cases" box I get an error page (generic HTTP 500 page).</p>
  
  <p>In the system logs I get this: </p>
  
  <pre><code>PHP Fatal error:  Undefined class constant 'TASK_DELETE' in /mysite/sites/all/modules/civicrm/CRM/Case/Form/Search.php on line 180, referer: mysite.org/civicrm/case/search?reset=1
  </code></pre>
  
  <p>I'm unable to replicate this on the Demo site because I could only find a 5.3.1 Demo. There is deleted case bug on 5.3.1 but that is a different behavior and has a fix that has already been implemented in 5.5.3 <a href="https://lab.civicrm.org/dev/core/commit/2ff620ae263a6c7430730d9b59261ec2b400b063" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/commit/2ff620ae263a6c7430730d9b59261ec2b400b063</a></p>
  
  <p>I need a little help tracking down why the TASK_DELETE is undefined.</p>
  
  <p>The search works in 4.6.38 and I can see the buildQuickForm function was being re-jiggered in the Search file starting in 4.7. (From 5.0 and up it looks just as it does in 5.5.3)</p>
  
  <pre><code>  public function buildQuickForm() {
      parent::buildQuickForm();
      $this-&gt;addSortNameField();
  
      CRM_Case_BAO_Query::buildSearchForm($this);
  
      $rows = $this-&gt;get('rows');
      if (is_array($rows)) {
        if (!$this-&gt;_single) {
          $this-&gt;addRowSelectors($rows);
        }
  
        $tasks = CRM_Case_Task::permissionedTaskTitles(CRM_Core_Permission::getPermission());
  
        if (!empty($this-&gt;_formValues['case_deleted'])) {
          unset($tasks[CRM_Case_Task::TASK_DELETE]);
        }
        else {
          unset($tasks[CRM_Case_Task::RESTORE_CASES]);
        }
  
        $this-&gt;addTaskMenu($tasks);
      }
  
    }
  </code></pre>
  
  <p>In the Case > Task.php file, I see the TASK_DELETE</p>
  
  <pre><code>class CRM_Case_Task extends CRM_Core_Task {
  
  ...
  
  public static function tasks() {
          if (!self::$_tasks) {
            self::$_tasks = array(
              self::TASK_DELETE =&gt; array(
                'title' =&gt; ts('Delete cases'),
                'class' =&gt; 'CRM_Case_Form_Task_Delete',
                'result' =&gt; FALSE,
              ),
  ...
  </code></pre>
  
  <p>Is there some formatting error I'm overlooking? Does anyone else get this error?</p>
  
Tags: <civicase><search>
Title: Trouble searching for deleted cases
ThreadText: # Trouble searching for deleted cases
  
  (Asked by: username_0 on 2018-10-09)
  
  In Civi 5.5.3 (Drupal 7.59) I'm running into an error trying to search for deleted cases. In case search with our without additional parameters set, if I check the "Deleted Cases" box I get an error page (generic HTTP 500 page).
  In the system logs I get this: 
  PHP Fatal error:  Undefined class constant 'TASK_DELETE' in /mysite/sites/all/modules/civicrm/CRM/Case/Form/Search.php on line 180, referer: mysite.org/civicrm/case/search?reset=1
  
  I'm unable to replicate this on the Demo site because I could only find a 5.3.1 Demo. There is deleted case bug on 5.3.1 but that is a different behavior and has a fix that has already been implemented in 5.5.3 https://lab.civicrm.org/dev/core/commit/2ff620ae263a6c7430730d9b59261ec2b400b063
  I need a little help tracking down why the TASK_DELETE is undefined.
  The search works in 4.6.38 and I can see the buildQuickForm function was being re-jiggered in the Search file starting in 4.7. (From 5.0 and up it looks just as it does in 5.5.3)
    public function buildQuickForm() {
      parent::buildQuickForm();
      $this->addSortNameField();
  
      CRM_Case_BAO_Query::buildSearchForm($this);
  
      $rows = $this->get('rows');
      if (is_array($rows)) {
        if (!$this->_single) {
          $this->addRowSelectors($rows);
        }
  
        $tasks = CRM_Case_Task::permissionedTaskTitles(CRM_Core_Permission::getPermission());
  
        if (!empty($this->_formValues['case_deleted'])) {
          unset($tasks[CRM_Case_Task::TASK_DELETE]);
        }
        else {
          unset($tasks[CRM_Case_Task::RESTORE_CASES]);
        }
  
        $this->addTaskMenu($tasks);
      }
  
    }
  
  In the Case > Task.php file, I see the TASK_DELETE
  class CRM_Case_Task extends CRM_Core_Task {
  
  ...
  
  public static function tasks() {
          if (!self::$_tasks) {
            self::$_tasks = array(
              self::TASK_DELETE => array(
                'title' => ts('Delete cases'),
                'class' => 'CRM_Case_Form_Task_Delete',
                'result' => FALSE,
              ),
  ...
  
  Is there some formatting error I'm overlooking? Does anyone else get this error?
  
  **Tags:** civicase, search
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-09. Score: 1 | Accepted answer
  
  It's defined in CRM\_Core\_Task, not CRM\_Case\_Task, so that reference in buildQuickForm maybe should be CRM\_Core\_Task::TASK\_DELETE. I'm not sure off the top of my head how php handles static inheritance for constants. It might be a difference with your version of php, since it seems to work on dmaster.demo.civicrm.org.
  
  > **Comments:**
  > **username_0**: You're totally right, I swapped out Core for Case in the CRM and it works. I didn't know it would be related to my PHP version. (We are on PHP 5.6.26, testing through Civi 5 so we can move to PHP 7.1)  
  > **username_0**: Thank you for the link to the most recent Civi Demo (I was at https://civicrm.org/demo trying to find something.)  
  
  ---
  
  