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

CRM-21718: Don't choose 'print_contacts' as default task if it is not there #11596

Closed

Conversation

johanv
Copy link
Contributor

@johanv johanv commented Jan 27, 2018

Overview

If you remove 'print contacts' from the search tasks by implementing hook_civicrm_searchTasks, every search form stops working.

Before

If you remove 'print contacts' from the search tasks by implementing hook_civicrm_searchTasks, every search form stops working.
screenshot from 2018-01-27 20-33-30

After

Now it works.
screenshot from 2018-01-27 20-36-23

Technical Details

It seems that in some part of the code for some reason the 'print contacts' is selected as default action, which causes troubles if it is not there.


@mattwire
Copy link
Contributor

@johanv I think this will affect all search tasks, not just contacts. Could you wait until #11240 is merged and then refactor this?

@johanv
Copy link
Contributor Author

johanv commented Jan 28, 2018

Ok, just ping me when I should look at this again.

@eileenmcnaughton
Copy link
Contributor

@johanv - can you test again against master - hopefully you can close this out now

@eileenmcnaughton
Copy link
Contributor

@johanv Can you test the latest rc - I believe this is now fixed due to @mattwire's work. Closing this

@johanv
Copy link
Contributor Author

johanv commented Mar 19, 2018

Thank you @eileenmcnaughton and @mattwire for your work. Sorry that it took me so long to look at this again, but since I changed jobs I don't have a lot of time for CiviCRM.
But tonight I finally found some time to look at this again. Unfortunately using the current master branch does not solve my issue.

So, I created an extension, and I implemented hook_civicrm_searchTasks 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;
}

In CiviCRM 4.7.29 with the patch in this pull request, this would remove the item 'Print selected rows' from the search tasks.
With the current CiviCRM master branch, this does nothing.
I used my debugger, and it turned out that in the current master branch, $objectType is null. I assume this is a bug. But for testing purposes, I removed the first return statement, and in that case, I got this error message:

 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

screenshot from 2018-03-19 22-09-00

Unfortunately, I don't have time to look further into this tonight. Maybe another time.

@eileenmcnaughton
Copy link
Contributor

@johanv @mattwire please test #11861

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants