first steps toward supporting lock and note

This commit is contained in:
Jon Goldberg 2019-08-19 17:16:11 -04:00
parent 3534930f22
commit b27c080d18
No known key found for this signature in database
GPG Key ID: C2D2247364F9DB13
3 changed files with 10 additions and 7 deletions

View File

@ -60,14 +60,13 @@ class CRM_AnnualGrantBudgets_Upgrader extends CRM_AnnualGrantBudgets_Upgrader_Ba
* *
* @return TRUE on success * @return TRUE on success
* @throws Exception * @throws Exception
* */
public function upgrade_4200() { public function upgrade_1000() {
$this->ctx->log->info('Applying update 4200'); $this->ctx->log->info('Add notes and lock field to annual grant budget');
CRM_Core_DAO::executeQuery('UPDATE foo SET bar = "whiz"'); \CRM_Upgrade_Incremental_Base::addColumn($this->ctx, 'civicrm_grant_budget', 'note', "varchar(255) COMMENT 'Note'");
CRM_Core_DAO::executeQuery('DELETE FROM bang WHERE willy = wonka(2)'); \CRM_Upgrade_Incremental_Base::addColumn($this->ctx, 'civicrm_grant_budget', 'is_reserved', "tinyint(4) DEFAULT 0 COMMENT 'Is this grant budget locked?'");
return TRUE; return TRUE;
} // */ }
/** /**
* Example: Run an external SQL script. * Example: Run an external SQL script.

View File

@ -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.', `financial_type_id` int(10) UNSIGNED NOT NULL COMMENT 'FK to Financial Type.',
`fiscal_year` int(10) UNSIGNED NOT NULL COMMENT 'Fiscal Year', `fiscal_year` int(10) UNSIGNED NOT NULL COMMENT 'Fiscal Year',
`budget` decimal(20,2) DEFAULT '0.00' COMMENT 'Grant annual budget', `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`), PRIMARY KEY (`id`),
KEY `FK_civicrm_grant_budget_financial_type_id` (`financial_type_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`) UNIQUE KEY `UI_financial_type_id_fiscal_year` (`financial_type_id`,`fiscal_year`)

View File

@ -10,6 +10,8 @@
<th>{ts}Annual Budget{/ts}</th> <th>{ts}Annual Budget{/ts}</th>
<th>{ts}Amount Awarded{/ts}</th> <th>{ts}Amount Awarded{/ts}</th>
<th>{ts}Amount Remaining{/ts}</th> <th>{ts}Amount Remaining{/ts}</th>
<th>{ts}Locked?{/ts}</th>
<th>{ts}Note{/ts}</th>
</thead> </thead>
{crmAPI var='result' entity='GrantBudget' action='getbudget' fiscal_year=$fiscalYear} {crmAPI var='result' entity='GrantBudget' action='getbudget' fiscal_year=$fiscalYear}
{crmAPI var='totals' entity='GrantBudget' action='getbudget' fiscal_year=$fiscalYear return_totals=1} {crmAPI var='totals' entity='GrantBudget' action='getbudget' fiscal_year=$fiscalYear return_totals=1}