convert to using a civix-generated entity

This commit is contained in:
Jon Goldberg 2019-08-19 17:48:04 -04:00
parent b27c080d18
commit 092cb2a184
No known key found for this signature in database
GPG Key ID: C2D2247364F9DB13
9 changed files with 309 additions and 80 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget { class CRM_AnnualGrantBudgets_BAO_GrantBudget extends CRM_AnnualGrantBudgets_DAO_GrantBudget {
/** /**
* Build Fiscal year option list. * Build Fiscal year option list.
@ -28,9 +28,7 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
} }
$grantBudget = []; $grantBudget = [];
$paidStatusID = CRM_Core_PseudoConstant::getKey( $paidStatusID = CRM_Core_PseudoConstant::getKey(
'CRM_Grant_DAO_Grant', 'CRM_Grant_DAO_Grant', 'status_id', 'Paid'
'status_id',
'Paid'
); );
$accountRelationshipId = civicrm_api3('OptionValue', 'getvalue', [ $accountRelationshipId = civicrm_api3('OptionValue', 'getvalue', [
'return' => "value", 'return' => "value",
@ -56,7 +54,7 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
$qParams[6] = [$params['financial_type_id'], 'Integer']; $qParams[6] = [$params['financial_type_id'], 'Integer'];
} }
$grantBudgetTableName = CRM_Grant_DAO_GrantBudget::getTableName(); $grantBudgetTableName = CRM_AnnualGrantBudgets_DAO_GrantBudget::getTableName();
$sql = "SELECT cgb.id, cft.name, IFNULL(cgb.budget, 0) AS budget, $sql = "SELECT cgb.id, cft.name, IFNULL(cgb.budget, 0) AS budget,
SUM(CASE WHEN cg.id IS NULL THEN 0 ELSE IFNULL(trxn.total_amount, 0) END) as total_amount_granted, SUM(CASE WHEN cg.id IS NULL THEN 0 ELSE IFNULL(trxn.total_amount, 0) END) as total_amount_granted,
cft.id AS financial_type_id cft.id AS financial_type_id

View File

@ -1,67 +1,69 @@
<?php <?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/** /**
* @package CRM * @package CRM
* @copyright CiviCRM LLC (c) 2004-2017 * @copyright CiviCRM LLC (c) 2004-2019
* *
* Generated from /home/jon/local/agbud8/htdocs/web/sites/all/civicrm/extensions/org.agbu.annualgrantbudgets/xml/schema/CRM/AnnualGrantBudgets/GrantBudget.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen * DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:e21dfb56b654dd78e0ead9af1ba5bf77) * (GenCodeChecksum:7aad27e2f51ebfb640dd921e054f55c9)
*/ */
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
/** /**
* CRM_Grant_BAO_GrantBudget constructor. * Database access object for the GrantBudget entity.
*/ */
class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { class CRM_AnnualGrantBudgets_DAO_GrantBudget extends CRM_Core_DAO {
/** /**
* Static instance to hold the table name. * Static instance to hold the table name.
* *
* @var string * @var string
*/ */
static $_tableName = 'civicrm_grant_budget'; public static $_tableName = 'civicrm_grant_budget';
/** /**
* Should CiviCRM log any modifications to this table in the civicrm_log table. * Should CiviCRM log any modifications to this table in the civicrm_log table.
* *
* @var boolean * @var bool
*/ */
static $_log = TRUE; public static $_log = TRUE;
/** /**
* Unique GrantBudget ID
* *
* @var int unsigned * @var int
*/ */
public $id; public $id;
/**
* FK to Financial Type
*
* @var int
*/
public $financial_type_id; public $financial_type_id;
/**
* Fiscal year
*
* @var int
*/
public $fiscal_year; public $fiscal_year;
/**
* Grant Annual Budget
*
* @var float
*/
public $budget; public $budget;
/**
* Class constructor.
*/
public function __construct() { public function __construct() {
$this->__table = 'civicrm_grant_budget'; $this->__table = 'civicrm_grant_budget';
parent::__construct(); parent::__construct();
} }
/** /**
* Returns foreign keys and entity references. * Returns foreign keys and entity references.
* *
@ -70,12 +72,13 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
*/ */
public static function getReferenceColumns() { public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) { if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financialtypeid', 'civicrm_financial_type', 'id'); Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
} }
return Civi::$statics[__CLASS__]['links']; return Civi::$statics[__CLASS__]['links'];
} }
/** /**
* Returns all the column names of this table * Returns all the column names of this table
* *
@ -87,25 +90,27 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
'id' => [ 'id' => [
'name' => 'id', 'name' => 'id',
'type' => CRM_Utils_Type::T_INT, 'type' => CRM_Utils_Type::T_INT,
'description' => CRM_AnnualGrantBudgets_ExtensionUtil::ts('Unique GrantBudget ID'),
'required' => TRUE, 'required' => TRUE,
'where' => 'civicrm_grant_budget.id',
'table_name' => 'civicrm_grant_budget', 'table_name' => 'civicrm_grant_budget',
'entity' => 'GrantBudget', 'entity' => 'GrantBudget',
'bao' => 'CRM_Grant_BAO_GrantBudget', 'bao' => 'CRM_AnnualGrantBudgets_DAO_GrantBudget',
'localizable' => 0, 'localizable' => 1,
], ],
'financial_type_id' => [ 'financial_type_id' => [
'name' => 'financial_type_id', 'name' => 'financial_type_id',
'type' => CRM_Utils_Type::T_INT, 'type' => CRM_Utils_Type::T_INT,
'title' => ts('Financial Type Id'), 'title' => CRM_AnnualGrantBudgets_ExtensionUtil::ts('Financial Type Id'),
'description' => 'FK to Financial Type', 'description' => CRM_AnnualGrantBudgets_ExtensionUtil::ts('FK to Financial Type'),
'required' => TRUE, 'required' => TRUE,
'import' => TRUE, 'import' => TRUE,
'where' => 'civicrm_grant_budget.financial_type_id',
'export' => FALSE, 'export' => FALSE,
'table_name' => 'civicrm_grant_budget', 'table_name' => 'civicrm_grant_budget',
'entity' => 'GrantBudget', 'entity' => 'GrantBudget',
'bao' => 'CRM_Grant_BAO_GrantBudget', 'bao' => 'CRM_AnnualGrantBudgets_DAO_GrantBudget',
'localizable' => 0, 'localizable' => 1,
'FKClassName' => 'CRM_Financial_DAO_FinancialType',
'html' => [ 'html' => [
'type' => 'Select', 'type' => 'Select',
], ],
@ -113,43 +118,46 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
'table' => 'civicrm_financial_type', 'table' => 'civicrm_financial_type',
'keyColumn' => 'id', 'keyColumn' => 'id',
'labelColumn' => 'name', 'labelColumn' => 'name',
] ],
], ],
'fiscal_year' => [ 'fiscal_year' => [
'name' => 'fiscal_year', 'name' => 'fiscal_year',
'type' => CRM_Utils_Type::T_INT, 'type' => CRM_Utils_Type::T_INT,
'title' => ts('Fiscal year'), 'title' => CRM_AnnualGrantBudgets_ExtensionUtil::ts('Fiscal Year'),
'description' => 'Fiscal year', 'description' => CRM_AnnualGrantBudgets_ExtensionUtil::ts('Fiscal year'),
'required' => TRUE, 'required' => TRUE,
'import' => TRUE, 'import' => TRUE,
'where' => 'civicrm_grant_budget.fiscal_year',
'export' => FALSE, 'export' => FALSE,
'table_name' => 'civicrm_grant_budget', 'table_name' => 'civicrm_grant_budget',
'entity' => 'GrantBudget', 'entity' => 'GrantBudget',
'bao' => 'CRM_Grant_BAO_GrantBudget', 'bao' => 'CRM_AnnualGrantBudgets_DAO_GrantBudget',
'localizable' => 0, 'localizable' => 1,
'html' => [ 'html' => [
'type' => 'Select', 'type' => 'Select',
], ],
'pseudoconstant' => [ 'pseudoconstant' => [
'callback' => 'CRM_Grant_BAO_GrantBudget::getFiscalyear', 'callback' => 'CRM_Grant_BAO_GrantBudget::getFiscalyear',
] ],
], ],
'budget' => [ 'budget' => [
'name' => 'budget', 'name' => 'budget',
'type' => CRM_Utils_Type::T_MONEY, 'type' => CRM_Utils_Type::T_MONEY,
'title' => ts('Grant Annual Budget'), 'title' => CRM_AnnualGrantBudgets_ExtensionUtil::ts('Grant Annual Budget'),
'description' => 'Grant Annual Budget.', 'description' => CRM_AnnualGrantBudgets_ExtensionUtil::ts('Grant Annual Budget'),
'required' => TRUE, 'required' => TRUE,
'precision' => [ 'precision' => [
20, 20,
2 2,
], ],
'import' => TRUE, 'import' => TRUE,
'where' => 'civicrm_grant_budget.budget',
'export' => TRUE, 'export' => TRUE,
'default' => '0.00',
'table_name' => 'civicrm_grant_budget', 'table_name' => 'civicrm_grant_budget',
'entity' => 'GrantBudget', 'entity' => 'GrantBudget',
'bao' => 'CRM_Grant_BAO_GrantBudget', 'bao' => 'CRM_AnnualGrantBudgets_DAO_GrantBudget',
'localizable' => 0, 'localizable' => 1,
'html' => [ 'html' => [
'type' => 'Text', 'type' => 'Text',
], ],
@ -159,6 +167,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
} }
return Civi::$statics[__CLASS__]['fields']; return Civi::$statics[__CLASS__]['fields'];
} }
/** /**
* Return a mapping from field-name to the corresponding key (as used in fields()). * Return a mapping from field-name to the corresponding key (as used in fields()).
* *
@ -171,14 +180,16 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
} }
return Civi::$statics[__CLASS__]['fieldKeys']; return Civi::$statics[__CLASS__]['fieldKeys'];
} }
/** /**
* Returns the names of this table * Returns the names of this table
* *
* @return string * @return string
*/ */
public static function getTableName() { public static function getTableName() {
return self::$_tableName; return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
} }
/** /**
* Returns if this table needs to be logged * Returns if this table needs to be logged
* *
@ -187,6 +198,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
public function getLog() { public function getLog() {
return self::$_log; return self::$_log;
} }
/** /**
* Returns the list of fields that can be imported * Returns the list of fields that can be imported
* *
@ -198,6 +210,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
$r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant_budget', $prefix, []); $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant_budget', $prefix, []);
return $r; return $r;
} }
/** /**
* Returns the list of fields that can be exported * Returns the list of fields that can be exported
* *
@ -209,8 +222,13 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
$r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant_budget', $prefix, []); $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant_budget', $prefix, []);
return $r; return $r;
} }
/** /**
* Returns the list of indices * Returns the list of indices
*
* @param bool $localize
*
* @return array
*/ */
public static function indices($localize = TRUE) { public static function indices($localize = TRUE) {
$indices = []; $indices = [];

View File

@ -9,7 +9,7 @@ class CRM_Grant_Page_AnnualBudgets extends CRM_Core_Page_Basic {
* Classname of BAO. * Classname of BAO.
*/ */
public function getBAOName() { public function getBAOName() {
return 'CRM_Grant_BAO_GrantBudget'; return 'CRM_AnnualGrantBudgets_BAO_GrantBudget';
} }
/** /**
@ -40,7 +40,7 @@ class CRM_Grant_Page_AnnualBudgets extends CRM_Core_Page_Basic {
$fiscalYear = date('Y'); $fiscalYear = date('Y');
} }
$fiscalYearOptions = ''; $fiscalYearOptions = '';
foreach (CRM_Grant_BAO_GrantBudget::getFiscalyear() as $key => $value) { foreach (CRM_AnnualGrantBudgets_BAO_GrantBudget::getFiscalyear() as $key => $value) {
$extra = ''; $extra = '';
if ($key == $fiscalYear) { if ($key == $fiscalYear) {
$extra = 'selected="selected"'; $extra = 'selected="selected"';

View File

@ -263,16 +263,17 @@ function _annualgrantbudgets_civix_find_files($dir, $pattern) {
*/ */
function _annualgrantbudgets_civix_civicrm_managed(&$entities) { function _annualgrantbudgets_civix_civicrm_managed(&$entities) {
$mgdFiles = _annualgrantbudgets_civix_find_files(__DIR__, '*.mgd.php'); $mgdFiles = _annualgrantbudgets_civix_find_files(__DIR__, '*.mgd.php');
sort($mgdFiles);
foreach ($mgdFiles as $file) { foreach ($mgdFiles as $file) {
$es = include $file; $es = include $file;
foreach ($es as $e) { foreach ($es as $e) {
if (empty($e['module'])) { if (empty($e['module'])) {
$e['module'] = E::LONG_NAME; $e['module'] = E::LONG_NAME;
} }
$entities[] = $e;
if (empty($e['params']['version'])) { if (empty($e['params']['version'])) {
$e['params']['version'] = '3'; $e['params']['version'] = '3';
} }
$entities[] = $e;
} }
} }
} }
@ -453,6 +454,14 @@ function _annualgrantbudgets_civix_civicrm_alterSettingsFolders(&$metaDataFolder
* *
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_entityTypes * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_entityTypes
*/ */
function _annualgrantbudgets_civix_civicrm_entityTypes(&$entityTypes) { function _annualgrantbudgets_civix_civicrm_entityTypes(&$entityTypes) {
$entityTypes = array_merge($entityTypes, []); $entityTypes = array_merge($entityTypes, array (
'CRM_AnnualGrantBudgets_DAO_GrantBudget' =>
array (
'name' => 'GrantBudget',
'class' => 'CRM_AnnualGrantBudgets_DAO_GrantBudget',
'table' => 'civicrm_grant_budget',
),
));
} }

View File

@ -55,7 +55,7 @@ function civicrm_api3_grant_budget_delete($params) {
* Array of deleted values. * Array of deleted values.
*/ */
function civicrm_api3_grant_budget_getbudget($params) { function civicrm_api3_grant_budget_getbudget($params) {
$result = CRM_Grant_BAO_GrantBudget::getGrantBudget($params); $result = CRM_AnnualGrantBudgets_BAO_GrantBudget::getGrantBudget($params);
return civicrm_api3_create_success($result, $params, 'GrantBudget', 'get'); return civicrm_api3_create_success($result, $params, 'GrantBudget', 'get');
} }

View File

@ -1,17 +1,95 @@
CREATE TABLE IF NOT EXISTS `civicrm_grant_budget` ( -- +--------------------------------------------------------------------+
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Primary ID', -- | CiviCRM version 5 |
`financial_type_id` int(10) UNSIGNED NOT NULL COMMENT 'FK to Financial Type.', -- +--------------------------------------------------------------------+
`fiscal_year` int(10) UNSIGNED NOT NULL COMMENT 'Fiscal Year', -- | Copyright CiviCRM LLC (c) 2004-2019 |
`budget` decimal(20,2) DEFAULT '0.00' COMMENT 'Grant annual budget', -- +--------------------------------------------------------------------+
`note` varchar(255) DEFAULT NULL COMMENT 'Note', -- | This file is a part of CiviCRM. |
`is_reserved`, tinyint(4) DEFAULT 0 COMMENT 'Is this grant budget locked?', -- | |
PRIMARY KEY (`id`), -- | CiviCRM is free software; you can copy, modify, and distribute it |
KEY `FK_civicrm_grant_budget_financial_type_id` (`financial_type_id`), -- | under the terms of the GNU Affero General Public License |
UNIQUE KEY `UI_financial_type_id_fiscal_year` (`financial_type_id`,`fiscal_year`) -- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- | |
-- | CiviCRM is distributed in the hope that it will be useful, but |
-- | WITHOUT ANY WARRANTY; without even the implied warranty of |
-- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
-- | See the GNU Affero General Public License for more details. |
-- | |
-- | You should have received a copy of the GNU Affero General Public |
-- | License and the CiviCRM Licensing Exception along |
-- | with this program; if not, contact CiviCRM LLC |
-- | at info[AT]civicrm[DOT]org. If you have questions about the |
-- | GNU Affero General Public License or the licensing of CiviCRM, |
-- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
-- +--------------------------------------------------------------------+
--
-- Generated from schema.tpl
-- DO NOT EDIT. Generated by CRM_Core_CodeGen
--
-- +--------------------------------------------------------------------+
-- | CiviCRM version 5 |
-- +--------------------------------------------------------------------+
-- | Copyright CiviCRM LLC (c) 2004-2019 |
-- +--------------------------------------------------------------------+
-- | This file is a part of CiviCRM. |
-- | |
-- | CiviCRM is free software; you can copy, modify, and distribute it |
-- | under the terms of the GNU Affero General Public License |
-- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
-- | |
-- | CiviCRM is distributed in the hope that it will be useful, but |
-- | WITHOUT ANY WARRANTY; without even the implied warranty of |
-- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
-- | See the GNU Affero General Public License for more details. |
-- | |
-- | You should have received a copy of the GNU Affero General Public |
-- | License and the CiviCRM Licensing Exception along |
-- | with this program; if not, contact CiviCRM LLC |
-- | at info[AT]civicrm[DOT]org. If you have questions about the |
-- | GNU Affero General Public License or the licensing of CiviCRM, |
-- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
-- +--------------------------------------------------------------------+
-- --
-- Constraints for table `civicrm_grant_budget` -- Generated from drop.tpl
-- DO NOT EDIT. Generated by CRM_Core_CodeGen
-- --
ALTER TABLE `civicrm_grant_budget` -- /*******************************************************
ADD CONSTRAINT `FK_civicrm_grant_budget_financial_type_id` FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type` (`id`) ON DELETE CASCADE; -- *
-- * Clean up the exisiting tables
-- *
-- *******************************************************/
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `civicrm_grant_budget`;
SET FOREIGN_KEY_CHECKS=1;
-- /*******************************************************
-- *
-- * Create new tables
-- *
-- *******************************************************/
-- /*******************************************************
-- *
-- * civicrm_grant_budget
-- *
-- * FIXME
-- *
-- *******************************************************/
CREATE TABLE `civicrm_grant_budget` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ScholarshipBudget ID',
`financial_type_id` int unsigned NOT NULL COMMENT 'FK to Financial Type',
`fiscal_year` int unsigned NOT NULL COMMENT 'Fiscal year',
`budget` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT 'Scholarship Annual Budget'
,
PRIMARY KEY (`id`)
, CONSTRAINT FK_civicrm_grant_budget_financial_type_id FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type`(`id`)
) ;

38
sql/auto_uninstall.sql Normal file
View File

@ -0,0 +1,38 @@
-- +--------------------------------------------------------------------+
-- | CiviCRM version 5 |
-- +--------------------------------------------------------------------+
-- | Copyright CiviCRM LLC (c) 2004-2019 |
-- +--------------------------------------------------------------------+
-- | This file is a part of CiviCRM. |
-- | |
-- | CiviCRM is free software; you can copy, modify, and distribute it |
-- | under the terms of the GNU Affero General Public License |
-- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
-- | |
-- | CiviCRM is distributed in the hope that it will be useful, but |
-- | WITHOUT ANY WARRANTY; without even the implied warranty of |
-- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
-- | See the GNU Affero General Public License for more details. |
-- | |
-- | You should have received a copy of the GNU Affero General Public |
-- | License and the CiviCRM Licensing Exception along |
-- | with this program; if not, contact CiviCRM LLC |
-- | at info[AT]civicrm[DOT]org. If you have questions about the |
-- | GNU Affero General Public License or the licensing of CiviCRM, |
-- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
-- +--------------------------------------------------------------------+
--
-- Generated from drop.tpl
-- DO NOT EDIT. Generated by CRM_Core_CodeGen
--
-- /*******************************************************
-- *
-- * Clean up the exisiting tables
-- *
-- *******************************************************/
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `civicrm_grant_budget`;
SET FOREIGN_KEY_CHECKS=1;

View File

@ -0,0 +1,11 @@
<?php
// This file declares a new entity type. For more details, see "hook_civicrm_entityTypes" at:
// http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference
return array (
0 =>
array (
'name' => 'GrantBudget',
'class' => 'CRM_AnnualGrantBudgets_DAO_GrantBudget',
'table' => 'civicrm_grant_budget',
),
);

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<table>
<base>CRM/AnnualGrantBudgets</base>
<class>GrantBudget</class>
<name>civicrm_grant_budget</name>
<comment>FIXME</comment>
<log>true</log>
<field>
<name>id</name>
<type>int unsigned</type>
<required>true</required>
<comment>Unique GrantBudget ID</comment>
<localizable>true</localizable>
</field>
<primaryKey>
<name>id</name>
<autoincrement>true</autoincrement>
</primaryKey>
<field>
<name>financial_type_id</name>
<title>Financial Type Id</title>
<type>int unsigned</type>
<comment>FK to Financial Type</comment>
<required>true</required>
<import>true</import>
<export>false</export>
<localizable>false</localizable>
<pseudoconstant>
<table>civicrm_financial_type</table>
<keyColumn>id</keyColumn>
<labelColumn>name</labelColumn>
</pseudoconstant>
<html>
<type>Select</type>
</html>
</field>
<foreignKey>
<name>financial_type_id</name>
<table>civicrm_financial_type</table>
<key>id</key>
</foreignKey>
<field>
<name>fiscal_year</name>
<title>Fiscal Year</title>
<type>int unsigned</type>
<comment>Fiscal year</comment>
<required>true</required>
<import>true</import>
<export>false</export>
<localizable>false</localizable>
<pseudoconstant>
<callback>CRM_Grant_BAO_GrantBudget::getFiscalyear</callback>
</pseudoconstant>
<html>
<type>Select</type>
</html>
</field>
<field>
<name>budget</name>
<title>Grant Annual Budget</title>
<type>decimal</type>
<comment>Grant Annual Budget</comment>
<required>true</required>
<import>true</import>
<export>true</export>
<localizable>false</localizable>
<default>0.00</default>
<html>
<type>Text</type>
</html>
</field>
</table>