diff --git a/src/app/code/community/FireGento/MageSetup/Model/Consent.php b/src/app/code/community/FireGento/MageSetup/Model/Consent.php new file mode 100644 index 00000000..3b3dd945 --- /dev/null +++ b/src/app/code/community/FireGento/MageSetup/Model/Consent.php @@ -0,0 +1,38 @@ + + * @copyright 2013-2015 FireGento Team (http://www.firegento.com) + * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) + */ + +/** + * Config class + * + * @category FireGento + * @package FireGento_MageSetup + * @author FireGento Team + */ +class FireGento_MageSetup_Model_Consent extends Mage_Core_Model_Abstract +{ + const CONSENT_TYPE_CONTACTFORM = 'contactform'; + const CONSENT_TYPE_NEWSLETTER = 'newsletter'; + + protected function _construct() + { + $this->_init('magesetup/consent'); + } +} \ No newline at end of file diff --git a/src/app/code/community/FireGento/MageSetup/Model/Resource/Consent.php b/src/app/code/community/FireGento/MageSetup/Model/Resource/Consent.php new file mode 100644 index 00000000..c4848e38 --- /dev/null +++ b/src/app/code/community/FireGento/MageSetup/Model/Resource/Consent.php @@ -0,0 +1,35 @@ + + * @copyright 2013-2018 FireGento Team (http://www.firegento.com) + * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) + */ + +/** + * Consent Resource Model + * + * @category FireGento + * @package FireGento_MageSetup + * @author FireGento Team + */ +class FireGento_MageSetup_Model_Resource_Consent extends Mage_Core_Model_Resource_Db_Abstract +{ + protected function _construct() + { + $this->_init('magesetup/consent', 'consent_id'); + } +} diff --git a/src/app/code/community/FireGento/MageSetup/Model/Resource/Consent/Collection.php b/src/app/code/community/FireGento/MageSetup/Model/Resource/Consent/Collection.php new file mode 100644 index 00000000..1ac6b568 --- /dev/null +++ b/src/app/code/community/FireGento/MageSetup/Model/Resource/Consent/Collection.php @@ -0,0 +1,35 @@ + + * @copyright 2013-2018 FireGento Team (http://www.firegento.com) + * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) + */ + +/** + * Consent Resource Collection Model + * + * @category FireGento + * @package FireGento_MageSetup + * @author FireGento Team + */ +class FireGento_MageSetup_Model_Resource_Consent_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract +{ + public function _construct() + { + $this->_init('magesetup/consent'); + } +} diff --git a/src/app/code/community/FireGento/MageSetup/etc/config.xml b/src/app/code/community/FireGento/MageSetup/etc/config.xml index 35a39b4f..cd2399e8 100644 --- a/src/app/code/community/FireGento/MageSetup/etc/config.xml +++ b/src/app/code/community/FireGento/MageSetup/etc/config.xml @@ -21,7 +21,7 @@ - 2.4.2 + 2.4.3 @@ -56,6 +56,9 @@ newsletter_subscriber_status
+ + consent
+
diff --git a/src/app/code/community/FireGento/MageSetup/sql/magesetup_setup/mysql4-upgrade-2.4.2-2.4.3.php b/src/app/code/community/FireGento/MageSetup/sql/magesetup_setup/mysql4-upgrade-2.4.2-2.4.3.php new file mode 100644 index 00000000..1d15df77 --- /dev/null +++ b/src/app/code/community/FireGento/MageSetup/sql/magesetup_setup/mysql4-upgrade-2.4.2-2.4.3.php @@ -0,0 +1,77 @@ + + * @copyright 2013-2018 FireGento Team (http://www.firegento.com) + * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) + */ +/** + * @category FireGento + * @package FireGento_MageSetup + * @author FireGento Team + */ + +$installer = $this; + +$installer->startSetup(); + +if (version_compare(Mage::getVersion(), '1.6', '<')) { + $installer->run(" + DROP TABLE IF EXISTS `{$installer->getTable('magesetup/consent')}`; + CREATE TABLE `{$installer->getTable('magesetup/consent')}` ( + `consent_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', + `ip` VARCHAR(45) NOT NULL COMMENT 'IP address of user doing the consent', + `date` DATETIME NOT NULL COMMENT 'time of consent', + `consent_user` VARCHAR(255) NOT NULL COMMENT 'user doing the consent', + `consent_type` VARCHAR(255) NOT NULL COMMENT 'area of consent (e.g. contactform or newsletter)', + `consent` VARCHAR(5) NOT NULL COMMENT 'separate saved consent for lawyer', + PRIMARY KEY (`consent_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='MageSetup consent table'; + "); + +} else { + $consentTable = $installer->getTable('magesetup/consent'); + if ($installer->getConnection()->isTableExists($consentTable)) { + $installer->getConnection()->dropTable($consentTable); + } + + $consentTable = $installer->getConnection()->newTable($consentTable) + ->addColumn('consent_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ), 'id of consent') + ->addColumn('ip', Varien_Db_Ddl_Table::TYPE_VARCHAR, 45, array( + 'nullable' => true, + ), 'IP address of user doing the consent') + ->addColumn('date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array( + 'nullable' => false, + ), 'time of consent') + ->addColumn('consent_user', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array( + 'nullable' => false, + ), 'user doing the consent') + ->addColumn('consent_type', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array( + 'nullable' => false, + ), 'area of consent (e.g. contactform or newsletter)') + ->addColumn('consent', Varien_Db_Ddl_Table::TYPE_TINYINT, 5, array( + 'unsigned' => true, + 'nullable' => false, + ), 'separate saved consent for lawyer'); + $installer->getConnection()->createTable($consentTable); +} + +$installer->endSetup(); \ No newline at end of file