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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • how to enable more years in the past
Pages: [1]

Author Topic: how to enable more years in the past  (Read 1719 times)

mtndan

  • Guest
how to enable more years in the past
July 11, 2007, 05:53:49 am
Hi, my client is entering historical contribution and membership data. How can I allow her to select years further in the past than the default options provided by the drop-down menus?

Thank you,
Dan

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: how to enable more years in the past
July 11, 2007, 07:06:50 am

The easiest way to do this for now is to hack the relevant form files. Typically when we build a date form field, we tell the system how many years to go back.

CRM/Contribute/Form/Contribution.php (search for 'date')

CRM_Core_SelectValues::date('manual', 3, 1)

3 is the number of years to go back
1 is the number of years to go forward

yes, we know we should make this configurable. Dates are used quite a bit and we'd need different config values for each classs of dates (birth_date is very different than the above etc)

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

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: how to enable more years in the past
July 12, 2007, 05:01:14 am
Every time I install a new version I have to hack the date ranges for CiviMember too. This was logged as issue http://issues.civicrm.org/jira/browse/CRM-1480 at the very end of last year.
Quote

The Membership form allows the user to choose from a range of input years. For organisations that have long standing members it is necessary to edit the Membership.php file to change the number of years available. While this is easy to achieve it would be good if this was configurable in global settings rather than having to edit the file on each update.

Specifically this would mean having an upper and lower range limit for join_date, start_date and end_date.

You can modify the years supported in the New Membership form by changing this line in :
 CRM/Member/Form/Membership.php
        $this->add('date', 'join_date', ts('Join Date'),
CRM_Core_SelectValues::date('manual', 3, 1), false );
        $this->addRule('join_date', ts('Select a valid date.'), 'qfDate');
        $this->add('date', 'start_date', ts('Start Date'),
CRM_Core_SelectValues::date('manual', 3, 1), false );
        $this->addRule('start_date', ts('Select a valid date.'), 'qfDate');
        $this->add('date', 'end_date', ts('End Date'),
CRM_Core_SelectValues::date('manual', 3, 1), false );
        $this->addRule('end_date', ts('Select a valid date.'), 'qfDate');

Change the parameter that is currently "3" to "20" - this will give you current year through 20 years ago on the form.

At the time the variables were being shifted from the settings file to the db and there was reluctance to add this feature.

Would be good to revisit this and include it in a future release.

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: how to enable more years in the past
July 12, 2007, 07:21:21 am

agreed, we'll shoot to fix this in 2.0. the relevant issue is:

http://issues.civicrm.org/jira/browse/CRM-2090

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

mtndan

  • Guest
Re: how to enable more years in the past
July 13, 2007, 02:31:25 pm
Thank you!

Quote from: Donald Lobo on July 11, 2007, 07:06:50 am

The easiest way to do this for now is to hack the relevant form files. Typically when we build a date form field, we tell the system how many years to go back.

CRM/Contribute/Form/Contribution.php (search for 'date')

CRM_Core_SelectValues::date('manual', 3, 1)

3 is the number of years to go back
1 is the number of years to go forward

yes, we know we should make this configurable. Dates are used quite a bit and we'd need different config values for each classs of dates (birth_date is very different than the above etc)

lobo


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • how to enable more years in the past

This forum was archived on 2017-11-26.