Compare commits

..
4 Commits
4 changed files with 41 additions and 44 deletions
+6 -2
View File
@@ -20,6 +20,9 @@ class Customer < QboBaseModel
before_validation :normalize_phone_numbers
self.primary_key = :id
qbo_sync push: true
# Normalize the local database column :name
normalizes :name, with: ->(name) { name.to_s.strip.titleize }
acts_as_searchable columns: %w[name phone_number mobile_phone_number ],
scope: ->(_context) { left_joins(:project) },
@@ -61,8 +64,9 @@ class Customer < QboBaseModel
# Updates Both local DB name & QBO display_name
def name=(s)
details.display_name = s
super
super(s)
# Write the normalized value from Active Record to QBO details
details.display_name = self.name
end
# Normalizes phone numbers by removing non-digit characters. This method is called before validation to ensure that phone numbers are stored in a consistent format, which can help with searching and integration with external systems like QuickBooks Online.
+25 -29
View File
@@ -2,59 +2,55 @@
<tbody>
<tr>
<th><%=t(:label_name)%></th>
<th><%= t(:label_name) %></th>
<td><%= customer.name %></td>
</tr>
<tr>
<th><%=t(:label_email)%></th>
<th><%= t(:label_email) %></th>
<td><%= customer.email %></td>
</tr>
<tr>
<th><%=t(:label_primary_phone)%></th>
<th><%= t(:label_primary_phone) %></th>
<td><%= number_to_phone(customer&.primary_phone&.gsub(/[^\d]/, '').to_i, area_code: true) %></td>
</tr>
<tr>
<th><%=t(:label_mobile_phone)%></th>
<th><%= t(:label_mobile_phone) %></th>
<td><%= number_to_phone(customer&.mobile_phone&.gsub(/[^\d]/, '').to_i, area_code: true) %></td>
</tr>
<tr>
<th><%=t(:label_billing_address)%></th>
<td><pre><%= @billing_address %></pre></td>
</tr>
<tr>
<th><%=t(:label_shipping_address)%></th>
<td><pre><%= @shipping_address %></pre></td>
<tr>
<th><%= t(:label_billing_address) %></th>
<td><pre><%= @billing_address %></pre></td>
</tr>
<tr>
<th><%=t(:label_account_balance)%></th>
<td>$<%= customer.balance %></td>
<th><%= t(:label_shipping_address) %></th>
<td><pre><%= @shipping_address %></pre></td>
</tr>
<tr>
<th colspan="2"><h4><%=t(:field_notes)%></hr></th>
<th><%= t(:label_account_balance) %></th>
<td>$<%= customer.balance %></td>
</tr>
<% if customer.notes.present? %>
<tr>
<th colspan="2"><h4><%= t(:field_notes) %></h4></th>
</tr>
<tr>
<td colspan="2">
<pre id="note-display" style="text-align: left; white-space: pre-wrap; font-family: inherit;">
<%= customer.notes %>
</pre>
</td>
</tr>
<script>
const preElement = document.getElementById('note-display');
// This takes the text, trims the edges, and puts it back
preElement.textContent = preElement.textContent.trim();
</script>
<tr>
<td colspan="2">
<div class="wiki">
<%= textilizable(customer, :notes) %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
<br/>
<br/>
<br/>
+9 -12
View File
@@ -32,20 +32,17 @@
</div>
</div>
<div class="clearfix">
<div class="clearfix">
<%=t(:field_notes)%>:
<div class="input">
<p>
<%= content_tag :span, id: "issue_description_and_toolbar" do %>
<%= f.text_area :notes,
cols: 60,
rows: 10,
accesskey: accesskey(:edit),
class: 'wiki-edit',
no_label: true %>
<% end %>
</p>
<%= wikitoolbar_for :issue_description %>
<p>
<%= f.text_area :notes,
rows: 8,
class: 'wiki-edit',
style: 'width: 95%;',
id: 'customer_appointment_description' %>
<%= wikitoolbar_for 'customer_appointment_description' %>
</p>
</div>
</div>
+1 -1
View File
@@ -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.17'
version '2026.8.1'
url 'https://github.com/rickbarrette/redmine_qbo'
author_url 'https://barrettefabrication.com'
settings default: {empty: true}, partial: 'qbo/settings'