CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Changes to Contact Logging Reports
Pages: [1]

Author Topic: Changes to Contact Logging Reports  (Read 1307 times)

AlexR

  • I’m new here
  • *
  • Posts: 19
  • Karma: 0
  • CiviCRM version: 4.3.1
  • CMS version: Drupal
  • MySQL version: 5.1.69
  • PHP version: 5.3.23
Changes to Contact Logging Reports
June 06, 2013, 11:16:14 am
I have recently implemented logging with my multilingual install. I am not entirely sure how the Contact Logging Reports (Summary and Detail) are supposed to behave because there may be complications due to the multilingual. However, I am currently in the process of cleaning up the report pages and have included a list items that have been corrected and are in progress. I would like to know if some of the changes I have implemented would be worth submitting to the core.




Contact Logging Report (Summary)

Column: Action

Allowed viewing of details for Delete, Delete (to trash) and Insert for activities of the type Contact and Relationship.

Changed icon color for viewable changes to dark and added light icon for non-viewable changes to improve the look of the table.


Column: Altered Contact

Stopped the Altered Contact field from being empty if the contact has been deleted from the database.

In Progress: Altered Contact does not reflect correct name when Action Type is Activity, currently shows Altered By[Activity]


Column: Altered By

When the altered contact was the one to make the change, such as removing themselves from an email list, the Altered By column was blank. Now, the contact name appears in both fields.


Overall:

In Progress: A single Contact insert along with an email, address and phone can result in up to 5 entries. Will reduce this down to one.

In Progress: Statistical counter displays incorrect number for Row(s) Listed.

In Progress: Print/PDF/Export to CSV currently return empty documents.




Contact Logging Report (Detail)

Change to Altered Contact made by Altered By on Date:

Ensured contact names were present as they would fail to show when viewing a update/insert/delete to phone/address/email and when the contact made the changes themselves.

In Progress: Ability to revert changes when Log Type is Activity or Group.


« Last Edit: June 18, 2013, 09:47:37 am by AlexR »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Changes to Contact Logging Reports
June 06, 2013, 01:09:16 pm
These sound like improvements to me
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

AlexR

  • I’m new here
  • *
  • Posts: 19
  • Karma: 0
  • CiviCRM version: 4.3.1
  • CMS version: Drupal
  • MySQL version: 5.1.69
  • PHP version: 5.3.23
Re: Changes to Contact Logging Reports
June 17, 2013, 07:26:31 am
Currently, I have completed most of the tasks listed as in progress. However, I have broken the functionality of inputting a page number and hitting the "Go" button.

I have not been successful in locating this functionality within the source code.

Also, I can not figure out how to get the print/pdf/export to CSV to work, they all yield empty results.

Code: [Select]
function endPostProcess(&$rows = NULL) {
 
    if ($this->_outputMode == 'print' ||
      $this->_outputMode == 'pdf' ||
      $this->_sendmail
    ) {

      $content = $this->compileContent();
      $url = CRM_Utils_System::url("civicrm/report/instance/{$this->_id}",
             "reset=1", TRUE
      );

      if ($this->_sendmail) {
        $config = CRM_Core_Config::singleton();
        $attachments = array();

        if ($this->_outputMode == 'csv') {
          $content = $this->_formValues['report_header'] . '<p>' . ts('Report URL') . ": {$url}</p>" . '<p>' . ts('The report is attached as a CSV file.') . '</p>' . $this->_formValues['report_footer'];

          $csvFullFilename = $config->templateCompileDir . CRM_Utils_File::makeFileName('CiviReport.csv');
          $csvContent = CRM_Report_Utils_Report::makeCsv($this, $rows);
          file_put_contents($csvFullFilename, $csvContent);
          $attachments[] = array(
            'fullPath' => $csvFullFilename,
            'mime_type' => 'text/csv',
            'cleanName' => 'CiviReport.csv',
          );
        }
        if ($this->_outputMode == 'pdf') {
          // generate PDF content
          $pdfFullFilename = $config->templateCompileDir . CRM_Utils_File::makeFileName('CiviReport.pdf');
          file_put_contents($pdfFullFilename,
            CRM_Utils_PDF_Utils::html2pdf($content, "CiviReport.pdf",
              TRUE, array('orientation' => 'landscape')
            )
          );
          // generate Email Content
          $content = $this->_formValues['report_header'] . '<p>' . ts('Report URL') . ": {$url}</p>" . '<p>' . ts('The report is attached as a PDF file.') . '</p>' . $this->_formValues['report_footer'];

          $attachments[] = array(
            'fullPath' => $pdfFullFilename,
            'mime_type' => 'application/pdf',
            'cleanName' => 'CiviReport.pdf',
          );
        }

        if (CRM_Report_Utils_Report::mailReport($content, $this->_id,
            $this->_outputMode, $attachments
          )) {
          CRM_Core_Session::setStatus(ts("Report mail has been sent."), ts('Sent'), 'success');
        }
        else {
          CRM_Core_Session::setStatus(ts("Report mail could not be sent."), ts('Mail Error'), 'error');
        }

        CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
      }
      elseif ($this->_outputMode == 'print') {
        echo $content;
        echo " NANANANA BATMAN ";
        echo $this->compileContent();
        echo " TRY AGAIN ";
        echo $this->_formValues['report_header'] . CRM_Core_Form::$_template->fetch('CRM/Report/Form.tpl') . $this->_formValues['report_footer'];
      }
      else {
        if ($chartType = CRM_Utils_Array::value('charts', $this->_params)) {
          $config = CRM_Core_Config::singleton();
          //get chart image name
          $chartImg = $this->_chartId . '.png';
          //get image url path
          $uploadUrl = str_replace('/persist/contribute/', '/persist/', $config->imageUploadURL) . 'openFlashChart/';
          $uploadUrl .= $chartImg;
          //get image doc path to overwrite
          $uploadImg = str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) . 'openFlashChart/' . $chartImg;
          //Load the image
          $chart = imagecreatefrompng($uploadUrl);
          //convert it into formattd png
          header('Content-type: image/png');
          //overwrite with same image
          imagepng($chart, $uploadImg);
          //delete the object
          imagedestroy($chart);
        }
        CRM_Utils_PDF_Utils::html2pdf($content, "CiviReport.pdf", FALSE, array('orientation' => 'landscape'));
      }
      CRM_Utils_System::civiExit();
    }
    elseif ($this->_outputMode == 'csv') {
      CRM_Report_Utils_Report::export2csv($this, $rows);
    }
    elseif ($this->_outputMode == 'group') {
      $group = $this->_params['groups'];
      $this->add2group($group);
    }
    elseif ($this->_instanceButtonName == $this->controller->getButtonName()) {
      CRM_Report_Form_Instance::postProcess($this);
    }
    elseif ($this->_createNewButtonName == $this->controller->getButtonName() ||
            $this->_outputMode == 'create_report' ) {
      $this->_createNew = TRUE;
      CRM_Report_Form_Instance::postProcess($this);
    }
  }

The variable $content is empty, when I click print, the output is:

6/18/13 https:// XXXXXXX/civicrm/report/instance/45
https:// XXXXXXX/civicrm/report/instance/45 1/1
Contact Logging Report (Summary)
June 18th, 2013 11:00 AM
« Last Edit: June 18, 2013, 07:49:22 am by AlexR »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Changes to Contact Logging Reports

This forum was archived on 2017-11-26.