CRM-13863 - Get rid of double title for forms that use popups
[civicrm-core.git] / templates / CRM / Financial / Form / FinancialTypeAccount.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*}
26{* this template is used for adding/editing/deleting financial type *}
6a488035 27<div class="crm-block crm-form-block crm-financial_type-form-block">
7b3622bf
PN
28 {if $action eq 8}
29 <div class="messages status">
30 <div class="icon inform-icon"></div>
3b67ab13 31 {ts}WARNING: You cannot delete a financial type if it is currently used by any Contributions, Contribution Pages or Membership Types. Consider disabling this option instead.{/ts} {ts}Deleting a financial type cannot be undone. Unbalanced transactions may be created if you delete this account.{/ts} {ts}Do you want to continue?{/ts}
6a488035 32 </div>
7b3622bf
PN
33 {else}
34 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
96cfe0d7 35
7b3622bf 36 <table class="form-layout">
96cfe0d7 37
38 <tr class="crm-contribution-form-block-account_relationship">
39 <td class="label">{$form.account_relationship.label}</td>
40 <td class="html-adjust">{$form.account_relationship.html}</td>
7b3622bf 41 </tr>
96cfe0d7 42 <tr class="crm-contribution-form-block-financial_account_id">
43 <td class="label">{$form.financial_account_id.label}</td>
44 <td class="html-adjust">{$form.financial_account_id.html}</td>
7b3622bf 45 </tr>
96cfe0d7 46
d0f466d1 47 </table>
6a488035
TO
48 {/if}
49 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="botttom"}</div>
50</div>
51
52<script language="JavaScript" type="text/javascript">
53{literal}
7b3622bf 54cj("#financial_account_id").change(function() {
6a488035 55{/literal}
7b3622bf
PN
56 relationID = "#account_relationship"
57 financialAccountID = "#financial_account_id"
58 callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}"
6a488035 59{literal}
7b3622bf
PN
60 var financialId = cj("#financial_account_id").val();
61 var check = cj(relationID).val();
62 if (check == 'select' || financialId == 'select') {
63 callbackURL = callbackURL+"&_value=" + financialId;
64 cj.ajax({
65 url: callbackURL,
66 context: document.body,
67 success: function(data, textStatus) {
96cfe0d7 68 cj(relationID).html("");//clear old options
69 data = eval(data);//get json array
7b3622bf 70 if (data != null) {
96cfe0d7 71 for (i = 0; i < data.length; i++) {
72 if (data[i].selected == 'Selected') {
73 var idf = data[i].value;
7b3622bf 74 }
96cfe0d7 75 cj(relationID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
76 }
77 }
78 if (idf != null) {
79 cj(relationID).val(idf);
7b3622bf 80 }
7b3622bf
PN
81 }
82 });
83 if (financialId == 'select') {
6a488035 84{/literal}
7b3622bf 85 callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}"
6a488035 86{literal}
7b3622bf
PN
87 callbackURLs = callbackURLs + "&_value=select";
88 cj.ajax({
89 url: callbackURLs,
90 context: document.body,
91 success: function(data, textStatus) {
96cfe0d7 92 cj(financialAccountID).html("");//clear old options
93 data = eval(data);//get json array
7b3622bf 94 if (data != null) {
96cfe0d7 95 for (i = 0; i < data.length; i++) {
96 cj(financialAccountID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
97 }
98 }
99 }
7b3622bf 100 });
a48d1d9c 101 }
7b3622bf 102 }
6a488035
TO
103});
104{/literal}
96cfe0d7 105{literal}
7b3622bf 106cj("#account_relationship").change(function() {
6a488035 107{/literal}
7b3622bf
PN
108 relationID = "#account_relationship"
109 financialAccountID = "#financial_account_id"
110 callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}"
6a488035 111{literal}
7b3622bf
PN
112 var financialId = cj("#account_relationship").val();
113 var check = cj(financialAccountID).val();
114 if (check == 'select' || financialId == 'select') {
115 callbackURLs = callbackURLs+"&_value="+financialId;
116 cj.ajax({
117 url: callbackURLs,
118 context: document.body,
119 success: function(data, textStatus) {
96cfe0d7 120 cj(financialAccountID).html("");//clear old options
121 data = eval(data);//get json array
7b3622bf 122 if (data != null) {
96cfe0d7 123 for (i = 0; i < data.length; i++) {
124 if (data[i].selected == 'Selected') {
125 var idf = data[i].value;
7b3622bf 126 }
96cfe0d7 127 cj(financialAccountID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
128 }
129 }
130 if (idf != null) {
131 cj(financialAccountID).val(idf);
7b3622bf 132 }
96cfe0d7 133 }
7b3622bf
PN
134 });
135 if (financialId == 'select') {
6a488035 136{/literal}
96cfe0d7 137 callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}"
138{literal}
7b3622bf
PN
139 callbackURL = callbackURL+"&_value=select";
140 cj.ajax({
141 url: callbackURL,
142 context: document.body,
143 success: function(data, textStatus) {
96cfe0d7 144 cj(relationID).html("");//clear old options
145 data = eval(data);//get json array
7b3622bf 146 if (data != null) {
96cfe0d7 147 for (i = 0; i < data.length; i++) {
148 if (data[i].selected == 'Selected') {
149 var idf = data[i].value;
7b3622bf 150 }
96cfe0d7 151 cj(relationID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
152 }
153 }
154 if (idf != null) {
155 cj(relationID).val(idf);
a48d1d9c 156 }
7b3622bf 157 }
96cfe0d7 158 });
159 }
7b3622bf 160 }
6a488035
TO
161});
162{/literal}
232624b1 163</script>