Commit | Line | Data |
---|---|---|
7f254ad8 AE |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
3 | | CiviCRM version 4.6 | | |
4 | +--------------------------------------------------------------------+ | |
5 | | Copyright CiviCRM LLC (c) 2004-2015 | | |
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 | <div class="crm-block crm-form-block crm-financial_type-form-block"> | |
28 | {if $action eq 8} | |
29 | <div class="messages status"> | |
30 | <div class="icon inform-icon"></div> | |
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} | |
32 | </div> | |
33 | {else} | |
34 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
35 | ||
36 | <table class="form-layout"> | |
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> | |
41 | </tr> | |
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> | |
45 | </tr> | |
46 | ||
47 | </table> | |
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} | |
54 | cj("#financial_account_id").change(function() { | |
55 | {/literal} | |
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'}" | |
59 | {literal} | |
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) { | |
68 | cj(relationID).html("");//clear old options | |
69 | data = eval(data);//get json array | |
70 | if (data != null) { | |
71 | for (i = 0; i < data.length; i++) { | |
72 | if (data[i].selected == 'Selected') { | |
73 | var idf = data[i].value; | |
74 | } | |
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); | |
80 | } | |
81 | } | |
82 | }); | |
83 | if (financialId == 'select') { | |
84 | {/literal} | |
85 | callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}" | |
86 | {literal} | |
87 | callbackURLs = callbackURLs + "&_value=select"; | |
88 | cj.ajax({ | |
89 | url: callbackURLs, | |
90 | context: document.body, | |
91 | success: function(data, textStatus) { | |
92 | cj(financialAccountID).html("");//clear old options | |
93 | data = eval(data);//get json array | |
94 | if (data != null) { | |
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 | } | |
100 | }); | |
101 | } | |
102 | } | |
103 | }); | |
104 | {/literal} | |
105 | {literal} | |
106 | cj("#account_relationship").change(function() { | |
107 | {/literal} | |
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'}" | |
111 | {literal} | |
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) { | |
120 | cj(financialAccountID).html("");//clear old options | |
121 | data = eval(data);//get json array | |
122 | if (data != null) { | |
123 | for (i = 0; i < data.length; i++) { | |
124 | if (data[i].selected == 'Selected') { | |
125 | var idf = data[i].value; | |
126 | } | |
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); | |
132 | } | |
133 | } | |
134 | }); | |
135 | if (financialId == 'select') { | |
136 | {/literal} | |
137 | callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}" | |
138 | {literal} | |
139 | callbackURL = callbackURL+"&_value=select"; | |
140 | cj.ajax({ | |
141 | url: callbackURL, | |
142 | context: document.body, | |
143 | success: function(data, textStatus) { | |
144 | cj(relationID).html("");//clear old options | |
145 | data = eval(data);//get json array | |
146 | if (data != null) { | |
147 | for (i = 0; i < data.length; i++) { | |
148 | if (data[i].selected == 'Selected') { | |
149 | var idf = data[i].value; | |
150 | } | |
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); | |
156 | } | |
157 | } | |
158 | }); | |
159 | } | |
160 | } | |
161 | }); | |
162 | {/literal} | |
163 | </script> |