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}

View file

@ -0,0 +1,109 @@
{*
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
*}
{htxt id="id-negative-title"}
{ts}Negative Amounts{/ts}
{/htxt}
{htxt id="id-negative"}
{ts}You may enter a negative amount value if the field or option is being used to discount the total price. Use a price of 1 and Display Amount off (unchecked) to allow a user to enter a contribution amount in a Text / Numeric Quantity field.{/ts}
{/htxt}
{htxt id="id-negative-options-title"}
{ts}Negative Options{/ts}
{/htxt}
{htxt id="id-negative-options"}
{ts}You may enter a negative amount value if the field or option is being used to discount the total price.{/ts}
{/htxt}
{htxt id="id-visibility-options-title"}
{ts}Visibility per Option{/ts}
{/htxt}
{htxt id="id-visibility-options"}
{ts}Select between Admin/Public for each option. 'Public' will show the option to all users accessing the price set. Use 'Admin' to limit the option to users with the 'CiviEvent: edit event participants permission (when viewing the field via the event registration pages) or the CiviContribute: edit contributions permission (when accessing the field through a contribution page).{/ts}
{/htxt}
{htxt id="id-participant-count-title"}
{ts}Participant Count{/ts}
{/htxt}
{htxt id="id-participant-count"}
<p>{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. For example, if this price field is for a table at a fundraiser which seats eight people, you would set Participant Count to 8.{/ts}</p>
<p>{ts}If you do not want this option to increment the participant count for the event you can still restrict how many times this particular option can be chosen. Leave this field empty and enter a value in the adjacent Max Participants box. For example, if you leave this empty and set the adjacent Max Participant = 20, only 20 registrants can choose this option before it becomes unavailable to online registrants.{/ts}</p>
{/htxt}
{htxt id="id-participant-max-title"}
{ts}Participant Limit{/ts}
{/htxt}
{htxt id="id-participant-max"}
{ts}If you want to limit the number of participants who can chose this option, enter that number here. This limit is separate from the maximum number of participants allowed to register for the event (you can set that number from Configure Event > Info and Settings). {/ts}
{/htxt}
{htxt id="id-visibility-title"}
{ts}Visibility{/ts}
{/htxt}
{htxt id="id-visibility"}
{ts}Fields with 'Public' visibility will be displayed on your Event Information page AND will be available in the online registration (self-service) form. For some events you may want to allow staff to select special options with special pricing and / or discounts (using negative price set field values). Select 'Admin' visibility for these Price Fields. They will only be included when staff or volunteers are registering participants from the back-office 'Register Event Participants' screen. If the parent price field visibility is Public then it should be possible to set individual price options as 'Admin', but it should have at least one 'Public' option. If the parent price field visibility is 'Admin', then all the price field options should be set to 'Admin', including any new options added to the form.{/ts}
{/htxt}
{htxt id="id-member-price-options-title"}
{ts}Price Options{/ts}
{/htxt}
{htxt id="id-member-price-options"}
<p>
{ts}Create an option row for each membership type you want to offer as a choice. The option Label and Amount columns will be automatically filled with the selected membership type name and associated fee. However you can over-ride these values as needed. For example, you can create an option for a special discount on a particular membership.{/ts}
</p>
<p>
{ts}Leave the Membership Type blank for additional non-membership options (e.g. magazine subscription).{/ts}
</p>
<p>
{ts}Generally you will create a separate price field for each non-overlapping "class" of membership (e.g. National membership vs. Local Chapter membership).{/ts}<br />
{ts}EXAMPLE: A price set with 3 price fields. National membership (with 3 price options - radio button style), Regional membership (checkbox), and an optional magazine subscription.{/ts}
<br />
<table>
<tr>
<td>{ts}National Membership{/ts} :</td><td>[ x ] {ts}General{/ts} $ 125.00</td>
</tr>
<tr><td></td><td>[ ] {ts}Student{/ts} $ 50.00</td></tr>
<tr><td></td><td>[ ] {ts}Senior{/ts} $ 75.00</td></tr>
<tr><td colspan=2></td></tr>
<tr><td>{ts}Join your local chapter{/ts}</td><td>[ x ] $15.00</td></tr>
<tr><td>{ts}Subscribe to Green Times{/ts}</td><td>[ x ] $35.00</td></tr>
</table>
</p>
<p>
{ts}Auto-renew Memberships - You can offer constituents the option to have their membership renewed automatically AND use the membership price set feature if:{/ts} <ul>
<li>{ts}You are using a payment processor that supports auto-renewals.{/ts}</li>
<li>{ts}All membership types in the price set have the auto-renew feature enabled (Administer > CiviMember > Membership Types){/ts}.</li>
<li>{ts}All membership types in the price set have the same duration (e.g. they are one year memberships).{/ts}<li>
</ul>
{ts}These constraints are due to the fact that when a constituent signs up for multiple memberships using a price set - a single recurring payment record is created which covers the total fees for all selected memberships.{/ts}
</p>
{/htxt}
{htxt id="id-membership-type-title"}
{ts}Membership Type{/ts}
{/htxt}
{htxt id="id-membership-type"}
{ts}If you select a membership type, a membership will be created or renewed when users select this option. Leave this column blank for non-membership options (e.g. magazine subscription).{/ts}
{/htxt}

View file

@ -0,0 +1,114 @@
{*
+--------------------------------------------------------------------+
| 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 ($action eq 1 or $action eq 2 or $action eq 4) and !$isReserved}
{include file="CRM/Price/Form/Field.tpl"}
{elseif $action eq 8 and !$usedBy and !$isReserved}
{include file="CRM/Price/Form/DeleteField.tpl"}
{elseif $action eq 1024 }
{include file="CRM/Price/Form/Preview.tpl"}
{elseif ($usedBy and $action eq 8) or $usedBy.civicrm_event or $usedBy.civicrm_contribution_page}
<div id="price_set_used_by" class="messages status no-popup">
<div class="icon inform-icon"></div>
{if $action eq 8}
{ts 1=$usedPriceSetTitle}Unable to delete the '%1' Price Field - it is currently in use by one or more active events or contribution pages or contributions or event templates.{/ts}
{/if}
{if $usedBy.civicrm_event or $usedBy.civicrm_contribution_page or $usedBy.civicrm_event_template}
{include file="CRM/Price/Page/table.tpl"}
{/if}
</div>
{/if}
{if $action NEQ 8 and $priceField}
<div class="action-link">
{if !$isReserved}
{crmButton q="reset=1&action=add&sid=$sid" id="newPriceField" icon="plus-circle"}{ts}Add Price Field{/ts}{/crmButton}
{/if}
{crmButton p="civicrm/admin/price" q="action=preview&sid=`$sid`&reset=1&context=field" icon="television"}{ts}Preview (all fields){/ts}{/crmButton}
</div>
<div id="field_page">
{strip}
{* handle enable/disable actions*}
{include file="CRM/common/enableDisableApi.tpl"}
<table id="options" class="row-highlight">
<thead>
<tr>
<th>{ts}Field Label{/ts}</th>
<th>{ts}Field Type{/ts}</th>
<th>{ts}Order{/ts}</th>
<th>{ts}Req?{/ts}</th>
<th>{ts}Enabled?{/ts}</th>
<th>{ts}Active On{/ts}</th>
<th>{ts}Expire On{/ts}</th>
<th>{ts}Price{/ts}</th>
{if $getTaxDetails}
<th>{ts}Tax Label{/ts}</th>
<th>{ts}Tax Amount{/ts}</th>
{/if}
<th></th>
</tr>
</thead>
{foreach from=$priceField key=fid item=row}
<tr id="price_field-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
<td class="crm-editable" data-field="label">{$row.label}</td>
<td>{$row.html_type_display}</td>
<td class="nowrap">{$row.weight}</td>
<td class="crm-editable" data-field="is_required" data-type="boolean">{if $row.is_required eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td>{if $row.active_on}{$row.active_on|date_format:"%Y-%m-%d %T"}{/if}</td>
<td>{if $row.expire_on}{$row.expire_on|date_format:"%Y-%m-%d %T"}{/if}</td>
<td>{if $row.html_type eq "Text"}{$row.price|crmMoney}{else}<a class="action-item" href="{crmURL p="civicrm/admin/price/field/option" q="action=browse&reset=1&sid=$sid&fid=$fid"}">{if $isReserved}{ts}View Price Options{/ts}{else}{ts}Edit Price Options{/ts}{/if}</a>{/if}</td>
{if $getTaxDetails}
<td>{if $row.tax_rate != '' && $row.html_type eq "Text / Numeric Quantity"}
{$taxTerm} ({$row.tax_rate|string_format:"%.2f"}%)
{/if}
</td>
<td>{if $row.html_type eq "Text / Numeric Quantity" }{$row.tax_amount|crmMoney}{/if}</td>
{/if}
<td class="field-action">{$row.action|replace:'xx':$row.id}</td>
</tr>
{/foreach}
</table>
{/strip}
</div>
<div class="action-link">
{if !$isReserved}
{crmButton q="reset=1&action=add&sid=$sid" id="newPriceField" icon="plus-circle"}{ts}Add Price Field{/ts}{/crmButton}
{/if}
{crmButton p="civicrm/admin/price" q="action=preview&sid=`$sid`&reset=1&context=field" icon="television"}{ts}Preview (all fields){/ts}{/crmButton}
</div>
{else}
{if $action eq 16}
<div class="messages status no-popup crm-empty-table">
<div class="icon inform-icon"></div>
{ts}None found.{/ts}
</div>
<div class="action-link">
{crmButton q="reset=1&action=add&sid=$sid" id="newPriceField" icon="plus-circle"}{ts}Add Price Field{/ts}{/crmButton}
</div>
{/if}
{/if}

View file

@ -0,0 +1,163 @@
{*
+--------------------------------------------------------------------+
| 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 $displayLineItemFinancialType}
<th>{ts}Financial Type{/ts}</th>
{/if}
{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>
{if !$getTaxDetails}
<th class="right">{ts}Total Price{/ts}</th>
{/if}
{/if}
{if $getTaxDetails}
<th class="right">{ts}Subtotal{/ts}</th>
<th class="right">{ts}Tax Rate{/ts}</th>
<th class="right">{ts}Tax Amount{/ts}</th>
<th class="right">{ts}Total Amount{/ts}</th>
{/if}
{if $pricesetFieldsCount}
<th class="right">{ts}Total Participants{/ts}</th>
{/if}
</tr>
{foreach from=$value item=line}
<tr{if $line.qty EQ 0} class="cancelled"{/if}>
<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 $displayLineItemFinancialType}
<td>{$line.financial_type}</td>
{/if}
{if $context NEQ "Membership"}
<td class="right">{$line.qty}</td>
<td class="right">{$line.unit_price|crmMoney}</td>
{else}
<td class="right">{$line.line_total|crmMoney}</td>
{/if}
{if !$getTaxDetails && $context NEQ "Membership"}
<td class="right">{$line.line_total|crmMoney}</td>
{/if}
{if $getTaxDetails}
<td class="right">{$line.line_total|crmMoney}</td>
{if $line.tax_rate != "" || $line.tax_amount != ""}
<td class="right">{$taxTerm} ({$line.tax_rate}%)</td>
<td class="right">{$line.tax_amount|crmMoney}</td>
{else}
<td></td>
<td></td>
{/if}
<td class="right">{$line.line_total+$line.tax_amount|crmMoney}</td>
{/if}
{if $pricesetFieldsCount}
<td class="right">{$line.participant_count}</td>
{/if}
</tr>
{/foreach}
</table>
{/if}
{/foreach}
<div class="crm-section no-label total_amount-section">
<div class="content bold">
{if $getTaxDetails && $totalTaxAmount}
{ts 1=$taxTerm}Total %1 Amount{/ts}: {$totalTaxAmount|crmMoney}<br />
{/if}
{if $context EQ "Contribution"}
{ts}Contribution Total{/ts}:
{elseif $context EQ "Event"}
{if $totalTaxAmount}
{ts}Event SubTotal: {$totalAmount-$totalTaxAmount|crmMoney}{/ts}<br />
{/if}
{ts}Event Total{/ts}:
{elseif $context EQ "Membership"}
{ts}Membership Fee Total{/ts}:
{else}
{ts}Total Amount{/ts}:
{/if}
{$totalAmount|crmMoney}
</div>
<div class="clear"></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 class="clear"></div>
</div>
{if $hookDiscount.message}
<div class="crm-section hookDiscount-section">
<em>({$hookDiscount.message})</em>
</div>
{/if}
{literal}
<script type="text/javascript">
CRM.$(function($) {
{/literal}
var comma = '{$config->monetaryThousandSeparator}';
var dot = '{$config->monetaryDecimalPoint}';
var format = '{$config->moneyformat}';
var currency = '{$currency}';
var currencySymbol = '{$currencySymbol}';
{literal}
// Todo: This function should be a utility
function moneyFormat(amount) {
amount = parseFloat(amount).toFixed(2);
amount = amount.replace(',', 'comma').replace('.', 'dot');
amount = amount.replace('comma', comma).replace('dot', dot);
return format.replace('%C', currency).replace('%c', currencySymbol).replace('%a', amount);
}});
</script>
{/literal}

View file

@ -0,0 +1,120 @@
{*
+--------------------------------------------------------------------+
| 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 ($action eq 1 or $action eq 2 or $action eq 4 or $action eq 8 and !$usedBy) and !$isReserved}
{include file="CRM/Price/Form/Option.tpl"}
{elseif $usedBy}
<div class='spacer'></div>
<div id="price_set_used_by" class="messages status no-popup">
<div class="icon inform-icon"></div>
{if $action eq 8}
{ts 1=$usedPriceSetTitle}Unable to delete the '%1' Price Field Option - it is currently in use by one or more active events or contribution pages or contributions.{/ts}
{/if}
{if $usedBy.civicrm_event or $usedBy.civicrm_contribution_page}
{include file="CRM/Price/Page/table.tpl"}
{/if}
</div>
{else}
{if $customOption}
<div id="field_page">
<p></p>
{strip}
{* handle enable/disable actions*}
{include file="CRM/common/enableDisableApi.tpl"}
<table id="options" class="row-highlight">
<thead>
<tr>
<th>{ts}Option Label{/ts}</th>
<th>{ts}Option Amount{/ts}</th>
<th>{ts}Non-deductible Amount{/ts}</th>
<th>{ts}Pre Help{/ts}</th>
<th>{ts}Post Help{/ts}</th>
{if $isEvent}
<th>{ts}Participant Count{/ts}</th>
<th>{ts}Maximum{/ts}</th>
{/if}
<th>{ts}Default{/ts}</th>
<th>{ts}Financial Type{/ts}</th>
<th>{ts}Order{/ts}</th>
{if $getTaxDetails}
<th>{ts}Tax Label{/ts}</th>
<th>{ts}Tax Amount{/ts}</th>
{/if}
<th>{ts}Enabled?{/ts}</th>
<th></th>
</tr>
</thead>
<tbody>
{foreach from=$customOption item=row}
<tr id="price_field_value-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
<td class="crm-price-option-label crm-editable" data-field="label">{$row.label}</td>
<td class="crm-price-option-value">{$row.amount|crmMoney}</td>
<td class="crm-price-option-non-deductible-amount">{$row.non_deductible_amount|crmMoney}</td>
<td class="crm-price-option-pre-help">{$row.help_pre}</td>
<td class="crm-price-option-post-help">{$row.help_post}</td>
{if $isEvent}
<td class="crm-price-option-count">{$row.count}</td>
<td class="crm-price-option-max">{$row.max_value}</td>
{/if}
<td class="crm-price-option-is_default">{if $row.is_default}<img src="{$config->resourceBase}i/check.gif" alt="{ts}Default{/ts}" />{/if}</td>
<td class="nowrap crm-price-option-financial-type-id">{$row.financial_type_id}</td>
<td class="nowrap crm-price-option-order">{$row.weight}</td>
{if $getTaxDetails}
<td>{if $row.tax_rate != '' }
{$taxTerm} ({$row.tax_rate}%)
{/if}
</td>
<td>{$row.tax_amount|crmMoney}</td>
{/if}
<td id="row_{$row.id}_status" class="crm-price-option-is_active">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td>{$row.action|replace:'xx':$row.id}</td>
</tr>
{/foreach}
</tbody>
</table>
{/strip}
</div>
{else}
{if $action eq 16}
<div class="messages status no-popup">
<img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"/>
{ts}None found.{/ts}
</div>
{/if}
{/if}
{if $addMoreFields && !$isReserved}
<div class="action-link">
{crmButton q="reset=1&action=add&fid=$fid&sid=$sid" icon="plus-circle"}{ts 1=$fieldTitle}New Option for '%1'{/ts}{/crmButton}
{crmButton p="civicrm/admin/price/field" q="reset=1&sid=$sid" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
</div>
{/if}
{/if}

View file

@ -0,0 +1,94 @@
{*
+--------------------------------------------------------------------+
| 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 $action eq 1 or $action eq 2 or $action eq 4}
{include file="CRM/Price/Form/Set.tpl"}
{elseif $action eq 1024}
{include file="CRM/Price/Form/Preview.tpl"}
{elseif $action eq 8 and !$usedBy}
{include file="CRM/Price/Form/DeleteSet.tpl"}
{else}
<div class="help">
{ts}Price sets allow you to set up flexible multi-option pricing schemes for your contribution, event and membership pages. Use a price set if the standard pricing options are insufficient for your needs.{/ts}
</div>
{if $usedBy}
<div class='spacer'></div>
<div id="price_set_used_by" class="messages status no-popup">
<div class="icon inform-icon"></div>
{if $action eq 8}
{ts 1=$usedPriceSetTitle}Unable to delete the '%1' price set - it is currently in use by one or more active events or contribution pages or contributions or event templates.{/ts}
{/if}
{if $usedBy.civicrm_event or $usedBy.civicrm_contribution_page or $usedBy.civicrm_event_template}
{include file="CRM/Price/Page/table.tpl"}
{/if}
</div>
{/if}
{if $rows}
<div id="price_set">
<p></p>
{strip}
{* handle enable/disable actions*}
{include file="CRM/common/enableDisableApi.tpl"}
{include file="CRM/common/jsortable.tpl"}
<table id="price_set" class="display crm-price-set-listing">
<thead>
<tr>
<th id="sortable">{ts}Set Title{/ts}</th>
<th id="nosort">{ts}Used For{/ts}</th>
<th>{ts}Enabled?{/ts}</th>
<th></th>
</tr>
</thead>
{foreach from=$rows item=row}
<tr id="price_set-{$row.id}" class="crm-entity crm-price-set_{$row.id} {cycle values="even-row,odd-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
<td class="crmf-title crm-editable">{$row.title}</td>
<td class="crmf-extends">{$row.extends}</td>
<td class="crmf-is_active">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td>{$row.action|replace:'xx':$row.id}</td>
</tr>
{/foreach}
</table>
{if NOT ($action eq 1 or $action eq 2) }
<div class="action-link">
{crmButton p='civicrm/admin/price' q="action=add&reset=1" id="newPriceSet" icon="plus-circle"}{ts}Add Set of Price Fields{/ts}{/crmButton}
</div>
{/if}
{/strip}
</div>
{else}
{if $action ne 1} {* When we are adding an item, we should not display this message *}
{capture assign=infoTitle}{ts}No price sets have been added yet.{/ts}{/capture}
{assign var="infoType" value="no-popup"}
{capture assign=crmURL}{crmURL p='civicrm/admin/price' q='action=add&reset=1'}{/capture}
{capture assign=infoMessage}{ts 1=$crmURL}You can <a href='%1'>create one here</a>.{/ts}{/capture}
{include file="CRM/common/info.tpl"}
{/if}
{/if}
{/if}

View file

@ -0,0 +1,97 @@
{*
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
*}
{foreach from=$contexts item=context}
{if $context EQ "Event"}
{if $action eq 8}
{ts}If you no longer want to use this price set, click the event title below, and modify the fees for that event.{/ts}
{else}
{ts}This price set is used by the event(s) listed below. Click the event title to change or remove the price set.{/ts}
{/if}
<br /><br />
<table class="report">
<thead class="sticky">
<th scope="col">{ts}Event{/ts}</th>
<th scope="col">{ts}Type{/ts}</th>
<th scope="col">{ts}Public{/ts}</th>
<th scope="col">{ts}Date(s){/ts}</th>
</thead>
{foreach from=$usedBy.civicrm_event item=event key=id}
<tr>
<td><a href="{crmURL p="civicrm/event/manage/fee" q="action=update&reset=1&id=`$id`"}" title="{ts}Change or remove the price set used for this event.{/ts}">{$event.title}</a></td>
<td>{$event.eventType}</td>
<td>{if $event.isPublic}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}</td>
<td>{$event.startDate|crmDate}{if $event.endDate}&nbsp;to&nbsp;{$event.endDate|crmDate}{/if}</td>
</tr>
{/foreach}
</table>
{/if}
{if $context EQ "Contribution"}
{if $action eq 8}
{ts}If you no longer want to use this price set, click the contribution page title below, and modify the Amounts or Membership tab configuration.{/ts}
{else}
{ts}This price set is used by the contribution page(s) listed below. Click the contribution page title to change or remove the price set.{/ts}
{/if}
<br /><br />
<table class="report">
<thead class="sticky">
<th scope="col">{ts}Contribution Page{/ts}</th>
<th scope="col">{ts}Type{/ts}</th>
<th scope="col">{ts}Date(s){/ts}</th>
</thead>
{foreach from=$usedBy.civicrm_contribution_page item=contributionPage key=id}
<tr>
<td><a href="{crmURL p="civicrm/admin/contribute/settings" q="action=update&reset=1&id=`$id`"}" title="{ts}Change or remove the price set used for this contribution page.{/ts}">{$contributionPage.title}</a></td>
<td>{$contributionPage.type}</td>
<td>{$contributionPage.startDate|truncate:10:''|crmDate}{if $contributionPage.endDate}&nbsp;to&nbsp;{$contributionPage.endDate|truncate:10:''|crmDate}{/if}</td>
</tr>
{/foreach}
</table>
{/if}
{if $context EQ "EventTemplate"}
{if $action eq 8}
{ts}If you no longer want to use this price set, click the event template title below, and modify the fees for that event.{/ts}
{else}
{ts}This price set is used by the event template(s) listed below. Click the event template title to change or remove the price set.{/ts}
{/if}
<br /><br />
<table class="report">
<thead class="sticky">
<th scope="col">{ts}Event Template Name{/ts}</th>
<th scope="col">{ts}Type{/ts}</th>
<th scope="col">{ts}Public{/ts}</th>
</thead>
{foreach from=$usedBy.civicrm_event_template item=eventTemplate key=id}
<tr>
<td><a href="{crmURL p="civicrm/event/manage/fee" q="action=update&reset=1&id=`$id`"}" title="{ts}Change or remove the price set used for this event template.{/ts}">{$eventTemplate.title}</a></td>
<td>{$eventTemplate.eventType}</td>
<td>{if $eventTemplate.isPublic}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}</td>
</tr>
{/foreach}
</table>
{/if}
{/foreach}