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,361 @@
{*
+--------------------------------------------------------------------+
| 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 batch transaction screen, assign/remove transactions to batch *}
{if in_array($batchStatus, array('Open', 'Reopened'))}
<div class="crm-form-block crm-search-form-block">
<div class="crm-accordion-wrapper crm-batch_transaction_search-accordion collapsed">
<div class="crm-accordion-header crm-master-accordion-header">
{ts}Edit Search Criteria{/ts}
</div>
<div class="crm-accordion-body">
<div id="searchForm" class="crm-block crm-form-block crm-contact-custom-search-activity-search-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
<tr>
<td class="font-size12pt" colspan="2">{$form.sort_name.label}&nbsp;&nbsp;{$form.sort_name.html|crmAddClass:'twenty'}</td>
</tr>
<tr>
{if $form.contact_tags}
<td><label>{ts}Contributor Tag(s){/ts}</label>
{$form.contact_tags.html}
</td>
{else}
<td>&nbsp;</td>
{/if}
{if $form.group}
<td><label>{ts}Contributor Group(s){/ts}</label>
{$form.group.html}
</td>
{else}
<td>&nbsp;</td>
{/if}
</tr>
{include file="CRM/Contribute/Form/Search/Common.tpl"}
</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
</div>
</div>
</div>
{if in_array($batchStatus, array('Open', 'Reopened'))}
<div class="form-layout-compressed">{$form.trans_assign.html}&nbsp;{$form.submit.html}</div><br/>
{/if}
<div id="ltype">
<p></p>
<div class="form-item">
{strip}
<table id="crm-transaction-selector-assign-{$entityID}" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th class="crm-transaction-checkbox">{if in_array($batchStatus, array('Open', 'Reopened'))}{$form.toggleSelect.html}{/if}</th>
<th class="crm-contact-type"></th>
<th class="crm-contact-name">{ts}Name{/ts}</th>
<th class="crm-amount">{ts}Amount{/ts}</th>
<th class="crm-trxnID">{ts}Trxn ID{/ts}</th>
<th class="crm-trxn_date">{ts}Payment/Transaction Date{/ts}</th>
<th class="crm-received">{ts}Contribution Date{/ts}</th>
<th class="crm-payment-method">{ts}Pay Method{/ts}</th>
<th class="crm-status">{ts}Status{/ts}</th>
<th class="crm-type">{ts}Financial Type{/ts}</th>
<th class="crm-transaction-links"></th>
</tr>
</thead>
</table>
{/strip}
</div>
</div>
{/if}
{literal}
<script type="text/javascript">
CRM.$(function($) {
CRM.$('#_qf_BatchTransaction_submit-top, #_qf_BatchTransaction_submit-bottom').click(function() {
CRM.$('.crm-batch_transaction_search-accordion:not(.collapsed)').crmAccordionToggle();
});
var batchStatus = {/literal}{$statusID}{literal};
{/literal}{if $validStatus}{literal}
// build transaction listing only for open/reopened batches
var paymentInstrumentID = {/literal}{if $paymentInstrumentID neq null}{$paymentInstrumentID}{else}'null'{/if}{literal};
if (paymentInstrumentID != 'null') {
buildTransactionSelectorAssign( true );
}
else {
buildTransactionSelectorAssign( false );
}
buildTransactionSelectorRemove();
CRM.$('#_qf_BatchTransaction_submit-bottom, #_qf_BatchTransaction_submit-top').click( function() {
buildTransactionSelectorAssign( true );
return false;
});
CRM.$("#trans_assign").prop('disabled',true);
CRM.$("#trans_remove").prop('disabled',true);
CRM.$('#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect').click( function() {
enableActions('x');
});
CRM.$('#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects').click( function() {
enableActions('y');
});
CRM.$('#Go').click( function() {
return selectAction("trans_assign","toggleSelect", "crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']");
});
CRM.$('#GoRemove').click( function() {
return selectAction("trans_remove","toggleSelects", "crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']");
});
CRM.$('#Go').click( function() {
if (CRM.$("#trans_assign" ).val() != "" && CRM.$("input[id^='mark_x_']").is(':checked')) {
bulkAssignRemove('Assign');
}
return false;
});
CRM.$('#GoRemove').click( function() {
if (CRM.$("#trans_remove" ).val() != "" && CRM.$("input[id^='mark_y_']").is(':checked')) {
bulkAssignRemove('Remove');
}
return false;
});
CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").click( function() {
enableActions('x');
});
CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").click( function() {
enableActions('y');
});
CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").click( function() {
toggleFinancialSelections('#toggleSelect', 'assign');
});
CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").click( function() {
toggleFinancialSelections('#toggleSelects', 'remove');
});
{/literal}{else}{literal}
buildTransactionSelectorRemove();
{/literal}{/if}{literal}
});
function enableActions( type ) {
if (type == 'x') {
CRM.$("#trans_assign").prop('disabled',false);
}
else {
CRM.$("#trans_remove").prop('disabled',false);
}
}
function toggleFinancialSelections(toggleID, toggleClass) {
var mark = 'x';
if (toggleClass == 'remove') {
mark = 'y';
}
if (CRM.$("#crm-transaction-selector-" + toggleClass + "-{/literal}{$entityID}{literal} " + toggleID).is(':checked')) {
CRM.$("#crm-transaction-selector-" + toggleClass + "-{/literal}{$entityID}{literal} input[id^='mark_" + mark + "_']").prop('checked',true);
}
else {
CRM.$("#crm-transaction-selector-" + toggleClass + "-{/literal}{$entityID}{literal} input[id^='mark_" + mark + "_']").prop('checked',false);
}
}
function buildTransactionSelectorAssign(filterSearch) {
var columns = '';
var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Financial_Page_AJAX&fnName=getFinancialTransactionsList&snippet=4&context=financialBatch&entityID=$entityID&notPresent=1&statusID=$statusID"}'{literal};
if ( filterSearch ) {
sourceUrl = sourceUrl+"&search=1";
var ZeroRecordText = '<div class="status messages">{/literal}{ts escape="js"}None found.{/ts}{literal}</li></ul></div>';
}
crmBatchSelector1 = CRM.$('#crm-transaction-selector-assign-{/literal}{$entityID}{literal}').dataTable({
"bDestroy" : true,
"bFilter" : false,
"bAutoWidth" : false,
"lengthMenu": [ 10, 25, 50, 100, 250, 500, 1000, 2000 ],
"aaSorting" : [[5, 'desc']],
"aoColumns" : [
{sClass:'crm-transaction-checkbox', bSortable:false},
{sClass:'crm-contact-type', bSortable:false},
{sClass:'crm-contact-name'},
{sClass:'crm-amount'},
{sClass:'crm-trxnID'},
{sClass:'crm-trxn_date'},
{sClass:'crm-received'},
{sClass:'crm-payment-method'},
{sClass:'crm-status'},
{sClass:'crm-type'},
{sClass:'crm-transaction-links', bSortable:false}
],
"bProcessing": true,
"asStripClasses" : [ "odd-row", "even-row" ],
"sPaginationType": "full_numbers",
"sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": sourceUrl,
"iDisplayLength": 25,
"oLanguage": {
"sZeroRecords": ZeroRecordText,
"sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
"sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
"sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
"sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
"sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
"sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
"oPaginate": {
"sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
"sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
"sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
"sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
}
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
if ( filterSearch ) {
CRM.$('#searchForm :input').each(function() {
if (CRM.$(this).val()) {
aoData.push(
{name:CRM.$(this).attr('id'), value: CRM.$(this).val()}
);
CRM.$(':radio, :checkbox').each(function() {
if (CRM.$(this).is(':checked')) {
aoData.push( { name: CRM.$(this).attr('name'), value: CRM.$(this).val() } );
}
});
}
});
}
CRM.$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": function(b) {
fnCallback(b);
toggleFinancialSelections('#toggleSelect', 'assign');
}
});
}
});
}
function buildTransactionSelectorRemove( ) {
var columns = '';
var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Financial_Page_AJAX&fnName=getFinancialTransactionsList&snippet=4&context=financialBatch&entityID=$entityID&statusID=$statusID"}'{literal};
crmBatchSelector = CRM.$('#crm-transaction-selector-remove-{/literal}{$entityID}{literal}').dataTable({
"bDestroy" : true,
"bFilter" : false,
"bAutoWidth" : false,
"aaSorting" : [[5, 'desc']],
"aoColumns" : [
{sClass:'crm-transaction-checkbox', bSortable:false},
{sClass:'crm-contact-type', bSortable:false},
{sClass:'crm-contact-name'},
{sClass:'crm-amount'},
{sClass:'crm-trxnID'},
{sClass:'crm-trxn_date'},
{sClass:'crm-received'},
{sClass:'crm-payment-method'},
{sClass:'crm-status'},
{sClass:'crm-type'},
{sClass:'crm-transaction-links', bSortable:false}
],
"bProcessing": true,
"asStripClasses" : [ "odd-row", "even-row" ],
"sPaginationType": "full_numbers",
"sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": sourceUrl,
"iDisplayLength": 25,
"oLanguage": {
"sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
"sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
"sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
"sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
"sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
"sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
"oPaginate": {
"sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
"sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
"sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
"sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
}
},
"fnServerData": function (sSource, aoData, fnCallback) {
CRM.$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": function(b) {
fnCallback(b);
toggleFinancialSelections('#toggleSelects', 'remove');
}
});
}
});
}
function selectAction( id, toggleSelectId, checkId ) {
if (CRM.$("#"+ id ).is(':disabled')) {
return false;
}
else if (!CRM.$("#" + toggleSelectId).is(':checked') && !CRM.$("#" + checkId).is(':checked') && CRM.$("#" + id).val() != "") {
CRM.alert ({/literal}'{ts escape="js"}Please select one or more contributions for this action.{/ts}'{literal});
return false;
}
else if (CRM.$("#" + id).val() == "") {
CRM.alert ({/literal}'{ts escape="js"}Please select an action from the drop-down menu.{/ts}'{literal});
return false;
}
}
function bulkAssignRemove( action ) {
var postUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q="className=CRM_Financial_Page_AJAX&fnName=bulkAssignRemove&entityID=$entityID" }"{literal};
var fids = [];
if (action == 'Assign') {
CRM.$("input[id^='mark_x_']:checked").each( function () {
var a = CRM.$(this).attr('id');
fids.push(a);
});
}
if (action == 'Remove') {
CRM.$("input[id^='mark_y_']:checked").each( function () {
var a = CRM.$(this).attr('id');
fids.push(a);
});
}
CRM.$.post(postUrl, { ID: fids, action:action }, function(data) {
//this is custom status set when record update success.
if (data.status == 'record-updated-success') {
buildTransactionSelectorAssign( true );
buildTransactionSelectorRemove();
batchSummary({/literal}{$entityID}{literal});
}
else {
CRM.alert(data.status);
}
}, 'json');
}
</script>
{/literal}

View file

@ -0,0 +1,64 @@
{*
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
*}
{* Confirmation of Export Batch(s) *}
<h3>{ts}Export Batch{/ts}</h3>
<div class="messages status">
<div class="icon inform-icon"></div>
{ts}Warning: You will not be able to reopen or change the batch after it is exported. Are you sure you want to export?{/ts}
</div>
<div class="crm-block crm-form-block crm-export_batch-form-block">
<div class = "batch-names">
<ul>
{foreach from=$batchNames item=batchName}
<li>{$batchName}</li>
{/foreach}
</ul>
</div>
<table class="form-layout">
<tr class="crm-contribution-form-block-name">
<td class="html-adjust">
{$form.export_format.html}
</td>
</tr>
</table>
<div class="form-item">
{$form.buttons.html}
</div>
</div>
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('input[name="export_format"]').filter('[value=IIF]').prop('checked', true);
$('#_qf_Export_next').click(function(){
$(this).hide();
$('#_qf_Export_cancel').val('{/literal}{ts}Done{/ts}{literal}');
});
});
</script>
{/literal}

View file

@ -0,0 +1,38 @@
{*
+--------------------------------------------------------------------+
| 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-financial-owner-title"}
{ts}Financial Account Owner{/ts}
{/htxt}
{htxt id="id-financial-owner"}
<p>{ts}Normally the owner of a financial account is the organization implementing CiviCRM so there is no need to change this. Some organizations that maintain accounts for groups, chapters, regions, constiuency associations or other parts of the main CiviCRM organization may need to change the owner to one of these sub-entities or sibling entities.{/ts}</p>
{/htxt}
{htxt id="id-account-type-code-title"}
{ts}Account Type Code{/ts}
{/htxt}
{htxt id="id-account-type-code"}
<p>{ts}For export to QuickBooks, export your Chart of Accounts and open in low level text editor. You will be able to see the Account Type Code for each account. Generally, they will be from the following list: BANK, AR, OCASSET, FIXASSET, OASSET, AP, OCLIAB, LTLIAB, EQUITY, INC, COGS, EXP, EXEXP (though there may be others in your version of QuickBooks).{/ts}</p>
{/htxt}

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 |
+--------------------------------------------------------------------+
*}
{* this template is used for adding/editing/deleting financial type *}
<div class="crm-block crm-form-block crm-contribution_type-form-block crm-financial_type-form-block">
{if $action eq 8}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
{ts}WARNING: You cannot delete a {$delName} Financial Account if it is currently used by any Financial Types. Consider disabling this option instead.{/ts} {ts}Deleting a financial type cannot be undone.{/ts} {ts}Do you want to continue?{/ts}
</div>
{else}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
<tr class="crm-contribution-form-block-name">
<td class="label">{$form.name.label}</td>
<td class="html-adjust">{$form.name.html}</td>
</tr>
<tr class="crm-contribution-form-block-description">
<td class="label">{$form.description.label}</td>
<td class="html-adjust">{$form.description.html}</td>
</tr>
<tr class="crm-contribution-form-block-organisation_name">
<td class="label">{$form.contact_id.label}&nbsp;{help id="id-financial-owner" file="CRM/Financial/Form/FinancialAccount.hlp"}</td>
<td class="html-adjust">{$form.contact_id.html}<br />
<span class="description">{ts}Use this field to indicate the organization that owns this account.{/ts}</span>
</td>
</tr>
<tr class="crm-contribution-form-block-financial_account_type_id">
<td class="label">{$form.financial_account_type_id.label}</td>
<td class="html-adjust">{$form.financial_account_type_id.html}</td>
</tr>
<tr class="crm-contribution-form-block-accounting_code">
<td class="label">{$form.accounting_code.label}</td>
<td class="html-adjust">{$form.accounting_code.html}<br />
<span class="description">{ts}Enter the corresponding account code used in your accounting system. This code will be available for contribution export, and included in accounting batch exports.{/ts}</span>
</td>
</tr>
<tr class="crm-contribution-form-block-account_type_code">
<td class="label">{$form.account_type_code.label}&nbsp;{help id="id-account-type-code" file="CRM/Financial/Form/FinancialAccount.hlp"}</td>
<td class="html-adjust">{$form.account_type_code.html}<br />
<span class="description">{ts}Enter an account type code for this account. Account type codes are required for QuickBooks integration and will be included in all accounting batch exports.{/ts}</span>
</td>
</tr>
<tr class="crm-contribution-form-block-is_deductible">
<td class="label">{$form.is_deductible.label}</td>
<td class="html-adjust">{$form.is_deductible.html}<br />
<span class="description">{ts}Are monies received into this account tax-deductible?{/ts}</span>
</td>
</tr>
<tr class="crm-contribution-form-block-is_active">
<td class="label">{$form.is_active.label}</td>
<td class="html-adjust">{$form.is_active.html}</td>
</tr>
<tr class="crm-contribution-form-block-is_tax">
<td class="label">{$form.is_tax.label}</td>
<td class="html-adjust">{$form.is_tax.html}<br />
<span class="description">{ts}Does this account hold taxes collected?{/ts}</span>
</td>
</tr>
<tr class="crm-contribution-form-block-tax_rate">
<td class="label">{$form.tax_rate.label}</td>
<td class="html-adjust">{$form.tax_rate.html}<br />
<span class="description">{ts}The default rate used to calculate the taxes collected into this account (e.g. for tax rate of 8.27%, enter 8.27).{/ts}</span>
</td>
</tr>
<tr class="crm-contribution-form-block-is_default">
<td class="label">{$form.is_default.label}</td>
<td class="html-adjust">{$form.is_default.html}<br />
<span class="description">{ts}Is this account to be used as the default account for its financial account type when associating financial accounts with financial types?{/ts}</span>
</td>
</tr>
</table>
{/if}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="botttom"}</div>
</div>

View file

@ -0,0 +1,86 @@
{*
+--------------------------------------------------------------------+
| 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 adding/editing/deleting financial batch *}
<div class="crm-block crm-form-block crm-financial_type-form-block">
{if $action eq 8}
<div class="messages status">
<div class="icon inform-icon"></div>
{ts}WARNING: You cannot delete a financial type if it is currently used by any Contributions, Contribution Pages or Membership Types. Consider disabling this option instead.{/ts} {ts}Deleting a financial type cannot be undone.{/ts} {ts}Do you want to continue?{/ts}
</div>
{else}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout">
<tr class="crm-contribution-form-block-name">
<td class="label">{$form.title.label}</td>
<td class="html-adjust">{$form.title.html}</td>
</tr>
<tr class="crm-contribution-form-block-description">
<td class="label">{$form.description.label}</td>
<td class="html-adjust">{$form.description.html}</td>
</tr>
{if $action eq 2}
<tr class="crm-contribution-form-block-contact">
<td class="label">{ts}Created By{/ts}</td>
<td class="html-adjust">{$contactName}</td>
</tr>
<tr class="crm-contribution-form-block-open_date">
<td class="label">{ts}Opened Date{/ts}</td>
<td class="html-adjust">{$created_date|crmDate}</td>
</tr>
<tr class="crm-contribution-form-block-modified_date">
<td class="label">{ts}Modified Date{/ts}</td>
<td class="html-adjust">{$modified_date|crmDate}</td>
</tr>
<tr class="crm-contribution-form-block-batch_status">
<td class="label">{$form.status_id.label}</td>
<td class="html-adjust">{$form.status_id.html}</td>
</tr>
{/if}
</table>
<fieldset class="crm-collapsible">
<legend class="collapsible-title">{ts}Optional Constraints{/ts}</legend>
<div>
<table class="form-layout">
<tr class="crm-contribution-form-block-payment_instrument">
<td class="label">{$form.payment_instrument_id.label}</td>
<td class="html-adjust">{$form.payment_instrument_id.html} {help id="payment_instrument"}</td>
</tr>
<tr class="crm-contribution-form-block-item_count">
<td class="label">{$form.item_count.label}</td>
<td class="html-adjust">{$form.item_count.html|crmAddClass:number} {help id="item_count"}</td>
</tr>
<tr class="crm-contribution-form-block-total">
<td class="label">{$form.total.label}</td>
<td class="html-adjust">{$form.total.html|crmAddClass:number} {help id="total"}</td>
</tr>
</table>
</div>
</fieldset>
{/if}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="botttom"}</div>
</div>
{include file="CRM/Form/validate.tpl"}

View file

@ -0,0 +1,69 @@
{*
+--------------------------------------------------------------------+
| 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 adding/editing/deleting financial type *}
<div class="crm-block crm-form-block crm-financial_type-form-block">
{if $action eq 8}
<div class="messages status">
<div class="icon inform-icon"></div>
{ts}WARNING: You cannot delete a financial type if it is currently used by any Contributions, Contribution Pages or Membership Types. Consider disabling this option instead.{/ts} {ts}Deleting a financial type cannot be undone.{/ts} {ts}Do you want to continue?{/ts}
</div>
{else}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout">
<tr class="crm-contribution-form-block-name">
<td class="label">{$form.name.label}</td>
<td class="html-adjust">{$form.name.html}</td>
</tr>
<tr class="crm-contribution-form-block-description">
<td class="label">{$form.description.label}</td>
<td class="html-adjust">{$form.description.html}</td>
</tr>
<tr class="crm-contribution-form-block-is_deductible">
<td class="label">{$form.is_deductible.label}</td>
<td class="html-adjust">{$form.is_deductible.html}<br />
<span class="description">{ts}Are contributions of this type tax-deductible?{/ts}</span>
</td>
</tr>
<tr class="crm-contribution-form-block-is_active">
<td class="label">{$form.is_active.label}</td>
<td class="html-adjust">{$form.is_active.html}</td>
</tr>
<tr class="crm-contribution-form-block-is_reserved">
<td class="label">{$form.is_reserved.label}</td>
<td class="html-adjust">{$form.is_reserved.html}</td>
</tr>
</table>
{/if}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="botttom"}</div>
{if $action eq 2 or $action eq 4 } {* Update or View*}
<div class="crm-submit-buttons">
<a href="{crmURL p='civicrm/admin/financial/financialType/accounts' q="action=browse&reset=1&aid=$aid"}" class="button"><span>{ts}View or Edit Financial Accounts{/ts}</a></span>
</div>
{/if}
</div>

View file

@ -0,0 +1,161 @@
{*
+--------------------------------------------------------------------+
| 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 adding/editing/deleting financial type *}
<div class="crm-block crm-form-block crm-financial_type-form-block">
{if $action eq 8}
<div class="messages status">
<div class="icon inform-icon"></div>
{ts}WARNING: You cannot delete a financial type if it is currently used by any Contributions, Contribution Pages or Membership Types. Consider disabling this option instead.{/ts} {ts}Deleting a financial type cannot be undone. Unbalanced transactions may be created if you delete this account.{/ts} {ts}Do you want to continue?{/ts}
</div>
{else}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout">
<tr class="crm-contribution-form-block-account_relationship">
<td class="label">{$form.account_relationship.label}</td>
<td class="html-adjust">{$form.account_relationship.html}</td>
</tr>
<tr class="crm-contribution-form-block-financial_account_id">
<td class="label">{$form.financial_account_id.label}</td>
<td class="html-adjust">{$form.financial_account_id.html}</td>
</tr>
</table>
{/if}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="botttom"}</div>
</div>
<script language="JavaScript" type="text/javascript">
{literal}
CRM.$(function($) {
$("#financial_account_id").change(function() {
{/literal}
relationID = "#account_relationship"
financialAccountID = "#financial_account_id"
callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}"
{literal}
var financialId = $("#financial_account_id").val();
var check = $(relationID).val();
if (check == 'select' || financialId == 'select') {
callbackURL = callbackURL+"&_value=" + financialId;
$.ajax({
url: callbackURL,
context: document.body,
success: function(data, textStatus) {
$(relationID).html("");//clear old options
data = eval(data);//get json array
if (data != null) {
for (i = 0; i < data.length; i++) {
if (data[i].selected == 'Selected') {
var idf = data[i].value;
}
$(relationID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
}
}
if (idf != null) {
$(relationID).val(idf);
}
}
});
}
if (financialId == 'select') {
{/literal}
callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}"
{literal}
callbackURLs = callbackURLs + "&_value=select";
$.ajax({
url: callbackURLs,
context: document.body,
success: function(data, textStatus) {
$(financialAccountID).html("");//clear old options
data = eval(data);//get json array
if (data != null) {
for (i = 0; i < data.length; i++) {
$(financialAccountID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
}
}
}
});
}
});
$("#account_relationship").change(function() {
{/literal}
relationID = "#account_relationship"
financialAccountID = "#financial_account_id"
callbackURLs = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancial'}"
{literal}
var financialId = $("#account_relationship").val();
var check = $(financialAccountID).val();
callbackURLs = callbackURLs+"&_value="+financialId;
$.ajax({
url: callbackURLs,
context: document.body,
success: function(data, textStatus) {
$(financialAccountID).html("");//clear old options
data = eval(data);//get json array
if (data != null) {
for (i = 0; i < data.length; i++) {
if (data[i].selected == 'Selected') {
var idf = data[i].value;
}
$(financialAccountID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
}
}
if (idf != null) {
$(financialAccountID).val(idf);
}
}
});
if (financialId == 'select') {
{/literal}
callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialRelation'}"
{literal}
callbackURL = callbackURL+"&_value=select";
$.ajax({
url: callbackURL,
context: document.body,
success: function(data, textStatus) {
$(relationID).html("");//clear old options
data = eval(data);//get json array
if (data != null) {
for (i = 0; i < data.length; i++) {
if (data[i].selected == 'Selected') {
var idf = data[i].value;
}
$(relationID).get(0).add(new Option(data[i].name, data[i].value), document.all ? i : null);
}
}
if (idf != null) {
$(relationID).val(idf);
}
}
});
}
});
});
{/literal}
</script>

View file

@ -0,0 +1,29 @@
{*
+--------------------------------------------------------------------+
| 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 id="billing-payment-block">
{include file="CRM/Core/BillingBlock.tpl"}
</div>

View file

@ -0,0 +1,68 @@
{*
+--------------------------------------------------------------------+
| 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="payment-edit-block"}
<div id="payment-edit-section" class="crm-section billing_mode-section">
{foreach from=$paymentFields key=fieldName item=paymentField}
{assign var='name' value=$fieldName}
<div class="crm-container {$name}-section">
<div class="label">{$form.$name.label}
</div>
<div class="content">{if $name eq 'total_amount'}{$currency}&nbsp;&nbsp;{/if}{$form.$name.html}
</div>
<div class="clear"></div>
</div>
{/foreach}
</div>
{/crmRegion}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
{literal}
<script type="text/javascript">
CRM.$(function ($) {
showHideFieldsByPaymentInstrumentID();
$('#payment_instrument_id').on('change', showHideFieldsByPaymentInstrumentID);
function showHideFieldsByPaymentInstrumentID() {
var paymentInstrumentLabel = $('#payment_instrument_id option:selected').text();
if (paymentInstrumentLabel == ts('Credit Card')) {
$('.check_number-section').hide();
$('.card_type_id-section, .pan_truncation-section').show();
}
else if (paymentInstrumentLabel == ts('Check')) {
$('.card_type_id-section, .pan_truncation-section').hide();
$('.check_number-section').show();
}
else {
$('.card_type_id-section, .pan_truncation-section, .check_number-section').hide();
}
}
});
</script>
{/literal}

View file

@ -0,0 +1,45 @@
{*
+--------------------------------------------------------------------+
| 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 id="paypalExpress">
<fieldset class="crm-group paypal_checkout-group">
<legend>{ts}Checkout with PayPal{/ts}</legend>
<div class="section">
<div class="crm-section paypalButtonInfo-section">
<div class="content">
<span class="description">{ts}Click the PayPal button to continue.{/ts}</span>
</div>
<div class="clear"></div>
</div>
<div class="crm-section {$expressButtonName}-section">
<div class="content">
{$form.$expressButtonName.html} <span class="description">{ts}Checkout securely. Pay without sharing your financial information.{/ts}</span>
</div>
<div class="clear"></div>
</div>
</div>
</fieldset>
</div>

View file

@ -0,0 +1,38 @@
{*
+--------------------------------------------------------------------+
| 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 $form.$expressButtonName}
<div class="crm-section no-label paypal_button_info-section">
<div class="content description">
{ts}If you have a PayPal account, you can click the PayPal button to continue. Otherwise, fill in the credit card and billing information on this form and click <strong>Continue</strong> at the bottom of the page.{/ts}
</div>
</div>
<div class="crm-section no-label {$form.$expressButtonName.name}-section">
<div class="content description">
{$form.$expressButtonName.html}
<div class="description">{ts}Checkout securely. Pay without sharing your financial information.{/ts}</div>
</div>
</div>
{/if}

View file

@ -0,0 +1,335 @@
{*
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
*}
{* Financial search component. *}
<div id="enableDisableStatusMsg" class="crm-container" style="display:none"></div>
<div class="crm-submit-buttons">
<a accesskey="N" href="{crmURL p='civicrm/financial/batch' q="reset=1&action=add&context=$batchStatus"}" id="newBatch" class="button"><span><i class="crm-i fa-plus-circle"></i> {ts}New Accounting Batch{/ts}</span></a>
</div>
<div class="crm-form-block crm-search-form-block">
<div class="crm-accordion-wrapper crm-activity_search-accordion">
<div class="crm-accordion-header">
{ts}Filter Results{/ts}
</div>
<div class="crm-accordion-body">
<div id="financial-search-form" class="crm-block crm-form-block">
<table class="form-layout-compressed">
{* Loop through all defined search criteria fields (defined in the buildForm() function). *}
{foreach from=$elements item=element}
<tr class="crm-financial-search-form-block-{$element}">
<td class="label">{$form.$element.label}</td>
<td>{$form.$element.html}</td>
</tr>
{/foreach}
</table>
</div>
</div>
</div>
</div>
<div class="form-layout-compressed">{$form.batch_update.html}&nbsp;{$form.submit.html}</div><br/>
<table id="crm-batch-selector-{$batchStatus}" class="row-highlight">
<thead>
<tr>
<th class="crm-batch-checkbox">{$form.toggleSelect.html}</th>
<th class="crm-batch-name">{ts}Batch Name{/ts}</th>
<th class="crm-batch-payment_instrument">{ts}Payment Method{/ts}</th>
<th class="crm-batch-item_count">{ts}Item Count{/ts}</th>
<th class="crm-batch-total">{ts}Total Amount{/ts}</th>
<th class="crm-batch-status">{ts}Status{/ts}</th>
<th class="crm-batch-created_by">{ts}Created By{/ts}</th>
<th></th>
</tr>
</thead>
</table>
{include file="CRM/Form/validate.tpl"}
{literal}
<script type="text/javascript">
CRM.$(function($) {
var batchSelector;
buildBatchSelector();
$("#batch_update").prop('disabled', false);
$('#financial-search-form :input')
.change(function() {
if (!$(this).hasClass('crm-inline-error')) {
batchSelector.fnDraw();
}
})
.keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
$(this).change();
return false;
}
});
var checkedRows = [];
function buildBatchSelector() {
var ZeroRecordText = {/literal}'<div class="status messages">{ts escape="js"}No Accounting Batches match your search criteria.{/ts}</div>'{literal};
var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/batchlist" h=0 q="snippet=4&context=financialBatch"}'{literal};
batchSelector = $('#crm-batch-selector-{/literal}{$batchStatus}{literal}').dataTable({
"bFilter" : false,
"bAutoWidth" : false,
"aaSorting" : [],
"aoColumns" : [
{sClass:'crm-batch-checkbox', bSortable:false},
{sClass:'crm-batch-name'},
{sClass:'crm-batch-payment_instrument'},
{sClass:'crm-batch-item_count right', bSortable:false},
{sClass:'crm-batch-total right', bSortable:false},
{sClass:'crm-batch-status'},
{sClass:'crm-batch-created_by'},
{sClass:'crm-batch-links', bSortable:false},
],
"bProcessing": true,
"asStripClasses" : ["odd-row", "even-row"],
"sPaginationType": "full_numbers",
"sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": sourceUrl,
"iDisplayLength": 25,
"oLanguage": {
"sZeroRecords": ZeroRecordText,
"sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
"sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
"sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
"sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
"sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries) {/ts}"{literal},
"sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
"oPaginate": {
"sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
"sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
"sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
"sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
}
},
"fnServerParams": function (aoData) {
$('#financial-search-form :input').each(function() {
if ($(this).val()) {
aoData.push(
{name:$(this).attr('id'), value: $(this).val()}
);
}
});
checkedRows = [];
$("#crm-batch-selector-{/literal}{$batchStatus}{literal} input.select-row:checked").each(function() {
checkedRows.push('#' + $(this).attr('id'));
});
},
"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
var box = $(aData[0]);
var id = box.attr('id').replace('check_', '');
$(nRow).addClass('crm-entity').attr('data-entity', 'batch').attr('data-id', id).attr('data-status_id', box.attr('data-status_id'));
$('td:eq(1)', nRow).wrapInner('<div class="crm-editable crmf-title" />');
return nRow;
},
"fnDrawCallback": function(oSettings) {
$(this).trigger('crmLoad');
$("#toggleSelect").prop('checked', false);
if (checkedRows.length) {
$(checkedRows.join(',')).prop('checked', true).change();
}
}
});
}
function editRecords(records, op) {
records = validateOp(records, op);
if (records.length) {
$("#enableDisableStatusMsg").dialog({
title: {/literal}'{ts escape="js"}Confirm Changes{/ts}'{literal},
modal: true,
open:function() {
switch (op) {{/literal}
case 'reopen':
var msg = '<h3>{ts escape="js"}Are you sure you want to re-open:{/ts}</h3>';
break;
case 'delete':
var msg = '<h3>{ts escape="js"}Are you sure you want to delete:{/ts}</h3>';
break;
case 'close':
var msg = '<h3>{ts escape="js"}Are you sure you want to close:{/ts}</h3>';
break;
case 'export':
var msg = '<h3>{ts escape="js"}Export:{/ts}</h3>\
<div>\
<label>{ts escape="js"}Format:{/ts}</label>\
<select class="export-format">\
<option value="IIF">IIF</option>\
<option value="CSV">CSV</option>\
</select>\
</div>';
break;
{literal}}
msg += listRecords(records, op == 'close' || op == 'export');
$('#enableDisableStatusMsg').show().html(msg);
},
buttons: {
{/literal}"{ts escape='js'}Cancel{/ts}"{literal}: function() {
$(this).dialog("close");
},
{/literal}"{ts escape='js'}OK{/ts}{literal}": function() {
saveRecords(records, op);
$(this).dialog("close");
}
}
});
}
}
function listRecords(records, compareValues) {
var txt = '<ul>',
mismatch = false;
for (var i in records) {
var $tr = $('tr[data-id=' + records[i] + ']');
txt += '<li>' + $('.crmf-title', $tr).text();
if (compareValues) {
$('.actual-value.crm-error', $tr).each(function() {
mismatch = true;
var $th = $tr.closest('table').find('th').eq($(this).closest('td').index());
var $expected = $(this).siblings('.expected-value');
var label = $th.text();
var actual = $(this).text();
var expected = $expected.text();
txt += {/literal}'<div class="messages crm-error"><strong>' +
label + ' {ts escape="js"}mismatch.{/ts}</strong><br />{ts escape="js"}Expected{/ts}: ' + expected + '<br />{ts escape="js"}Current Total{/ts}: ' + actual + '</div>'{literal};
});
}
txt += '</li>';
}
txt += '</ul>';
if (mismatch) {
txt += {/literal}'<div class="messages status">{ts escape="js"}Click OK to override and update expected values.{/ts}</div>'{literal}
}
return txt;
}
function saveRecords(records, op) {
if (op == 'export') {
return exportRecords(records);
}
var postUrl = CRM.url('civicrm/ajax/rest', 'className=CRM_Financial_Page_AJAX&fnName=assignRemove');
//post request and get response
$.post(postUrl, {records: records, recordBAO: 'CRM_Batch_BAO_Batch', op: op, key: {/literal}"{crmKey name='civicrm/ajax/ar'}"{literal}},
function(response) {
//this is custom status set when record update success.
if (response.status == 'record-updated-success') {
//Redirect CRM-18169
window.location.href = CRM.url('civicrm/financial/financialbatches', 'reset=1&batchStatus=' + response.status_id);
CRM.alert(listRecords(records), op == 'delete' ? {/literal}'{ts escape="js"}Deleted{/ts}' : '{ts escape="js"}Updated{/ts}'{literal}, 'success');
}
else {
CRM.alert({/literal}'{ts escape="js"}An error occurred while processing your request.{/ts}', $("#batch_update option[value=" + op + "]").text() + ' {ts escape="js"}Error{/ts}'{literal}, 'error');
}
},
'json').error(serverError);
}
function exportRecords(records) {
var query = {'batch_id': records, 'export_format': $('select.export-format').val()};
var exportUrl = CRM.url('civicrm/financial/batch/export', 'reset=1');
// jQuery redirect expects all query args as an object, so extract them from crm url
var urlParts = exportUrl.split('?');
$.each(urlParts[1].split('&'), function(key, val) {
var q = val.split('=');
query[q[0]] = q[1];
});
$().redirect(urlParts[0], query, 'GET');
setTimeout(function() {batchSelector.fnDraw();}, 4000);
}
function validateOp(records, op) {
switch (op) {
case 'reopen':
var notAllowed = [1, 5];
break;
case 'close':
var notAllowed = [2, 5];
break;
case 'export':
var notAllowed = [5];
break;
default:
return records;
}
var len = records.length;
var invalid = {};
var i = 0;
while (i < len) {
var status = $('tr[data-id='+records[i]+']').data('status_id');
if ($.inArray(status, notAllowed) >= 0) {
$('#check_' + records[i] + ':checked').prop('checked', false).change();
invalid[status] = invalid[status] || [];
invalid[status].push(records[i]);
records.splice(i, 1);
--len;
}
else {
i++;
}
}
for (status in invalid) {
i = invalid[status];
var msg = (i.length == 1 ? {/literal}'{ts escape="js"}This record already has the status{/ts}' : '{ts escape="js"}The following records already have the status{/ts}'{literal}) + ' ' + $('tr[data-id='+i[0]+'] .crm-batch-status').text() + ':' + listRecords(i);
CRM.alert(msg, {/literal}'{ts escape="js"}Cannot{/ts} '{literal} + $("#batch_update option[value=" + op + "]").text());
}
return records;
}
function serverError() {
CRM.alert({/literal}'{ts escape="js"}No response from the server. Check your internet connection and try reloading the page.{/ts}', '{ts escape="js"}Network Error{/ts}'{literal}, 'error');
}
$('#Go').click(function() {
var op = $("#batch_update").val();
if (op == "") {
CRM.alert({/literal}'{ts escape="js"}Please select an action from the menu.{/ts}', '{ts escape="js"}No Action Selected{/ts}'{literal});
}
else if (!$("input.select-row:checked").length) {
CRM.alert({/literal}'{ts escape="js"}Please select one or more batches for this action.{/ts}', '{ts escape="js"}No Batches Selected{/ts}'{literal});
}
else {
records = [];
$("input.select-row:checked").each(function() {
records.push($(this).attr('id').replace('check_', ''));
});
editRecords(records, op);
}
return false;
});
$('#crm-container').on('click', 'a.action-item[href="#"]', function(event) {
event.stopImmediatePropagation();
editRecords([$(this).closest('tr').attr('data-id')], $(this).attr('rel'));
return false;
});
});
</script>
{/literal}