Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add consent table to store different GDPR consents of user #342

Merged
merged 1 commit into from
Nov 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/app/code/community/FireGento/MageSetup/Model/Consent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* This file is part of a FireGento e.V. module.
*
* This FireGento e.V. module is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This script 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 General Public License for more details.
*
* PHP version 5
*
* @category FireGento
* @package FireGento_MageSetup
* @author FireGento Team <team@firegento.com>
* @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 <team@firegento.com>
*/
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');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* This file is part of a FireGento e.V. module.
*
* This FireGento e.V. module is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This script 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 General Public License for more details.
*
* PHP version 5
*
* @category FireGento
* @package FireGento_MageSetup
* @author FireGento Team <team@firegento.com>
* @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 <team@firegento.com>
*/
class FireGento_MageSetup_Model_Resource_Consent extends Mage_Core_Model_Resource_Db_Abstract
{
protected function _construct()
{
$this->_init('magesetup/consent', 'consent_id');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* This file is part of a FireGento e.V. module.
*
* This FireGento e.V. module is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This script 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 General Public License for more details.
*
* PHP version 5
*
* @category FireGento
* @package FireGento_MageSetup
* @author FireGento Team <team@firegento.com>
* @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 <team@firegento.com>
*/
class FireGento_MageSetup_Model_Resource_Consent_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
public function _construct()
{
$this->_init('magesetup/consent');
}
}
5 changes: 4 additions & 1 deletion src/app/code/community/FireGento/MageSetup/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<config>
<modules>
<FireGento_MageSetup>
<version>2.4.2</version>
<version>2.4.3</version>
</FireGento_MageSetup>
</modules>
<global>
Expand Down Expand Up @@ -56,6 +56,9 @@
<newsletter_subscriber_status>
<table>newsletter_subscriber_status</table>
</newsletter_subscriber_status>
<consent>
<table>consent</table>
</consent>
</entities>
</magesetup_resource>
<tax>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
/**
* This file is part of a FireGento e.V. module.
*
* This FireGento e.V. module is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This script 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 General Public License for more details.
*
* PHP version 5
*
* @category FireGento
* @package FireGento_MageSetup
* @author FireGento Team <team@firegento.com>
* @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 <team@firegento.com>
*/

$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();