Handle throough api
This commit is contained in:
parent
66082cc24e
commit
e809f5779e
@ -239,7 +239,10 @@ function checknumberpaymentmethod_civicrm_buildForm($formName, &$form) {
|
|||||||
*/
|
*/
|
||||||
function checknumberpaymentmethod_civicrm_pre($op, $objectName, $id, &$params) {
|
function checknumberpaymentmethod_civicrm_pre($op, $objectName, $id, &$params) {
|
||||||
if ($objectName == 'Contribution' && in_array($op, ['create', 'edit'])) {
|
if ($objectName == 'Contribution' && in_array($op, ['create', 'edit'])) {
|
||||||
if (!CRM_Utils_System::isNull($params['check_number']) || !empty($_POST['check_number'])) {
|
if (!CRM_Utils_System::isNull($params['check_number'])
|
||||||
|
|| !empty($_POST['check_number'])
|
||||||
|
|| !empty($params['payment_instrument_check_number'])
|
||||||
|
) {
|
||||||
$paymentInstrumentId = !empty($params['payment_instrument_id']) ? $params['payment_instrument_id'] : $params['prevContribution']->payment_instrument_id;
|
$paymentInstrumentId = !empty($params['payment_instrument_id']) ? $params['payment_instrument_id'] : $params['prevContribution']->payment_instrument_id;
|
||||||
$paymentInstrumentsFromSettings = civicrm_api3('Setting', 'getvalue', [
|
$paymentInstrumentsFromSettings = civicrm_api3('Setting', 'getvalue', [
|
||||||
'name' => 'check_payment_instrument_ids',
|
'name' => 'check_payment_instrument_ids',
|
||||||
@ -250,6 +253,9 @@ function checknumberpaymentmethod_civicrm_pre($op, $objectName, $id, &$params) {
|
|||||||
if (!CRM_Utils_System::isNull($params['check_number'])) {
|
if (!CRM_Utils_System::isNull($params['check_number'])) {
|
||||||
$params['check_number'] = $params['check_number'];
|
$params['check_number'] = $params['check_number'];
|
||||||
}
|
}
|
||||||
|
elseif (!empty($params['payment_instrument_check_number'])) {
|
||||||
|
$params['check_number'] = $params['payment_instrument_check_number'];
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$params['check_number'] = $_POST['check_number'];
|
$params['check_number'] = $_POST['check_number'];
|
||||||
}
|
}
|
||||||
@ -277,3 +283,14 @@ function _checknumberpaymentmethod_alterpayments(&$payments) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_civicrm_pre().
|
||||||
|
*
|
||||||
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_pre
|
||||||
|
*/
|
||||||
|
function checknumberpaymentmethod_civicrm_apiWrappers(&$wrappers, $apiRequest) {
|
||||||
|
if ($apiRequest['entity'] == 'Contribution' && $apiRequest['action'] == 'create') {
|
||||||
|
$wrappers[] = new CRM_Contribute_CheckAPIWrapper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user