CRM-15002: fix case id in subject
[civicrm-core.git] / templates / CRM / Case / Form / Activity / LinkCases.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
819d0d41 3 | CiviCRM version 4.5 |
6a488035 4 +--------------------------------------------------------------------+
819d0d41 5 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25*}
53532066 26{* Template for to create a link between two cases. *}
6a488035 27 <div class="crm-block crm-form-block crm-case-linkcases-form-block">
f72119d9
CW
28 <tr class="crm-case-linkcases-form-block-link_to_case_id">
29 <td class="label">{$form.link_to_case_id.label}</td>
30 <td>{$form.link_to_case_id.html}</td>
6a488035
TO
31 </tr>
32
33{literal}
34<script type="text/javascript">
3cc60a06 35 CRM.$(function($) {
f72119d9 36 var $form = $("#{/literal}{$form.formName}{literal}");
a243158e 37 $('input[name=link_to_case_id]', $form).crmSelect2({
f72119d9
CW
38 placeholder: {/literal}'{ts escape="js"}- select case -{/ts}'{literal},
39 minimumInputLength: 1,
3c0b6a40
CW
40 formatResult: CRM.utils.formatSelect2Result,
41 formatSelection: function(row) {
42 return row.label;
43 },
f72119d9
CW
44 ajax: {
45 url: {/literal}"{crmURL p='civicrm/case/ajax/unclosed' h=0}"{literal},
46 data: function(term) {
47 return {term: term, excludeCaseIds: "{/literal}{$excludeCaseIds}{literal}"};
48 },
49 results: function(response) {
50 return {results: response};
51 }
52 }
53 }).change(function() {
54 if ($(this).val()) {
55 var info = $(this).select2('data').extra;
56 {/literal}{* Mix in variables and placeholders for clientside substitution *}
ad32fddf 57 var subject = "{ts escape=js 1="%1" 2="%2" 3="%3" 4=$client.sort_name 5=$caseTypeLabel 6=$caseID}Create link between %1 - %2 (CaseID: %3) and %4 - %5 (CaseID: %6){/ts}";
f72119d9
CW
58 {literal}
59 $('#subject', $form).val(ts(subject, {1: info.sort_name, 2: info.case_type, 3: $(this).val()}));
60 }
61 });
62 });
6a488035
TO
63</script>
64{/literal}
232624b1 65 </div>