Fix undefined var
[civicrm-core.git] / templates / CRM / Contribute / Form / ContributionPage / AddProduct.tpl
CommitLineData
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{capture assign=managePremiumsURL}{crmURL p='civicrm/admin/contribute/managePremiums' q="reset=1"}{/capture}
27<h3>{if $action eq 2 }{ts}Add Products to This Page{/ts} {elseif $action eq 1024}{ts}Preview{/ts}{else} {ts}Remove Products from this Page{/ts}{/if}</h3>
28<div class="crm-block crm-form-block crm-contribution-add_product-form-block">
29 <div id="help">
30 {if $action eq 1024}
31 {ts}This is a preview of this product as it will appear on your Contributions page(s).{/ts}
32 {else}
33 {ts}Use this form to select a premium to be offered on this Online Contribution Page.{/ts}
34 {/if}
35 </div>
36
37 {if $action eq 8}
38 <div class="messages status no-popup">
39 <div class="icon inform-icon"></div>
40 {ts}Are you sure you want to remove this premium product from this Contribution page?{/ts}
41 </div>
42 {elseif $action eq 1024}
43 {include file="CRM/Contribute/Form/Contribution/PremiumBlock.tpl"}
44 {else}
45 <table class="form-layout-compressed">
46 <tr class="crm-contribution-form-block-product_id"><td class="label">{$form.product_id.label}</td><td class="html-adjust">{$form.product_id.html}<br />
47 <span class="description">{ts 1=$managePremiumsURL}Pick a premium to include on this Contribution Page. Use <a href='%1'>Manage Premiums</a> to create or enable additional premium choices for your site.{/ts}</span></td></tr>
48 <tr class="crm-contribution-form-block-financial_type">
49 <td class="label">{$form.financial_type_id.label}</td>
50 <td>
51 {if !$financialType }
b2603e29 52 {capture assign=ftUrl}{crmURL p='civicrm/admin/financial/financialType' q="reset=1"}{/capture}
6a488035 53 {ts 1=$ftUrl}There are no financial types configured with linked 'Cost of Sales Premiums' and 'Premiums Inventory Account' accounts. If you want to generate accounting transactions which track the cost of premiums used <a href='%1'>click here</a> to configure financial types and accounts.{/ts}
b2603e29 54 {else}
6a488035 55 {$form.financial_type_id.html}{help id="id-financial_type-product"}
b2603e29 56 {/if}
6a488035
TO
57 </td>
58 </tr>
59 <tr class="crm-contribution-form-block-weight"><td class="label">{$form.weight.label}</td><td class="html-adjust">{$form.weight.html}<br />
60 <span class="description">{ts}Weight controls the order that premiums are displayed on the Contribution Page.{/ts}</span></td></tr>
61 </table>
62 {/if}
63
64{if $action ne 4}
65 <div class="crm-submit-buttons">
66 {include file="CRM/common/formButtons.tpl" location="bottom"}
67 </div>
68{else}
69 <div class="crm-done-button">
70 {include file="CRM/common/formButtons.tpl"}
71 </div>
72{/if} {* $action ne view *}
73</div>
74
75{* include jscript to warn if unsaved form field changes *}
76{include file="CRM/common/formNavigate.tpl"}
77<script language="JavaScript" type="text/javascript">
78{literal}
79function getFinancialType()
80{
81{/literal}
b2603e29 82 productID = "#product_id";
83 financialTypeID = "#financial_type_id"
84 callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialType'}"
6a488035 85{literal}
b2603e29 86
87 var check = cj(productID).val();
88 callbackURL = callbackURL+"&_value="+check;
6a488035
TO
89 cj.ajax({
90 url: callbackURL,
91 context: document.body,
92 success: function( data, textStatus ){
b2603e29 93 data = eval(data);//get json array
6a488035 94 if ( data != null ) {
b2603e29 95 cj(financialTypeID).val(data);
96
97 }
98
99 }
100 });
101
102 }
6a488035 103
b2603e29 104cj(document).ready(function(){
105 getFinancialType();
6a488035 106
b2603e29 107 cj("#product_id").change( function(){
108 getFinancialType();
109 });
110});
6a488035
TO
111{/literal}
112</script>