if ($contribution->id) {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
if ((empty($input['prevContribution']) && $paymentProcessorId) || (!$input['prevContribution']->is_pay_later &&
-- $input['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatuses))) {
+ $input['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatuses))) {
$input['payment_processor'] = $paymentProcessorId;
}
$input['contribution_status_id'] = array_search('Completed', $contributionStatuses);