feat: Add supplier exports functionality with scheduling and admin management
This commit is contained in:
@@ -10,6 +10,7 @@ require_once __DIR__ . '/class-siti-stock-admin.php';
|
||||
require_once __DIR__ . '/class-siti-stock-inventory-manager.php';
|
||||
require_once __DIR__ . '/class-siti-stock-sync-service.php';
|
||||
require_once __DIR__ . '/class-siti-stock-sync-controller.php';
|
||||
require_once __DIR__ . '/class-siti-stock-supplier-exports.php';
|
||||
|
||||
/**
|
||||
* Core plugin bootstrap that wires together all sub-components.
|
||||
@@ -50,6 +51,11 @@ class Siti_Stock_Plugin {
|
||||
*/
|
||||
private $sync_controller;
|
||||
|
||||
/**
|
||||
* @var Siti_Stock_Supplier_Exports
|
||||
*/
|
||||
private $supplier_exports;
|
||||
|
||||
/**
|
||||
* Get singleton instance.
|
||||
*
|
||||
@@ -80,6 +86,10 @@ class Siti_Stock_Plugin {
|
||||
|
||||
$settings_repo = new Siti_Stock_Settings( self::OPTION_KEY );
|
||||
Siti_Stock_Sync_Controller::maybe_schedule_from_settings( self::CRON_HOOK, $settings_repo->get_all() );
|
||||
|
||||
$notices = new Siti_Stock_Admin_Notices();
|
||||
$supplier_exports = new Siti_Stock_Supplier_Exports( $settings_repo, $notices );
|
||||
$supplier_exports->reschedule_all();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,18 +97,22 @@ class Siti_Stock_Plugin {
|
||||
*/
|
||||
public static function deactivate() {
|
||||
Siti_Stock_Sync_Controller::clear_schedule( self::CRON_HOOK );
|
||||
Siti_Stock_Supplier_Exports::clear_all_schedules();
|
||||
}
|
||||
|
||||
private function __construct() {
|
||||
$this->settings = new Siti_Stock_Settings( self::OPTION_KEY );
|
||||
$this->notices = new Siti_Stock_Admin_Notices();
|
||||
$this->sync_controller = new Siti_Stock_Sync_Controller( $this->settings, $this->notices, self::CRON_HOOK );
|
||||
$this->supplier_exports = new Siti_Stock_Supplier_Exports( $this->settings, $this->notices );
|
||||
$this->inventory_manager = new Siti_Stock_Inventory_Manager( self::EXTERNAL_STOCK_META_KEY );
|
||||
$this->admin = new Siti_Stock_Admin( $this->settings, $this->sync_controller, $this->notices );
|
||||
$this->admin = new Siti_Stock_Admin( $this->settings, $this->sync_controller, $this->notices, $this->supplier_exports );
|
||||
|
||||
$this->admin->register_hooks();
|
||||
$this->inventory_manager->register_hooks();
|
||||
$this->sync_controller->register_hooks();
|
||||
$this->supplier_exports->register_hooks();
|
||||
$this->supplier_exports->maybe_schedule_all();
|
||||
add_filter( 'woocommerce_data_stores', array( $this, 'override_product_data_store' ), 20 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user