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) »
  • Referencing civicrm_contribution.contribution_status_id
Pages: [1]

Author Topic: Referencing civicrm_contribution.contribution_status_id  (Read 1557 times)

npemtiv

  • Guest
Referencing civicrm_contribution.contribution_status_id
August 14, 2009, 10:53:54 pm
Where are the text strings located for civicrm_contribution.contribution_status_id?? I can't find them anywhere. Is this conversion handled somewhere in the php? Since everything else seems dynamically links to the database I wouldn't think so. I'm working on a system to pull that data off and yet I can't find where it's done....

Here's what I'm trying to do:

Print

SELECT civicrm_######.status_description (or whatever it's called...can't find)

WHERE civicrm_#####.status_id = civicrm_contribution.contribution_status_id

So basically if civicrm_contribution.contribution_status_id = 1 and that actually means 'Completed' or 'Pending' I'm trying to locate where in the schema the 'Completed', 'Pending', etc... strings are stored. Any ideas? I've looked all evening.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Referencing civicrm_contribution.contribution_status_id
August 14, 2009, 11:50:04 pm
The civicrm_option_group and civicrm_option_values define these statuses along with a whole bunch of other things
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

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Referencing civicrm_contribution.contribution_status_id
August 15, 2009, 03:19:44 am
As Eileen said these values are coming from civicrm_option_group and civicrm_option_value tables.

here option group name is 'contribution_status'. Do check values from civicrm_option_value corresponding to contribution status option group.
query might be like :
Code: [Select]

SELECT   vals.value value,
         vals.name constantName,
         vals.label canBeModifyLabel
     FROM civicrm_option_value vals
LEFT JOIN civicrm_option_group grp  ON ( grp.id = vals.option_group_id )
   WHERE grp.name = 'contribution_status';

we consider column value as a status from civicrm_option_value.

to access these values check ( http://sandbox.civicrm.org/civicrm/admin/options?reset=1 )
find name = 'contribution_status' and click on "Multiple Choice Options" ( http://sandbox.civicrm.org/civicrm/admin/optionValue?reset=1&action=browse&gid=11 )

Here 'Title' ( civicrm_option_value.label ) can be modified and on user end we expose these strings ( viewable status on forms and in receipts )

click on 'Edit' -
here Name is constant string( civicrm_option_value.name ) and which is used for internal programing logic.

so if we want to update any contribution to Completed -  we pull civicm_option_value.value where civicrm_option_value.name = 'Completed'

To easily access these values in program -

Code: [Select]
require_once 'CRM/Contribute/PseudoConstant.php';
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus( null, 'name' );
$completedStatusId     = array_search( 'Completed', $contributionStatuses );

HTH

kiran
You Are Designed To Choose... Defined By Choice.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Referencing civicrm_contribution.contribution_status_id

This forum was archived on 2017-11-26.