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) »
  • Modifying CiviCase sys template msgs
Pages: [1]

Author Topic: Modifying CiviCase sys template msgs  (Read 1425 times)

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
Modifying CiviCase sys template msgs
May 16, 2011, 11:29:13 pm
Hi - a client is asking to have the system email that goes out modified to not show some fields from the case - specifically
Created By;
Reported By
Medium

So from the system template messages here /civicrm/admin/messageTemplates/add?action=update&id=1&reset=1

it looks to me like these fields might be coming in here in the code

Code: [Select]
{foreach from=$activity.fields item=field}
      <tr>
       <td {$labelStyle}>
        {$field.label}{if $field.category}({$field.category}){/if}
       </td>
       <td {$valueStyle}>
        {if $field.type eq 'Date'}
         {$field.value|crmDate:$config->dateformatDatetime}
        {else}
         {$field.value}
        {/if}
       </td>
      </tr>
     {/foreach}

so presumably have to dig in elsewhere to cause some fields not to be included - any clues? Thanks
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

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Modifying CiviCase sys template msgs
May 17, 2011, 06:05:38 pm
Add a <td>{$field.name}</td> in there so you can see the field names in the email, then remove that <td> and add {if $field.name != 'unwanted_name_1' && $field.name!= 'unwanted_name' ...} around the whole <tr> row.

Off the top of my head I think they are created_by, reported_by, and encounter_medium.

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: Modifying CiviCase sys template msgs
May 17, 2011, 06:23:11 pm
thanks so much for responding - will give it a whirl and report back.
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

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: Modifying CiviCase sys template msgs
May 17, 2011, 08:39:15 pm
hmm - well i tried both of your suggestions to the letter, so if there was other obvious bits I failed to think of, my bad. But adding
Code: [Select]
<td>{$field.name}</td>did change the output beyond giving me a blank column - had a look around the db for what the field names might be but failed on that too  ::)
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

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Modifying CiviCase sys template msgs
May 18, 2011, 08:45:59 am
Hmm, maybe there is no name element. It's a little tricky to work inside those templates since you can't just use {debug} to see all the vars.

Not sure if this will work since not sure if $field is visible inside the {php} block, but can try this to dump the $field var.
<td>{php} print_r({$field}); {/php}</td>

Alternatively, just to see what keys are available. Maybe it's called something other than "name".
<td>{foreach from=$field item=f key=k}{$k}, {/foreach}</td>

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: Modifying CiviCase sys template msgs
May 18, 2011, 12:29:07 pm
Will give those a go - thanks for persisting with me on this - we had already tried a couple of variations of the below ;-)
Code: [Select]
<?php print_r(get_object_vars($field)); ?>
So tried <td>{php} print_r({$field}); {/php}</td>
and got
Code: [Select]
Parse error: syntax error, unexpected '{', expecting ')' in /home/www-home/drupal7/sites/default/files/civicrm/templates_c/en_US/%%16/16C/16CBCC56%%html%3E.php on line 295so 'Reverted to Default' and tried again in case I had left something in from earlier tinkering but same error.

Then I tried <td>{foreach from=$field item=f key=k}{$k}, {/foreach}</td>
and just got this in the output "label, value, type,"
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

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Modifying CiviCase sys template msgs
May 18, 2011, 06:08:03 pm
Interesting, no identifier in the field keys. Ok then I guess there's two options:

1) Use $field.label in the aforementioned outer {if}, and hope nobody changes the label.

2) Something more complicated, like what you were originally suggesting. Don't know off the top of my head where that code might be.

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: Modifying CiviCase sys template msgs
May 18, 2011, 07:17:47 pm
Bingo - thanks so much - so adding the second line of this snippet below the first one (and of course closing off the 'if' after the /tr ) removes the unwanted fields.

Code: [Select]
{foreach from=$activity.fields item=field}
      {if $field.label neq 'Medium' && $field.label neq 'Reported By' && $field.label neq 'Created By'}


So in the hope that this helps others who may be looking for this, it relates to the 'send a copy' option under 'case activities' when you click on 'edit' and expand the 'Send a Copy' section.
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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • Modifying CiviCase sys template msgs

This forum was archived on 2017-11-26.