First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

View file

@ -0,0 +1,212 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{assign var='hideTotal' value=$quickConfig+$noCalcValueDisplay}
<div id="pricesetTotal" class="crm-section section-pricesetTotal">
<div class="label
{if $hideTotal}, hiddenElement{/if}" id="pricelabel">
<label>
{if ( $extends eq 'Contribution' ) || ( $extends eq 'Membership' )}
<span id='amount_sum_label'>{ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts}</span>
{if $isAdditionalParticipants} {ts}for this participant{/ts}{/if}
{/if}
</label>
</div>
<div class="content calc-value" {if $hideTotal}style="display:none;"{/if} id="pricevalue" ></div>
</div>
<script type="text/javascript">
{literal}
var thousandMarker = '{/literal}{$config->monetaryThousandSeparator}{literal}';
var separator = '{/literal}{$config->monetaryDecimalPoint}{literal}';
var symbol = '{/literal}{$currencySymbol}{literal}';
var optionSep = '|';
cj("#priceset [price]").each(function () {
var elementType = cj(this).attr('type');
if ( this.tagName == 'SELECT' ) {
elementType = 'select-one';
}
switch(elementType) {
case 'checkbox':
//event driven calculation of element.
cj(this).click(function(){
calculateCheckboxLineItemValue(this);
display(calculateTotalFee());
});
calculateCheckboxLineItemValue(this);
break;
case 'radio':
//event driven calculation of element.
cj(this).click( function(){
calculateRadioLineItemValue(this);
display(calculateTotalFee());
});
calculateRadioLineItemValue(this);
break;
case 'text':
//event driven calculation of element.
cj(this).bind( 'keyup', function() {
calculateText(this);
}).bind( 'blur' , function() {
calculateText(this);
});
//default calculation of element.
calculateText(this);
break;
case 'select-one':
calculateSelectLineItemValue(this);
//event driven calculation of element.
cj(this).change( function() {
calculateSelectLineItemValue(this);
display(calculateTotalFee());
});
break;
}
display(calculateTotalFee());
});
/**
* Calculate the value of the line item for a radio value.
*/
function calculateCheckboxLineItemValue(priceElement) {
eval( 'var option = ' + cj(priceElement).attr('price') ) ;
optionPart = option[1].split(optionSep);
price = parseFloat(0);
if (cj(priceElement).prop('checked')) {
price = parseFloat(optionPart[0]);
}
cj(priceElement).data('line_raw_total', price);
}
/**
* Calculate the value of the line item for a radio value.
*/
function calculateRadioLineItemValue(priceElement) {
eval( 'var option = ' + cj(priceElement).attr('price') );
optionPart = option[1].split(optionSep);
var lineTotal = parseFloat(optionPart[0]);
cj(priceElement).data('line_raw_total', lineTotal);
var radionGroupName = cj(priceElement).attr("name");
// Reset all unchecked options to having a data value of 0.
cj('input[name=' + radionGroupName + ']:radio:unchecked').each(
function () {
cj(this).data('line_raw_total', 0);
}
);
}
/**
* Calculate the value of the line item for a select value.
*/
function calculateSelectLineItemValue(priceElement) {
eval( 'var selectedText = ' + cj(priceElement).attr('price') );
var price = parseFloat('0');
var option = cj(priceElement).val();
if (option) {
optionPart = selectedText[option].split(optionSep);
price = parseFloat(optionPart[0]);
}
cj(priceElement).data('line_raw_total', price);
}
/**
* Calculate the value of the line item for a text box.
*/
function calculateText(priceElement) {
//CRM-16034 - comma acts as decimal in price set text pricing
//CRM-19937 - dollar sign easy mistake to make by users.
var textval = parseFloat(cj(priceElement).val().replace(thousandMarker, '').replace(symbol, ''));
if (isNaN(textval)) {
textval = parseFloat(0);
}
eval('var option = '+ cj(priceElement).attr('price'));
optionPart = option[1].split(optionSep);
addprice = parseFloat(optionPart[0]);
var curval = textval * addprice;
cj(priceElement).data('line_raw_total', curval);
display(calculateTotalFee());
}
/**
* Calculate the total fee for the visible priceset.
*/
function calculateTotalFee() {
var totalFee = 0;
cj("#priceset [price]").each(function () {
totalFee = totalFee + cj(this).data('line_raw_total');
});
return totalFee;
}
/**
* Display calculated amount.
*/
function display(totalfee) {
// totalfee is monetary, round it to 2 decimal points so it can
// go as a float - CRM-13491
totalfee = Math.round(totalfee*100)/100;
var totalEventFee = formatMoney( totalfee, 2, separator, thousandMarker);
document.getElementById('pricevalue').innerHTML = "<b>"+symbol+"</b> "+totalEventFee;
cj('#total_amount').val( totalfee );
cj('#pricevalue').data('raw-total', totalfee).trigger('change');
( totalfee < 0 ) ? cj('table#pricelabel').addClass('disabled') : cj('table#pricelabel').removeClass('disabled');
if (typeof skipPaymentMethod == 'function') {
// Advice to anyone who, like me, feels hatred towards this if construct ... if you remove the if you
// get an error on participant 2 of a event that requires approval & permits multiple registrants.
skipPaymentMethod();
}
}
//money formatting/localization
function formatMoney (amount, c, d, t) {
var n = amount,
c = isNaN(c = Math.abs(c)) ? 2 : c,
d = d == undefined ? "," : d,
t = t == undefined ? "." : t, s = n < 0 ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
{/literal}
</script>

View file

@ -0,0 +1,33 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* this template is used for confirmation of delete for a Fields *}
<div class="crm-block crm-form-block crm-price_field_delete-form-block">
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
{ts 1=$title}WARNING: Deleting this price field will result in the loss of all '%1' data.{/ts} {ts}This action cannot be undone.{/ts} {ts}Do you want to continue?{/ts}
</div>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>

View file

@ -0,0 +1,35 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* this template is used for confirmation of delete for a price set *}
<div class="messages status no-popup">
<img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"/>
{ts 1=$title}WARNING: Deleting this price set will result in the loss of all '%1' data.{/ts} {ts}This action cannot be undone.{/ts} {ts}Do you want to continue?{/ts}
</div>
<div class="form-item">
{include file="CRM/common/formButtons.tpl"}
</div>

View file

@ -0,0 +1,268 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{*Javascript function controls showing and hiding of form elements based on html type.*}
{literal}
<script type="text/Javascript">
function option_html_type(form) {
var html_type_name = cj('#html_type').val();
if (html_type_name == "Text") {
cj("#price-block").show();
cj("#showoption").hide();
}
else {
cj("#price-block").hide();
cj("#showoption").show();
}
if (html_type_name == 'Radio' || html_type_name == 'CheckBox') {
cj("#optionsPerLine").show( );
}
else {
cj("#optionsPerLine").hide( );
cj("#optionsPerLineDef").hide( );
}
var radioOption, checkBoxOption;
for (var i=1; i<=15; i++) {
radioOption = '#radio'+i;
checkBoxOption = '#checkbox'+i;
if (html_type_name == 'Radio' || html_type_name == 'CheckBox' || html_type_name == 'Select') {
if (html_type_name == "CheckBox") {
cj(checkBoxOption).show();
cj(radioOption).hide();
}
else {
cj(radioOption).show();
cj(checkBoxOption).hide();
}
}
}
}
var adminVisibilityID = 0;
cj('#visibility_id').on('change', function () {
if (adminVisibilityID == 0) {
CRM.api3('OptionValue', 'getvalue', {
'sequential': 1,
'return': 'value',
'option_group_id': 'visibility',
'name': 'admin'
}).done(function(result) {
adminVisibilityID = result.result;
if (cj('#visibility_id').val() == adminVisibilityID) {
updateVisibilitySelects(adminVisibilityID);
}
});
} else {
if (cj('#visibility_id').val() == adminVisibilityID) {
updateVisibilitySelects(adminVisibilityID);
}
}
});
function updateVisibilitySelects(value) {
for (var i=1; i<=15; i++) {
cj('#option_visibility_id_' + i).val(value);
}
}
</script>
{/literal}
<div class="crm-block crm-form-block crm-price-field-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout">
<tr class="crm-price-field-form-block-label">
<td class="label">{$form.label.label}</td>
<td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_field' field='label' id=$fid}{/if}{$form.label.html}
</td>
</tr>
<tr class="crm-price-field-form-block-html_type">
<td class="label">{$form.html_type.label}</td>
<td>{$form.html_type.html}
</td>
</tr>
{if $action neq 4 and $action neq 2}
<tr>
<td>&nbsp;</td>
<td class="description">{ts}Select the html type used to offer options for this field{/ts}
</td>
</tr>
{/if}
</table>
<div class="spacer"></div>
<div id="price-block" {if $action eq 2 && $form.html_type.value.0 eq 'Text'} class="show-block" {else} class="hiddenElement" {/if}>
<table class="form-layout">
<tr class="crm-price-field-form-block-price">
<td class="label">{$form.price.label} <span class="crm-marker" title="{ts}This field is required.{/ts}">*</span></td>
<td>{$form.price.html}
{if $action neq 4}
<br /><span class="description">{ts}Unit price.{/ts}</span> {help id="id-negative"}
{/if}
</td>
</tr>
<tr class="crm-price-field-form-block-non-deductible-amount">
<td class="label">{$form.non_deductible_amount.label}</td>
<td>{$form.non_deductible_amount.html}</td>
</tr>
{if $useForEvent}
<tr class="crm-price-field-form-block-count">
<td class="label">{$form.count.label}</td>
<td>{$form.count.html}<br />
<span class="description">{ts}Enter a value here if you want to increment the number of registered participants per unit against the maximum number of participants allowed for this event.{/ts}</span>
{help id="id-participant-count"}
</td>
</tr>
<tr class="crm-price-field-form-block-max_value">
<td class="label">{$form.max_value.label}</td>
<td>{$form.max_value.html}
</td>
</tr>
{/if}
<tr class="crm-price-field-form-block-financial_type">
<td class="label">{$form.financial_type_id.label}<span class="crm-marker" title="{ts}This field is required.{/ts}">*</span></td></td>
<td>
{if !$financialType}
{capture assign=ftUrl}{crmURL p='civicrm/admin/financial/financialType' q="reset=1"}{/capture}
{ts 1=$ftUrl}There is no Financial Type configured of Account Relation Revenue. <a href='%1'>Click here</a> if you want to configure financial type for your site.{/ts}
{else}
{$form.financial_type_id.html}
{/if}
</td>
</tr>
</table>
</div>
{if $action eq 1}
{* Conditionally show table for setting up selection options - for field types = radio, checkbox or select *}
<div id='showoption' class="hiddenElement">{ include file="CRM/Price/Form/OptionFields.tpl"}</div>
{/if}
<table class="form-layout">
<tr id="optionsPerLine" class="crm-price-field-form-block-options_per_line">
<td class="label">{$form.options_per_line.label}</td>
<td>{$form.options_per_line.html|crmAddClass:two}</td>
</tr>
<tr class="crm-price-field-form-block-is_display_amounts">
<td class="label">{$form.is_display_amounts.label}</td>
<td>{$form.is_display_amounts.html}
{if $action neq 4}
<div class="description">{ts}Display amount next to each option? If no, then the amount should be in the option description.{/ts}</div>
{/if}
</td>
</tr>
<tr class="crm-price-field-form-block-weight">
<td class="label">{$form.weight.label}</td>
<td>{$form.weight.html|crmAddClass:two}
{if $action neq 4}
<div class="description">{ts}Weight controls the order in which fields are displayed in a group. Enter a positive or negative integer - lower numbers are displayed ahead of higher numbers.{/ts}</div>
{/if}
</td>
</tr>
<tr class="crm-price-field-form-block-help_pre">
<td class="label">{$form.help_pre.label}</td>
<td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_field' field='help_pre' id=$fid}{/if}{$form.help_pre.html|crmAddClass:huge}&nbsp;
{if $action neq 4}
<div class="description">{ts}Explanatory text displayed to users at the beginning of this field.{/ts}</div>
{/if}
</td>
</tr>
<tr class="crm-price-field-form-block-help_post">
<td class="label">{$form.help_post.label}</td>
<td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_field' field='help_post' id=$fid}{/if}{$form.help_post.html|crmAddClass:huge}&nbsp;
{if $action neq 4}
<div class="description">{ts}Explanatory text displayed to users below this field.{/ts}</div>
{/if}
</td>
</tr>
<tr class="crm-price-field-form-block-active_on">
<td class="label">{$form.active_on.label}</td>
<td>{include file="CRM/common/jcalendar.tpl" elementName=active_on}
{if $action neq 4}
<br /><span class="description">{ts}Date this field becomes effective (optional). Used for price set fields that are made available starting on a specific date.{/ts}</span>
{/if}
</td>
</tr>
<tr class="crm-price-field-form-block-expire_on">
<td class="label">{$form.expire_on.label}</td>
<td>{include file="CRM/common/jcalendar.tpl" elementName=expire_on}
{if $action neq 4}
<br /><span class="description">{ts}Date this field expires (optional). Used for price set fields that are no longer available after a specific date (e.g. early-bird pricing).{/ts}</span>
{/if}
</td>
</tr>
<tr class="crm-price-field-form-block-is_required">
<td class="label">{$form.is_required.label}</td>
<td>&nbsp;{$form.is_required.html}</td>
</tr>
<tr class="crm-price-field-form-block-visibility_id">
<td class="label">{$form.visibility_id.label}</td>
<td>&nbsp;{$form.visibility_id.html} {help id="id-visibility"}</td>
</tr>
<tr class="crm-price-field-form-block-is_active">
<td class="label">{$form.is_active.label}</td>
<td>{$form.is_active.html}</td>
</tr>
</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
{literal}
<script type="text/javascript">
option_html_type(this.form);
function calculateRowValues( row ) {
var mtype = cj("#membership_type_id_"+row).val();
var postUrl = "{/literal}{crmURL p='civicrm/ajax/memType' h=0}{literal}";
cj.post( postUrl, {mtype: mtype}, function(data) {
cj("#option_amount_"+ row).val(data.total_amount);
cj("#option_label_"+ row).val(data.name);
cj("#option_financial_type_id_"+ row).val(data.financial_type_id);
if (data.name) {
cj("#membership_num_terms_"+ row).val('1');
}
else {
cj("#membership_num_terms_"+ row).val('');
}
}, 'json');
}
</script>
{/literal}
{* Give link to view/edit choice options if in edit mode and html_type is one of the multiple choice types *}
{if $action eq 2 AND ($form.data_type.value.1.0 eq 'CheckBox' OR $form.data_type.value.1.0 eq 'Radio' OR $form.data_type.value.1.0 eq 'Select') }
<div class="action-link">
<a href="{crmURL p="civicrm/admin/event/field/option" q="reset=1&action=browse&fid=`$fid`"}" class="button"><span>{ts}Multiple Choice Options{/ts}</span></a>
</div>
{/if}

View file

@ -0,0 +1,160 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* Displays contribution/event fees when price set is used. *}
{foreach from=$lineItem item=value key=priceset}
{if $value neq 'skip'}
{if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
{if $priceset GT 0}<br/>{/if}
<strong>{ts}Participant {$priceset+1}{/ts}</strong>
{$part.$priceset.info}
{/if}
<table>
<tr class="columnheader">
<th>{ts}Item{/ts}</th>
{if $context EQ "Membership"}
<th class="right">{ts}Fee{/ts}</th>
{else}
<th class="right">{ts}Qty{/ts}</th>
<th class="right">{ts}Unit Price{/ts}</th>
<th class="right">{ts}Total Price{/ts}</th>
{if $context EQ "Contribution" && $action eq 2}
<th class="right">{ts}Paid{/ts}</th>
<th class="right">{ts}Owing{/ts}</th>
<th class="right">{ts}Amount of<br>Current Payment {/ts}</th>
{/if}
{/if}
{if $pricesetFieldsCount}
<th class="right">{ts}Total Participants{/ts}</th>{/if}
</tr>
{foreach from=$value item=line}
<tr>
<td>{if $line.field_title && $line.html_type neq 'Text'}{$line.field_title} &ndash; {$line.label}{else}{$line.label}{/if} {if $line.description}
<div class="description">{$line.description}</div>{/if}</td>
{if $context NEQ "Membership"}
<td class="right">{$line.qty}</td>
<td class="right">{$line.unit_price|crmMoney}</td>
{/if}
<td class="right">{$line.line_total|crmMoney}</td>
{if $pricesetFieldsCount}
<td class="right">{$line.participant_count}</td> {/if}
{if $context EQ "Contribution" && $action eq 2}
<td class="right">{$pricefildTotal.LineItems[$line.price_field_value_id]|crmMoney}</td>
<td class="right">
{assign var="fildTotal" value=$line.line_total-$pricefildTotal[$pricefildTotal.id][$line.price_field_value_id]}
{$fildTotal|crmMoney}
</td>
<td class="left">$<input
type='text' id='txt-price[{$line.price_field_value_id}]'
name='txt-price[{$line.price_field_value_id}]' size='4'
class='distribute'>&nbsp<input type='checkbox'
id='cb-price[{$line.price_field_value_id}]'
name='cb-price[{$line.price_field_value_id}]'
price='{$fildTotal}' class='payFull'/></td>
{/if}
</tr>
{/foreach}
{if $context EQ "Contribution" && $action eq 2}
<tr>
<td>
{ts}Contribution Total{/ts}:
</td>
<td></td>
<td></td>
<td class="right">{$totalAmount|crmMoney}</td>
<td class="right">{$pricefildTotal.total|crmMoney}</td>
<td class="right">{assign var="total" value= $totalAmount-$pricefildTotal.total}{$total|crmMoney}</td>
<td class="left"><h5 class='editPayment'></h5>
{literal}
<script type="text/javascript">
CRM.$(function ($) {
$(document).on('blur', '.distribute', function () {
var totalAmount = 0;
$('.distribute').each(function () {
if ($(this).val().length > 0) {
totalAmount = parseFloat(totalAmount) + parseFloat($(this).val());
}
});
$('.editPayment').text('$ ' + totalAmount);
var unlocateAmount = '{/literal}{$total}{literal}';
$('.unlocateAmount').text('$ ' + (unlocateAmount - totalAmount));
});
});
</script>
{/literal}
</td>
</tr>
<tr>
<td colspan=6 class="right"><strong>Unallocated Amount</strong></td>
<td><h5 class='unlocateAmount'>{$total|crmMoney} </h5></td>
</tr>
{/if}
</table>
{/if}
{/foreach}
<div class="crm-section no-label total_amount-section">
<div class="content bold">
{if $context EQ "Contribution"}
{ts}Contribution Total{/ts}:
{elseif $context EQ "Event"}
{ts}Event Total{/ts}:
{elseif $context EQ "Membership"}
{ts}Membership Fee Total{/ts}:
{else}
{ts}Total Amount{/ts}:
{/if}
{$totalAmount|crmMoney}
</div>
<div class="content bold">
{if $pricesetFieldsCount}
{ts}Total Participants{/ts}:
{foreach from=$lineItem item=pcount}
{if $pcount neq 'skip'}
{assign var="lineItemCount" value=0}
{foreach from=$pcount item=p_count}
{assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
{/foreach}
{if $lineItemCount < 1 }
{assign var="lineItemCount" value=1}
{/if}
{assign var="totalcount" value=$totalcount+$lineItemCount}
{/if}
{/foreach}
{$totalcount}
{/if}
</div>
</div>
{if $hookDiscount.message}
<div class="crm-section hookDiscount-section">
<em>({$hookDiscount.message})</em>
</div>
{/if}

View file

@ -0,0 +1,136 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="crm-form-block">
{if $action eq 8}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
{ts}WARNING: Deleting this option will result in the loss of all data.{/ts} {ts}This action cannot be undone.{/ts} {ts}Do you want to continue?{/ts}
</div>
{else}
<table class="form-layout">
{if $showMember}
<tr class="crm-price-option-form-block-membership_type_id">
<td class="label">{$form.membership_type_id.label}</td>
<td>{$form.membership_type_id.html}
<br /> <span class="description">{ts}If a membership type is selected, a membership will be created or renewed when users select this option. Leave this blank if you are using this for non-membership options (e.g. magazine subscription).{/ts} {help id="id-member-price-options" file="CRM/Price/Page/Field.hlp"}</span></td>
</tr>
<tr class="crm-price-option-form-block-membership_num_terms">
<td class="label">{$form.membership_num_terms.label}</td>
<td>{$form.membership_num_terms.html}
<br /> <span class="description">{ts}You can set this to a number other than one to allow multiple membership terms.{/ts}</span></td>
</tr>
{/if}
<tr class="crm-price-option-form-block-label">
<td class="label">{$form.label.label}</td>
<td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_field_value' field='label' id=$optionId}{/if}{$form.label.html}</td>
</tr>
<tr class="crm-price-option-form-block-amount">
<td class="label">{$form.amount.label}</td>
<td>{$form.amount.html}</td>
</tr>
<tr class="crm-price-option-form-block-non-deductible-amount">
<td class="label">{$form.non_deductible_amount.label}</td>
<td>{$form.non_deductible_amount.html}</td>
</tr>
<tr class="crm-price-option-form-block-description">
<td class="label">{$form.description.label}</td>
<td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_field_value' field='description' id=$optionId}{/if}{$form.description.html}</td>
</tr>
<tr class="crm-price-option-form-block-help-pre">
<td class="label">{$form.help_pre.label}</td>
<td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_field_value' field='help_pre' id=$optionId}{/if}{$form.help_pre.html}</td>
</tr>
<tr class="crm-price-option-form-block-help-post">
<td class="label">{$form.help_post.label}</td>
<td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_field_value' field='help_post' id=$optionId}{/if}{$form.help_post.html}</td>
</tr>
<tr class="crm-price-option-form-block-financial-type">
<td class="label">{$form.financial_type_id.label}</td>
<td>
{if !$financialType }
{capture assign=ftUrl}{crmURL p='civicrm/admin/financial/financialType' q="reset=1"}{/capture}
{ts 1=$ftUrl}There are no financial types configured with a linked 'Revenue Account of' account. <a href='%1'>Click here</a> if you want to configure financial types for your site.{/ts}
{else}
{$form.financial_type_id.html}
{/if}
</td>
</tr>
{* fix for CRM-10241 *}
{if $form.count.html}
<tr class="crm-price-option-form-block-count">
<td class="label">{$form.count.label}</td>
<td>{$form.count.html} {help id="id-participant-count" file="CRM/Price/Page/Field.hlp"}</td>
</tr>
{* 2 line fix for CRM-10241 *}
{/if}
{if $form.max_value.html}
<tr class="crm-price-option-form-block-max_value">
<td class="label">{$form.max_value.label}</td>
<td>{$form.max_value.html} {help id="id-participant-max" file="CRM/Price/Page/Field.hlp"}</td>
</tr>
{* fix for CRM-10241 *}
{/if}
<tr class="crm-price-option-form-block-weight">
<td class="label">{$form.weight.label}</td>
<td>{$form.weight.html}</td>
</tr>
<tr class="crm-price-option-form-block-is_active">
<td class="label">{$form.is_active.label}</td>
<td>{$form.is_active.html}</td>
{if !$hideDefaultOption}
<tr class="crm-price-option-form-block-is_default">
<td class="label">{$form.is_default.label}</td>
<td>{$form.is_default.html}</td>
</tr>
{/if}
<tr class="crm-price-field-form-block-visibility_id">
<td class="label">{$form.visibility_id.label}</td>
<td>&nbsp;{$form.visibility_id.html} {help id="id-visibility-options" file="CRM/Price/Page/Field.hlp"}</td>
</tr>
</table>
{literal}
<script type="text/javascript">
function calculateRowValues( ) {
var mtype = cj("#membership_type_id").val();
var postUrl = "{/literal}{crmURL p='civicrm/ajax/memType' h=0}{literal}";
cj.post( postUrl, {mtype: mtype}, function( data ) {
cj("#amount").val( data.total_amount );
cj("#label").val( data.name );
}, 'json');
}
{/literal}
</script>
{/if}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl"}
</div>
</div>

View file

@ -0,0 +1,131 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<fieldset><legend>{if $useForMember}{ts}Membership Options{/ts}{else}{ts}Price Field Options{/ts}{/if}</legend>
<div class="description">
{if $useForMember}
{ts}Fill in a row for each membership type you want to offer as an option (click 'another choice' for each additional choice). Click the help icon for more info on membership price sets.{/ts} {help id="id-member-price-options"}
{else}
{ts}Enter up to fifteen (15) multiple choice options in this table (click 'another choice' for each additional choice). If you need more than ten options, you can create an unlimited number of additional choices using the Edit Price Options link after saving this new field. Enter a description of the option in the 'Label' column, and the associated price in the 'Amount' column. Click the 'Default' radio button to the left of an option if you want that to be selected by default.{/ts}
{/if}
</div>
{strip}
<table id='optionField'>
<tr>
<th>&nbsp;</th>
<th>{ts}Default{/ts}</th>
{if $useForMember}
<th>{ts}Membership Type{/ts} {help id="id-membership-type"}</th>
<th>{ts}Number of Terms{/ts}</th>
{/if}
<th>{ts}Label{/ts}</th>
<th>{ts}Amount{/ts} {if $useForEvent}{help id="id-negative-options"}{/if}</th>
<th>{ts}Financial Type{/ts}</th>
{if $useForEvent}
<th>{ts}Participant Count{/ts} {help id="id-participant-count"}</th>
<th>{ts}Max Participant{/ts} {help id="id-participant-max"}</th>
{/if}
<th>{ts}Order{/ts}</th>
<th>{ts}Visibility{/ts} {help id="id-visibility-options"}</th>
<th>{ts}Active?{/ts}</th>
</tr>
{section name=rowLoop start=1 loop=16}
{assign var=index value=$smarty.section.rowLoop.index}
<tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}">
<td>
{if $index GT 1}
<a onclick="showHideRow({$index}); return false;" name="optionField_{$index}" href="#" class="form-link"><i class="crm-i fa-trash" title="{ts}hide field or section{/ts}"></i></a>
{/if}
</td>
<td>
<div id="radio{$index}" style="display:none">
{$form.default_option[$index].html}
</div>
<div id="checkbox{$index}" style="display:none">
{$form.default_checkbox_option.$index.html}
</div>
</td>
{if $useForMember}
<td>{$form.membership_type_id.$index.html}</td>
<td>{$form.membership_num_terms.$index.html}</td>
{/if}
<td> {$form.option_label.$index.html}</td>
<td> {$form.option_amount.$index.html}</td>
<td>{$form.option_financial_type_id.$index.html}</td>
{if $useForEvent}
<td>{$form.option_count.$index.html}</td>
<td>{$form.option_max_value.$index.html}</td>
{/if}
<td> {$form.option_weight.$index.html}</td>
<td> {$form.option_visibility_id.$index.html}</td>
<td> {$form.option_status.$index.html}</td>
</tr>
{/section}
</table>
<div id="optionFieldLink" class="add-remove-link">
<a onclick="showHideRow(); return false;" name="optionFieldLink" href="#" class="form-link"><i class="crm-i fa-plus-circle"></i> {ts}add another choice{/ts}</a>
</div>
<div id="additionalOption" class="description">
{ts}If you need additional options - you can add them after you Save your current entries.{/ts}
</div>
{/strip}
</fieldset>
<script type="text/javascript">
var showRows = new Array({$showBlocks});
var hideBlocks = new Array({$hideBlocks});
var rowcounter = 0;
{literal}
if (navigator.appName == "Microsoft Internet Explorer") {
for ( var count = 0; count < hideBlocks.length; count++ ) {
var r = document.getElementById(hideBlocks[count]);
r.style.display = 'none';
}
}
cj('#optionField input').blur( function(){
var currentId = cj(this).attr('id');
var arrayID = currentId.split('_');
if ((arrayID[1] == 'label' || arrayID[1] == 'amount') && arrayID[2] > 1) {
var value = cj("#"+currentId).val();
if (value.length != 0 && cj("#option_financial_type_id_"+arrayID[2]).val() =='') {
var currentFtid = "#option_financial_type_id_"+arrayID[2];
var previousFtid = "#option_financial_type_id_"+ (arrayID[2]-1);
var financial_type = cj(previousFtid).val();
cj(currentFtid).val(financial_type);
}
if (cj("#option_label_"+arrayID[2]).val().length == 0 && cj("#option_amount_"+arrayID[2]).val().length == 0) {
cj("#option_financial_type_id_"+arrayID[2]).val('');
}
}
});
{/literal}
{* hide and display the appropriate blocks as directed by the php code *}
on_load_init_blocks( showRows, hideBlocks, '' );
</script>

View file

@ -0,0 +1,207 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{if $priceSet && $allowGroupOnWaitlist}
{literal}
<script type="text/javascript">
var isAdditionalParticipants = false;
var pPartiCount = 0;
var pPartiRef = Array( );
var optionSep = '|';
CRM.$(function($) {
pricesetParticipantCount( );
allowGroupOnWaitlist(0, pPartiCount);
});
function pricesetParticipantCount( ) {
cj("input,#priceset select,#priceset").each(function () {
if ( cj(this).attr('price') ) {
switch( cj(this).attr('type') ) {
case 'checkbox':
eval( 'var option = ' + cj(this).attr('price') ) ;
ele = option[0];
optionPart = option[1].split(optionSep);
var addCount = 0;
if ( optionPart[1] ) {
addCount = parseInt(optionPart[1]);
}
if( cj(this).prop('checked') ) {
pPartiCount += addCount;
pPartiRef[ele] += addCount;
}
cj(this).click( function(){
if( cj(this).prop('checked') ) {
pPartiCount += addCount;
pPartiRef[ele] += addCount;
} else {
pPartiCount -= addCount;
pPartiRef[ele] -= addCount;
}
updateWaitingStatus( pPartiCount );
});
break;
case 'radio':
//default calcution of element.
eval( 'var option = ' + cj(this).attr('price') );
ele = option[0];
optionPart = option[1].split(optionSep);
var addCount = 0;
if ( optionPart[1] ) {
addCount = parseInt(optionPart[1]);
}
if ( ! pPartiRef[ele] ) {
pPartiRef[ele] = 0;
}
if( cj(this).prop('checked') ) {
pPartiCount = parseInt(pPartiCount) + addCount - parseInt(pPartiRef[ele]);
pPartiRef[ele] = addCount;
}
cj(this).click( function(){
pPartiCount = parseInt(pPartiCount) + addCount - parseInt(pPartiRef[ele]);
pPartiRef[ele] = addCount;
updateWaitingStatus( pPartiCount );
})
break;
case 'text':
// default calcution of element.
var textval = parseFloat( cj(this).val() );
var addCount = 0;
if ( textval ) {
eval( 'var option = '+ cj(this).attr('price') );
ele = option[0];
if ( ! pPartiRef[ele] ) {
pPartiRef[ele] = 0;
}
optionPart = option[1].split(optionSep);
if ( optionPart[1] ) {
addCount = parseInt( optionPart[1] );
var curval = textval * addCount;
if ( textval >= 0 ) {
pPartiCount = parseInt(pPartiCount) + curval - parseInt(pPartiRef[ele]);
pPartiRef[ele] = curval;
}
}
}
//event driven calculation of element.
cj(this).bind( 'keyup', function() { calculateTextCount( this );
}).bind( 'blur' , function() { calculateTextCount( this );
});
break;
case 'select-one':
//default calcution of element.
var ele = cj(this).attr('id');
if ( ! pPartiRef[ele] ) {
pPartiRef[ele] = 0;
}
var addcount = 0;
eval( 'var selectedText = ' + cj(this).attr('price') );
if ( cj(this).val( ) ) {
optionPart = selectedText[cj(this).val( )].split(optionSep);
if ( optionPart[1] ) {
addcount = parseInt( optionPart[1] );
}
}
if ( addcount ) {
pPartiCount = parseInt(pPartiCount) + addcount - parseInt(pPartiRef[ele]);
pPartiRef[ele] = addcount;
}
//event driven calculation of element.
cj(this).change( function() {
var ele = cj(this).attr('id');
if ( ! pPartiRef[ele] ) {
pPartiRef[ele] = 0;
}
eval( 'var selectedText = ' + cj(this).attr('price') );
var addcount = 0;
if ( cj(this).val( ) ) {
var optionPart = selectedText[cj(this).val( )].split(optionSep);
if ( optionPart[1] ) {
addcount = parseInt( optionPart[1] );
}
}
if ( addcount ) {
pPartiCount = parseInt(pPartiCount) + addcount - parseInt(pPartiRef[ele]);
pPartiRef[ele] = addcount;
} else {
pPartiCount = parseInt(pPartiCount) - parseInt(pPartiRef[ele]);
pPartiRef[ele] = 0;
}
updateWaitingStatus( pPartiCount );
});
break;
}
}
});
}
function calculateTextCount( object ) {
eval( 'var option = ' + cj(object).attr('price') );
ele = option[0];
if ( ! pPartiRef[ele] ) {
pPartiRef[ele] = 0;
}
var optionPart = option[1].split(optionSep);
if ( optionPart[1] ) {
addCount = parseInt( optionPart[1] );
var textval = parseInt( cj(object).attr('value') );
var curval = textval * addCount;
if ( textval >= 0 ) {
pPartiCount = pPartiCount + curval - parseInt(pPartiRef[ele]);
pPartiRef[ele] = curval;
} else {
pPartiCount = pPartiCount - parseInt(pPartiRef[ele]);
pPartiRef[ele] = 0;
}
updateWaitingStatus( pPartiCount );
}
}
function updateWaitingStatus( pricesetParticipantCount ) {
allowGroupOnWaitlist( 0, pricesetParticipantCount );
}
</script>
{/literal}
{/if}

View file

@ -0,0 +1,44 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{capture assign=infoTitle}{ts}Preview Mode{/ts}{/capture}
{assign var="infoType" value="info"}
{if $preview_type eq 'group'}
{capture assign=infoMessage}{ts}Showing price set as it will be displayed within a form.{/ts}{/capture}
{else}
{capture assign=infoMessage}{ts}Showing field as it will be displayed in a form.{/ts}{/capture}
{/if}
{include file="CRM/common/info.tpl"}
<div class="crm-block crm-form-block crm-price-set-preview-block">
{strip}
{foreach from=$groupTree item=priceSet key=group_id}
<fieldset>
{if $preview_type eq 'group'}<legend>{$setTitle}</legend>{/if}
{include file="CRM/Price/Form/PriceSet.tpl"}
</fieldset>
{/foreach}
{/strip}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>

View file

@ -0,0 +1,133 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{crmRegion name="price-set-1"}
<div id="priceset" class="crm-section price_set-section">
{if $priceSet.help_pre}
<div class="messages help">{$priceSet.help_pre}</div>
{/if}
{assign var='adminFld' value=false}
{if call_user_func(array('CRM_Core_Permission','check'), 'administer CiviCRM') }
{assign var='adminFld' value=true}
{/if}
{foreach from=$priceSet.fields item=element key=field_id}
{* Skip 'Admin' visibility price fields WHEN this tpl is used in online registration unless user has administer CiviCRM permission. *}
{if $element.visibility EQ 'public' || ($element.visibility EQ 'admin' && $adminFld EQ true) || $context eq 'standalone' || $context eq 'advanced' || $context eq 'search' || $context eq 'participant' || $context eq 'dashboard' || $action eq 1024}
{if $element.help_pre}<span class="content description">{$element.help_pre}</span><br />{/if}
<div class="crm-section {$element.name}-section">
{if ($element.html_type eq 'CheckBox' || $element.html_type == 'Radio') && $element.options_per_line}
{assign var="element_name" value="price_"|cat:$field_id}
<div class="label">{$form.$element_name.label}</div>
<div class="content {$element.name}-content">
{assign var="elementCount" value="0"}
{assign var="optionCount" value="0"}
{assign var="rowCount" value="0"}
{foreach name=outer key=key item=item from=$form.$element_name}
{assign var="elementCount" value=`$elementCount+1`}
{if is_numeric($key) }
{assign var="optionCount" value=`$optionCount+1`}
{if $optionCount == 1}
{assign var="rowCount" value=`$rowCount+1`}
<div class="price-set-row {$element.name}-row{$rowCount}">
{/if}
<span class="price-set-option-content">{$form.$element_name.$key.html}</span>
{if $optionCount == $element.options_per_line || $elementCount == $form.$element_name|@count}
</div>
{assign var="optionCount" value="0"}
{/if}
{/if}
{/foreach}
{if $element.help_post}
<div class="description">{$element.help_post}</div>
{/if}
</div>
{else}
{assign var="element_name" value="price_"|cat:$field_id}
<div class="label">{$form.$element_name.label}</div>
<div class="content {$element.name}-content">
{$form.$element_name.html}
{if $element.html_type eq 'Text'}
{if $element.is_display_amounts}
<span class="price-field-amount{if $form.$element_name.frozen EQ 1} sold-out-option{/if}">
{foreach item=option from=$element.options}
{if ($option.tax_amount || $option.tax_amount == "0") && $displayOpt && $invoicing}
{assign var="amount" value=`$option.amount+$option.tax_amount`}
{if $displayOpt == 'Do_not_show'}
{$amount|crmMoney}
{elseif $displayOpt == 'Inclusive'}
{$amount|crmMoney}
<span class='crm-price-amount-label'> (includes {$taxTerm} of {$option.tax_amount|crmMoney})</span>
{else}
{$option.amount|crmMoney}
<span class='crm-price-amount-label'> + {$option.tax_amount|crmMoney} {$taxTerm}</span>
{/if}
{else}
{$option.amount|crmMoney} {$fieldHandle} {$form.$fieldHandle.frozen}
{/if}
{if $form.$element_name.frozen EQ 1} ({ts}Sold out{/ts}){/if}
{/foreach}
</span>
{else}
{* Not showing amount, but still need to conditionally show Sold out marker *}
{if $form.$element_name.frozen EQ 1}
<span class="sold-out-option">({ts}Sold out{/ts})<span>
{/if}
{/if}
{/if}
{if $element.help_post}<br /><span class="description">{$element.help_post}</span>{/if}
</div>
{/if}
{if !empty($extends) && $extends eq "Membership"}
{if (!empty($priceSet) && $element.id == $priceSet.auto_renew_membership_field) || (empty($priceSet) && $element.name == 'membership_amount')}
<div id="allow_auto_renew">
<div class='crm-section auto-renew'>
<div class='label'></div>
<div class='content' id="auto_renew_section">
{if isset($form.auto_renew) }
{$form.auto_renew.html}&nbsp;{$form.auto_renew.label}
{/if}
</div>
<div class='content' id="force_renew" style='display: none'>{ts}Membership will renew automatically.{/ts}</div>
</div>
</div>
{/if}
{/if}
<div class="clear"></div>
</div>
{/if}
{/foreach}
{if $priceSet.help_post}
<div class="messages help">{$priceSet.help_post}</div>
{/if}
{include file="CRM/Price/Form/Calculate.tpl"}
</div>
{/crmRegion}

View file

@ -0,0 +1,99 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* add/update price set *}
<div class="help">
{ts}Use this form to edit the title and group-level help for a set of Price fields.{/ts}
</div>
{capture assign="enableComponents"}{crmURL p='civicrm/admin/setting/component' q="reset=1"}{/capture}
<div class="crm-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout">
<tr class="crm-price-set-form-block-title">
<td class="label">{$form.title.label}</td>
<td>
{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_set' field='title' id=$sid}{/if}{$form.title.html}
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="description">{ts}The name of this Price Set{/ts}
</td>
<tr class="crm-price-set-form-block-extends">
<td class="label">{$form.extends.label}</td>
<td>
{if $extends eq false}
<div class="status message">{ts 1=$enableComponents}No Components have been enabled for your site that can be configured with the price sets. Click <a href='%1'>here</a> if you want to enable CiviEvent/CiviContribute for your site.{/ts}</div>
{else}
{$form.extends.html}
{/if}
</td>
</tr>
<tr id="min_amount" class="crm-price-set-form-block-min_amount">
<td class="label">{$form.min_amount.label}</td>
<td>{$form.min_amount.html}</td>
</tr>
<tr id="financial_type_id_row" class="crm-price-set-form-block-contribution_type_id crm-price-set-form-block-financial_type_id">
<td class="label">{$form.financial_type_id.label}</td>
<td>{$form.financial_type_id.html}</td>
<td>&nbsp;</td>
</tr>
<tr class="crm-price-set-form-block-help_pre">
<td class="label">{$form.help_pre.label}</td>
<td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_set' field='help_pre' id=$sid}{/if}{$form.help_pre.html}
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="description">{ts}Explanatory text displayed at the beginning of this group of fields.{/ts}
</td>
</tr>
<tr class="crm-price-set-form-block-help_post">
<td class="label">{$form.help_post.label}</td>
<td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_price_set' field='help_post' id=$sid}{/if}{$form.help_post.html}
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="description">{ts}Explanatory text displayed below this group of fields.{/ts}
</td>
</tr>
<tr class="crm-price-set-form-block-is_active">
<td class="label">{$form.is_active.label}</td>
<td>{$form.is_active.html}</td>
</tr>
</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
{if $action eq 2 or $action eq 4} {* Update or View*}
<p></p>
<div class="action-link">
<a href="{crmURL p='civicrm/admin/price/field' q="action=browse&reset=1&sid=$sid"}" class="button"><span>{ts}Fields for this Set{/ts}</span></a>
</div>
{/if}