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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Edit Contribution type - online
Pages: [1]

Author Topic: Edit Contribution type - online  (Read 767 times)

oak

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Joomla 1.7
  • MySQL version: 5.0.92
  • PHP version: PHP 5.3.6 (cli) (built: Sep 12 2011 18:02:42)
Edit Contribution type - online
March 12, 2013, 03:08:24 pm
Sometimes the staff need to re-asssign a contribution type. This can NOT be done from on-line contributions by default. If I change the code at
..administrator/components/com_civicrm/civicrm/CRM/Contribute/Form/Contribution.php

to allow this:

 $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution');

    $element = $this->add('select', 'contribution_type_id',
      ts('Contribution Type'),
      array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType(),
      TRUE, array('onChange' => "buildCustomData( 'Contribution', this.value );")
    );
    if ($this->_online) {
     // $element->freeze();
    }

What do I mess up?  What is this buildCustomData?

PS I am not a PHP programmer, so some advice is appreciated.
http://forum.civicrm.org/index.php?topic=22126.0

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: Edit Contribution type - online
March 13, 2013, 02:33:14 am
If you are not a PHP programmer you are pretty deep in the code  ;D
buildCustomData is a function, if you are not a programmer I would not try to fix this yourself, but get someone familiar with CiviCRM customizations to do it for you. Alternative is that you describe in a little more detail what you want exactly and we (as in the forum and community) can help you with other solutions to get where you want to be? What version of CiviCRM are you using?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

oak

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Joomla 1.7
  • MySQL version: 5.0.92
  • PHP version: PHP 5.3.6 (cli) (built: Sep 12 2011 18:02:42)
Re: Edit Contribution type - online
March 13, 2013, 11:56:45 am
Thank Erik,

The situation happens when the staff made a mistake with setting up a retreat page with "contribution type 'donations'' rather then 'retreat'. The accountant points this this out to the staff which corrects the retreat page, but now has to go back to CiviCRM>>Contact Summary [name] Edit Contribution.
On this page the staff find that the 'Contribution Type ' drop dow box is a text field rather then a drop down box.

The changed code enable the drop down box. It seems to work, but there might be a unintended consequence as I do not understand what 'buildCustomData' function capability we are losing. Somebody who who wrote this screen interface was trying to prevent from what my customer needs. My question is why?  Can I get away with changing these transaction this way and then change the code back?

We are using CiviCRM 4.2.8

Any help is sincerely appreciated.

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: Edit Contribution type - online
March 13, 2013, 12:07:34 pm
I am still not totally sure of what you are trying to achieve but....
the 'buildCustomData' bit is used when you are using custom data with your contribution. Apparently you are not doing that because as far as you can see everything is OK. I do not think it will cause any problems. My advice: test thoroughly and if it works for you, you made a good change :-)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

oak

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Joomla 1.7
  • MySQL version: 5.0.92
  • PHP version: PHP 5.3.6 (cli) (built: Sep 12 2011 18:02:42)
Re: Edit Contribution type - online
March 13, 2013, 12:09:10 pm
Could you give me an example of custom data?

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: Edit Contribution type - online
March 15, 2013, 10:54:51 am
It is a function in CiviCRM to create specific data? So for example, if I am installing CiviCRM for a baseball club, we would want to know things about players that are not in the standard CiviCRM database. Like the number of homeruns etc. I would create custom fields (probably linked to a contact subtype named Player) to hold those specific data elemants. Does that make sense?

Check http://book.civicrm.org/user/current/organising-your-data/custom-fields/
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

oak

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Joomla 1.7
  • MySQL version: 5.0.92
  • PHP version: PHP 5.3.6 (cli) (built: Sep 12 2011 18:02:42)
Re: Edit Contribution type - online
March 15, 2013, 11:25:52 am
All right. Glad to hear hear you confirm my thoughts. Custom data = custom fields. So If I have no custom fields related to "Contribution Type" (and -Just to be sure- the "event tag"), I should be to change this "Contribution Type". Is that how you see it? - Hartelijk bedankt!
« Last Edit: March 15, 2013, 11:30:14 am by oak »

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: Edit Contribution type - online
March 15, 2013, 12:24:21 pm
That is indeed how
I see it! Alstublieft :-)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Edit Contribution type - online

This forum was archived on 2017-11-26.