diff --git a/CRM/Batch/BAO/Batch.php b/CRM/Batch/BAO/Batch.php index 3bb93f140b70..1f420a0c5778 100644 --- a/CRM/Batch/BAO/Batch.php +++ b/CRM/Batch/BAO/Batch.php @@ -450,8 +450,8 @@ public function links($context = NULL) { 'export' => [ 'name' => ts('Export'), 'title' => ts('Export Batch'), - 'url' => '#', - 'extra' => 'rel="export"', + 'url' => 'civicrm/financial/batch/export', + 'qs' => 'reset=1&id=%%id%%&status=1', ], 'reopen' => [ 'name' => ts('Re-open'), diff --git a/CRM/Financial/Form/Search.php b/CRM/Financial/Form/Search.php index 069c6e0a9abd..db9af59260b4 100644 --- a/CRM/Financial/Form/Search.php +++ b/CRM/Financial/Form/Search.php @@ -41,8 +41,6 @@ public function setDefaultValues() { } public function buildQuickForm() { - CRM_Core_Resources::singleton() - ->addScriptFile('civicrm', 'packages/jquery/plugins/jquery.redirect.min.js', 0, 'html-header'); $attributes = CRM_Core_DAO::getAttribute('CRM_Batch_DAO_Batch'); $attributes['total']['class'] = $attributes['item_count']['class'] = 'number'; $this->add('text', 'title', ts('Batch Name'), $attributes['title']); diff --git a/CRM/Financial/Page/AJAX.php b/CRM/Financial/Page/AJAX.php index bc2e2f7b5324..484d7a41d1cf 100644 --- a/CRM/Financial/Page/AJAX.php +++ b/CRM/Financial/Page/AJAX.php @@ -198,10 +198,6 @@ public static function assignRemove() { $params['id'] = $recordID; break; - case 'export': - CRM_Utils_System::redirect("civicrm/financial/batch/export?reset=1&id=$recordID"); - break; - case 'delete': $params = $recordID; break; diff --git a/templates/CRM/Financial/Form/Search.tpl b/templates/CRM/Financial/Form/Search.tpl index 3cc7b90473e2..3c10417481ff 100644 --- a/templates/CRM/Financial/Form/Search.tpl +++ b/templates/CRM/Financial/Form/Search.tpl @@ -214,9 +214,6 @@ CRM.$(function($) { } 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}}, @@ -234,19 +231,6 @@ CRM.$(function($) { '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': @@ -302,6 +286,11 @@ CRM.$(function($) { $("input.select-row:checked").each(function() { records.push($(this).attr('id').replace('check_', '')); }); + if (op == 'export') { + // No need for the modal pop-up, just proceed to the next screen. + window.location = CRM.url("civicrm/financial/batch/export", {reset: 1, id: records[0], status: 1}); + return false; + } editRecords(records, op); } return false;