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) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Simple report template modifications
Pages: [1]

Author Topic: Simple report template modifications  (Read 3243 times)

mdmiller1

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
Simple report template modifications
March 11, 2010, 08:50:06 am
I'm new and still learning the php system of the report templates.

I want to take a default template 'activity.php' and add the field 'duration'.  Is there a document that explains this simple process.  Maybe I'm overlooking something.

Thanks for your patience with someone who is new and learning.
-Duane

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Simple report template modifications
March 11, 2010, 09:20:57 am
I am not sure of what you are trying to achieve?
Adding a field called duration to an activity can be done using custom data, which you can then display on a report. I am not familiar with the Reports yet, so I do not know if it makes sense there to have a template called Activity.php. In general Activity.php would refer to the script (the PHP program) and Activitiy.tpl to the (Smarty) template.
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

mdmiller1

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
Re: Simple report template modifications
March 11, 2010, 12:51:27 pm
-
in CiviCRM when adding a New Activity to a Contact (in the default CiviCRM install), there is an existing field named 'duration'.

I can't find a default report that reports on this field.  So I'm guessing I'll need to customize a report.

The Activity Report would work, but I'll need to add this 'duration' field into it.  I believe I've got to modify the php to query the field value first.  ../CRM/report/form/activity.php

I was hoping to find some examples on where you modify this report code to permit a report containing this additional existing field.

appreciate the reply.  thanks - Duane

mdmiller1

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
Re: Simple report template modifications
March 11, 2010, 01:29:29 pm
I've got it nailed down and duration is included in the reports now.
thanks - Duane

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Simple report template modifications
March 11, 2010, 02:03:35 pm

would be great if you can provide a detailed step-by-step procedure so other folks can follow it. Might be better to document this on the wiki:

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviReport+structure+and+customization

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

mdmiller1

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
Re: Simple report template modifications
March 11, 2010, 03:09:01 pm
When Adding a 'New Activity' to a Contact, the input form provides a field called 'duration' where minutes of duration of the activity can be tracked.  We plan on using this to track Volunteer time but there was no report that contained the data.  The fix is simple.  Here is what you do.
Locate file activity.php
mine was here: administrator/com_civicrm/civicrm/CRM/Report/form/Activity.php

I duplicated this file as an archive in case of a problem, and then edited the original.

Search for the FIRST instance of 'Activity Date'
you will see two lines:
     array( 'title'      => ts( 'Activity Date'),
              'default'    => true ),

Immediately below these two lines I inserted this brief block of code:

       'duration'=>
            array( 'title'      => ts( 'Duration - Minutes'),
                     'default'    => true ),

save the file make sure it is called Activity.php, then you will need to open the template and activate the field 'Duration - Minutes' that now appears.  I haven't tested it in all the iterations-print/pdf/csv but the CSV works and we'll be able to track time on our volunteers now.
that's it.  good luck - Duane


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Simple report template modifications

This forum was archived on 2017-11-26.