Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-21718

If you remove 'Print selected rows' using hook_civicrm_searchTasks, search forms stop working

    Details

    • Type: Bug
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 4.7.29
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No
    • How it works currently:
      When you remove 'Print selected rows' from the search tasks menu, by implementing hook_civicrm_searchTasks, you get an exception.
    • How it should work:
      It should just remove 'Print selected rows' from the search tasks menu

      Description

      If you implement hook_civicrm_searchTask like this

      function test_civicrm_searchTasks($objectType, &$tasks) {
        if ($objectType != 'contact') {
          return;
        }
      
        foreach ($tasks as $key => $value) {
          if ($value['title'] == 'Print selected rows') {
            unset($tasks[$key]);
          }
        }
      
        return;
      }

      Every search form will break, with this error:

      Fatal error: require_once(): Failed opening required '.php' (include_path='/opt/ext/be.johanv.test/:/var/www/html/sites/all/modules/civicrm/tools/extensions/cividiscount/:/var/www/html/sites/all/modules/civicrm/tools/extensions/civisualize/:/var/www/html/sites/all/modules/civicrm/tools/extensions/org.civicoop.civirules/:/var/www/html/sites/all/modules/civicrm/tools/extensions/civivolunteer/:/var/www/html/sites/all/modules/civicrm/tools/extensions/org.civicrm.angularprofiles/:.:/var/www/html/sites/all/modules/civicrm/:/var/www/html/sites/all/modules/civicrm//packages:.:/var/www/html/sites/all/modules/civicrm:/var/www/html/sites/all/modules/civicrm/packages:/var/www/html/sites/all/modules/civicrm/vendor/tecnickcom:/var/www/html/sites/all/modules/civicrm/vendor/phpseclib/phpseclib/phpseclib:/var/www/html/sites/all/modules/civicrm/vendor/pear/pear_exception:/var/www/html/sites/all/modules/civicrm/vendor/pear/auth_sasl:/var/www/html/sites/all/modules/civicrm/vendor/pear/net_socket:/var/www/html/sites/all/modules/civicrm/vendor in /var/www/html/sites/all/modules/civicrm/CRM/Core/Controller.php on line 451
      

      I wil create a PR that fixes the issue.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              johanv Johan Vervloet
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: