Merge pull request #5918 from eileenmcnaughton/check_hook
[civicrm-core.git] / CRM / Contribute / Form / UpdateSubscription.php
index 7f86dcd1cf50a5c35b94c42b5185febc02edc643..75e3f1c3f7f60c63962c92a9df8c484569123860 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -61,7 +61,7 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
   public $_paymentProcessorObj = NULL;
 
   /**
-   * The id of the contact associated with this recurring contribution
+   * The id of the contact associated with this recurring contribution.
    *
    * @var int
    */
@@ -141,7 +141,7 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
   }
 
   /**
-   * Actually build the components of the form
+   * Actually build the components of the form.
    *
    * @return void
    */
@@ -149,9 +149,9 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
     // define the fields
     $this->addMoney('amount', ts('Recurring Contribution Amount'), TRUE,
       array(
-        'size' => 20
+        'size' => 20,
       ), TRUE,
-      'currency', NULL, TRUE
+      'currency', $this->_subscriptionDetails->currency, TRUE
     );
 
     $this->add('text', 'installments', ts('Number of Installments'), array('size' => 20), TRUE);
@@ -181,7 +181,7 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
   }
 
   /**
-   * called after the user submits the form
+   * called after the user submits the form.
    *
    *
    * @return void
@@ -238,7 +238,7 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
       if ($this->_subscriptionDetails->installments != $params['installments']) {
         $message .= "<br /> " . ts("Recurring contribution installments have been updated from %1 to %2 for this subscription.", array(
               1 => $this->_subscriptionDetails->installments,
-              2 => $params['installments']
+              2 => $params['installments'],
             )) . ' ';
       }
 
@@ -315,11 +315,13 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
       CRM_Core_Session::setStatus($status, $msgTitle, $msgType);
     }
     elseif (!$userID) {
-      if ($status)
+      if ($status) {
         CRM_Utils_System::setUFMessage($status);
+      }
       // keep result as 1, since we not displaying anything on the redirected page anyway
       return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus',
         "reset=1&task=update&result=1"));
     }
   }
+
 }