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) »
  • Retrieving configured fiscal date
Pages: [1]

Author Topic: Retrieving configured fiscal date  (Read 1100 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Retrieving configured fiscal date
September 04, 2011, 10:13:20 pm
I am using the CiviCRM function   CRM_Utils_Date::calculateFiscalYear( $fyDate, $fyMonth  );  to determine the current fiscal year.  But I am currently hard-coding the parameters for month and date to July 1.

I would prefer to use the global setting for the fiscal year start, which I have already configured at: http://mygroup.org/civicrm/admin/setting/date?reset=1

What is the proper way to retrieve the global setting for the fiscal year start?
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Retrieving configured fiscal date
September 04, 2011, 11:58:52 pm
Hi,

Don't have the answer, but would be great if you could implement it as an API (makes it easier to test, easier to use...)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Retrieving configured fiscal date
September 05, 2011, 06:28:46 am
If it was an API, what would the "entity" be called?

Also, the fiscal start date is currently stored in the field "config_backend"  in the table "civicrm_domain".   Are there any utility classes that I can use to parse that field into usable chunks?



Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

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: Retrieving configured fiscal date
September 05, 2011, 09:18:11 am

You can use

Code: [Select]
$config = CRM_Core_Config::singleton( );
echo $config->fiscalYearStart;

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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Retrieving configured fiscal date
September 05, 2011, 10:37:51 am
And quite logically, config seems like a nice entity name, I'd say.
something along (seriously pseudocodish:
api/v3/Config.php

function civicrm_api3_config_get ($params) {
$config = CRM_Core_Config::singleton( );
if (!array_key_exists('name',$params)) {
  return civicrm_api3_create_success($config);
}
if (array_key_exists('name',$params)
  return civicrm_api3_create_success($config[$params['name']])
}
return civicrm_api3_create_error ("config $params['name'] doesn't exist",array_keys($config))

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Retrieving configured fiscal date

This forum was archived on 2017-11-26.