-
Notifications
You must be signed in to change notification settings - Fork 57
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
hook_civicrm_alterReportVar is not working #577
Comments
@fajlay calling I guess there are few different ways to do what you are trying to do but the first question is - could it be done with SearchKit? From my point of view I'm not aware of anything this extension does that search kit doesn't do better these days |
Thanks for your reply. |
ouch - I might update that! |
@eileenmcnaughton I will just say that getVar() has been used in some JMA extensions to add or modify things like the from etc |
@seamuslee001 yeah - it has a lot of legacy uses - but it is basically used to access things that are not supported for external access - so it is totally liable to break at any time |
Yes, find the columns do not appear in the report. Example below. The code executes and freezes with a var_dump, but doesn't seem to work with the hook.
Might look at search kit. |
Built with Search Kit and looks amazing! Turned into a dashlet/report. Thank you @eileenmcnaughton for the suggestion. |
@devappsoftware thanks for the feedback - & hopefully it will be the first of many search kit dashlets for you! |
I am trying to alter a report to show an extra column. Before updating the extension it worked fine. But after updating, it is not working anymore. Following is my code. The error shows "Call to a member function getVar() on string in ..."
I also noticed that $var->_select value is empty and $var->_columnHeaders, $var->getVar(), $var->setVar() are not working anymore. Any thoughts?
function extname_civicrm_alterReportVar($varType, &$var, $reportForm) {
$instanceValue = $reportForm->getVar('_instanceValues');
if (!empty($instanceValue) && in_array($instanceValue['report_id'], array('price/lineitem',))) {
if ($varType == 'sql') {
$var->_columnHeaders['civicrm_card_name'] = array(
'title' => 'Credit Card Type',
'type' => 2,
);
$var->_select .= ' , GROUP_CONCAT(DISTINCT (card_type.card_type_id)) as civicrm_credit_card_type ,
GROUP_CONCAT(DISTINCT (card_type_label.name)) as civicrm_card_name';
}
}
The text was updated successfully, but these errors were encountered: