-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement corporate pricing into invoice items #546
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class InvoiceItem < ApplicationRecord | ||
validates_presence_of :memo, :category, :price | ||
validates_presence_of :memo, :category, :price, :corporate | ||
validates_inclusion_of :category, :in => InvoiceLine::Invoice_Categories | ||
validates_numericality_of :price | ||
validates_numericality_of :price, :corporate | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,11 @@ | |
<option></option> | ||
|
||
<% InvoiceItem.all.each do |item| %> | ||
<option data-memo="<%= item.memo %>" data-category="<%= item.category %>" data-price="<%= item.price %>"><%= item.memo %></option> | ||
<% if @invoice.payment_type == "Oracle" %> | ||
<option data-memo="<%= item.memo %>" data-category="<%= item.category %>" data-price="<%= item.corporate %>"><%= item.memo %></option> | ||
<% else %> | ||
<option data-memo="<%= item.memo %>" data-category="<%= item.category %>" data-price="<%= item.price %>"><%= item.memo %></option> | ||
<% end %> | ||
Comment on lines
+11
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not certain if this is the best way to detect corporate pricing. In a lot of cases you won't have an Oracle string at first, and there have been cases where you have an Oracle string but it goes to a student org. I don't think we want to cause people to input incorrect data/omit data simply to switch pricing. It would probably be better to have a separate checkbox implemented only in JavaScript (that switches the select boxes). However, I think you can do this a slightly different way. See other comments. |
||
<% end %> | ||
</select> | ||
</td> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class ChangeInvoiceItemPriceToFloat < ActiveRecord::Migration[6.1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is missing the float migration and new column. |
||
def change | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename this to
corporate_price
to be more specific.