2

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?

1

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.

  • 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) – RayWright Oct 9 '18 at 17:03
  • Thank you for the link to the most recent Civi Demo (I was at civicrm.org/demo trying to find something.) – RayWright Oct 9 '18 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.