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 CiviCase (Moderator: Dave Greenberg) »
  • CiviCase "Medium" and other Open Case customisations
Pages: 1 [2]

Author Topic: CiviCase "Medium" and other Open Case customisations  (Read 3351 times)

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: CiviCase "Medium" and other Open Case customisations
August 26, 2012, 08:44:24 am
PS - I'm wondering if we should now round up these improvement and create a open CiviCase UI improvement issue and patch.  Opinions of other Civicase users appreciated :)
« Last Edit: August 26, 2012, 08:50:15 am by michaelmcandrew »
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: CiviCase "Medium" and other Open Case customisations
August 26, 2012, 10:01:47 am
Quote
In an ideal world, I suppose, the entire CiviCase front end would be customisable on a per-case type basis as a standard part of the CiviCase customisation, such that another tab was automatically added to the Contact record for each new type of interaction, bypassing the need to choose a case type at the point of use ("medium" would also be optional). That would be great for a lot of uses of CiviCase, anyway. But I realise that would be a significant undertaking. In the mean time, I guess it's a matter of rolling your own if you have the time / skills.

I've made a start at that with the following patch (against 4.1.5) which allows you to pass a case_type_id into the open case URL, which means one less click for the user and allows  Not tested extensively at all but might be helpful for you.

Code: [Select]
*** drupal/sites/all/modules/civicrm/CRM/Case/Form/Case.php 2012-08-26 16:49:35.000000000 +0000
--- php/CRM/Case/Form/Case.php 2012-08-26 16:50:59.000000000 +0000
***************
*** 91,96 ****
--- 91,97 ----
     * @return None
     * @access public
     */ function preProcess() {
+     $this->_caseTypeId = CRM_Utils_Array::value('case_type_id', $_GET);
      $this->_cdType = CRM_Utils_Array::value('type', $_GET);
      $this->assign('cdType', FALSE);
      if ($this->_cdType) {
***************
*** 219,224 ****
--- 220,230 ----
      }
      eval('$defaults = CRM_Case_Form_Activity_' . $this->_activityTypeFile . '::setDefaultValues($this);');
      $defaults = array_merge($defaults, CRM_Custom_Form_Customdata::setDefaultValues($this));
+ if($this->_caseTypeId){
+ $defaults['case_type_id']=$this->_caseTypeId;
+ $cases=CRM_Case_PseudoConstant::caseType();
+ drupal_set_title(drupal_get_title().': '.$cases[$this->_caseTypeId]);
+ }
      return $defaults;
    }

i've also mimicked the New Organisation > New Organisation subtype menu structure for this so that people can immediatley go to this URL.  There are a few other places in the UI that it would be good to continue this (e.g. on the contact actions tab, it would nice to be able to go straight to the case type a bit like you can do for new activity.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: CiviCase "Medium" and other Open Case customisations
August 26, 2012, 10:29:56 am
OK - another post with a quick example of how you can add links to go directly to case types from the contact summary screen using the civicrm_summaryActions hook.  I wrote a small module called civicrm_case_types_in_summary_actions.

This could be put into core or packaged as an extension.

civicrm_case_types_in_summary_actions.info
Code: [Select]
name = Case types in summary actions
description = Shows direct links to case types in CiviCRM's summary actions
core = 7.x


civicrm_case_types_in_summary_actions.module
Code: [Select]
<?php
function civicrm_case_types_in_summary_actions_civicrm_summaryActions( &$actions, $contactID ){
    
$weight=$actions['case']['weight'];
    unset(
$actions['case']);
    require_once
'CRM/Case/PseudoConstant.php';
$case_types=CRM_Case_PseudoConstant::caseType();
foreach($case_types as $case_id => $case_name){
    $actions['case_'.$case_id]=array(
 
       'title' => 'add '.$case_name,
       'weight' => $weight,
       'ref' => 'new-case',
       'key' => 'case_'.$case_id,
       'component' => 'CiviCase',
       'href' => "/civicrm/case/add?reset=1&action=add&atype=13&context=case&case_type_id={$case_id}&cid={$contactID}",
       'permissions' => array('add cases'),
    );
    
}
}

I haven't tested this and I don't think I quite have the weights stuff right, etc., and am unsure as to if this would look alright with more than one case type, but it is a start.

PS. Here is a link to the files when I made this commit:

https://github.com/michaelmcandrew/rd/tree/082539fcc49ef03cd4f5a1b00226b82d0ab309f3/drupal/sites/all/modules/custom/civicrm_case_types_in_summary_actions

If you're reading this at some point in the future, that module might not be there in the latest version any more (but fingers crossed that link should still work).
« Last Edit: August 27, 2012, 06:17:47 am by Michael McAndrew »
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: CiviCase "Medium" and other Open Case customisations
August 26, 2012, 12:11:31 pm
michael were you planning on attaching something?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: CiviCase "Medium" and other Open Case customisations
August 27, 2012, 05:51:24 am
hey pete,

the two module files are quoted inline and the menu example was in the previous post - maybe i missed something else?
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: CiviCase "Medium" and other Open Case customisations
August 27, 2012, 06:57:29 am
It seems like lcdweb is also into the reshuffle of the case UI: http://forum.civicrm.org/index.php/topic,14012.0.html
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

FadeOUT

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 0
  • IT Development at UK Charity
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.14
  • MySQL version: 5.1.57-community
  • PHP version: 5.3
Re: CiviCase "Medium" and other Open Case customisations
September 20, 2012, 04:22:23 am
Interesting stuff here, Michael - I must have a play with this! I think it's time for me to quit with the live edits for a bit ;-)

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • CiviCase "Medium" and other Open Case customisations

This forum was archived on 2017-11-26.