From b27c080d188073db8b3e01d1c9da3c1e88f5875e Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Mon, 19 Aug 2019 17:16:11 -0400 Subject: [PATCH] first steps toward supporting lock and note --- CRM/AnnualGrantBudgets/Upgrader.php | 13 ++++++------- sql/auto_install.sql | 2 ++ templates/CRM/Grant/Page/AnnualBudgets.tpl | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CRM/AnnualGrantBudgets/Upgrader.php b/CRM/AnnualGrantBudgets/Upgrader.php index 01611f4..7c32aed 100644 --- a/CRM/AnnualGrantBudgets/Upgrader.php +++ b/CRM/AnnualGrantBudgets/Upgrader.php @@ -60,14 +60,13 @@ class CRM_AnnualGrantBudgets_Upgrader extends CRM_AnnualGrantBudgets_Upgrader_Ba * * @return TRUE on success * @throws Exception - * - public function upgrade_4200() { - $this->ctx->log->info('Applying update 4200'); - CRM_Core_DAO::executeQuery('UPDATE foo SET bar = "whiz"'); - CRM_Core_DAO::executeQuery('DELETE FROM bang WHERE willy = wonka(2)'); + */ + public function upgrade_1000() { + $this->ctx->log->info('Add notes and lock field to annual grant budget'); + \CRM_Upgrade_Incremental_Base::addColumn($this->ctx, 'civicrm_grant_budget', 'note', "varchar(255) COMMENT 'Note'"); + \CRM_Upgrade_Incremental_Base::addColumn($this->ctx, 'civicrm_grant_budget', 'is_reserved', "tinyint(4) DEFAULT 0 COMMENT 'Is this grant budget locked?'"); return TRUE; - } // */ - + } /** * Example: Run an external SQL script. diff --git a/sql/auto_install.sql b/sql/auto_install.sql index 5932176..16b4f48 100644 --- a/sql/auto_install.sql +++ b/sql/auto_install.sql @@ -3,6 +3,8 @@ CREATE TABLE IF NOT EXISTS `civicrm_grant_budget` ( `financial_type_id` int(10) UNSIGNED NOT NULL COMMENT 'FK to Financial Type.', `fiscal_year` int(10) UNSIGNED NOT NULL COMMENT 'Fiscal Year', `budget` decimal(20,2) DEFAULT '0.00' COMMENT 'Grant annual budget', + `note` varchar(255) DEFAULT NULL COMMENT 'Note', + `is_reserved`, tinyint(4) DEFAULT 0 COMMENT 'Is this grant budget locked?', PRIMARY KEY (`id`), KEY `FK_civicrm_grant_budget_financial_type_id` (`financial_type_id`), UNIQUE KEY `UI_financial_type_id_fiscal_year` (`financial_type_id`,`fiscal_year`) diff --git a/templates/CRM/Grant/Page/AnnualBudgets.tpl b/templates/CRM/Grant/Page/AnnualBudgets.tpl index 95efe42..14b62e5 100644 --- a/templates/CRM/Grant/Page/AnnualBudgets.tpl +++ b/templates/CRM/Grant/Page/AnnualBudgets.tpl @@ -10,6 +10,8 @@ {ts}Annual Budget{/ts} {ts}Amount Awarded{/ts} {ts}Amount Remaining{/ts} + {ts}Locked?{/ts} + {ts}Note{/ts} {crmAPI var='result' entity='GrantBudget' action='getbudget' fiscal_year=$fiscalYear} {crmAPI var='totals' entity='GrantBudget' action='getbudget' fiscal_year=$fiscalYear return_totals=1}