fix disconnect
This commit is contained in:
@@ -86,8 +86,13 @@ class MauticConnect extends Module
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
// ... (SQL and static config installation is the same)
|
||||
$sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'mautic_processed_hooks` (...)';
|
||||
$sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'mautic_processed_hooks` (
|
||||
`id_processed_hook` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`hook_hash` VARCHAR(32) NOT NULL,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id_processed_hook`),
|
||||
UNIQUE KEY `hook_hash` (`hook_hash`)
|
||||
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;';
|
||||
Db::getInstance()->execute($sql);
|
||||
Configuration::updateValue(self::MAUTIC_URL, '');
|
||||
// ... set other static configs to empty/0 ...
|
||||
@@ -136,11 +141,20 @@ class MauticConnect extends Module
|
||||
$output = '';
|
||||
|
||||
if (Tools::isSubmit('submit' . $this->name)) {
|
||||
$mauticUrl = Tools::getValue(self::MAUTIC_URL);
|
||||
$clientId = Tools::getValue(self::MAUTIC_CLIENT_ID);
|
||||
$clientSecret = Tools::getValue(self::MAUTIC_CLIENT_SECRET);
|
||||
$output .= $this->postProcess();
|
||||
}
|
||||
|
||||
// ... (disconnect logic is the same) ...
|
||||
|
||||
if ($mauticUrl && $clientId && $clientSecret) {
|
||||
Configuration::updateValue(self::MAUTIC_URL, rtrim($mauticUrl, '/'));
|
||||
Configuration::updateValue(self::MAUTIC_CLIENT_ID, $clientId);
|
||||
Configuration::updateValue(self::MAUTIC_CLIENT_SECRET, $clientSecret);
|
||||
$output .= $this->displayConfirmation($this->l('Settings updated. Please connect to Mautic if you haven\'t already.'));
|
||||
} else {
|
||||
$output .= $this->displayError($this->l('Mautic URL, Client ID, and Client Secret are required.'));
|
||||
}
|
||||
$output .= $this->displayConnectionStatus();
|
||||
$output .= $this->renderForms(); // Single method to render all forms
|
||||
|
||||
@@ -156,7 +170,12 @@ class MauticConnect extends Module
|
||||
Configuration::updateValue(self::MAUTIC_URL, rtrim(Tools::getValue(self::MAUTIC_URL, ''), '/'));
|
||||
Configuration::updateValue(self::MAUTIC_CLIENT_ID, Tools::getValue(self::MAUTIC_CLIENT_ID, ''));
|
||||
Configuration::updateValue(self::MAUTIC_CLIENT_SECRET, Tools::getValue(self::MAUTIC_CLIENT_SECRET, ''));
|
||||
|
||||
// Handle disconnect request
|
||||
if (Tools::isSubmit('disconnectMautic')) {
|
||||
Configuration::updateValue(self::MAUTIC_ACCESS_TOKEN, '');
|
||||
Configuration::updateValue(self::MAUTIC_REFRESH_TOKEN, '');
|
||||
Configuration::updateValue(self::MAUTIC_TOKEN_EXPIRES, 0);
|
||||
}
|
||||
// Dynamically save event mapping settings
|
||||
if ($this->isConnected()) {
|
||||
foreach (self::$eventDefinitions as $event) {
|
||||
|
||||
Reference in New Issue
Block a user