Add GnuCash related fields to the CompanyInfo and Customer model

This commit is contained in:
Paul van Tilburg 2016-03-06 14:56:37 +01:00
parent 7184248ccd
commit f87954b73d
1 changed files with 26 additions and 2 deletions

View File

@ -236,6 +236,8 @@ module StopTime::Models
# @!attribute time_specification
# @return [Boolean] flag whether the customer requires time
# specifications
# @!attribute gnucash_customer_owner_id
# @return [String] owner ID used in GnuCash for this customer
# @!attribute created_at
# @return [Time] time of creation
# @!attribute updated_at
@ -630,6 +632,8 @@ module StopTime::Models
# @return [String] number of the bank account
# @!attribute accountiban
# @return [String] international bank account number
# @!attribute gnucash_revenues_account_name
# @return [String] account name used in GnuCash for the revenues account
# @!attribute created_at
# @return [Time] time of creation
# @!attribute updated_at
@ -887,6 +891,19 @@ module StopTime::Models
end
end
# @private
class GnuCashInvoiceExportSupport < V 1.96
def self.up
add_column(CompanyInfo.table_name, :gnucash_revenues_account_name, :string)
add_column(Customer.table_name, :gnucash_customer_owner_id, :string)
end
def self.down
remove_column(CompanyInfo.table_name, :gnucash_revenues_account_name)
remove_column(Customer.table_name, :gnucash_customer_owner_id)
end
end
end # StopTime::Models
# = The Stop… Camping Time! helpers
@ -1085,7 +1102,7 @@ module StopTime::Controllers
elsif @input.has_key? "update"
attrs = ["name", "short_name", "financial_contact",
"address_street", "address_postal_code", "address_city",
"email", "phone", "hourly_rate"]
"email", "phone", "hourly_rate", "gnucash_customer_owner_id"]
attrs.each do |attr|
@customer[attr] = @input[attr]
end
@ -1738,7 +1755,8 @@ module StopTime::Controllers
"country", "country_code",
"phone", "cell", "email", "website",
"chamber", "vatno",
"bank_name", "bank_bic", "accountno", "accountiban"]
"bank_name", "bank_bic", "accountno", "accountiban",
"gnucash_revenues_account_name"]
attrs.each do |attr|
@company[attr] = @input[attr]
end
@ -2163,6 +2181,8 @@ module StopTime::Views
_form_input_with_label("Default hourly rate", "hourly_rate", :text,
control_class: "col-sm-4 col-xs-5",
input_addon: "€ / h")
_form_input_with_label("GnuCash owner ID",
"gnucash_customer_owner_id", :text)
div.form_group do
label.control_label.col_sm_3.col_xs_4 "Time specifications?"
div.col_sm_6.col_xs_8 do
@ -2853,6 +2873,10 @@ module StopTime::Views
_form_input_with_label("Intl. account number", "accountiban", :text,
control_class: "col-sm-5 col-xs-6")
h3 "GnuCash export information"
_form_input_with_label("Revenues account name",
"gnucash_revenues_account_name", :text)
div.form_group do
div.col_sm_offset_3.col_sm_6.col_xs_offset_4.col_xs_8 do
button.btn.btn_primary "Update", type: "submit",