class GHMS_Tasks {
public function __construct() {
add_action('ghms_daily_maintenance', array($this, 'check_scheduled_tasks'));
add_action('init', array($this, 'schedule_events'));
}
public function schedule_events() {
if (!wp_next_scheduled('ghms_daily_maintenance')) {
wp_schedule_event(time(), 'daily', 'ghms_daily_maintenance');
}
}
public function check_scheduled_tasks() {
$today = current_time('Y-m-d');
$due_tasks = GHMS_Database::get_instance()->get_tasks_due_on($today);
foreach ($due_tasks as $task) {
$this->send_task_reminder($task);
}
}
private function send_task_reminder($task) {
$employee = GHMS_Database::get_instance()->get_employee($task->assigned_to);
$user = get_user_by('id', $employee->user_id);
if ($user) {
$subject = sprintf(__('Reminder: %s task due today', 'ghms'), $task->task_type);
$message = sprintf(
__('Hello %s, you have a %s task scheduled for today. Details: %s', 'ghms'),
$user->display_name,
$task->task_type,
$task->notes
);
wp_mail($user->user_email, $subject, $message);
}
}
}class GHMS_WooCommerce {
public function __construct() {
add_action('save_post_product', array($this, 'sync_product_with_ghms'), 10, 3);
add_action('woocommerce_order_status_changed', array($this, 'handle_order_status_change'), 10, 3);
}
public function sync_product_with_ghms($post_id, $post, $update) {
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
if ($post->post_type != 'product') return;
$product = wc_get_product($post_id);
$flower_type_id = get_post_meta($post_id, '_ghms_flower_type_id', true);
if ($flower_type_id) {
// Update existing flower type
GHMS_Database::get_instance()->update_flower_type($flower_type_id, [
'name' => $product->get_name(),
'wc_product_id' => $post_id,
'wc_last_sync' => current_time('mysql')
]);
} else {
// Create new flower type
$flower_type_id = GHMS_Database::get_instance()->insert_flower_type([
'wc_product_id' => $post_id,
'name' => $product->get_name(),
'wc_last_sync' => current_time('mysql')
]);
update_post_meta($post_id, '_ghms_flower_type_id', $flower_type_id);
}
}
public function handle_order_status_change($order_id, $old_status, $new_status) {
if ($new_status == 'completed') {
$order = wc_get_order($order_id);
foreach ($order->get_items() as $item) {
$product_id = $item->get_product_id();
$flower_type_id = get_post_meta($product_id, '_ghms_flower_type_id', true);
if ($flower_type_id) {
GHMS_Database::get_instance()->record_sale([
'flower_type_id' => $flower_type_id,
'wc_order_id' => $order_id,
'sold_quantity' => $item->get_quantity(),
'sale_date' => current_time('mysql')
]);
}
}
}
}
} Deprecated: Creation of dynamic property WC_Accept_Payments::$kiosk is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 20
Deprecated: Creation of dynamic property WC_Accept_Payments::$online is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 21
Deprecated: Creation of dynamic property WC_Accept_Payments::$lucky is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 22
Deprecated: Creation of dynamic property WC_Accept_Payments::$valu is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 23
Deprecated: Creation of dynamic property WC_Accept_Payments::$wallet is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 24
Deprecated: Creation of dynamic property WC_Accept_Payments::$installments is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 25
Deprecated: Creation of dynamic property WC_Accept_Payments::$sympl is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 26
Deprecated: Creation of dynamic property WC_Accept_Payments::$premium is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 27
Deprecated: Creation of dynamic property WC_Accept_Payments::$souhoola is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 28
Deprecated: Creation of dynamic property WC_Accept_Payments::$forsa is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 29
Deprecated: Creation of dynamic property WC_Accept_Payments::$shahry is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 30
Deprecated: Creation of dynamic property WC_Accept_Payments::$get_go is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 31
Deprecated: Creation of dynamic property WC_Accept_Payments::$tabby is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 32
Deprecated: Creation of dynamic property WC_Accept_Payments::$nowpay is deprecated in /home4/umifydmy/public_html/wp-content/plugins/woo-accept/accept-wc.php on line 33
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the zero-bs-crm domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home4/umifydmy/public_html/wp-includes/functions.php on line 6121