$this->assignBillingType();
$this->_fields = array();
- CRM_Core_Payment_Form::setPaymentFieldsByProcessor($this, $this->_paymentProcessor);
+ CRM_Core_Payment_Form::setPaymentFieldsByProcessor($this, $this->_paymentProcessor, FALSE, TRUE);
}
}
catch (CRM_Core_Exception $e) {
'id' => $type,
);
- CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE);
+ CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, TRUE);
$qfKey = $this->controller->_key;
$this->assign('qfKey', $qfKey);
$billingPanes = array();
if ($this->_mode) {
- if (CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE) == TRUE) {
+ if (CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, TRUE) == TRUE) {
$buildRecurBlock = TRUE;
foreach ($this->billingPane as $name => $label) {
if (!empty($this->billingFieldSets[$name]['fields'])) {
)
);
- CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor['object'], TRUE);
+ CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor['object'], TRUE, TRUE);
$this->addFormRule(array('CRM_Contribute_Form_UpdateBilling', 'formRule'), $this);
}
* Array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors.
* @param bool $forceBillingFieldsForPayLater
* Display billing fields even for pay later.
+ * @param bool $isBackOffice
+ * Is this a back office function? If so the option to suppress the cvn needs to be evaluated.
*/
- static public function setPaymentFieldsByProcessor(&$form, $processor, $forceBillingFieldsForPayLater = FALSE) {
+ static public function setPaymentFieldsByProcessor(&$form, $processor, $forceBillingFieldsForPayLater = FALSE, $isBackOffice = FALSE) {
$form->billingFieldSets = array();
if ($processor != NULL) {
// ie it is pay later
$paymentFields = self::getPaymentFields($processor);
+ if (in_array('cvv2', $paymentFields) && $isBackOffice) {
+ if (!civicrm_api3('setting', 'getvalue', array('name' => 'cvv_backoffice_required', 'group' => 'Contribute Preferences'))) {
+ unset($paymentFields[array_search('cvv2', $paymentFields)]);
+ }
+ }
$paymentTypeName = self::getPaymentTypeName($processor);
$paymentTypeLabel = self::getPaymentTypeLabel($processor);
//@todo if we switch to iterating through $form->billingFieldSets we won't need to assign these directly
*
* @return bool
*/
- public static function buildPaymentForm(&$form, $processor, $isBillingDataOptional) {
+ public static function buildPaymentForm(&$form, $processor, $isBillingDataOptional, $isBackOffice) {
//if the form has address fields assign to the template so the js can decide what billing fields to show
$profileAddressFields = $form->get('profileAddressFields');
if (!empty($profileAddressFields)) {
return NULL;
}
- self::setPaymentFieldsByProcessor($form, $processor, empty($isBillingDataOptional));
+ self::setPaymentFieldsByProcessor($form, $processor, empty($isBillingDataOptional), $isBackOffice);
self::addCommonFields($form, !$isBillingDataOptional, $form->_paymentFields);
self::addRules($form, $form->_paymentFields);
self::addPaypalExpressCode($form);
if (!empty($form->_paymentProcessorID)) {
$form->addElement('hidden', 'hidden_processor', 1);
}
- CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, empty($form->_isBillingAddressRequiredForPayLater));
+ CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, empty($form->_isBillingAddressRequiredForPayLater), FALSE);
}
}
$this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($payment_processor_id, $this->_mode);
$this->assign('paymentProcessor', $this->_paymentProcessor);
- CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE);
+ CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, FALSE);
if ($can_pay_later || self::is_administrator()) {
$this->addElement('checkbox', 'is_pay_later',
}
}
if ($form->_mode) {
- CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, FALSE);
+ CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, FALSE, TRUE);
}
elseif (!$form->_mode) {
$form->addElement('checkbox', 'record_contribution', ts('Record Payment?'), NULL,
$this->_processors, TRUE,
array('onChange' => "buildAutoRenew( null, this.value );")
);
- CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE);
+ CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, TRUE);
}
if ($this->_action & CRM_Core_Action::RENEW) {
$this->addButtons(array(