X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FPledge%2FForm%2FPledge.php;h=c93c8b3b4e863c2e7cbe85c7a953fc8220c2e63d;hb=16b10e64496e4854eb267a21aa33e961bec6ecba;hp=2f89c421514789c9884afa40fe87f441a2a8acf3;hpb=64e59809d10c3ff342718a28f42983ec217dc282;p=civicrm-core.git diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index 2f89c42151..c93c8b3b4e 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -44,7 +44,6 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { * The id of the pledge that we are proceessing * * @var int - * @public */ public $_id; @@ -52,25 +51,21 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { * The id of the contact associated with this pledge * * @var int - * @public */ public $_contactID; /** * The Pledge values if an existing pledge - * @public */ public $_values; /** * The Pledge frequency Units - * @public */ public $_freqUnits; /** * Is current pledge pending. - * @public */ public $_isPending = FALSE; @@ -78,7 +73,6 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { * Set variables up before form is built * * @return void - * @access public */ public function preProcess() { $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this); @@ -103,7 +97,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { if ($this->_contactID) { list($this->userDisplayName, $this->userEmail - ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); + ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); $this->assign('displayName', $this->userDisplayName); } @@ -135,11 +129,10 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { * Set default values for the form. * the default values are retrieved from the database * - * @access public * * @return void */ - function setDefaultValues() { + public function setDefaultValues() { $defaults = $this->_values; $fields = array(); @@ -190,7 +183,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $defaults['max_reminders'] = 1; $defaults['additional_reminder_day'] = 5; $defaults['frequency_unit'] = array_search('month', $this->_freqUnits); - $defaults['financial_type_id'] = array_search( 'Donation', CRM_Contribute_PseudoConstant::financialType() ); + $defaults['financial_type_id'] = array_search('Donation', CRM_Contribute_PseudoConstant::financialType()); } $pledgeStatus = CRM_Contribute_PseudoConstant::contributionStatus(); @@ -204,9 +197,9 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { //assign status. $this->assign('status', CRM_Utils_Array::value(CRM_Utils_Array::value('status_id', $this->_values), - $pledgeStatus, - $defaultPledgeStatus - )); + $pledgeStatus, + $defaultPledgeStatus + )); if (isset($this->userEmail)) { $this->assign('email', $this->userEmail); @@ -222,7 +215,6 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { * Build the form object * * @return void - * @access public */ public function buildQuickForm() { if ($this->_action & CRM_Core_Action::DELETE) { @@ -243,7 +235,10 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { } if ($this->_context == 'standalone') { - $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE); + $this->addEntityRef('contact_id', ts('Contact'), array( + 'create' => TRUE, + 'api' => array('extra' => array('email')) + ), TRUE); } $showAdditionalInfo = FALSE; @@ -256,7 +251,8 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { ); foreach ($paneNames as $name => $type) { $urlParams = "snippet=4&formType={$type}"; - $allPanes[$name] = array('url' => CRM_Utils_System::url('civicrm/contact/view/pledge', $urlParams), + $allPanes[$name] = array( + 'url' => CRM_Utils_System::url('civicrm/contact/view/pledge', $urlParams), 'open' => 'false', 'id' => $type, ); @@ -337,7 +333,8 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $element = &$this->add('select', 'frequency_unit', ts('Frequency'), array( - '' => ts('- select -')) + $freqUnitsDisplay, + '' => ts('- select -') + ) + $freqUnitsDisplay, TRUE ); @@ -355,7 +352,11 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $element->freeze(); } - $this->add('text', 'eachPaymentAmount', ts('each'), array('size' => 10, 'style' => "background-color:#EBECE4", 'READONLY')); + $this->add('text', 'eachPaymentAmount', ts('each'), array( + 'size' => 10, + 'style' => "background-color:#EBECE4", + 'READONLY' + )); //add various dates if (!$this->_id || $this->_isPending) { @@ -385,9 +386,9 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $this->addDate('acknowledge_date', ts('Acknowledgment Date')); - $this->add('select', 'financial_type_id', - ts( 'Financial Type' ), - array(''=>ts( '- select -' )) + CRM_Contribute_PseudoConstant::financialType( ), + $this->add('select', 'financial_type_id', + ts('Financial Type'), + array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(), TRUE ); @@ -405,7 +406,8 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { } $ele = $this->add('select', 'contribution_page_id', ts('Self-service Payments Page'), array( - '' => ts('- select -')) + $pledgePages + '' => ts('- select -') + ) + $pledgePages ); $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, @@ -448,16 +450,18 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { /** * Global form rule * - * @param array $fields the input form values - * @param array $files the uploaded files if any + * @param array $fields + * The input form values. + * @param array $files + * The uploaded files if any. * @param $self * * - * @return true if no errors, else array of errors - * @access public + * @return bool|array + * true if no errors, else array of errors * @static */ - static function formRule($fields, $files, $self) { + public static function formRule($fields, $files, $self) { $errors = array(); if ($fields['amount'] <= 0) { @@ -483,7 +487,6 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { /** * Process the form submission * - * @access public * * @return void */ @@ -616,7 +619,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { if (!isset($this->userEmail)) { list($this->userDisplayName, $this->userEmail - ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); + ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); } $statusMsg .= ' ' . ts("An acknowledgment email has been sent to %1.
", array(1 => $this->userEmail)); @@ -633,7 +636,10 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { "billing_mode IN ( 1, 3 )" ); if (count($processors) > 0) { - $statusMsg .= ' ' . ts("If a payment is due now, you can record a check, EFT, or cash payment for this pledge OR submit a credit card payment.", array(1 => $contribURL, 2 => $creditURL)); + $statusMsg .= ' ' . ts("If a payment is due now, you can record a check, EFT, or cash payment for this pledge OR submit a credit card payment.", array( + 1 => $contribURL, + 2 => $creditURL + )); } else { $statusMsg .= ' ' . ts("If a payment is due now, you can record a check, EFT, or cash payment for this pledge.", array(1 => $contribURL)); @@ -646,20 +652,19 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { if ($this->_context == 'standalone') { if ($buttonName == $this->getButtonName('upload', 'new')) { $session->replaceUserContext(CRM_Utils_System::url('civicrm/pledge/add', - 'reset=1&action=add&context=standalone' - )); + 'reset=1&action=add&context=standalone' + )); } else { $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', - "reset=1&cid={$this->_contactID}&selectedChild=pledge" - )); + "reset=1&cid={$this->_contactID}&selectedChild=pledge" + )); } } elseif ($buttonName == $this->getButtonName('upload', 'new')) { $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/pledge', - "reset=1&action=add&context=pledge&cid={$this->_contactID}" - )); + "reset=1&action=add&context=pledge&cid={$this->_contactID}" + )); } } } -