CRM-21587, Notice error for Grant date fields (#11497)
authorPradeep Nayak <pradpnayak@gmail.com>
Tue, 16 Jan 2018 02:09:09 +0000 (02:09 +0000)
committerEileen McNaughton <eileen@mcnaughty.com>
Tue, 16 Jan 2018 02:09:09 +0000 (15:09 +1300)
* CRM-21587, fixed code to add formattype for date field

----------------------------------------
* CRM-21587: Notice error for grant date fields
  https://issues.civicrm.org/jira/browse/CRM-21587

* CRM-21587, removed cruft code

----------------------------------------
* CRM-21587: Notice error for grant date fields
  https://issues.civicrm.org/jira/browse/CRM-21587

* CRM-21587, generated DAO file

----------------------------------------
* CRM-21587: Notice error for grant date fields
  https://issues.civicrm.org/jira/browse/CRM-21587

* CRM-21587, removed cruft code

----------------------------------------
* CRM-21587: Notice error for grant date fields
  https://issues.civicrm.org/jira/browse/CRM-21587

* Standalone code contributor from now.

CRM/Grant/BAO/Grant.php
CRM/Grant/DAO/Grant.php
xml/schema/Grant/Grant.xml

index 7a669d599e6b71fd26579a98fd8a0d73fdf4aecb..5fe5e2b1c9c62c71d5d8254b4e6d0f2b7062d649 100644 (file)
  */
 class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
 
-  /**
-   * Static field for all the grant information that we can potentially export.
-   * @var array
-   */
-  static $_exportableFields = NULL;
-
   /**
    * Class constructor.
    */
@@ -346,54 +340,19 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
    *   array of exportable Fields
    */
   public static function &exportableFields() {
-    if (!self::$_exportableFields) {
-      if (!self::$_exportableFields) {
-        self::$_exportableFields = array();
-      }
-
-      $grantFields = array(
-        'grant_status' => array(
-          'title' => ts('Grant Status'),
-          'name' => 'grant_status',
-          'data_type' => CRM_Utils_Type::T_STRING,
-        ),
-        'grant_type' => array(
-          'title' => ts('Grant Type'),
-          'name' => 'grant_type',
-          'data_type' => CRM_Utils_Type::T_STRING,
-        ),
-        'grant_money_transfer_date' => array(
-          'title' => ts('Grant Money Transfer Date'),
-          'name' => 'grant_money_transfer_date',
-          'data_type' => CRM_Utils_Type::T_DATE,
-        ),
-        'grant_amount_requested' => array(
-          'title' => ts('Grant Amount Requested'),
-          'name' => 'grant_amount_requested',
-          'data_type' => CRM_Utils_Type::T_FLOAT,
-        ),
-        'grant_application_received_date' => array(
-          'title' => ts('Grant Application Received Date'),
-          'name' => 'grant_application_received_date',
-          'data_type' => CRM_Utils_Type::T_DATE,
-        ),
-      );
-
-      $fields = CRM_Grant_DAO_Grant::export();
-      $grantNote = array(
-        'grant_note' => array(
-          'title' => ts('Grant Note'),
-          'name' => 'grant_note',
-          'data_type' => CRM_Utils_Type::T_TEXT,
-        ),
-      );
-      $fields = array_merge($fields, $grantFields, $grantNote,
-        CRM_Core_BAO_CustomField::getFieldsForImport('Grant')
-      );
-      self::$_exportableFields = $fields;
-    }
+    $fields = CRM_Grant_DAO_Grant::export();
+    $grantNote = array(
+      'grant_note' => array(
+        'title' => ts('Grant Note'),
+        'name' => 'grant_note',
+        'data_type' => CRM_Utils_Type::T_TEXT,
+      ),
+    );
+    $fields = array_merge($fields, $grantNote,
+      CRM_Core_BAO_CustomField::getFieldsForImport('Grant')
+    );
 
-    return self::$_exportableFields;
+    return $fields;
   }
 
   /**
index 979a767c3add344852bf1a2ef3e9917d5b82b1bc..329a05259b717f65bbc66b048978f4b5b7575e47 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Grant/Grant.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:600fc71093543f1c7b31ad663f2325c6)
+ * (GenCodeChecksum:13652dd0ca88b2b29b17df240790eece)
  */
 
 /**
@@ -205,14 +205,19 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_DATE,
           'title' => ts('Application received date'),
           'description' => 'Date on which grant application was received by donor.',
-          'export' => TRUE,
+          'import' => TRUE,
           'where' => 'civicrm_grant.application_received_date',
           'headerPattern' => '',
           'dataPattern' => '',
+          'export' => TRUE,
           'table_name' => 'civicrm_grant',
           'entity' => 'Grant',
           'bao' => 'CRM_Grant_BAO_Grant',
           'localizable' => 0,
+          'html' => [
+            'type' => 'Select Date',
+            'formatType' => 'activityDate',
+          ],
         ],
         'decision_date' => [
           'name' => 'decision_date',
@@ -230,6 +235,7 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
           'localizable' => 0,
           'html' => [
             'type' => 'Select Date',
+            'formatType' => 'activityDate',
           ],
         ],
         'grant_money_transfer_date' => [
@@ -248,6 +254,7 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
           'localizable' => 0,
           'html' => [
             'type' => 'Select Date',
+            'formatType' => 'activityDate',
           ],
         ],
         'grant_due_date' => [
@@ -255,12 +262,18 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_DATE,
           'title' => ts('Grant Due Date'),
           'description' => 'Date on which grant report is due.',
+          'import' => TRUE,
+          'where' => 'civicrm_grant.grant_due_date',
+          'headerPattern' => '',
+          'dataPattern' => '',
+          'export' => TRUE,
           'table_name' => 'civicrm_grant',
           'entity' => 'Grant',
           'bao' => 'CRM_Grant_BAO_Grant',
           'localizable' => 0,
           'html' => [
             'type' => 'Select Date',
+            'formatType' => 'activityDate',
           ],
         ],
         'grant_report_received' => [
index 9a9d3096b82c6c5fb88f93d60dfa17ca8fe77d2d..9d09f0c13c13199c7a962841c0c8ce6198a09fa7 100644 (file)
     <title>Application received date</title>
     <type>date</type>
     <export>true</export>
+    <import>true</import>
     <comment>Date on which grant application was received by donor.</comment>
     <add>1.8</add>
+    <html>
+      <type>Select Date</type>
+      <formatType>activityDate</formatType>
+    </html>
   </field>
   <field>
     <name>decision_date</name>
@@ -57,6 +62,7 @@
     <add>1.8</add>
     <html>
       <type>Select Date</type>
+      <formatType>activityDate</formatType>
     </html>
   </field>
   <field>
@@ -69,6 +75,7 @@
     <add>1.8</add>
     <html>
       <type>Select Date</type>
+      <formatType>activityDate</formatType>
     </html>
   </field>
   <field>
     <title>Grant Due Date</title>
     <comment>Date on which grant report is due.</comment>
     <add>1.8</add>
+    <import>true</import>
     <html>
       <type>Select Date</type>
+      <formatType>activityDate</formatType>
     </html>
   </field>
   <field>