From 1d29d2a8165d0b4a729033c8ae28eff3c39fdaf9 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Sat, 7 Mar 2026 12:49:34 -0500 Subject: [PATCH] Don't save blank line items --- app/views/line_items/_line_item_fields.html.erb | 2 +- lib/redmine_qbo_line_items/patches/issue_patch.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/line_items/_line_item_fields.html.erb b/app/views/line_items/_line_item_fields.html.erb index a596f97..8b4bf5c 100644 --- a/app/views/line_items/_line_item_fields.html.erb +++ b/app/views/line_items/_line_item_fields.html.erb @@ -13,7 +13,7 @@ <%= f.number_field :quantity, step: 1, - min: 1, + min: 0, style: "width:90px;", no_label: true, disabled: readonly %> diff --git a/lib/redmine_qbo_line_items/patches/issue_patch.rb b/lib/redmine_qbo_line_items/patches/issue_patch.rb index ccc155a..ad211c7 100644 --- a/lib/redmine_qbo_line_items/patches/issue_patch.rb +++ b/lib/redmine_qbo_line_items/patches/issue_patch.rb @@ -20,7 +20,9 @@ module RedmineQboLineItems base.class_eval do has_many :line_items, dependent: :destroy - accepts_nested_attributes_for :line_items, allow_destroy: true + accepts_nested_attributes_for :line_items, + allow_destroy: true, + reject_if: proc { |attrs| attrs['description'].blank? } end end