From c2d0e5c702e64b23f792ae0a43fe4002a2f21e9f Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Mon, 16 Mar 2026 08:18:11 -0400 Subject: [PATCH] Improved qbo hooks to allow a single entity or an array of entities --- app/jobs/qbo_sync_dispatcher.rb | 6 ++++-- app/jobs/webhook_process_job.rb | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/jobs/qbo_sync_dispatcher.rb b/app/jobs/qbo_sync_dispatcher.rb index 09ea3ec..d488ab6 100644 --- a/app/jobs/qbo_sync_dispatcher.rb +++ b/app/jobs/qbo_sync_dispatcher.rb @@ -33,8 +33,10 @@ class QboSyncDispatcher # Allow other plugins to add addtional sync jobs via Hooks Redmine::Hook.call_hook( :qbo_full_sync ).each do |context| next unless context - jobs.push context - log "Added additionals QBO Sync Job for #{context.to_s}" + Array(context).each do |entity| + jobs.push(entity) + log "Added additional QBO Sync Job for #{entity.to_s}" + end end jobs.each { |job| QboSyncJob.perform_later(entity: job, full_sync: full_sync) } diff --git a/app/jobs/webhook_process_job.rb b/app/jobs/webhook_process_job.rb index d394e22..e35938b 100644 --- a/app/jobs/webhook_process_job.rb +++ b/app/jobs/webhook_process_job.rb @@ -47,8 +47,10 @@ class WebhookProcessJob < ActiveJob::Base # Allow other plugins to add addtional qbo entities via Hooks Redmine::Hook.call_hook( :qbo_additional_entities ).each do |context| next unless context - entities.push context - log "Added additional QBO entities: #{context}" + Array(context).each do |entity| + jobs.push(entity) + log "Added additional QBO entity #{entity}" + end end return unless entities.include?(name)