mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-04-02 16:21:58 -04:00
Compare commits
2 Commits
d8a26f98c0
...
1f64e36892
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f64e36892 | |||
| 643b15391b |
14
README.md
14
README.md
@@ -117,12 +117,14 @@ Adds support for tracking **customer vehicles** associated with Issues.
|
||||
|
||||
Available hooks:
|
||||
|
||||
|Type|Hook|
|
||||
|--|---|
|
||||
View Hook|:pdf\_left, { issue: issue }
|
||||
View Hook|:pdf\_right, { issue: issue }
|
||||
Hook|process\_invoice\_custom\_fields, { issue: issue, invoice: invoice }
|
||||
View Hook|:show\_customer\_view\_right, { customer: customer }
|
||||
|Type|Hook|Note
|
||||
|--|--|--|
|
||||
View Hook|:pdf_left, { issue: issue } | Used to add text to left side of PDF
|
||||
View Hook|:pdf_right, { issue: issue } | Used to add text to right side of PDF
|
||||
Hook|process_invoice_custom_fields, { issue: issue, invoice: invoice } | Used to process invoice custom fields
|
||||
View Hook|:show_customer_view_right, { customer: customer } | Used to show partials on right side of customer view
|
||||
Hook| :qbo_additional_entities | Used to add additional entites to be processed by the WebhookProcessJob
|
||||
Hook| :qbo_full_sync | Used to add a Class to be called by the QboSyncDispatcher
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -19,6 +19,23 @@ class QboSyncDispatcher
|
||||
|
||||
# Dispatches all synchronization jobs to perform a full sync of QuickBooks entities with the local database. Each job is enqueued with the `full_sync` flag set to true.
|
||||
def self.full_sync!
|
||||
SYNC_JOBS.each { |job| job.perform_later(full_sync: true) }
|
||||
|
||||
jobs = SYNC_JOBS.dup
|
||||
|
||||
# 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 #{contex.to_s}"
|
||||
end
|
||||
|
||||
jobs.each { |job| job.perform_later(full_sync: true) }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.log(msg)
|
||||
Rails.logger.info "[QboSyncDispatcher] #{msg}"
|
||||
end
|
||||
|
||||
end
|
||||
@@ -43,7 +43,14 @@ class WebhookProcessJob < ActiveJob::Base
|
||||
name = entity['name']
|
||||
id = entity['id']&.to_i
|
||||
|
||||
return unless ALLOWED_ENTITIES.include?(name)
|
||||
entitys = ALLOWED_ENTITIES.dup
|
||||
# Allow other plugins to add addtional qbo entities via Hooks
|
||||
Redmine::Hook.call_hook( :qbo_additional_entities ).each do |context|
|
||||
next unless context
|
||||
entitys.push context
|
||||
log "Added additional QBO entities: #{context}"
|
||||
end
|
||||
return unless entitys.include?(name)
|
||||
|
||||
model = name.safe_constantize
|
||||
return unless model
|
||||
|
||||
2
init.rb
2
init.rb
@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo do
|
||||
name 'Redmine QBO plugin'
|
||||
author 'Rick Barrette'
|
||||
description 'A pluging for Redmine to connect with QuickBooks Online to create Time Activity Entries for billable hours logged when an Issue is closed'
|
||||
version '2026.3.2'
|
||||
version '2026.3.3'
|
||||
url 'https://github.com/rickbarrette/redmine_qbo'
|
||||
author_url 'https://barrettefabrication.com'
|
||||
settings default: {empty: true}, partial: 'qbo/settings'
|
||||
|
||||
Reference in New Issue
Block a user