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) »
  • Adding activity based Wage
Pages: [1]

Author Topic: Adding activity based Wage  (Read 1509 times)

jakedaynes

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
  • CiviCRM version: 4.0.1
  • CMS version: Drupal 7
  • MySQL version: MySQL 5.5.9
  • PHP version: 5.3.5
Adding activity based Wage
January 25, 2012, 07:50:54 pm
Hey guys - I work for an investigation company, and we're going to be using Civi for case and contact management! I'm pretty excited about it, it's years ahead of our current system.

Anyways - I've hacked together bits and pieces of civi in order to make everything work for us as necessary, but the last spot I'm stuck on is adding a wage attribute to activities.

Basically, if I was to add an activity ("Document Service") to a case, I want a "Wage" to be associated with that activity type. That way when I use my custom report to generate payroll, we have the wage populated.

I've tried adding it as custom data, but it doesn't work like I need it to. Any ideas on a direction to look?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Adding activity based Wage
January 25, 2012, 11:23:31 pm
What is the problem with custom data?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

jakedaynes

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
  • CiviCRM version: 4.0.1
  • CMS version: Drupal 7
  • MySQL version: MySQL 5.5.9
  • PHP version: 5.3.5
Re: Adding activity based Wage
January 25, 2012, 11:24:50 pm
So, I've managed to hack and slash this together thanks to the civicase time spent report

I'm left at one last block, and that is how to use a variable to fill in an array key (I'm fairly new to PHP - so I'm glad I've managed thus far)

This is the code:

Code: [Select]
                             
global $user;
$wage = ($user->name);
$wage2 = 'wage2';
$wage3 = $wage.$wage2;




                      'civicrm_activity'      =>
                                array( 'dao'     => 'CRM_Activity_DAO_Activity',
                                       'fields'  =>
                                       array(  'source_contact_id'  =>
                                               array( 'title'      => ts( 'Contact ID' ),
                                                      'default'    => false ,
                                                      'no_display' => true,
                                                      ),
                                               'activity_type_id'  =>
                                               array( 'title'      => ts( 'Activity Type' ),
                                                      'default'    => true ,
                                                      'type'       =>  CRM_Utils_Type::T_STRING
                                                      ),
                                               'activity_date_time'=>
                                               array( 'title'      => ts( 'Activity Date'),
                                                      'default'    => true ),
                                               'status_id'         =>
                                               array( 'title'      => ts( 'Activity Status' ),
                                                      'default'    => false ,
                                                      'type'       =>  CRM_Utils_Type::T_STRING,
                                                    ),
                                               'id'               =>
                                               array( 'title'      => ts('Activity ID'),
                                                      'default'    => false   
                                                      ),
                                               'duration'         =>
                                               array( 'title'      => ts( 'Duration' ),
                                                      'default'    => false ,
                                                      'type'       =>  CRM_Utils_Type::T_INT ),
                                               'subject'          =>
                                               array( 'title'      => ts( 'Activity Subject' ),
                                                      'default'    => true, ),
                                              '$wage3'          =>
                                               array( 'title'      => ts( 'Wage' ),
                                                      'default'    => true,
                                                      ),
                                             ),


I need to get that $wage3 to act as the array key using it's value.

Any help on that?
« Last Edit: January 25, 2012, 11:26:21 pm by jakedaynes »

jakedaynes

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
  • CiviCRM version: 4.0.1
  • CMS version: Drupal 7
  • MySQL version: MySQL 5.5.9
  • PHP version: 5.3.5
Re: Adding activity based Wage
January 25, 2012, 11:25:48 pm
Quote from: xavier on January 25, 2012, 11:23:31 pm
What is the problem with custom data?

Custom data allows users to edit it/forces them to enter it - that's something I can't have. I thought about using CSS to hide it and entering it that way, but it's a route I'd rather not use just in case

Remember, each activity type has it's own wage on a per user basis
« Last Edit: January 25, 2012, 11:39:08 pm by jakedaynes »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Adding activity based Wage
January 26, 2012, 01:16:04 am
You could make them read only and write a hook to populate them automatically.

http://book.civicrm.org/developer/ for more info

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) »
  • Adding activity based Wage

This forum was archived on 2017-11-26.