Skip to content

Commit

Permalink
Fix issues with entity definition and regenerate
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed Jun 30, 2019
1 parent 2a622d2 commit f51ec13
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 25 deletions.
36 changes: 20 additions & 16 deletions CRM/Civigiftaid/DAO/BatchSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2019
*
* Generated from xml/schema/CRM/Civigiftaid/BatchSettings.xml
* Generated from /home/dev/civicrm/civicrm-buildkit/build/dmaster/sites/default/files/civicrm/ext/uk.co.compucorp.civicrm.giftaid/xml/schema/CRM/Civigiftaid/BatchSettings.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:03e9148920c213359a8b1d1335dfc451)
* (GenCodeChecksum:9707560ffca052f1c10410999475dccd)
*/

/**
Expand All @@ -31,14 +31,14 @@ class CRM_Civigiftaid_DAO_BatchSettings extends CRM_Core_DAO {
/**
* Unique BatchSettings ID
*
* @var int unsigned
* @var int
*/
public $id;

/**
* FK to Batch
*
* @var int unsigned
* @var int
*/
public $batch_id;

Expand All @@ -52,14 +52,14 @@ class CRM_Civigiftaid_DAO_BatchSettings extends CRM_Core_DAO {
/**
* Globally enabled for this batch
*
* @var boolean
* @var bool
*/
public $globally_enabled;

/**
* Basic rate tax for the batch.
*
* @var decimal(4,2)
* @var float
*/
public $basic_rate_tax;

Expand Down Expand Up @@ -97,7 +97,7 @@ public static function &fields() {
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'description' => ts('Unique BatchSettings ID'),
'description' => CRM_Civigiftaid_ExtensionUtil::ts('Unique BatchSettings ID'),
'required' => TRUE,
'where' => 'civicrm_civigiftaid_batchsettings.id',
'table_name' => 'civicrm_civigiftaid_batchsettings',
Expand All @@ -108,19 +108,18 @@ public static function &fields() {
'batch_id' => [
'name' => 'batch_id',
'type' => CRM_Utils_Type::T_INT,
'description' => ts('FK to Batch'),
'description' => CRM_Civigiftaid_ExtensionUtil::ts('FK to Batch'),
'where' => 'civicrm_civigiftaid_batchsettings.batch_id',
'table_name' => 'civicrm_civigiftaid_batchsettings',
'entity' => 'BatchSettings',
'bao' => 'CRM_Civigiftaid_DAO_BatchSettings',
'localizable' => 0,
'FKClassName' => 'CRM_Batch_DAO_Batch',
],
'financial_types_enabled' => [
'name' => 'financial_types_enabled',
'type' => CRM_Utils_Type::T_TEXT,
'title' => ts('Financial Types Enabled'),
'description' => ts('Financial type enabled for this batch'),
'title' => CRM_Civigiftaid_ExtensionUtil::ts('Financial Types Enabled'),
'description' => CRM_Civigiftaid_ExtensionUtil::ts('Financial type enabled for this batch'),
'where' => 'civicrm_civigiftaid_batchsettings.financial_types_enabled',
'table_name' => 'civicrm_civigiftaid_batchsettings',
'entity' => 'BatchSettings',
Expand All @@ -130,8 +129,8 @@ public static function &fields() {
'globally_enabled' => [
'name' => 'globally_enabled',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Globally Enabled'),
'description' => ts('Globally enabled for this batch'),
'title' => CRM_Civigiftaid_ExtensionUtil::ts('Globally Enabled'),
'description' => CRM_Civigiftaid_ExtensionUtil::ts('Globally enabled for this batch'),
'where' => 'civicrm_civigiftaid_batchsettings.globally_enabled',
'table_name' => 'civicrm_civigiftaid_batchsettings',
'entity' => 'BatchSettings',
Expand All @@ -140,9 +139,14 @@ public static function &fields() {
],
'basic_rate_tax' => [
'name' => 'basic_rate_tax',
'type' => CRM_Utils_Type::T_DECIMAL(4, 2),
'title' => ts('Basic Rate Tax'),
'description' => ts('Basic rate tax for the batch.'),
'type' => CRM_Utils_Type::T_MONEY,
'title' => CRM_Civigiftaid_ExtensionUtil::ts('Basic Rate Tax'),
'description' => CRM_Civigiftaid_ExtensionUtil::ts('Basic rate tax for the batch.'),
'required' => TRUE,
'precision' => [
4,
2,
],
'where' => 'civicrm_civigiftaid_batchsettings.basic_rate_tax',
'table_name' => 'civicrm_civigiftaid_batchsettings',
'entity' => 'BatchSettings',
Expand Down
96 changes: 96 additions & 0 deletions sql/auto_install.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
-- +--------------------------------------------------------------------+
-- | 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 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 |
-- +--------------------------------------------------------------------+
--
-- 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_civigiftaid_batchsettings`;

SET FOREIGN_KEY_CHECKS=1;
-- /*******************************************************
-- *
-- * Create new tables
-- *
-- *******************************************************/

-- /*******************************************************
-- *
-- * civicrm_civigiftaid_batchsettings
-- *
-- * FIXME
-- *
-- *******************************************************/
CREATE TABLE `civicrm_civigiftaid_batchsettings` (


`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique BatchSettings ID',
`batch_id` int unsigned COMMENT 'FK to Batch',
`financial_types_enabled` text COMMENT 'Financial type enabled for this batch',
`globally_enabled` tinyint COMMENT 'Globally enabled for this batch',
`basic_rate_tax` decimal(4,2) NOT NULL COMMENT 'Basic rate tax for the batch.'
,
PRIMARY KEY (`id`)


, CONSTRAINT FK_civicrm_civigiftaid_batchsettings_batch_id FOREIGN KEY (`batch_id`) REFERENCES `civicrm_batch`(`id`) ON DELETE CASCADE
) ;


38 changes: 38 additions & 0 deletions sql/auto_uninstall.sql
Original file line number Diff line number Diff line change
@@ -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_civigiftaid_batchsettings`;

SET FOREIGN_KEY_CHECKS=1;
10 changes: 5 additions & 5 deletions sql/upgrade_3000.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
-- *******************************************************/

CREATE TABLE IF NOT EXISTS `civicrm_civigiftaid_batchsettings` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Primary key.',
`batch_id` INT UNSIGNED COMMENT 'Foreign key for the batch in `civicrm_batch`.',
`financial_types_enabled` TEXT COMMENT 'Only enabled for selected financial types for the batch.',
`globally_enabled` TINYINT COMMENT 'Enabled for all financial types for the batch.',
`basic_rate_tax` DECIMAL(4,2) NOT NULL COMMENT 'Basic rate tax for the batch.',
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique BatchSettings ID',
`batch_id` int unsigned COMMENT 'FK to Batch',
`financial_types_enabled` text COMMENT 'Financial type enabled for this batch',
`globally_enabled` tinyint COMMENT 'Globally enabled for this batch',
`basic_rate_tax` decimal(4,2) NOT NULL COMMENT 'Basic rate tax for the batch.',
PRIMARY KEY (`id`),
CONSTRAINT FK_civicrm_civigiftaid_batchsettings_batch_id FOREIGN KEY (`batch_id`) REFERENCES `civicrm_batch` (`id`) ON DELETE CASCADE
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// 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 [
0 =>
[
'name' => 'BatchSettings',
'class' => 'CRM_Civigiftaid_DAO_BatchSettings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@

<field>
<name>basic_rate_tax</name>
<type>decimal(4,2)</type>
<type>decimal</type>
<length>4,2</length>
<required>true</required>
<title>Basic Rate Tax</title>
<comment>Basic rate tax for the batch.</comment>
<add>4.4</add>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1" ?>

<tables xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="BatchSettings.xml" parse="xml" />
<xi:include href="BatchSettings.xml" parse="xml" />
</tables>
2 changes: 1 addition & 1 deletion xml/schema/Schema.xml.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<xi:include href="CRM/BatchSettings/files.xml" parse="xml" />
<xi:include href="CRM/Civigiftaid/files.xml" parse="xml" />

0 comments on commit f51ec13

Please sign in to comment.