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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Modify integer field to negative - duration
Pages: [1]

Author Topic: Modify integer field to negative - duration  (Read 1092 times)

mdmiller1

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
Modify integer field to negative - duration
March 22, 2010, 10:37:06 am
I would like the duration of an activity to accept a negative integer, currently it only accepts positive integers.  How can I modify this ??

Our volunteers will receive credit for their time on an activity.  They will be able to "Cash-in" that time and receive stuff in return.

I would like to be able to add an activity for when they cash-in that will permit a negative integer in the duration field, so that when we run an activity report that I've modified to include duration, the total duration can be calculated as either their total volunteer time, or the remaining "cash-in" time they have available.

Appreciate any thoughts/suggestions
Thanks -Duane.

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: Modify integer field to negative - duration
March 22, 2010, 12:26:47 pm

I suspect you can modify the code here to allow negative numbers:

CRM/Activity/Form/Activity.php, line 543. to allow all integers (instead of just positive integers)

I dont think we have any other code that uses duration, so i suspect this is a safe change. If you do write an activity report to do the below please publish it so others can benefit

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

mdmiller1

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
Re: Modify integer field to negative - duration
March 22, 2010, 08:07:43 pm
any chance you can point me to where the rules are located?

In the activity.php file you referenced, I modified the rule that tests for 'positiveInteger' to simple Integer and allInteger and get errors that there is no rule by that name.

I can't find the rules that do these tests to locate the correct rule name that might permit a negative Integer.

thanks for your advice - Duane

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: Modify integer field to negative - duration
March 22, 2010, 08:11:50 pm

CRM/Utils/Rule.php

change 'positiveInteger' to 'integer' and that should work

lob
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Modify integer field to negative - duration

This forum was archived on 2017-11-26.