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);
return (!empty($form->_paymentFields));
}
}
/**
++<<<<<<< HEAD
++=======
+ * Billing mode button is basically synonymous with paypal express - this is probably a good example of 'odds & sods' code we
+ * need to find a way for the payment processor to assign. A tricky aspect is that the payment processor may need to set the order
+ *
+ * @param $form
+ */
+ protected static function addPaypalExpressCode(&$form) {
+ if (empty($form->isBackOffice)) {
+ if (in_array(CRM_Utils_Array::value('billing_mode', $form->_paymentProcessor), array(2, 3))) {
+ $form->_expressButtonName = $form->getButtonName('upload', 'express');
+ $form->assign('expressButtonName', $form->_expressButtonName);
+ $form->add('image',
+ $form->_expressButtonName,
+ $form->_paymentProcessor['url_button'],
+ array('class' => 'crm-form-submit')
+ );
+ }
+ }
+ }
+
+ /**
++>>>>>>> 65e3e1ce2d1e407fa768966606173c79b12ba81f
* Validate the payment instrument values before passing it to the payment processor
* We want this to be overrideable by the payment processor, and default to using
* this object's validCreditCard for credit cards (implemented as the default in the Payment class).
$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);
}
+ // Build the form for auto renew. This is displayed when in credit card mode or update mode.
+ // The reason for showing it in update mode is not that clear.
+ $autoRenew = array();
+ $recurProcessor = array();
+ if ($this->_mode || ($this->_action & CRM_Core_Action::UPDATE)) {
+ if (!empty($recurProcessor)) {
+ $autoRenew = array();
+ if (!empty($membershipType)) {
+ $sql = '
+SELECT id,
+ auto_renew,
+ duration_unit,
+ duration_interval
+ FROM civicrm_membership_type
+WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
+ $recurMembershipTypes = CRM_Core_DAO::executeQuery($sql);
+ while ($recurMembershipTypes->fetch()) {
+ $autoRenew[$recurMembershipTypes->id] = $recurMembershipTypes->auto_renew;
+ foreach (array(
+ 'id',
+ 'auto_renew',
+ 'duration_unit',
+ 'duration_interval',
+ ) as $fld) {
+ $this->_recurMembershipTypes[$recurMembershipTypes->id][$fld] = $recurMembershipTypes->$fld;
+ }
+ }
+ }
+
+ if ($this->_mode) {
+ if (!empty($this->_recurPaymentProcessors)) {
+ $this->assign('allowAutoRenew', TRUE);
+ }
+ }
+
+ $this->assign('autoRenew', json_encode($autoRenew));
+ $autoRenewElement = $this->addElement('checkbox', 'auto_renew', ts('Membership renewed automatically'),
+ NULL, array('onclick' => "showHideByValue('auto_renew','','send-receipt','table-row','radio',true); showHideNotice( );")
+ );
+ if ($this->_action & CRM_Core_Action::UPDATE) {
+ $autoRenewElement->freeze();
+ }
+ }
+
+ }
+ $this->assign('recurProcessor', json_encode($recurProcessor));
+
+ if ($this->_mode || ($this->_action & CRM_Core_Action::UPDATE)) {
+ $this->addElement('checkbox',
+ 'auto_renew',
+ ts('Membership renewed automatically'),
+ NULL,
+ array('onclick' => "buildReceiptANDNotice( );")
+ );
+
+ $this->assignPaymentRelatedVariables();
+ }
+ $this->assign('autoRenewOptions', json_encode($autoRenew));
+
if ($this->_action & CRM_Core_Action::RENEW) {
$this->addButtons(array(
array(
);
}
+ /**
+ * Check system status.
+ *
+ * @param array $messages
+ * Array<CRM_Utils_Check_Message>. A list of messages regarding system status.
+ * @return mixed
+ */
+ public static function check(&$messages) {
+ return self::singleton()
+ ->invoke(1, $messages, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_check');
+ }
+
+ /**
+ * This hook is called when a query string of the CSV Batch export is generated.
+ */
+ public static function batchQuery(&$query) {
+ return self::singleton()->invoke(1, $query, self::$_nullObject,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_batchQuery'
+ );
+ }
+
+ /**
+ * This hook is called when the entries of the CSV Batch export are mapped.
+ */
+ public static function batchItems(&$results, &$items) {
+ return self::singleton()->invoke(2, $results, $items,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_batchItems'
+ );
+ }
+
}