From: Coleman Watts Date: Fri, 19 Jun 2015 19:25:55 +0000 (-0400) Subject: Merge branch '4.6' into master X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ce1e9d7538566c91aecd24ed15def59c133c0a07;p=civicrm-core.git Merge branch '4.6' into master Conflicts: CRM/Contribute/Form/Contribution.php CRM/Core/BAO/Mapping.php CRM/Core/BAO/PdfFormat.php CRM/Core/Payment/Form.php CRM/Member/BAO/Membership.php CRM/Utils/Hook.php sql/civicrm_generated.mysql xml/version.xml --- ce1e9d7538566c91aecd24ed15def59c133c0a07 diff --cc CRM/Core/Payment/Form.php index 3397f93ae4,87e9856ef8..9f6162a005 --- a/CRM/Core/Payment/Form.php +++ b/CRM/Core/Payment/Form.php @@@ -264,9 -276,10 +266,9 @@@ class CRM_Core_Payment_Form 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)); } @@@ -291,6 -304,26 +293,29 @@@ } /** ++<<<<<<< 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). diff --cc CRM/Member/Form.php index 1e873943e0,28295d2f7a..46b0ac44a9 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@@ -122,67 -129,8 +122,67 @@@ class CRM_Member_Form extends CRM_Contr $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( diff --cc CRM/Utils/Hook.php index 044457a470,60c1c088f0..c669a972b8 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@@ -1927,16 -1927,24 +1927,36 @@@ abstract class CRM_Utils_Hook ); } + /** + * Check system status. + * + * @param array $messages + * Array. 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' + ); + } + }