Updated to use DSL and qbo_sync flag

This commit is contained in:
2026-03-13 08:36:49 -04:00
parent a7899fb6b3
commit 896813983c
3 changed files with 6 additions and 17 deletions

View File

@@ -14,6 +14,7 @@ class Item < QboBaseModel
validates_presence_of :id, :description validates_presence_of :id, :description
validates :unit_price, numericality: { greater_than_or_equal_to: 0 } validates :unit_price, numericality: { greater_than_or_equal_to: 0 }
self.primary_key = :id self.primary_key = :id
qbo_sync push: true
# Updates Both local & remote DB description # Updates Both local & remote DB description
def description=(s) def description=(s)

View File

@@ -22,19 +22,7 @@ class ItemSyncService < SyncServiceBase
20 20
end end
# Map relevant attributes from the QBO Employee to the local Employee model map_attribute :active, :active?
def process_attributes(local, remote) map_attributes :description,, :id, :name, :sku, :unit_price
log "Processing Item ##{remote.id}"
local.id = remote.id
local.description = remote.description
local.unit_price = remote.unit_price
local.active = remote.active?
local.name = remote.name
local.sku = remote.sku
end
def log(msg)
Rails.logger.info "[ItemSyncService] #{msg}"
end
end end

View File

@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo_lineitems do
name 'Redmine QBO Line Items plugin' name 'Redmine QBO Line Items plugin'
author 'Rick Barrette' author 'Rick Barrette'
description 'A plugin for Redmine to extend the capabilitys of the Redmine QuickBooks Online plugin to attach billable line items to an isuue' description 'A plugin for Redmine to extend the capabilitys of the Redmine QuickBooks Online plugin to attach billable line items to an isuue'
version '2026.3.7' version '2026.3.8'
url 'https://github.com/rickbarrette/redmine_qbo_lineitems' url 'https://github.com/rickbarrette/redmine_qbo_lineitems'
author_url 'https://barrettefabrication.com' author_url 'https://barrettefabrication.com'
requires_redmine version_or_higher: '6.1.0' requires_redmine version_or_higher: '6.1.0'
@@ -22,7 +22,7 @@ Redmine::Plugin.register :redmine_qbo_lineitems do
# Ensure redmine_qbo is installed # Ensure redmine_qbo is installed
begin begin
requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.3.6' requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.3.7'
rescue Redmine::PluginNotFound rescue Redmine::PluginNotFound
raise 'Please install the redmine_qbo plugin (https://github.com/rickbarrette/redmine_qbo)' raise 'Please install the redmine_qbo plugin (https://github.com/rickbarrette/redmine_qbo)'
end end