Skip to content
Snippets Groups Projects
Commit 4730957c authored by Pradeep Nayak's avatar Pradeep Nayak
Browse files

--worked on RG-108

parent f386e84b
No related branches found
No related tags found
No related merge requests found
Showing
with 883 additions and 135 deletions
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.1 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2011 |
+--------------------------------------------------------------------+
| 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
* @copyright CiviCRM LLC (c) 2004-2011
* $Id$
*
*/
require_once 'CRM/Core/Component/Config.php';
class CRM_Grant_Config extends CRM_Core_Component_Config {
}
<?xml version="1.0" encoding="iso-8859-1" ?>
<menu>
<item>
<path>civicrm/grant</path>
<title>CiviGrant Dashboard</title>
<page_callback>CRM_Grant_Page_DashBoard</page_callback>
<access_arguments>access CiviGrant</access_arguments>
<page_type>1</page_type>
<weight>1000</weight>
<component>CiviGrant</component>
</item>
<item>
<path>civicrm/grant/info</path>
<access_arguments>access CiviGrant</access_arguments>
<weight>0</weight>
</item>
<item>
<path>civicrm/grant/search</path>
<title>Find Grants</title>
<page_callback>CRM_Grant_Controller_Search</page_callback>
<access_arguments>access CiviGrant</access_arguments>
<page_type>1</page_type>
<weight>1010</weight>
</item>
<item>
<path>civicrm/grant/add</path>
<title>New Grant</title>
<page_callback>CRM_Grant_Page_Tab</page_callback>
<path_arguments>action=add</path_arguments>
<access_arguments>access CiviGrant</access_arguments>
<page_type>1</page_type>
<component>CiviGrant</component>
</item>
<item>
<path>civicrm/contact/view/grant</path>
<page_callback>CRM_Grant_Page_Tab</page_callback>
<access_arguments>access CiviGrant</access_arguments>
</item>
<item>
<path>civicrm/grant_program</path>
<title>Grant Programs</title>
<desc>List of grant programs which can be assigned to Grants</desc>
<page_callback>CRM_Grant_Page_GrantProgram</page_callback>
<access_arguments>edit grant program</access_arguments>
<page_type>1</page_type>
<weight>1011</weight>
</item>
<item>
<path>civicrm/grant/payment</path>
<title>Grant Payment</title>
<desc>Grant Payment.</desc>
<page_callback>CRM_Grant_Page_Payment</page_callback>
<access_arguments>access CiviCRM</access_arguments>
</item>
<item>
<path>civicrm/grant/payment/search</path>
<title>Find Grant Payments</title>
<page_callback>CRM_Grant_Controller_PaymentSearch</page_callback>
<access_arguments>access CiviGrant</access_arguments>
<page_type>1</page_type>
<component>CiviGrant</component>
</item>
<item>
<path>civicrm/grant/payment/reprint</path>
<title>Grant Payment Reprint</title>
<desc>Grant Payment Reprint.</desc>
<path_arguments>action=add</path_arguments>
<page_callback>CRM_Grant_Form_Task_GrantPayment</page_callback>
<access_arguments>access CiviGrant</access_arguments>
</item>
<item>
<path>civicrm/grant_program/allocate</path>
<page_callback>CRM_Grant_Form_GrantProgramView::allocate</page_callback>
<access_arguments>access CiviCRM</access_arguments>
</item>
<item>
<path>civicrm/grant_program/finalize</path>
<page_callback>CRM_Grant_Form_GrantProgramView::finalize</page_callback>
<access_arguments>access CiviCRM</access_arguments>
</item>
<item>
<path>civicrm/grant_program/reject</path>
<page_callback>CRM_Grant_Form_GrantProgramView::reject</page_callback>
<access_arguments>access CiviCRM</access_arguments>
</item>
<item>
<path>civicrm/grant_program/processFinalization</path>
<page_callback>CRM_Grant_Form_GrantProgramView::processFinalization</page_callback>
<access_arguments>access CiviCRM</access_arguments>
</item>
</menu>
<?php
/**
* Collection of upgrade steps
*/
class CRM_Grantprograms_Upgrader extends CRM_Grantprograms_Upgrader_Base {
// By convention, functions that look like "function upgrade_NNNN()" are
// upgrade tasks. They are executed in order (like Drupal's hook_update_N).
/**
* Example: Run an external SQL script when the module is installed
*
public function install() {
$this->executeSqlFile('sql/myinstall.sql');
}
/**
* Example: Run an external SQL script when the module is uninstalled
*
public function uninstall() {
$this->executeSqlFile('sql/myuninstall.sql');
}
/**
* Example: Run a simple query when a module is enabled
*
public function enable() {
CRM_Core_DAO::executeQuery('UPDATE foo SET is_active = 1 WHERE bar = "whiz"');
}
/**
* Example: Run a simple query when a module is disabled
*
public function disable() {
CRM_Core_DAO::executeQuery('UPDATE foo SET is_active = 0 WHERE bar = "whiz"');
}
/**
* Example: Run a couple simple queries
*
* @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)');
return TRUE;
} // */
/**
* Example: Run an external SQL script
*
* @return TRUE on success
* @throws Exception
public function upgrade_4201() {
$this->ctx->log->info('Applying update 4201');
// this path is relative to the extension base dir
$this->executeSqlFile('sql/upgrade_4201.sql');
return TRUE;
} // */
/**
* Example: Run a slow upgrade process by breaking it up into smaller chunk
*
* @return TRUE on success
* @throws Exception
public function upgrade_4202() {
$this->ctx->log->info('Planning update 4202'); // PEAR Log interface
$this->addTask(ts('Process first step'), 'processPart1', $arg1, $arg2);
$this->addTask(ts('Process second step'), 'processPart2', $arg3, $arg4);
$this->addTask(ts('Process second step'), 'processPart3', $arg5);
return TRUE;
}
public function processPart1($arg1, $arg2) { sleep(10); return TRUE; }
public function processPart2($arg3, $arg4) { sleep(10); return TRUE; }
public function processPart3($arg5) { sleep(10); return TRUE; }
// */
/**
* Example: Run an upgrade with a query that touches many (potentially
* millions) of records by breaking it up into smaller chunks.
*
* @return TRUE on success
* @throws Exception
public function upgrade_4203() {
$this->ctx->log->info('Planning update 4203'); // PEAR Log interface
$minId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(min(id),0) FROM civicrm_contribution');
$maxId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(max(id),0) FROM civicrm_contribution');
for ($startId = $minId; $startId <= $maxId; $startId += self::BATCH_SIZE) {
$endId = $startId + self::BATCH_SIZE - 1;
$title = ts('Upgrade Batch (%1 => %2)', array(
1 => $startId,
2 => $endId,
));
$sql = '
UPDATE civicrm_contribution SET foobar = whiz(wonky()+wanker)
WHERE id BETWEEN %1 and %2
';
$params = array(
1 => array($startId, 'Integer'),
2 => array($endId, 'Integer'),
);
$this->addTask($title, 'executeSql', $sql, $params);
}
return TRUE;
} // */
}
<?php
// AUTO-GENERATED FILE -- Civix may overwrite any changes made to this file
/**
* Base class which provides helpers to execute upgrade logic
*/
class CRM_Grantprograms_Upgrader_Base {
/**
* @var varies, subclass of htis
*/
static $instance;
/**
* @var CRM_Queue_TaskContext
*/
protected $ctx;
/**
* @var string, eg 'com.example.myextension'
*/
protected $extensionName;
/**
* @var string, full path to the extension's source tree
*/
protected $extensionDir;
/**
* @var array(revisionNumber) sorted numerically
*/
private $revisions;
/**
* Obtain a refernece to the active upgrade handler
*/
static public function instance() {
if (! self::$instance) {
// FIXME auto-generate
self::$instance = new CRM_Grantprograms_Upgrader(
'biz.jmaconsulting.grantprograms',
__DIR__ .'/../../../'
);
}
return self::$instance;
}
/**
* Adapter that lets you add normal (non-static) member functions to the queue.
*
* Note: Each upgrader instance should only be associated with one
* task-context; otherwise, this will be non-reentrant.
*
* @code
* CRM_Grantprograms_Upgrader_Base::_queueAdapter($ctx, 'methodName', 'arg1', 'arg2');
* @endcode
*/
static public function _queueAdapter() {
$instance = self::instance();
$args = func_get_args();
$instance->ctx = array_shift($args);
$instance->queue = $instance->ctx->queue;
$method = array_shift($args);
return call_user_func_array(array($instance, $method), $args);
}
public function __construct($extensionName, $extensionDir) {
$this->extensionName = $extensionName;
$this->extensionDir = $extensionDir;
}
// ******** Task helpers ********
/**
* Run a SQL file
*/
public function executeSqlFile($relativePath) {
CRM_Utils_File::sourceSQLFile(
CIVICRM_DSN,
$this->extensionDir . '/' . $relativePath
);
return TRUE;
}
/**
* Run one SQL query
*
* This is just a wrapper for CRM_Core_DAO::executeSql, but it
* provides syntatic sugar for queueing several tasks that
* run different queries
*/
public function executeSql($query, $params = array()) {
// FIXME verify that we raise an exception on error
CRM_Core_DAO::executeSql($query, $params);
return TRUE;
}
/**
* Syntatic sugar for enqueuing a task which calls a function
* in this class. The task is weighted so that it is processed
* as part of the currently-pending revision.
*
* After passing the $funcName, you can also pass parameters that will go to
* the function. Note that all params must be serializable.
*/
public function addTask($title) {
$args = func_get_args();
$title = array_shift($args);
$task = new CRM_Queue_Task(
array(get_class($this), '_queueAdapter'),
$args,
$title
);
return $this->queue->createItem($task, array('weight' => -1));
}
// ******** Revision-tracking helpers ********
/**
* Determine if there are any pending revisions
*
* @return bool
*/
public function hasPendingRevisions() {
$revisions = $this->getRevisions();
$currentRevision = $this->getCurrentRevision();
if (empty($revisions)) {
return FALSE;
}
if (empty($currentRevision)) {
return TRUE;
}
return ($currentRevision < max($revisions));
}
/**
* Add any pending revisions to the queue
*/
public function enqueuePendingRevisions(CRM_Queue_Queue $queue) {
$this->queue = $queue;
$currentRevision = $this->getCurrentRevision();
foreach ($this->getRevisions() as $revision) {
if ($revision > $currentRevision) {
$title = ts('Upgrade %1 to revision %2', array(
1 => $this->extensionName,
2 => $revision,
));
// note: don't use addTask() because it sets weight=-1
$task = new CRM_Queue_Task(
array(get_class($this), '_queueAdapter'),
array('upgrade_' . $revision),
$title
);
$this->queue->createItem($task);
$task = new CRM_Queue_Task(
array(get_class($this), '_queueAdapter'),
array('setCurrentRevision', $revision),
$title
);
$this->queue->createItem($task);
}
}
}
/**
* Get a list of revisions
*
* @return array(revisionNumbers) sorted numerically
*/
public function getRevisions() {
if (! is_array($this->revisions)) {
$this->revisions = array();
$clazz = new ReflectionClass(get_class($this));
$methods = $clazz->getMethods();
foreach ($methods as $method) {
if (preg_match('/^upgrade_(.*)/', $method->name, $matches)) {
$this->revisions[] = $matches[1];
}
}
sort($this->revisions, SORT_NUMERIC);
}
return $this->revisions;
}
public function getCurrentRevision() {
// return CRM_Core_BAO_Extension::getSchemaVersion($this->extensionName);
$key = $this->extensionName . ':version';
return CRM_Core_BAO_Setting::getItem('Extension', $key);
}
public function setCurrentRevision($revision) {
// We call this during hook_civicrm_install, but the underlying SQL
// UPDATE fails because the extension record hasn't been INSERTed yet.
// Instead, track revisions in our own namespace.
// CRM_Core_BAO_Extension::setSchemaVersion($this->extensionName, $revision);
$key = $this->extensionName . ':version';
CRM_Core_BAO_Setting::setItem($revision, 'Extension', $key);
return TRUE;
}
// ******** Hook delegates ********
public function onInstall() {
foreach (glob($this->extensionDir . '/sql/*_install.sql') as $file) {
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $file);
}
if (is_callable(array($this, 'install'))) {
$this->install();
}
$revisions = $this->getRevisions();
if (!empty($revisions)) {
$this->setCurrentRevision(max($revisions));
}
}
public function onUninstall() {
if (is_callable(array($this, 'uninstall'))) {
$this->uninstall();
}
foreach (glob($this->extensionDir . '/sql/*_uninstall.sql') as $file) {
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $file);
}
$this->setCurrentRevision(NULL);
}
public function onEnable() {
// stub for possible future use
if (is_callable(array($this, 'enable'))) {
$this->enable();
}
}
public function onDisable() {
// stub for possible future use
if (is_callable(array($this, 'disable'))) {
$this->disable();
}
}
public function onUpgrade($op, CRM_Queue_Queue $queue = NULL) {
switch($op) {
case 'check':
return array($this->hasPendingRevisions());
case 'enqueue':
return $this->enqueuePendingRevisions($queue);
default:
}
}
}
-- +--------------------------------------------------------------------+
-- | CiviCRM version 4.2 |
-- +--------------------------------------------------------------------+
-- | Copyright CiviCRM LLC (c) 2004-2012 |
-- +--------------------------------------------------------------------+
-- | 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 |
-- +--------------------------------------------------------------------+
{* not sure how to define the below in Smarty, so doing it in PHP instead *}
{php}
$ogNames = array(
'grant' => ts('Message Template Workflow for Grant', array('escape' => 'sql')),
);
$ovNames = array(
'grant' => array(
'grant_approved' => ts('Grant approved', array('escape' => 'sql')),
'grant_awaiting_info' => ts('Grant awaiting info', array('escape' => 'sql')),
'grant_paid' => ts('Grant paid', array('escape' => 'sql')),
'grant_rejected' => ts('Grant rejected', array('escape' => 'sql')),
'grant_submitted' => ts('Grant submitted', array('escape' => 'sql')),
),
);
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('ogNames', $ogNames);
$smarty->assign('ovNames', $ovNames);
{/php}
INSERT INTO civicrm_option_group
(name, {localize field='title'}title{/localize}, {localize field='description'}description{/localize}, is_reserved, is_active) VALUES
{foreach from=$ogNames key=name item=description name=for_groups}
('msg_tpl_workflow_{$name}', {localize}'{$description}'{/localize}, {localize}'{$description}'{/localize}, 1, 1) {if $smarty.foreach.for_groups.last};{else},{/if}
{/foreach}
{foreach from=$ogNames key=name item=description}
SELECT @tpl_ogid_{$name} := MAX(id) FROM civicrm_option_group WHERE name = 'msg_tpl_workflow_{$name}';
{/foreach}
INSERT INTO civicrm_option_value
(option_group_id, name, {localize field='label'}label{/localize}, value, weight) VALUES
{foreach from=$ovNames key=gName item=ovs name=for_groups}
{foreach from=$ovs key=vName item=label name=for_values}
(@tpl_ogid_{$gName}, '{$vName}', {localize}'{$label}'{/localize}, {$smarty.foreach.for_values.iteration}, {$smarty.foreach.for_values.iteration}) {if $smarty.foreach.for_groups.last and $smarty.foreach.for_values.last};{else},{/if}
{/foreach}
{/foreach}
{foreach from=$ovNames key=gName item=ovs}
{foreach from=$ovs key=vName item=label}
SELECT @tpl_ovid_{$vName} := MAX(id) FROM civicrm_option_value WHERE option_group_id = @tpl_ogid_{$gName} AND name = '{$vName}';
{/foreach}
{/foreach}
INSERT INTO civicrm_msg_template
(msg_title, msg_subject, msg_text, msg_html, workflow_id, is_default, is_reserved) VALUES
{foreach from=$ovNames key=gName item=ovs name=for_groups}
{foreach from=$ovs key=vName item=title name=for_values}
{fetch assign=subject file="`$config->extensionsDir`biz.jmaconsulting.grantprograms/sql/message_templates/`$vName`_subject.tpl"}
{fetch assign=text file="`$config->extensionsDir`biz.jmaconsulting.grantprograms/sql/message_templates/`$vName`_text.tpl"}
{fetch assign=html file="`$config->extensionsDir`biz.jmaconsulting.grantprograms/sql/message_templates/`$vName`_html.tpl"}
('{$title}', '{$subject|escape:"quotes"}', '{$text|escape:"quotes"}', '{$html|escape:"quotes"}', @tpl_ovid_{$vName}, 1, 0),
('{$title}', '{$subject|escape:"quotes"}', '{$text|escape:"quotes"}', '{$html|escape:"quotes"}', @tpl_ovid_{$vName}, 0, 1) {if $smarty.foreach.for_groups.last and $smarty.foreach.for_values.last};{else},{/if}
{/foreach}
{/foreach}
/**
* Enhanced Event Registration extension improves how parents register kids
* in CiviEvent
*
* Copyright (C) 2012 JMA Consulting
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Support: https://github.com/JMAConsulting/biz.jmaconsulting.eer/issues
*
* Contact: info@jmaconsulting.biz
* JMA Consulting
* 215 Spadina Ave, Ste 400
* Toronto, ON
* Canada M5T 2C7
*/
-- create civicrm_payment table.
CREATE TABLE IF NOT EXISTS `civicrm_payment` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Id',
`payment_batch_number` int(10) unsigned NOT NULL COMMENT 'Payment Batch Nnumber',
`payment_number` int(10) unsigned NOT NULL COMMENT 'Payment Number',
`contribution_type_id` int(10) unsigned NOT NULL COMMENT 'Contribution Type ID',
`contact_id` int(10) unsigned NOT NULL COMMENT 'Contact ID',
`payment_created_date` date DEFAULT NULL COMMENT 'Payment Created Date.',
`payment_date` date DEFAULT NULL COMMENT 'Payment Date.',
`payable_to_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Payable To Name.',
`payable_to_address` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Payable To Address.',
`amount` decimal(20,2) NOT NULL COMMENT 'Requested grant amount, in default currency.',
`currency` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '3 character string, value from config setting or input via user.',
`payment_reason` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Payment Reason.',
`payment_status_id` int(10) unsigned DEFAULT NULL COMMENT 'Payment Status ID',
`replaces_payment_id` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Replaces Payment Id.',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-- create civicrm_entity_payment
CREATE TABLE IF NOT EXISTS `civicrm_entity_payment` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`payment_id` int(10) unsigned NOT NULL COMMENT 'Type of grant. Implicit FK to civicrm_payment.',
`entity_table` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Entity Table.',
`entity_id` int(10) unsigned NOT NULL COMMENT 'Entity ID',
PRIMARY KEY (`id`),
KEY `FK_civicrm_entity_payment_payment_id` (`payment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `civicrm_entity_payment`
ALTER TABLE `civicrm_entity_payment`
ADD CONSTRAINT `FK_civicrm_entity_payment_payment_id` FOREIGN KEY (`payment_id`) REFERENCES `civicrm_payment` (`id`);
-- create civicrm_grant_program
CREATE TABLE IF NOT EXISTS `civicrm_grant_program` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Grant Program ID',
`label` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Label displayed to users',
`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Stores a fixed (non-translated) name for the grant program.',
`grant_type_id` int(10) unsigned NOT NULL COMMENT 'Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.',
`total_amount` decimal(20,2) NOT NULL COMMENT 'Requested grant program amount, in default currency.',
`remainder_amount` decimal(20,2) NOT NULL COMMENT 'Requested grant program remainder amount, in default currency.',
`contribution_type_id` int(10) unsigned NOT NULL COMMENT 'Contribution Type ID',
`status_id` int(10) unsigned NOT NULL COMMENT 'Id of Grant status.',
`applications_start_date` datetime DEFAULT NULL COMMENT 'Application Start Date',
`applications_end_date` datetime DEFAULT NULL COMMENT 'Application End Date.',
`allocation_date` date DEFAULT NULL COMMENT 'Allocation date.',
`is_active` tinyint(4) DEFAULT '1' COMMENT 'Is this grant program active?',
`is_auto_email` tinyint(4) DEFAULT '1' COMMENT 'Is auto email active?',
`allocation_algorithm` int(10) unsigned DEFAULT NULL COMMENT 'Allocation Algorithm.',
`payment_id` int(10) unsigned NOT NULL COMMENT 'Type of grant. Implicit FK to civicrm_payment.',
PRIMARY KEY (`id`),
KEY `FK_civicrm_grant_program_grant_type_id` (`grant_type_id`),
KEY `FK_civicrm_grant_program_status_id` (`status_id`),
KEY `FK_civicrm_grant_program_payment_id` (`payment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `civicrm_grant_program`
ALTER TABLE `civicrm_grant_program`
ADD CONSTRAINT `FK_civicrm_grant_program_grant_type_id` FOREIGN KEY (`grant_type_id`) REFERENCES `civicrm_option_value` (`id`),
ADD CONSTRAINT `FK_civicrm_grant_program_payment_id` FOREIGN KEY (`payment_id`) REFERENCES `civicrm_payment` (`id`),
ADD CONSTRAINT `FK_civicrm_grant_program_status_id` FOREIGN KEY (`status_id`) REFERENCES `civicrm_option_value` (`id`);
-- add columns to civicrm_grant
ALTER TABLE `civicrm_grant`
ADD `grant_program_id` INT( 10 ) UNSIGNED NOT NULL COMMENT 'Grant Program ID of grant program record given grant belongs to.' AFTER `contact_id`,
ADD `grant_rejected_reason_id` INT( 10 ) UNSIGNED NOT NULL COMMENT 'Id of Grant Rejected Reason.' AFTER `status_id` ,
ADD `assessment` VARCHAR( 655 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER `grant_rejected_reason_id`;
--
-- Constraints for table `civicrm_grant`
ALTER TABLE `civicrm_grant`
ADD CONSTRAINT `FK_civicrm_grant_grant_program_id` FOREIGN KEY (`grant_program_id`) REFERENCES `civicrm_grant_program` (`id`) ON DELETE CASCADE;
-- add option groups and option values
-- Grant Payment Status
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'grant_payment_status';
INSERT IGNORE INTO `civicrm_option_group` (`id`, `name`, `title`, `description`, `is_reserved`, `is_active`) VALUES
(@opGId, 'grant_payment_status', 'Grant Payment Status', NULL, 1, 1);
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'grant_payment_status';
-- option values
SELECT @opv1 := id FROM civicrm_option_value WHERE name = 'Printed' AND option_group_id = @opGId;
SELECT @opv2 := id FROM civicrm_option_value WHERE name = 'Reprinted' AND option_group_id = @opGId;
SELECT @opv3 := id FROM civicrm_option_value WHERE name = 'Stopped' AND option_group_id = @opGId;
SELECT @opv4 := id FROM civicrm_option_value WHERE name = 'Withdrawn' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv1, @opGId, 'Printed', '1', 'Printed', NULL, 0, 0, 1, 'Payment that has had cheque or other payment created via PDF or csv download. The default status.', 0, 1, 1, NULL, 1, NULL),
(@opv3, @opGId, 'Stopped', '2', 'Stopped', NULL, 0, 0, 1, 'The bank has been told to put a Stop Payment on the cheque or payment. Usually caused by a lost cheque that is being replaced by a newly printed one.', 0, 1, 1, NULL, 1, NULL),
(@opv2, @opGId, 'Reprinted', '3', 'Reprinted', NULL, 0, 1, 1, 'This payment is no longer valid, and a new one has been printed to replace it. For example, a cheque jammed in the printer has been reprinted on cheque with a different number.', 0, 1, 1, NULL, 1, NULL),
(@opv4, @opGId, 'Withdrawn', '4', 'Withdrawn', NULL, 0, 0, 2, 'Payment has been returned. For example, a grant winner gets a different better grant that makes them no longer eligible for this grant.', 0, 1, 1, NULL, NULL, NULL);
-- Grant Program Status
SET @opGId := '';
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'grant_program_status';
INSERT IGNORE INTO `civicrm_option_group` (`id`, `name`, `title`, `description`, `is_reserved`, `is_active`) VALUES
(@opGId, 'grant_program_status', 'Grant Program Status', NULL, 1, 1);
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'grant_program_status';
SET @opv1 := '';
SET @opv2 := '';
SET @opv3 := '';
-- option values
SELECT @opv1 := id FROM civicrm_option_value WHERE name = 'Accepting Applications' AND option_group_id = @opGId;
SELECT @opv2 := id FROM civicrm_option_value WHERE name = 'Trial Allocation' AND option_group_id = @opGId;
SELECT @opv3 := id FROM civicrm_option_value WHERE name = 'Allocation Finalized' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv1, @opGId, 'Accepting Applications', '1', NULL, NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL),
(@opv2, @opGId, 'Trial Allocation', '2', NULL, NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL),
(@opv3, @opGId, 'Allocation Finalized', '3', NULL, NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL);
-- Grant Program Allocation Algorithm
SET @opGId := '';
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'allocation_algorithm';
INSERT IGNORE INTO `civicrm_option_group` (`id`, `name`, `title`, `description`, `is_reserved`, `is_active`) VALUES
(@opGId, 'allocation_algorithm', 'Grant Program Allocation Algorithm', NULL, 1, 1);
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'allocation_algorithm';
-- option values
SET @opv1 := '';
SET @opv2 := '';
SELECT @opv1 := id FROM civicrm_option_value WHERE name = 'Best To Worst, Fully Funded' AND option_group_id = @opGId;
SELECT @opv2 := id FROM civicrm_option_value WHERE name = 'Over Threshold, Percentage Of Request Funded' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv2, @opGId, 'Over Threshold, Percentage Of Request Funded', '1', 'Over Threshold, Percentage Of Request Funded', 'immediate', 0, 1, 1, NULL, 0, 0, 1, NULL, 1, NULL),
(@opv1, @opGId, 'Best To Worst, Fully Funded', '2', 'Best To Worst, Fully Funded', 'batch', 0, 0, 1, NULL, 0, 0, 1, NULL, 1, NULL);
-- Grant Thresholds
SET @opGId := '';
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'grant_thresholds';
INSERT IGNORE INTO `civicrm_option_group` (`id`, `name`, `title`, `description`, `is_reserved`, `is_active`) VALUES
(@opGId, 'grant_thresholds', 'Grant Thresholds', NULL, 1, 1);
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'grant_thresholds';
-- option values
SET @opv1 := '';
SET @opv2 := '';
SET @opv3 := '';
SET @opv4 := '';
SELECT @opv1 := id FROM civicrm_option_value WHERE name = 'Funding factor' AND option_group_id = @opGId;
SELECT @opv2 := id FROM civicrm_option_value WHERE name = 'Fixed Percentage Of Grant' AND option_group_id = @opGId;
SELECT @opv3 := id FROM civicrm_option_value WHERE name = 'Maximum Grant' AND option_group_id = @opGId;
SELECT @opv4 := id FROM civicrm_option_value WHERE name = 'Minimum Score For Grant Award' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv1, @opGId, 'Funding factor', '85', NULL, NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL),
(@opv2, @opGId, 'Fixed Percentage Of Grant', '80', 'Fixed Percentage Of Grant', NULL, 0, 0, 3, NULL, 0, 1, 1, NULL, NULL, NULL),
(@opv3, @opGId, 'Maximum Grant', '1500', 'Maximum Grant', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL),
(@opv4, @opGId, 'Minimum Score For Grant Award', '73', 'Minimum Score For Grant Award', NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL);
-- grant_status
SET @opv1 := '';
SET @opv2 := '';
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'grant_status';
-- option values
SELECT @opv1 := id FROM civicrm_option_value WHERE name = 'Granted' AND option_group_id = @opGId;
SELECT @opv2 := id FROM civicrm_option_value WHERE name = 'Ineligible' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv2, @opGId, 'Ineligible', '7', 'Ineligible', NULL, 0, 0, 6, NULL, 0, 1, 1, NULL, NULL, NULL),
(@opv1, @opGId, 'Granted', '7', 'Granted', NULL, 0, 0, 4, NULL, 0, 1, 1, NULL, NULL, NULL);
-- insert navigation links
SELECT @parentId1 := id FROM civicrm_navigation WHERE name = 'CiviGrant';
SELECT @parentId2 := id FROM civicrm_navigation WHERE name = 'Grants';
SELECT @weight := MAX(weight) FROM civicrm_navigation WHERE parent_id = @parentId2;
INSERT INTO `civicrm_navigation` (`domain_id`, `label`, `name`, `url`, `permission`, `permission_operator`, `parent_id`, `is_active`, `has_separator`, `weight`) VALUES
(1, 'Find Grant Payments', 'Find Grant Payments', 'civicrm/grant/payment/search&reset=1', 'access CiviGrant', 'AND', @parentId2, 1, 1, @weight = @weight + 1),
(1, 'New Grant Program', 'New Grant Program', 'civicrm/grant_program?action=add&reset=1', 'access CiviCRM,access CiviGrant,edit grants', 'AND', @parentId2, 1, 0, @weight = @weight + 1),
(1, 'Grant Programs', 'Grant Programs', 'civicrm/grant_program&reset=1', 'access CiviGrant,administer CiviCRM', 'AND', @parentId1, 1, NULL, 2);
\ No newline at end of file
/**
* Enhanced Event Registration extension improves how parents register kids
* in CiviEvent
*
* Copyright (C) 2012 JMA Consulting
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Support: https://github.com/JMAConsulting/biz.jmaconsulting.eer/issues
*
* Contact: info@jmaconsulting.biz
* JMA Consulting
* 215 Spadina Ave, Ste 400
* Toronto, ON
* Canada M5T 2C7
*/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body>
{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
<p>Dear {contact.display_name},</p>
<p>This is being sent to you as a receipt of {$grant_status} grant.</p>
Grant Program Name: {$grant_programs} <br>
Grant Type : {$grant_type}<br>
Total Amount : {$params.amount_total}<br>
{if customField}
{foreach from=$customField key=key item=data}
<b>{$customGroup.$key}</b><br>
{foreach from=$data key=dkey item=ddata}
{$ddata.label} : {$ddata.value}<br>
{/foreach}
{/foreach}
{/if}
</body>
</html>
Receipt for {if $events_in_cart} Event Registration{/if}
Dear {contact.display_name},
This is being sent to you as a receipt of {$grant_status} grant.
Grant Program Name: {$grant_programs} <br>
Grant Type {$grant_type}
Total Amount: {$params.amount_total}
{if customField}
{foreach from=$customField key=key item=data}
{$customGroup.$key}
{foreach from=$data key=dkey item=ddata}
{$ddata.label} : {$ddata.value}<br>
{/foreach}
{/foreach}
{/if}
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body>
{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
<p>Dear {contact.display_name},</p>
<p>This is being sent to you as a receipt of {$grant_status} grant.</p>
Grant Program Name: {$grant_programs} <br>
Grant Type : {$grant_type}<br>
Total Amount : {$params.amount_total}<br>
{if customField}
{foreach from=$customField key=key item=data}
<b>{$customGroup.$key}</b><br>
{foreach from=$data key=dkey item=ddata}
{$ddata.label} : {$ddata.value}<br>
{/foreach}
{/foreach}
{/if}
</body>
</html>
Receipt for {if $events_in_cart} Event Registration{/if}
Dear {contact.display_name},
This is being sent to you as a receipt of {$grant_status} grant.
Grant Program Name: {$grant_programs} <br>
Grant Type {$grant_type}
Total Amount: {$params.amount_total}
{if customField}
{foreach from=$customField key=key item=data}
{$customGroup.$key}
{foreach from=$data key=dkey item=ddata}
{$ddata.label} : {$ddata.value}<br>
{/foreach}
{/foreach}
{/if}
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body>
{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
<p>Dear {contact.display_name},</p>
<p>This is being sent to you as a receipt of {$grant_status} grant.</p>
Grant Program Name: {$grant_programs} <br>
Grant Type : {$grant_type}<br>
Total Amount : {$params.amount_total}<br>
{if customField}
{foreach from=$customField key=key item=data}
<b>{$customGroup.$key}</b><br>
{foreach from=$data key=dkey item=ddata}
{$ddata.label} : {$ddata.value}<br>
{/foreach}
{/foreach}
{/if}
</body>
</html>
Receipt for {if $events_in_cart} Paid Grant{/if}
Dear {contact.display_name},
This is being sent to you as a receipt of {$grant_status} grant.
Grant Program Name: {$grant_programs} <br>
Grant Type {$grant_type}
Total Amount: {$params.amount_total}
{if customField}
{foreach from=$customField key=key item=data}
{$customGroup.$key}
{foreach from=$data key=dkey item=ddata}
{$ddata.label} : {$ddata.value}<br>
{/foreach}
{/foreach}
{/if}
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body>
{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
<p>Dear {contact.display_name},</p>
<p>This is being sent to you as a receipt of {$grant_status} grant.</p>
Grant Program Name: {$grant_programs} <br>
Grant Type : {$grant_type}<br>
Total Amount : {$params.amount_total}<br>
{if customField}
{foreach from=$customField key=key item=data}
<b>{$customGroup.$key}</b><br>
{foreach from=$data key=dkey item=ddata}
{$ddata.label} : {$ddata.value}<br>
{/foreach}
{/foreach}
{/if}
</body>
</html>
Receipt for {if $events_in_cart} Event Registration{/if}
Dear {contact.display_name},
This is being sent to you as a receipt of {$grant_status} grant.
Grant Program Name: {$grant_programs} <br>
Grant Type {$grant_type}
Total Amount: {$params.amount_total}
{if customField}
{foreach from=$customField key=key item=data}
{$customGroup.$key}
{foreach from=$data key=dkey item=ddata}
{$ddata.label} : {$ddata.value}<br>
{/foreach}
{/foreach}
{/if}
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body>
{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
<p>Dear {contact.display_name},</p>
<p>This is being sent to you as a receipt of {$grant_status} grant.</p>
Grant Program Name: {$grant_programs} <br>
Grant Type : {$grant_type}<br>
Total Amount : {$params.amount_total}<br>
{if customField}
{foreach from=$customField key=key item=data}
<b>{$customGroup.$key}</b><br>
{foreach from=$data key=dkey item=ddata}
{$ddata.label} : {$ddata.value}<br>
{/foreach}
{/foreach}
{/if}
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment