mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-17 18:20:36 -05:00
QuickBooks doesn't tell apps which custom fields are inactive, and a field stays on its old estimates after it's turned off, so an inactive "Sales Rep old" kept showing and was filled in with the sales person. The billing settings now list the fields found, with a box to hide each; hidden fields are left out of the editor, the sales person and other plugins' field lookups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
3.6 KiB
ERB
69 lines
3.6 KiB
ERB
<div class="box tabular settings">
|
|
<p>
|
|
<label for="settings_expiration_days"><%= l(:label_estimate_expiration_days) %></label>
|
|
<%= number_field_tag 'settings[expiration_days]', @settings['expiration_days'], id: 'settings_expiration_days',
|
|
min: 0, step: 1, size: 6 %>
|
|
<em class="info"><%= l(:text_estimate_expiration_days) %></em>
|
|
</p>
|
|
<%# Labor: issues from estimates, lines imported time replaces on invoices, and hours for the business report.
|
|
While none are chosen, items named "Labor" are used and shown selected. %>
|
|
<p>
|
|
<label for="settings_labor_item_ids"><%= l(:label_labor_items) %></label>
|
|
<%= hidden_field_tag 'settings[labor_item_ids][]', '', id: nil %>
|
|
<%= select_tag 'settings[labor_item_ids][]',
|
|
options_from_collection_for_select(Item.sellable.order(:name), :id, :name,
|
|
RedmineQboBilling::LaborItems.item_ids),
|
|
multiple: true, size: 8, id: 'settings_labor_item_ids' %>
|
|
<em class="info"><%= l(:text_labor_items) %></em>
|
|
</p>
|
|
<%# QuickBooks custom fields to leave out of estimates and invoices (see RedmineQboBilling::Company). Hidden
|
|
fields that aren't found right now (e.g. no recent estimate has them) are kept as hidden. %>
|
|
<% company = RedmineQboBilling::Company %>
|
|
<% qbo_fields = company.all_custom_fields %>
|
|
<% hidden_ids = company.hidden_field_ids %>
|
|
<% sales_field = company.sales_person_field %>
|
|
<p class="qbo-custom-fields-setting">
|
|
<label><%= l(:label_qbo_hidden_custom_fields) %></label>
|
|
<%= hidden_field_tag 'settings[hidden_custom_field_ids][]', '', id: nil %>
|
|
<% (hidden_ids - qbo_fields.map { |f| f.id.to_i }).each do |id| %>
|
|
<%= hidden_field_tag 'settings[hidden_custom_field_ids][]', id, id: nil %>
|
|
<% end %>
|
|
<% if qbo_fields.empty? %>
|
|
<%= l(:label_none) %>
|
|
<% else %>
|
|
<% qbo_fields.each do |field| %>
|
|
<label class="block">
|
|
<%= check_box_tag 'settings[hidden_custom_field_ids][]', field.id, hidden_ids.include?(field.id.to_i),
|
|
id: "settings_hidden_custom_field_#{field.id}" %>
|
|
<%= field.name %>
|
|
<% if sales_field && sales_field.id.to_i == field.id.to_i %>
|
|
<em>(<%= l(:text_qbo_sales_person_field) %>)</em>
|
|
<% end %>
|
|
</label>
|
|
<% end %>
|
|
<% end %>
|
|
<%= link_to sprite_icon('reload', l(:button_refresh_quickbooks_fields)), refresh_company_qbo_estimates_path,
|
|
method: :post, class: 'icon icon-reload' %>
|
|
<em class="info"><%= l(:text_qbo_hidden_custom_fields) %></em>
|
|
</p>
|
|
</div>
|
|
|
|
<% issue_builder = RedmineQboBilling::EstimateIssueBuilder %>
|
|
<fieldset class="box tabular">
|
|
<legend><%= l(:label_estimate_issue_settings) %></legend>
|
|
<p>
|
|
<label for="settings_issue_default_project_id"><%= l(:label_default_project) %></label>
|
|
<%= select_tag 'settings[issue_default_project_id]',
|
|
project_tree_options_for_select(Project.active.sorted, selected: Project.find_by(id: issue_builder.default_project_id)),
|
|
include_blank: true, id: 'settings_issue_default_project_id' %>
|
|
<em class="info"><%= l(:text_default_project_info) %></em>
|
|
</p>
|
|
<p>
|
|
<label for="settings_issue_default_tracker_id"><%= l(:label_default_tracker) %></label>
|
|
<%= select_tag 'settings[issue_default_tracker_id]',
|
|
options_from_collection_for_select(Tracker.sorted, :id, :name, issue_builder.default_tracker_id),
|
|
include_blank: true, id: 'settings_issue_default_tracker_id' %>
|
|
<em class="info"><%= l(:text_default_tracker_info) %></em>
|
|
</p>
|
|
</fieldset>
|