Update version numbers to 4.4 and lint php
[civicrm-core.git] / templates / CRM / Financial / Form / FinancialTypeAccount.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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 *}
27 <h3>{if $action eq 8}{ts}Delete Financial Type Account{/ts}{elseif $action eq 1}{ts}Add New Financial Type Account{/ts}{elseif $action eq 2}{ts}Edit Financial Type Account{/ts}{/if}</h3>
28 <div class="crm-block crm-form-block crm-financial_type-form-block">
29 {if $action eq 8}
30 <div class="messages status">
31 <div class="icon inform-icon"></div>
32 {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.{/ts} {ts}Do you want to continue?{/ts}
33 </div>
34 {else}
35 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
36
37 <table class="form-layout">
38
39 <tr class="crm-contribution-form-block-account_relationship">
40 <td class="label">{$form.account_relationship.label}</td>
41 <td class="html-adjust">{$form.account_relationship.html}</td>
42 </tr>
43 <tr class="crm-contribution-form-block-financial_account_id">
44 <td class="label">{$form.financial_account_id.label}</td>
45 <td class="html-adjust">{$form.financial_account_id.html}</td>
46 </tr>
47
48 </table>
49 {/if}
50 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="botttom"}</div>
51 </div>
52
53 <script language="JavaScript" type="text/javascript">
54 {literal}
55 cj("#financial_account_id").change(function() {
56 {/literal}
57 relationID = "#account_relationship"
58 financialAccountID = "#financial_account_id"
59 callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}"
60 {literal}
61 var financialId = cj("#financial_account_id").val();
62 var check = cj(relationID).val();
63 if (check == 'select' || financialId == 'select') {
64 callbackURL = callbackURL+"&_value=" + financialId;
65 cj.ajax({
66 url: callbackURL,
67 context: document.body,
68 success: function(data, textStatus) {
69 cj(relationID).html("");//clear old options
70 data = eval(data);//get json array
71 if (data != null) {
72 for (i = 0; i < data.length; i++) {
73 if (data[i].selected == 'Selected') {
74 var idf = data[i].value;
75 }
76 cj(relationID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
77 }
78 }
79 if (idf != null) {
80 cj(relationID).val(idf);
81 }
82 }
83 });
84 if (financialId == 'select') {
85 {/literal}
86 callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}"
87 {literal}
88 callbackURLs = callbackURLs + "&_value=select";
89 cj.ajax({
90 url: callbackURLs,
91 context: document.body,
92 success: function(data, textStatus) {
93 cj(financialAccountID).html("");//clear old options
94 data = eval(data);//get json array
95 if (data != null) {
96 for (i = 0; i < data.length; i++) {
97 cj(financialAccountID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
98 }
99 }
100 }
101 });
102 }
103 }
104 });
105 {/literal}
106 {literal}
107 cj("#account_relationship").change(function() {
108 {/literal}
109 relationID = "#account_relationship"
110 financialAccountID = "#financial_account_id"
111 callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}"
112 {literal}
113 var financialId = cj("#account_relationship").val();
114 var check = cj(financialAccountID).val();
115 if (check == 'select' || financialId == 'select') {
116 callbackURLs = callbackURLs+"&_value="+financialId;
117 cj.ajax({
118 url: callbackURLs,
119 context: document.body,
120 success: function(data, textStatus) {
121 cj(financialAccountID).html("");//clear old options
122 data = eval(data);//get json array
123 if (data != null) {
124 for (i = 0; i < data.length; i++) {
125 if (data[i].selected == 'Selected') {
126 var idf = data[i].value;
127 }
128 cj(financialAccountID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
129 }
130 }
131 if (idf != null) {
132 cj(financialAccountID).val(idf);
133 }
134 }
135 });
136 if (financialId == 'select') {
137 {/literal}
138 callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}"
139 {literal}
140 callbackURL = callbackURL+"&_value=select";
141 cj.ajax({
142 url: callbackURL,
143 context: document.body,
144 success: function(data, textStatus) {
145 cj(relationID).html("");//clear old options
146 data = eval(data);//get json array
147 if (data != null) {
148 for (i = 0; i < data.length; i++) {
149 if (data[i].selected == 'Selected') {
150 var idf = data[i].value;
151 }
152 cj(relationID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
153 }
154 }
155 if (idf != null) {
156 cj(relationID).val(idf);
157 }
158 }
159 });
160 }
161 }
162 });
163 {/literal}
164 </script>