Have a question about CiviCRM? Get it answered quickly at the new CiviCRM Stack Exchange Q+A siteThis forum was archived on 25 November 2017. Learn more.How to get involved.What to do if you think you've found a bug.
function statistics( &$rows ) { $statistics = parent::statistics( $rows ); // this is a hack that takes advantage of built-in functionality to display a row for each statistic // at bottom of report. We repurpose this inelegantly to display the notes for the selected contact in the filtered timeframe $select = "SELECT n.modified_date AS n_date, c.display_name AS n_name, n.note AS n_note FROM civicrm_note n inner join civicrm_contact c ON c.id=n.entity_id WHERE entity_table='civicrm_contact' AND entity_id='120'"; // need to add where clause to filter on civicrm_contact.id -- check if it is in $rows // not sure if activity_date_time_* is quite right - there may be suffix or prefix in actual param // could check that with CiviCRM debugging to display form variables, etc //$relative = CRM_Utils_Array::value( "activity_date_time_relative", $this->_params ); //$from = CRM_Utils_Array::value( "activity_date_time_from" , $this->_params ); // $to = CRM_Utils_Array::value( "activity_date_time_to" , $this->_params ); $relative = CRM_Utils_Array::value( "{$fieldName}_relative", $this->_params ); $from = CRM_Utils_Array::value( "{$fieldName}_from" , $this->_params ); $to = CRM_Utils_Array::value( "{$fieldName}_to" , $this->_params ); $clause = $this->dateClause( $field['name'], $relative, $from, $to, CRM_Utils_Type::T_DATE ); $sql = $select . ' ' . $clause; $dao = CRM_Core_DAO::executeQuery( $sql ); $i = 0; if ( $dao->fetch( ) ) { // $i may need to be a string key // $dao->n_date may need to be formatted as a string $statistics['counts'][$i] = array( 'value' => $dao->n_name . ' ' . $dao->n_note, 'title' => $dao->n_date ); } return $statistics; }
function statistics( &$rows ) { $statistics = parent::statistics( $rows, $naocc ); $select = "SELECT DATE_FORMAT(n.modified_date, '%c/%d/%Y') AS n_date, c.display_name AS n_name, n.note AS n_note FROM civicrm_note n inner join civicrm_contact c ON c.id=n.contact_id WHERE entity_table='civicrm_contact' AND entity_id=120 AND"; $clause = null; if ( CRM_Utils_Type::T_DATE ) { $relative = CRM_Utils_Array::value( "activity_date_time_relative", $this->_params ); $from = CRM_Utils_Array::value( "activity_date_time_from" , $this->_params ); $to = CRM_Utils_Array::value( "activity_date_time_to" , $this->_params ); $clause = $this->dateClause( "modified_date", $relative, $from, $to, CRM_Utils_Type::T_DATE ); } else { $op = CRM_Utils_Array::value( "activity_date_time_op", $this->_params ); if ( $op ) { $clause = $this->whereClause( $field, $op, CRM_Utils_Array::value( "activity_date_time_value", $this->_params ), CRM_Utils_Array::value( "activity_date_time_min", $this->_params ), CRM_Utils_Array::value( "activity_date_time_max", $this->_params ) ); } } $sql = $select . ' ' . $clause; $dao = CRM_Core_DAO::executeQuery( $sql ); $i = 0; while ( $dao->fetch( ) ) { $i++; $statistics['groups2'][$i] = array( 'title' => '', 'value' => $dao->n_date . '</td><td>' . $dao->n_name . '</td><td>' . $dao->n_note ); } return $statistics; }
{if $top} {if $printOnly} <h1>{$reportTitle}</h1> <div id="report-date">{$reportDate}</div> {/if} {if $statistics and $outputMode} <table class="report-layout statistics-table"> {foreach from=$statistics.groups item=row} <tr> <th class="statistics" scope="row">{$row.title}</th> <td>{$row.value}</td> </tr> {/foreach} {foreach from=$statistics.filters item=row} <tr> <th class="statistics" scope="row">{$row.title}</th> <td>{$row.value}</td> </tr> {/foreach} </table> {/if}{/if}{if $bottom and $rows and $statistics} <table class="report-layout"> {foreach from=$statistics.counts item=row} <tr> <th class="statistics" scope="row">{$row.title}</th> <td> {if $row.type eq 1024} {$row.value|crmMoney} {else} {$row.value|crmNumberFormat} {/if} </td> </tr> {/foreach} </table>{/if}// added to print Notes for the NAOCCActivitySummary Report{if $naocc and $rows and $statistics} <table class="report-layout"> <tr> <th class="statistics" scope="row">Date Entered</th><th>Entered By</th><th>Note</th> </tr> {foreach from=$statistics.groups2 item=row} <tr><td>{$row.value}</td> </tr> {/foreach} </table>{/if}
$sql = $select . ' ' . $clause; $dao = CRM_Core_DAO::executeQuery( $sql ); $i = 0; while ( $dao->fetch( ) ) { $i++; $statistics['groups2'][$i] = array( 'title' => '', 'value' => $dao->n_date . '</td><td>' . $dao->n_name . '</td><td>' . $dao->n_note ); } return $statistics;