Add delete options on delete plugin
This commit is contained in:
parent
83b668deb3
commit
fead96c4ca
@ -950,6 +950,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
$api_client = $this->getApiClient();
|
$api_client = $this->getApiClient();
|
||||||
$clientId = get_option('retailcrm_client_id');
|
$clientId = get_option('retailcrm_client_id');
|
||||||
WC_Retailcrm_Plugin::integration_module($api_client, $clientId, false);
|
WC_Retailcrm_Plugin::integration_module($api_client, $clientId, false);
|
||||||
|
delete_option('retailcrm_active_in_crm');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -962,7 +963,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
$client_id = get_option('retailcrm_client_id');
|
$client_id = get_option('retailcrm_client_id');
|
||||||
|
|
||||||
if (!$client_id) {
|
if (!$client_id) {
|
||||||
$client_id = hash('md5', date('Y-m-d H:i:s'));
|
$client_id = uniqid();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($settings['api_url'] && $settings['api_key'] && $settings['api_version']) {
|
if ($settings['api_url'] && $settings['api_key'] && $settings['api_version']) {
|
||||||
|
@ -3,9 +3,13 @@
|
|||||||
class WC_Retailcrm_Plugin {
|
class WC_Retailcrm_Plugin {
|
||||||
|
|
||||||
public $file;
|
public $file;
|
||||||
|
|
||||||
public static $history_run = false;
|
public static $history_run = false;
|
||||||
private static $instance = null;
|
private static $instance = null;
|
||||||
|
|
||||||
|
const MARKETPLACE_LOGO = 'https://s3.eu-central-1.amazonaws.com/retailcrm-billing/images/5b69ce4bda663-woocommercesvg2.svg';
|
||||||
|
const INTEGRATION_CODE = 'woocommerce';
|
||||||
|
|
||||||
public static function getInstance($file) {
|
public static function getInstance($file) {
|
||||||
if (self::$instance === null) {
|
if (self::$instance === null) {
|
||||||
self::$instance = new self($file);
|
self::$instance = new self($file);
|
||||||
@ -81,24 +85,23 @@ class WC_Retailcrm_Plugin {
|
|||||||
* Edit configuration in CRM
|
* Edit configuration in CRM
|
||||||
*
|
*
|
||||||
* @param WC_Retailcrm_Proxy $api_client
|
* @param WC_Retailcrm_Proxy $api_client
|
||||||
* @param string $cliend_id
|
* @param string $client_id
|
||||||
* @param bool $active
|
* @param bool $active
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function integration_module($api_client, $cliend_id, $active = true)
|
public static function integration_module($api_client, $client_id, $active = true) {
|
||||||
{
|
|
||||||
if (!$api_client) {
|
if (!$api_client) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$configuration = array(
|
$configuration = array(
|
||||||
'clientId' => $cliend_id,
|
'clientId' => $client_id,
|
||||||
'code' => 'woocommerce',
|
'code' => self::INTEGRATION_CODE . '-' . $client_id,
|
||||||
'integrationCode' => 'woocommerce',
|
'integrationCode' => self::INTEGRATION_CODE,
|
||||||
'active' => $active,
|
'active' => $active,
|
||||||
'name' => 'WooCommerce',
|
'name' => 'WooCommerce',
|
||||||
'logo' => 'https://s3.eu-central-1.amazonaws.com/retailcrm-billing/images/5b69ce4bda663-woocommercesvg2.svg'
|
'logo' => self::MARKETPLACE_LOGO
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $api_client->integrationModulesEdit($configuration);
|
$response = $api_client->integrationModulesEdit($configuration);
|
||||||
|
@ -39,6 +39,8 @@ wp_clear_scheduled_hook('retailcrm_inventories');
|
|||||||
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'woocommerce_integration-retailcrm_settings';");
|
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'woocommerce_integration-retailcrm_settings';");
|
||||||
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'retailcrm_customers_history_since_id';");
|
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'retailcrm_customers_history_since_id';");
|
||||||
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'retailcrm_orders_history_since_id';");
|
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'retailcrm_orders_history_since_id';");
|
||||||
|
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'retailcrm_active_in_crm';");
|
||||||
|
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'retailcrm_client_id';");
|
||||||
|
|
||||||
// Clear any cached data that has been removed
|
// Clear any cached data that has been removed
|
||||||
wp_cache_flush();
|
wp_cache_flush();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user