Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
232624b1 | 3 | | CiviCRM version 4.4 | |
6a488035 TO |
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"> | |
7b3622bf PN |
29 | {if $action eq 8} |
30 | <div class="messages status"> | |
31 | <div class="icon inform-icon"></div> | |
3b67ab13 | 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. Unbalanced transactions may be created if you delete this account.{/ts} {ts}Do you want to continue?{/ts} |
6a488035 | 33 | </div> |
7b3622bf PN |
34 | {else} |
35 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
96cfe0d7 | 36 | |
7b3622bf | 37 | <table class="form-layout"> |
96cfe0d7 | 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> | |
7b3622bf | 42 | </tr> |
96cfe0d7 | 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> | |
7b3622bf | 46 | </tr> |
96cfe0d7 | 47 | |
d0f466d1 | 48 | </table> |
6a488035 TO |
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} | |
7b3622bf | 55 | cj("#financial_account_id").change(function() { |
6a488035 | 56 | {/literal} |
7b3622bf PN |
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'}" | |
6a488035 | 60 | {literal} |
7b3622bf PN |
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) { | |
96cfe0d7 | 69 | cj(relationID).html("");//clear old options |
70 | data = eval(data);//get json array | |
7b3622bf | 71 | if (data != null) { |
96cfe0d7 | 72 | for (i = 0; i < data.length; i++) { |
73 | if (data[i].selected == 'Selected') { | |
74 | var idf = data[i].value; | |
7b3622bf | 75 | } |
96cfe0d7 | 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); | |
7b3622bf | 81 | } |
7b3622bf PN |
82 | } |
83 | }); | |
84 | if (financialId == 'select') { | |
6a488035 | 85 | {/literal} |
7b3622bf | 86 | callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}" |
6a488035 | 87 | {literal} |
7b3622bf PN |
88 | callbackURLs = callbackURLs + "&_value=select"; |
89 | cj.ajax({ | |
90 | url: callbackURLs, | |
91 | context: document.body, | |
92 | success: function(data, textStatus) { | |
96cfe0d7 | 93 | cj(financialAccountID).html("");//clear old options |
94 | data = eval(data);//get json array | |
7b3622bf | 95 | if (data != null) { |
96cfe0d7 | 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 | } | |
7b3622bf | 101 | }); |
a48d1d9c | 102 | } |
7b3622bf | 103 | } |
6a488035 TO |
104 | }); |
105 | {/literal} | |
96cfe0d7 | 106 | {literal} |
7b3622bf | 107 | cj("#account_relationship").change(function() { |
6a488035 | 108 | {/literal} |
7b3622bf PN |
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'}" | |
6a488035 | 112 | {literal} |
7b3622bf PN |
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) { | |
96cfe0d7 | 121 | cj(financialAccountID).html("");//clear old options |
122 | data = eval(data);//get json array | |
7b3622bf | 123 | if (data != null) { |
96cfe0d7 | 124 | for (i = 0; i < data.length; i++) { |
125 | if (data[i].selected == 'Selected') { | |
126 | var idf = data[i].value; | |
7b3622bf | 127 | } |
96cfe0d7 | 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); | |
7b3622bf | 133 | } |
96cfe0d7 | 134 | } |
7b3622bf PN |
135 | }); |
136 | if (financialId == 'select') { | |
6a488035 | 137 | {/literal} |
96cfe0d7 | 138 | callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}" |
139 | {literal} | |
7b3622bf PN |
140 | callbackURL = callbackURL+"&_value=select"; |
141 | cj.ajax({ | |
142 | url: callbackURL, | |
143 | context: document.body, | |
144 | success: function(data, textStatus) { | |
96cfe0d7 | 145 | cj(relationID).html("");//clear old options |
146 | data = eval(data);//get json array | |
7b3622bf | 147 | if (data != null) { |
96cfe0d7 | 148 | for (i = 0; i < data.length; i++) { |
149 | if (data[i].selected == 'Selected') { | |
150 | var idf = data[i].value; | |
7b3622bf | 151 | } |
96cfe0d7 | 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); | |
a48d1d9c | 157 | } |
7b3622bf | 158 | } |
96cfe0d7 | 159 | }); |
160 | } | |
7b3622bf | 161 | } |
6a488035 TO |
162 | }); |
163 | {/literal} | |
232624b1 | 164 | </script> |