X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FForm%2FSoftCredit.php;h=b8145f7898ea4cbb1cb80bfb88c582052f73e04b;hb=9747cc7e7676edd433c3c76e476a0fd0bd74ea7e;hp=9d4d2a628d1793156d180e220149e4fdfad861ba;hpb=7dee6a13d167a1dd2b4bf1075252bcb7e324c7e5;p=civicrm-core.git diff --git a/CRM/Contribute/Form/SoftCredit.php b/CRM/Contribute/Form/SoftCredit.php index 9d4d2a628d..b8145f7898 100644 --- a/CRM/Contribute/Form/SoftCredit.php +++ b/CRM/Contribute/Form/SoftCredit.php @@ -41,6 +41,8 @@ class CRM_Contribute_Form_SoftCredit { /** * Function to set variables up before form is built * + * @param $form + * * @return void * @access static */ @@ -74,7 +76,7 @@ class CRM_Contribute_Form_SoftCredit { * @return void */ static function buildQuickForm(&$form) { - if ($form->_mode == 'live' && $form->_honor_block_is_active) { + if ($form->_mode == 'live' && !empty($form->_honor_block_is_active)) { $ufJoinDAO = new CRM_Core_DAO_UFJoin(); $ufJoinDAO->module = 'soft_credit'; $ufJoinDAO->entity_id = $form->_id; @@ -86,13 +88,12 @@ class CRM_Contribute_Form_SoftCredit { } $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); - $extraOption = array('onclick' => "enableHonorType();"); // radio button for Honor Type foreach ($jsonData['soft_credit_types'] as $value) { - $honorTypes[$value] = $form->createElement('radio', NULL, NULL, $softCreditTypes[$value], $value, $extraOption); + $honorTypes[$value] = $form->createElement('radio', NULL, NULL, $softCreditTypes[$value], $value); } - $form->addGroup($honorTypes, 'soft_credit_type_id', NULL); + $form->addGroup($honorTypes, 'soft_credit_type_id', NULL)->setAttribute('allowClear', TRUE); } } return $form; @@ -105,7 +106,7 @@ class CRM_Contribute_Form_SoftCredit { if ($form->getAction() & CRM_Core_Action::UPDATE) { $form->_softCreditInfo = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($form->_id, TRUE); } - elseif ($form->_pledgeID) { + elseif (!empty($form->_pledgeID)) { //Check and select most recent completed contrubtion and use it to retrieve //soft-credit information to use as default for current pledge payment, CRM-13981 $pledgePayments = CRM_Pledge_BAO_PledgePayment::getPledgePayments($form->_pledgeID); @@ -190,9 +191,12 @@ class CRM_Contribute_Form_SoftCredit { /** * global form rule * - * @param array $fields the input form values + * @param array $fields the input form values + * + * @param $errors + * @param $self * - * @return true if no errors, else array of errors + * @return array of errors * @access public * @static */