Commit c4825c57 authored by Monish Deb's avatar Monish Deb

Refactored 'Reprint grant payment' task form

parent 8ce39eb9
......@@ -37,8 +37,9 @@
class CRM_Grant_BAO_GrantPayment extends CRM_Grant_DAO_GrantPayment {
const
STOP = 1,
REPRINT = 2;
STOP = 100,
REPRINT = 200,
WITHDRAW = 300;
/**
* static field for all the grant information that we can potentially export
* @var array
......
This diff is collapsed.
......@@ -236,20 +236,24 @@ class CRM_Grant_Form_PaymentSearch extends CRM_Core_Form {
$this->add('select', 'payment_status_id', ts('Status'),
array('' => ts('- select -')) + $paymentStatus);
$this->addElement('text', 'payment_batch_number', ts('Batch Number'), array('size' => 8, 'maxlength' => 8));
$this->add('select', 'payment_batch_number',
ts('Batch'),
// CRM-19325
['' => ts('None')] + CRM_Contribute_PseudoConstant::batch(),
FALSE, array('class' => 'crm-select2')
);
$this->addElement('text', 'payment_number', ts('Payment Number'), array('size' => 10, 'maxlength' => 10));
$this->addDate('payment_created_date_low', ts('From'), FALSE, array('formatType' => 'searchDate'));
$this->addDate('payment_created_date_high', ts('To'), FALSE, array('formatType' => 'searchDate'));
CRM_Core_Form_Date::buildDateRange($this, 'payment_created_date', 1, '_low', '_high', ts('From:'), FALSE);
$this->addElement('text', 'payable_to_name', ts('Payee name'), CRM_Core_DAO::getAttribute('CRM_Grant_DAO_GrantPayment', 'payable_to_name'));
$this->add('text', 'amount', ts('Amount'), array('size' => 8, 'maxlength' => 8));
/*
* add form checkboxes for each row. This is needed out here to conform to QF protocol
* of all elements being declared in builQuickForm
*/
$this->add('text', 'amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$this->addRule('amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$this->add('text', 'amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$this->addRule('amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
$rows = $this->get('rows');
......@@ -339,7 +343,7 @@ class CRM_Grant_Form_PaymentSearch extends CRM_Core_Form {
if ($buttonName == $this->_actionButtonName || $buttonName == $this->_printButtonName) {
// check actionName and if next, then do not repeat a search, since we are going to the next page
// hack, make sure we reset the task values
$stateMachine =& $this->controller->getStateMachine();
$stateMachine = $this->controller->getStateMachine();
$formName = $stateMachine->getTaskFormName();
$this->controller->resetPage($formName);
return;
......
......@@ -146,26 +146,4 @@ class CRM_Grant_Form_PaymentTask extends CRM_Core_Form {
);
}
/**
* simple shell that derived classes can call to add buttons to
* the form with a customized title for the main Submit
*
* @param string $title title of the main button
* @param string $type button type for the form after processing
* @return void
* @access public
*/
function addDefaultButtons($title, $nextType = 'next', $backType = 'back') {
$this->addButtons(array(
array (
'type' => $nextType,
'name' => $title,
'isDefault' => TRUE),
array (
'type' => $backType,
'name' => ts('Back')),
)
);
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -148,7 +148,7 @@ class CRM_Grant_Selector_PaymentSearch extends CRM_Core_Selector_Base implements
$context = 'search'
) {
// submitted form values
$this->_queryParams =& $queryParams;
$this->_queryParams = $queryParams;
$this->_single = $single;
......@@ -197,19 +197,19 @@ class CRM_Grant_Selector_PaymentSearch extends CRM_Core_Selector_Base implements
'qs' => 'reset=1&id=%%id%%&action=view&context=%%cxt%%&selectedChild=grant' . $extraParams,
'title' => ts('View Grant'),
),
121 => array(
CRM_Grant_BAO_GrantPayment::STOP => array(
'name' => ts('Stop'),
'url' => 'civicrm/grant/payment',
'qs' => 'reset=1&action=stop&id=%%id%%&context=%%cxt%%' . $extraParams,
'title' => ts('Edit Grant'),
),
1212 => array(
CRM_Grant_BAO_GrantPayment::REPRINT => array(
'name' => ts('Reprint'),
'url' => 'civicrm/grant/payment',
'qs' => 'reset=1&action=reprint&id=%%id%%&context=%%cxt%%' . $extraParams,
'title' => ts('Edit Grant'),
),
12121 => array(
CRM_Grant_BAO_GrantPayment::WITHDRAW => array(
'name' => ts('Withdraw'),
'url' => 'civicrm/grant/payment',
'qs' => 'reset=1&action=withdraw&id=%%id%%&context=%%cxt%%' . $extraParams,
......@@ -377,7 +377,7 @@ class CRM_Grant_Selector_PaymentSearch extends CRM_Core_Selector_Base implements
'direction' => CRM_Utils_Sort::DONTCARE,
),
array(
'name' => ts('Check Number'),
'name' => ts('Payment Number'),
'sort' => 'payment_number',
'direction' => CRM_Utils_Sort::DONTCARE,
),
......
......@@ -84,7 +84,7 @@ class CRM_Grant_StateMachine_PaymentSearch extends CRM_Core_StateMachine {
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
if (CRM_Utils_Array::value( '_qf_' . $formName . '_next_print', $_POST)) {
$value = CRM_Grant_Task::PRINT_GRANTS;
$value = CRM_Grant_Task::TASK_PRINT;
}
else {
$value = CRM_Utils_Array::value('task', $_POST);
......@@ -107,4 +107,3 @@ class CRM_Grant_StateMachine_PaymentSearch extends CRM_Core_StateMachine {
return CRM_Utils_String::getClassName($this->_task);
}
}
......@@ -37,37 +37,43 @@
</div>
<table class="form-layout">
<tr>
<td class="font-size12pt" colspan="4">
{$form.payable_to_name.label}&nbsp;&nbsp;{$form.payable_to_name.html|crmReplace:class:'twenty'}&nbsp;&nbsp;&nbsp;{$form.buttons.html}<br />
<td class="font-size12pt">
{$form.payable_to_name.label}&nbsp;&nbsp;{$form.payable_to_name.html}<br />
</td>
</tr>
<tr>
<td colspan="2">
<td>
{$form.payment_status_id.label}&nbsp;&nbsp;
{$form.payment_status_id.html}
</td>
<td colspan="2">
<td>
<table>
<tr>
<td>
<label>{ts}Payment Created:{/ts}</label>
</td>
{include file="CRM/Core/DateRange.tpl" fieldName="payment_created_date" from='_low' to='_high'}
</tr>
</table>
</td>
</tr>
<tr>
<td >
{$form.payment_batch_number.label}&nbsp;&nbsp;
{$form.payment_batch_number.html}
</td>
<td colspan="2">
<td>
{$form.payment_number.label}&nbsp;&nbsp;
{$form.payment_number.html}
</td>
<td colspan="3">
{ts}Amounts{/ts}</label> <br />
{$form.amount_low.label}
{$form.amount_low.html} &nbsp;&nbsp;
{$form.amount_high.label}
{$form.amount_high.html}
</td>
</tr>
<tr>
<td colspan="2">
{$form.payment_created_date_low.label}&nbsp;&nbsp;
{include file="CRM/common/jcalendar.tpl" elementName=payment_created_date_low}
</td>
<td colspan="2">
{$form.payment_created_date_high.label}&nbsp;&nbsp;
{include file="CRM/common/jcalendar.tpl" elementName=payment_created_date_high}
</td>
<td colspan="2">
{$form.amount.label}&nbsp;&nbsp;
{$form.amount.html}
</td>
<td colspan="2">{$form.buttons.html}</td>
</tr>
</table>
{/strip}
......@@ -94,20 +100,8 @@
</div><!-- /.crm-results-block -->
{/if}
</div><!-- /.crm-content-block -->
{if $download}
<div id ="download">
<a href={$download} class="download" "style="text-decoration: none;" >Download</a>
</div>
{/if}
{literal}
<script type="text/javascript">
var download = "{/literal}{$download}{literal}";
if ( download ) {
cj("#download").hide();
window.location.href = cj(".download").attr('href');
}
cj(function() {
cj().crmAccordions();
});
{* this function is called to change the color of selected row(s) *}
var fname = "{$form.formName}";
on_load_init_checkboxes(fname);
</script>
{/literal}
......@@ -25,7 +25,6 @@
*}
{* this template is used for adding/editing/deleting financial type *}
<h2>{ts}Pay Grants{/ts}</h2>
<div class="crm-block crm-form-block crm-contribution_type-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
......
......@@ -24,39 +24,6 @@
+--------------------------------------------------------------------+
*}
{* Confirmation of Grant pay *}
{if $payments}
<h3>{ts}Reprint Payments{/ts}</h3>
<div class="crm-block crm-form-block crm-contribution_type-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
<tr class="crm-grant_payment-form-block-contribution_type_id">
<td class="label">{$form.financial_type_id.label}</td>
<td class="html-adjust">{$form.financial_type_id.html}</td>
</tr>
<tr class="crm-grant_payment-form-block-payment_batch_number">
<td class="label">{$form.payment_batch_number.label}</td>
<td class="html-adjust">{$form.payment_batch_number.html}</td>
</tr>
<tr class="crm-grant_payment-form-block-payment_number">
<td class="label">{$form.payment_number.label}</td>
<td class="html-adjust">{$form.payment_number.html}</td>
</tr>
<tr class="crm-grant_payment-form-block-payment_date">
<td class="label">{$form.payment_date.label}</td>
<td>
{if $hideCalendar neq true}
{include file="CRM/common/jcalendar.tpl" elementName=payment_date}
{else}
{$form.payment_date.html|crmDate}
{/if}
</td>
</tr>
<tr class="crm-grant_payment-form-block-csv">
<td class="label">{$form.download_file.label}</td>
<td class="html-adjust">{$form.download_file.html}</td>
</tr>
</table>
</div>
{if $recordFound}
{include file="CRM/Grant/Form/Task/GrantPayment.tpl"}
{/if}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="botttom"}</div>
\ No newline at end of file
......@@ -58,11 +58,6 @@
<tr>
<td colspan="2">
{if $printButtonName}
{$form.$printButtonName.html} &nbsp; &nbsp;
{else}
{$form._qf_PaymentSearch_next_print.html} &nbsp; &nbsp;
{/if}
{$form.task.html}
{if $actionButtonName}
{$form.$actionButtonName.html} &nbsp; &nbsp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment