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 CiviContribute (Moderator: Donald Lobo) »
  • Change chart in dashboard
Pages: [1]

Author Topic: Change chart in dashboard  (Read 2621 times)

Conte01

  • I post occasionally
  • **
  • Posts: 79
  • Karma: -1
  • www.aidboard.com
    • Aidboard
  • CiviCRM version: latest
  • CMS version: Drupal
Change chart in dashboard
February 16, 2011, 02:52:56 am
hi

i would like to change the tabular view in the contribution dashboard.

i do no need the comulative column. instead i would need to add several colums. e.g.: one for private donations, company donations, membershipsfees, and so on

i guess the dashboard.tpl has to be changed for this but how....?

thanks
conte
http://www.aidboard.com

Conte01

  • I post occasionally
  • **
  • Posts: 79
  • Karma: -1
  • www.aidboard.com
    • Aidboard
  • CiviCRM version: latest
  • CMS version: Drupal
Re: Change chart in dashboard
February 16, 2011, 03:44:40 am
if i am right dashboard.tpl should be modified.

i would add this on the top

<tr>
    <td><strong>{ts}Private Donations{/ts}</strong></td>
    <td class="label">{if NOT $monthToDate.Valid.amount}{ts}(n/a){/ts}{else}{$monthToDate.Valid.amount}{/if}</td>
    <td class="label">{$monthToDate.Valid.count}</td>
    <td><a href="{$monthToDate.Valid.url}">{ts}view details{/ts}...</a></td>
</tr>

But How do i edit the code to display the private donations of this month?

thanks
conte
« Last Edit: February 16, 2011, 04:06:32 am by Conte01 »
http://www.aidboard.com

Conte01

  • I post occasionally
  • **
  • Posts: 79
  • Karma: -1
  • www.aidboard.com
    • Aidboard
  • CiviCRM version: latest
  • CMS version: Drupal
Re: Change chart in dashboard
February 16, 2011, 06:38:54 am
i am working on dashboard.php now. i changed somethings, hopefully the rights one :)

function preProcess( )
    {
        CRM_Utils_System::setTitle( ts('CiviContribute') );

        $status      = array( 'Valid', 'Cancelled' );
        $prefixes    = array( 'start', 'month', 'year', 'privat' );
        $startDate   = null;
        $startToDate = $monthToDate = $yearToDate = array( );

        //get contribution dates.
        require_once 'CRM/Contribute/BAO/Contribution.php';
        $dates = CRM_Contribute_BAO_Contribution::getContributionDates( );
        foreach ( array( 'now', 'yearDate', 'monthDate', 'privatDate' ) as $date ) {
            $$date = $dates[$date];
        }
        $yearNow = $yearDate + 10000;
        foreach ( $prefixes as $prefix ) {
            $aName = $prefix . 'ToDate';
            $dName = $prefix . 'Date';

            if ( $prefix == 'year') {
                $now  = $yearNow;
            }

            foreach ( $status as $s ) {
                ${$aName}[$s]        = CRM_Contribute_BAO_Contribution::getTotalAmountAndCount( $s, $$dName, $now );
                ${$aName}[$s]['url'] = CRM_Utils_System::url( 'civicrm/contribute/search',
                                                              "reset=1&force=1&status=1&start={$$dName}&end=$now&test=0");
            }

            $this->assign( $aName, $$aName );
        }

but how do i now get the privateDate to get me the privatdonations (contributiontype) from this month?

thanks
conte
http://www.aidboard.com

mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: Change chart in dashboard
February 16, 2011, 06:48:06 am
A patch in this issue seems to do something similar, but for memberships. Maybe it can provide hints on what needs to be done for contributions: http://issues.civicrm.org/jira/browse/CRM-7239

Note: I'm not sure if, in your case, this is the best approach however, since then you will have to maintain a custom patch to CiviCRM that you will need to re-apply after each upgrade.
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

Conte01

  • I post occasionally
  • **
  • Posts: 79
  • Karma: -1
  • www.aidboard.com
    • Aidboard
  • CiviCRM version: latest
  • CMS version: Drupal
Re: Change chart in dashboard
February 16, 2011, 07:10:30 am
hi

thanks for the hint. however i think i just have to modify a little thing that this search query

foreach ( $status as $s ) {
                ${$aName}[$s]        = CRM_Contribute_BAO_Contribution::getTotalAmountAndCount( $s, $$dName, $now );
                ${$aName}[$s]['url'] = CRM_Utils_System::url( 'civicrm/contribute/search',
                                                              "reset=1&force=1&status=1&start={$$dName}&end=$now&test=0");

delivers only results form a special contribution type. am i right?

thanks
conte
http://www.aidboard.com

Conte01

  • I post occasionally
  • **
  • Posts: 79
  • Karma: -1
  • www.aidboard.com
    • Aidboard
  • CiviCRM version: latest
  • CMS version: Drupal
Re: Change chart in dashboard
February 21, 2011, 01:42:57 am
i modified dashboard.php a little more to this:

        $status      = array( 'Valid', 'Cancelled' );
        $prefixes    = array( 'start', 'month', 'year' , 'private' );
        $startDate   = null;
        $startToDate = $monthToDate = $yearToDate = $privateToDate = array( );

        //get contribution dates.
        require_once 'CRM/Contribute/BAO/Contribution.php';
        $dates = CRM_Contribute_BAO_Contribution::getContributionDates( );
        foreach ( array( 'now', 'yearDate', 'monthDate', 'privateDate' ) as $date ) {
            $$date = $dates[$date];
        }
        $yearNow = $yearDate + 10000;
        foreach ( $prefixes as $prefix ) {
            $aName = $prefix . 'ToDate';
            $dName = $prefix . 'Date';
            $type = $contribution_type_id_value = 3;

            if ( $prefix == 'year') {
                $now  = $yearNow;
            }

            foreach ( $status as $s ) {
                ${$aName}[$s]        = CRM_Contribute_BAO_Contribution::getTotalAmountAndCount( $s, $$dName, $now, $type );
                ${$aName}[$s]['url'] = CRM_Utils_System::url( 'civicrm/contribute/search',
                                                              "reset=1&force=1&status=1&start={$$dName}&end=$now&test=0");
            }

            $this->assign( $aName, $$aName );
        }

can this line: $type = $contribution_type_id_value = 3;  be right for private donations?

in dashboard.tpl this line: {$privateToDate.Valid.amount} calculates now the total amount of contributions received in every year and not only the privatedonations from the current month.

thanks
conte
« Last Edit: February 21, 2011, 06:29:15 am by Conte01 »
http://www.aidboard.com

Conte01

  • I post occasionally
  • **
  • Posts: 79
  • Karma: -1
  • www.aidboard.com
    • Aidboard
  • CiviCRM version: latest
  • CMS version: Drupal
Re: Change chart in dashboard
February 28, 2011, 01:43:15 am
hello,

would be really thankful for some hints. kinda stuck.

thanks
conte
http://www.aidboard.com

Conte01

  • I post occasionally
  • **
  • Posts: 79
  • Karma: -1
  • www.aidboard.com
    • Aidboard
  • CiviCRM version: latest
  • CMS version: Drupal
Re: Change chart in dashboard
March 08, 2011, 12:03:00 am
up
http://www.aidboard.com

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: Change chart in dashboard
March 08, 2011, 06:52:29 am

not sure what your specific question is?

in general, its a bit hard for us to "debug" the copy-and-pasted code without seeing all the other changes etc. Easier to answer questions that are specific

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

Conte01

  • I post occasionally
  • **
  • Posts: 79
  • Karma: -1
  • www.aidboard.com
    • Aidboard
  • CiviCRM version: latest
  • CMS version: Drupal
Re: Change chart in dashboard
March 09, 2011, 01:12:10 am
Hi,

I copy/pasted all the changes I have made.

As I said I would like to change the tabular view of the contribution dashboard. CiviCRM shows the Monthly contributions, Total contributions of this year and overall total contributions.

I would like to add several columns for each contribution type. Therefore I would like to have seperate columns for all private, company, online contributions and memberships fees for the current month.

thanks
conte
http://www.aidboard.com

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: Change chart in dashboard
March 09, 2011, 08:27:51 am

Sorry, i cant look at all your changes to see what is happening and why things are not working

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

Conte01

  • I post occasionally
  • **
  • Posts: 79
  • Karma: -1
  • www.aidboard.com
    • Aidboard
  • CiviCRM version: latest
  • CMS version: Drupal
Re: Change chart in dashboard
August 31, 2011, 01:06:09 am
hi

i am still looking for a way to achieve my goal. any new ideas?

thanks
conte
http://www.aidboard.com

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Change chart in dashboard

This forum was archived on 2017-11-26.