* 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);