Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
3 | | CiviCRM version 4.3 | | |
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 | { | |
57 | {/literal} | |
58 | relationID = "#account_relationship" | |
59 | financialAccountID = "#financial_account_id" | |
60 | callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}" | |
61 | {literal} | |
62 | var financialId = cj("#financial_account_id").val(); | |
63 | var check = cj(relationID).val(); | |
64 | if( check == 'select' || financialId == 'select' ){ | |
65 | callbackURL = callbackURL+"&_value="+financialId; | |
66 | cj.ajax({ | |
67 | url: callbackURL, | |
68 | context: document.body, | |
69 | success: function( data, textStatus ){ | |
70 | cj(relationID).html("");//clear old options | |
71 | data = eval(data);//get json array | |
72 | if ( data != null ) { | |
73 | for (i = 0; i < data.length; i++) { | |
74 | if( data[i].selected == 'Selected') | |
75 | var idf = data[i].value; | |
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 | //cj("option:first", relationID).attr( "selected", "selected" );//select first option | |
82 | ||
83 | } | |
84 | }); | |
85 | if( financialId == 'select' ){ | |
86 | {/literal} | |
87 | ||
88 | callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}" | |
89 | {literal} | |
90 | callbackURLs = callbackURLs+"&_value=select"; | |
91 | cj.ajax({ | |
92 | url: callbackURLs, | |
93 | context: document.body, | |
94 | success: function( data, textStatus ){ | |
95 | cj(financialAccountID).html("");//clear old options | |
96 | data = eval(data);//get json array | |
97 | if ( data != null ) { | |
98 | for (i = 0; i < data.length; i++) { | |
99 | cj(financialAccountID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null); | |
100 | } | |
101 | } | |
102 | ||
103 | } | |
104 | }); | |
105 | } | |
106 | } | |
107 | }); | |
108 | {/literal} | |
109 | ||
110 | {literal} | |
111 | ||
112 | cj("#account_relationship").change(function() | |
113 | { | |
114 | {/literal} | |
115 | relationID = "#account_relationship" | |
116 | financialAccountID = "#financial_account_id" | |
117 | callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}" | |
118 | {literal} | |
119 | var financialId = cj("#account_relationship").val(); | |
120 | var check = cj(financialAccountID).val(); | |
121 | if( check == 'select' || financialId == 'select' ){ | |
122 | callbackURLs = callbackURLs+"&_value="+financialId; | |
123 | cj.ajax({ | |
124 | url: callbackURLs, | |
125 | context: document.body, | |
126 | success: function( data, textStatus ){ | |
127 | cj(financialAccountID).html("");//clear old options | |
128 | data = eval(data);//get json array | |
129 | if ( data != null ) { | |
130 | for (i = 0; i < data.length; i++) { | |
131 | cj(financialAccountID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null); | |
132 | } | |
133 | } | |
134 | ||
135 | } | |
136 | }); | |
137 | ||
138 | if( financialId == 'select' ){ | |
139 | {/literal} | |
140 | callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}" | |
141 | {literal} | |
142 | callbackURL = callbackURL+"&_value=select"; | |
143 | cj.ajax({ | |
144 | url: callbackURL, | |
145 | context: document.body, | |
146 | success: function( data, textStatus ){ | |
147 | cj(relationID).html("");//clear old options | |
148 | data = eval(data);//get json array | |
149 | if ( data != null ) { | |
150 | for (i = 0; i < data.length; i++) { | |
151 | if( data[i].selected == 'Selected') | |
152 | var idf = data[i].value; | |
153 | cj(relationID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null); | |
154 | } | |
155 | } | |
156 | if( idf != null) | |
157 | cj(relationID).val(idf); | |
158 | //cj("option:first", relationID).attr( "selected", "selected" );//select first option | |
159 | ||
160 | } | |
161 | }); | |
162 | } | |
163 | ||
164 | } | |
165 | }); | |
166 | {/literal} | |
167 | </script> |