Skip to content

Commit

Permalink
CRM-21587, Notice error for Grant date fields (civicrm#11497)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
pradpnayak authored and Richard van Oosterhout committed Jan 22, 2018
1 parent e449253 commit e7440c1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 55 deletions.
65 changes: 12 additions & 53 deletions CRM/Grant/BAO/Grant.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@
*/
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.
*/
Expand Down Expand Up @@ -346,54 +340,19 @@ public static function del($id) {
* 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;
}

/**
Expand Down
17 changes: 15 additions & 2 deletions CRM/Grant/DAO/Grant.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Grant/Grant.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:600fc71093543f1c7b31ad663f2325c6)
* (GenCodeChecksum:13652dd0ca88b2b29b17df240790eece)
*/

/**
Expand Down Expand Up @@ -205,14 +205,19 @@ public static function &fields() {
'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',
Expand All @@ -230,6 +235,7 @@ public static function &fields() {
'localizable' => 0,
'html' => [
'type' => 'Select Date',
'formatType' => 'activityDate',
],
],
'grant_money_transfer_date' => [
Expand All @@ -248,19 +254,26 @@ public static function &fields() {
'localizable' => 0,
'html' => [
'type' => 'Select Date',
'formatType' => 'activityDate',
],
],
'grant_due_date' => [
'name' => 'grant_due_date',
'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' => [
Expand Down
9 changes: 9 additions & 0 deletions xml/schema/Grant/Grant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@
<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>
Expand All @@ -57,6 +62,7 @@
<add>1.8</add>
<html>
<type>Select Date</type>
<formatType>activityDate</formatType>
</html>
</field>
<field>
Expand All @@ -69,6 +75,7 @@
<add>1.8</add>
<html>
<type>Select Date</type>
<formatType>activityDate</formatType>
</html>
</field>
<field>
Expand All @@ -77,8 +84,10 @@
<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>
Expand Down

0 comments on commit e7440c1

Please sign in to comment.