Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2014-12-16-01-08-03
[civicrm-core.git] / CRM / Price / Form / Set.php
index 084a02d270e5badbcb451eea12e0ae8ed4111733..e97de315ec4c783d826d9f517f6c7e4294a02216 100644 (file)
@@ -39,7 +39,7 @@
 class CRM_Price_Form_Set extends CRM_Core_Form {
 
   /**
-   * the set id saved to the session for an update
+   * The set id saved to the session for an update
    *
    * @var int
    * @access protected
@@ -47,7 +47,7 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
   protected $_sid;
 
   /**
-   * Function to set variables up before form is built
+   * Set variables up before form is built
    *
    * @param null
    *
@@ -79,7 +79,7 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
   }
 
   /**
-   * global form rule
+   * Global form rule
    *
    * @param array $fields  the input form values
    * @param array $files   the uploaded files if any
@@ -103,13 +103,13 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
     // gives the ascii value
     $asciiValue = ord($title{0});
     if ($asciiValue >= 48 && $asciiValue <= 57) {
-      $errors['title'] = ts("Set's Name should not start with digit");
+      $errors['title'] = ts("Name cannot not start with a digit");
     }
     return empty($errors) ? TRUE : $errors;
   }
 
   /**
-   * Function to actually build the form
+   * Build the form object
    *
    * @param null
    *
@@ -231,7 +231,7 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
   }
 
   /**
-   * This function sets the default values for the form. Note that in edit/view mode
+   * Set default values for the form. Note that in edit/view mode
    * the default values are retrieved from the database
    *
    * @param null
@@ -287,7 +287,9 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
       CRM_Core_Session::setStatus(ts('The Set \'%1\' has been saved.', array(1 => $set->title)), ts('Saved'), 'success');
     }
     else {
-      $url = CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1&action=add&sid=' . $set->id);
+      // Jump directly to adding a field if popups are disabled
+      $action = CRM_Core_Resources::singleton()->ajaxPopupsEnabled ? 'browse' : 'add';
+      $url = CRM_Utils_System::url('civicrm/admin/price/field', array('reset' => 1, 'action' => $action, 'sid' => $set->id, 'new' => 1));
       CRM_Core_Session::setStatus(ts("Your Set '%1' has been added. You can add fields to this set now.",
           array(1 => $set->title)
         ), ts('Saved'), 'success');