Merge pull request #10527 from eileenmcnaughton/act
[civicrm-core.git] / CRM / Core / SelectValues.php
index 344219ef5aba0beb9c0b28f5e5179868253bd737..ece069395cb36d36fde903825157bbab0de8c88a 100644 (file)
@@ -343,13 +343,14 @@ class CRM_Core_SelectValues {
       if (empty($date['format'])) {
         if ($context == 'Input') {
           $date['format'] = Civi::settings()->get('dateInputFormat');
-          $date['php_datetime_format'] = self::datePluginToPHPFormats(Civi::settings()->get('dateInputFormat'));
         }
         else {
           $date['format'] = 'M d';
         }
       }
     }
+
+    $date['smarty_view_format'] = CRM_Utils_Date::getDateFieldViewFormat($date['format']);
     if (!isset($date['time'])) {
       $date['time'] = FALSE;
     }
@@ -558,7 +559,7 @@ class CRM_Core_SelectValues {
    * @return array
    */
   public static function contributionTokens() {
-    return array(
+    return array_merge(array(
       '{contribution.contribution_id}' => ts('Contribution ID'),
       '{contribution.total_amount}' => ts('Total Amount'),
       '{contribution.fee_amount}' => ts('Fee Amount'),
@@ -582,7 +583,7 @@ class CRM_Core_SelectValues {
       //'{contribution.address_id}' => ts('Address ID'),
       '{contribution.check_number}' => ts('Check Number'),
       '{contribution.campaign}' => ts('Contribution Campaign'),
-    );
+    ), CRM_Utils_Token::getCustomFieldTokens('contribution', TRUE));
   }
 
   /**
@@ -762,32 +763,6 @@ class CRM_Core_SelectValues {
     return $dateInputFormats;
   }
 
-  /**
-   * Map date plugin and actual format that is used by PHP.
-   *
-   * @return array
-   */
-  public static function datePluginToPHPFormats() {
-    $dateInputFormats = array(
-      "mm/dd/yy" => 'm/d/Y',
-      "dd/mm/yy" => 'd/m/Y',
-      "yy-mm-dd" => 'Y-m-d',
-      "dd-mm-yy" => 'd-m-Y',
-      "dd.mm.yy" => 'd.m.Y',
-      "M d, yy" => 'M j, Y',
-      "d M yy" => 'j M Y',
-      "MM d, yy" => 'F j, Y',
-      "d MM yy" => 'j F Y',
-      "DD, d MM yy" => 'l, j F Y',
-      "mm/dd" => 'm/d',
-      "dd-mm" => 'd-m',
-      "yy-mm" => 'Y-m',
-      "M yy" => 'M Y',
-      "yy" => 'Y',
-    );
-    return $dateInputFormats;
-  }
-
   /**
    * Time formats.
    *