Some language fixes. Finished migration path.

This commit is contained in:
Benjamin Meichsner 2009-03-01 18:45:34 +01:00
parent 857475af1b
commit a29053b4e9
9 changed files with 172 additions and 169 deletions

View file

@ -34,11 +34,11 @@ class ArticlePrice < ActiveRecord::Base
# The financial gross, net plus tax and deposit. # The financial gross, net plus tax and deposit.
def gross_price def gross_price
((price + deposit) * (tax / 100 + 1)) ((price + deposit) * (tax / 100 + 1)).round(2)
end end
# The price for the foodcoop-member. # The price for the foodcoop-member.
def fc_price def fc_price
(gross_price * (APP_CONFIG[:price_markup] / 100 + 1)) (gross_price * (APP_CONFIG[:price_markup] / 100 + 1)).round(2)
end end
end end

View file

@ -2,7 +2,7 @@
#element_navigation #element_navigation
= link_to_unless @order.previous == @order, "<< #{@order.previous.name}", :action => "my_order_result", :id => @order.previous = link_to_unless @order.previous == @order, "<< #{@order.previous.name}", :action => "my_order_result", :id => @order.previous
| |
= link_to _("Overview"), :controller => 'ordering' = link_to "Übersicht", :controller => 'ordering'
| |
= link_to_unless @order.next == @order, "#{@order.next.name} >>", :action => "my_order_result", :id => @order.next = link_to_unless @order.next == @order, "#{@order.next.name} >>", :action => "my_order_result", :id => @order.next
@ -30,9 +30,9 @@
%b=h number_to_currency(@group_order.price) %b=h number_to_currency(@group_order.price)
- else - else
%b Du hast nicht bestellt. %b Du hast nicht bestellt.
%p - if @order.closed?
= "Abgerechnet von #{@order.updated_by.nick}" if @order.finished? %p
= "<b>Bestellung</b>" if @order.closed? = "Abgerechnet von #{@order.updated_by.nick}"
= link_to "Kommentare lesen/schreiben", "#comments" = link_to "Kommentare lesen/schreiben", "#comments"
// directly switch to active orders // directly switch to active orders

View file

@ -39,7 +39,7 @@
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>" valign="top"> <tr class="<%= cycle('even', 'odd', :name => 'articles') %>" valign="top">
<td class="name"> <td class="name">
<% unless order_article.article.note.blank? %> <% unless order_article.article.note.blank? %>
<%= order_article.article.name %> <%= image_tag "lamp_grey.png", {:alt => _("Show note"), :size => "15x16", :border => "0", :onmouseover => "$('note_#{i}').show();", :onmouseout => "$('note_#{i}').hide();" }%> <%= order_article.article.name %> <%= image_tag "lamp_grey.png", {:alt => "Notiz zeigen", :size => "15x16", :border => "0", :onmouseover => "$('note_#{i}').show();", :onmouseout => "$('note_#{i}').hide();" }%>
<% else %> <% else %>
<%= order_article.article.name %> <%= order_article.article.name %>
<% end %> <% end %>
@ -81,20 +81,20 @@
<tfoot> <tfoot>
<tr> <tr>
<td colspan="6"></td> <td colspan="6"></td>
<td colspan="3" class="currency"><%=_ "Total amount" %>: <span id="total_price"><%= total %></span> €</td> <td colspan="3" class="currency">Gesamtbetrag: <span id="total_price"><%= total %></span> €</td>
</tr> </tr>
<tr> <tr>
<td colspan="6"></td> <td colspan="6"></td>
<td colspan="3" class="currency"><%=_ "Credit available"%>: <%= number_to_currency(@availableFunds) %></td> <td colspan="3" class="currency">Verfügbares Guthaben: <%= number_to_currency(@availableFunds) %></td>
</tr> </tr>
<tr> <tr>
<td colspan="6"></td> <td colspan="6"></td>
<td colspan="3" class="currency"><%=_ "New account balance"%>: <strong><span id="new_balance"><%= @ordergroup.account_balance - total %></span> €</strong></td> <td colspan="3" class="currency">Neuer Kontostand: <strong><span id="new_balance"><%= @ordergroup.account_balance - total %></span> €</strong></td>
</tr> </tr>
<tr> <tr>
<td style="text-align:left;"><%= link_to_top %></td> <td style="text-align:left;"><%= link_to_top %></td>
<td colspan="5"></td> <td colspan="5"></td>
<td colspan="3" style="text-align:right;"><span style="font-size:1.2em"><%= submit_tag( _("Save order"), :id => 'submit_button' ) %></span> | <%= link_to _("Cancel"), :controller => 'ordering' %></td> <td colspan="3" style="text-align:right;"><span style="font-size:1.2em"><%= submit_tag( "Bestellung speichern", :id => 'submit_button' ) %></span> | <%= link_to "Abbrechen", :controller => 'ordering' %></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View file

@ -67,7 +67,7 @@
%tr %tr
%td{:colspan => "6"} %td{:colspan => "6"}
= check_box_tag 'checkall', "1", false, { :onclick => "checkUncheckAll(this)" } = check_box_tag 'checkall', "1", false, { :onclick => "checkUncheckAll(this)" }
=_ "Select all" Alle auswählen
- if (@template_orders && !@template_orders.empty?) - if (@template_orders && !@template_orders.empty?)
= render :partial => 'template_orders_script' = render :partial => 'template_orders_script'

View file

@ -2,6 +2,6 @@
- form_for @order do |form| - form_for @order do |form|
= render :partial => 'form', :locals => { :form => form } = render :partial => 'form', :locals => { :form => form }
= submit_tag _("Save") = submit_tag "Speichern"
| |
= link_to _("Cancel"), :action => 'show', :id => @order = link_to "Abbrechen", :action => 'show', :id => @order

View file

@ -5,7 +5,7 @@
- form_tag do - form_tag do
Neue Bestellung anlegen für Neue Bestellung anlegen für
%select{:onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;"} %select{:onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;"}
%option{:selected => 'selected'}=_ "Choose a supplier..." %option{:selected => 'selected'} Lieferant auswählen...
= options_for_suppliers_to_select = options_for_suppliers_to_select
%br/ %br/
.left_column{:style => "width:55em"} .left_column{:style => "width:55em"}
@ -27,13 +27,13 @@
%td=h order.name %td=h order.name
%td=h format_time(order.ends) unless order.ends.nil? %td=h format_time(order.ends) unless order.ends.nil?
%td=h truncate(order.note) %td=h truncate(order.note)
%td= link_to "Beenden", finish_order_path(order), :confirm => _("Are you really sure to finish the order?"), :method => :post %td= link_to "Beenden", finish_order_path(order), :confirm => "Bist Du sicher die Bestellung zu beenden?", :method => :post
%td %td
= link_to "Anzeigen", order = link_to "Anzeigen", order
= link_to icon(:edit), edit_order_path(order) = link_to icon(:edit), edit_order_path(order)
= link_to icon(:delete), order, :confirm => _("Are you really sure you want to destroy the order?"), :method => :delete = link_to icon(:delete), order, :confirm => "Bist Du sicher die Bestellung zu beenden?", :method => :delete
- else - else
=_ "There aren't open orders at the moment." Derzeit gibt es keine laufende Bestellungen.
.left_column{:style => "width:75em"} .left_column{:style => "width:75em"}
.box_title .box_title

View file

@ -18,13 +18,13 @@ pdf.text "Insgesamt #{order_articles.size} Artikel", :size => 8
pdf.move_down 10 pdf.move_down 10
order_articles_data = order_articles.collect do |a| order_articles_data = order_articles.collect do |a|
[a.article.name, a.article.unit, a.price.unit_quantity, a.price.fc_price, a.units_to_order] [a.article.name, a.article.unit, a.price.unit_quantity, number_with_precision(a.price.fc_price), a.units_to_order]
end end
pdf.table order_articles_data, pdf.table order_articles_data,
:font_size => 8, :font_size => 8,
:border_style => :grid, :border_style => :grid,
:vertical_padding => 3, :vertical_padding => 3,
:headers => ["Artikel", "Einheit", "Gebinde", "Preis", "Menge"], :headers => ["Artikel", "Einheit", "Gebinde", "FC-Preis", "Menge"],
:align => { 3 => :right } :align => { 3 => :right }
@ -46,15 +46,15 @@ while (page_number * max_order_articles_per_page < total_num_order_articles) do
header = [""] header = [""]
for header_article in current_order_articles for header_article in current_order_articles
name = header_article.article.name.split("-").join(" ").split(".").join(". ").split("/").join(" ") name = header_article.article.name.split("-").join(" ").split(".").join(". ").split("/").join(" ")
name = name.split.collect { |w| truncate(w, 8, "..") }.join(" ") name = name.split.collect { |w| truncate(w, :length => 8, :omission => "..") }.join(" ")
header << truncate(name, 30, " ..") header << truncate(name, :length => 30, :omission => " ..")
end end
# Collect group results # Collect group results
groups_data = [] groups_data = []
for group_order in @order.group_orders.all(:include => :ordergroup) for group_order in @order.group_orders.all(:include => :ordergroup)
group_result = [truncate(group_order.ordergroup.name, 20)] group_result = [truncate(group_order.ordergroup.name, :length => 20)]
for order_article in current_order_articles for order_article in current_order_articles
# get the Ordergroup result for this order_article # get the Ordergroup result for this order_article

View file

@ -2,7 +2,7 @@
#element_navigation #element_navigation
= link_to_unless @order.previous == @order, "<< #{@order.previous.name}", @order.previous = link_to_unless @order.previous == @order, "<< #{@order.previous.name}", @order.previous
| |
= link_to _("Overview"), orders_path = link_to "Übersicht", orders_path
| |
= link_to_unless @order.next == @order, "#{@order.next.name} >>", @order.next = link_to_unless @order.next == @order, "#{@order.next.name} >>", @order.next
@ -13,7 +13,7 @@
.column_content .column_content
- if @order.finished? and !@order.closed? - if @order.finished? and !@order.closed?
%p %p
%b{:style => "color:red"}=_ "Order isn't closed yet" %b{:style => "color:red"} Bestellung wurde noch nicht abgerechnet.
%p %p
Lieferant: Lieferant:
%b=h @order.name %b=h @order.name
@ -33,7 +33,7 @@
= "[#{@order.group_orders.find(:all, :include => :ordergroup).collect{|g| g.ordergroup.name}.join(', ')}]" = "[#{@order.group_orders.find(:all, :include => :ordergroup).collect{|g| g.ordergroup.name}.join(', ')}]"
%p %p
Netto/Bruttosumme aller Artikel Netto/Bruttosumme aller Artikel:
%b= "#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))}" %b= "#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))}"
%p %p
Bestellte Artikel: Bestellte Artikel:

View file

@ -1,148 +1,151 @@
class OrderGroup < Group; end # Needed for renaming of OrderGroup to Ordergroup
class RoadToVersionThree < ActiveRecord::Migration class RoadToVersionThree < ActiveRecord::Migration
def self.up def self.up
# TODO: Combine migrations since foodsoft3-development into one file # TODO: Combine migrations since foodsoft3-development into one file
# and try to build a migration path from old data. # and try to build a migration path from old data.
# # == Message # == Message
# drop_table :messages drop_table :messages
# create_table :messages do |t| create_table :messages do |t|
# t.references :sender t.references :sender
# t.text :recipients_ids t.text :recipients_ids
# t.string :subject, :null => false t.string :subject, :null => false
# t.text :body t.text :body
# t.integer :email_state, :default => 0, :null => false t.integer :email_state, :default => 0, :null => false
# t.boolean :private, :default => false t.boolean :private, :default => false
# t.datetime :created_at t.datetime :created_at
# end end
#
# # Acts_as_paranoid # Acts_as_paranoid
# add_column :suppliers, :deleted_at, :datetime add_column :suppliers, :deleted_at, :datetime
# add_column :articles, :deleted_at, :datetime add_column :articles, :deleted_at, :datetime
# add_column :groups, :deleted_at, :datetime add_column :groups, :deleted_at, :datetime
#
# # == Workgroups # == Workgroups
# # Migrate all groups to workgroups puts "Migrate all groups to workgroups.."
# Group.find(:all, :conditions => { :type => "" }).each do |workgroup| Group.find(:all, :conditions => { :type => "" }).each do |workgroup|
# workgroup.update_attribute(:type, "Workgroup") workgroup.update_attribute(:type, "Workgroup")
# end end
#
# # == Ordergroups # == Ordergroups
# remove_column :groups, :actual_size # Useless, desposits are better stored within a transaction.note remove_column :groups, :actual_size # Useless, desposits are better stored within a transaction.note
# # rename from OrderGroup to Ordergroup # rename from OrderGroup to Ordergroup
# rename_column :financial_transactions, :order_group_id, :ordergroup_id rename_column :financial_transactions, :order_group_id, :ordergroup_id
# rename_column :group_orders, :order_group_id, :ordergroup_id rename_column :group_orders, :order_group_id, :ordergroup_id
# rename_column :tasks, :group_id, :workgroup_id rename_column :tasks, :group_id, :workgroup_id
# remove_index :group_orders, :name => "index_group_orders_on_order_group_id_and_order_id" remove_index :group_orders, :name => "index_group_orders_on_order_group_id_and_order_id"
# add_index :group_orders, [:ordergroup_id, :order_id], :unique => true add_index :group_orders, [:ordergroup_id, :order_id], :unique => true
#
# Group.find(:all, :conditions => { :type => "OrderGroup" }).each do |ordergroup| Group.find(:all, :conditions => { :type => "OrderGroup" }).each do |ordergroup|
# ordergroup.update_attribute(:type, "Ordergroup") ordergroup.update_attribute(:type, "Ordergroup")
# end end
# # move contact-infos from users to ordergroups # move contact-infos from users to ordergroups
# add_column :groups, :contact_person, :string add_column :groups, :contact_person, :string
# add_column :groups, :contact_phone, :string add_column :groups, :contact_phone, :string
# add_column :groups, :contact_address, :string add_column :groups, :contact_address, :string
# Ordergroup.all.each do |ordergroup| Ordergroup.all.each do |ordergroup|
# contact = ordergroup.users.first contact = ordergroup.users.first
# if contact if contact
# ordergroup.update_attributes :contact_person => contact.name, ordergroup.update_attributes :contact_person => contact.name,
# :contact_phone => contact.phone, :contact_address => contact.address :contact_phone => contact.phone, :contact_address => contact.address
# end end
# end end
# remove_column :users, :address remove_column :users, :address
#
# # == Order # == Order
# drop_table :orders drop_table :orders
# drop_table :group_order_results drop_table :group_order_results
# drop_table :order_article_results drop_table :order_article_results
# drop_table :group_order_article_results drop_table :group_order_article_results
# GroupOrder.delete_all; OrderArticle.delete_all; GroupOrderArticle.delete_all; GroupOrderArticleQuantity.delete_all GroupOrder.delete_all; OrderArticle.delete_all; GroupOrderArticle.delete_all; GroupOrderArticleQuantity.delete_all
#
# create_table :orders do |t| create_table :orders do |t|
# t.references :supplier t.references :supplier
# t.text :note t.text :note
# t.datetime :starts t.datetime :starts
# t.datetime :ends t.datetime :ends
# t.string :state, :default => "open" # Statemachine ... open -> finished -> closed t.string :state, :default => "open" # Statemachine ... open -> finished -> closed
# t.integer :lock_version, :default => 0, :null => false t.integer :lock_version, :default => 0, :null => false
# t.integer :updated_by_user_id t.integer :updated_by_user_id
# end end
#
# # == Invoice # == Invoice
# create_table :invoices do |t| create_table :invoices do |t|
# t.references :supplier t.references :supplier
# t.references :delivery t.references :delivery
# t.references :order t.references :order
# t.string :number t.string :number
# t.date :date t.date :date
# t.date :paid_on t.date :paid_on
# t.text :note t.text :note
# t.decimal :amount, :null => false, :precision => 8, :scale => 2, :default => 0.0 t.decimal :amount, :null => false, :precision => 8, :scale => 2, :default => 0.0
# t.decimal :deposit, :precision => 8, :scale => 2, :default => 0.0, :null => false t.decimal :deposit, :precision => 8, :scale => 2, :default => 0.0, :null => false
# t.decimal :deposit_credit, :precision => 8, :scale => 2, :default => 0.0, :null => false t.decimal :deposit_credit, :precision => 8, :scale => 2, :default => 0.0, :null => false
# t.timestamps t.timestamps
# end end
#
# # == Delivery # == Delivery
# create_table :deliveries do |t| create_table :deliveries do |t|
# t.integer :supplier_id t.integer :supplier_id
# t.date :delivered_on t.date :delivered_on
# t.datetime :created_at t.datetime :created_at
# end end
#
# # == Comment # == Comment
# drop_table :comments drop_table :comments
# create_table :order_comments do |t| create_table :order_comments do |t|
# t.references :order t.references :order
# t.references :user t.references :user
# t.text :text t.text :text
# t.datetime :created_at t.datetime :created_at
# end end
#
# # == Article # == Article
# rename_column :articles, :net_price, :price rename_column :articles, :net_price, :price
# remove_column :articles, :gross_price remove_column :articles, :gross_price
#
# # == ArticlePrice # == ArticlePrice
# create_table :article_prices do |t| create_table :article_prices do |t|
# t.references :article t.references :article
# t.decimal :price, :precision => 8, :scale => 2, :default => 0.0, :null => false t.decimal :price, :precision => 8, :scale => 2, :default => 0.0, :null => false
# t.decimal :tax, :precision => 8, :scale => 2, :default => 0.0, :null => false t.decimal :tax, :precision => 8, :scale => 2, :default => 0.0, :null => false
# t.decimal :deposit, :precision => 8, :scale => 2, :default => 0.0, :null => false t.decimal :deposit, :precision => 8, :scale => 2, :default => 0.0, :null => false
# t.integer :unit_quantity t.integer :unit_quantity
# t.datetime :created_at t.datetime :created_at
# end end
# # Create price history for every Article # Create price history for every Article
# Article.all.each do |a| Article.all.each do |a|
# a.article_prices.create :price => a.price, :tax => a.tax, a.article_prices.create :price => a.price, :tax => a.tax,
# :deposit => a.deposit, :unit_quantity => a.unit_quantity :deposit => a.deposit, :unit_quantity => a.unit_quantity
# end end
# # Every Article has now a Category. Fix it if neccessary. # Every Article has now a Category. Fix it if neccessary.
# Article.all(:conditions => { :article_category_id => nil }).each do |article| Article.all(:conditions => { :article_category_id => nil }).each do |article|
# article.update_attribute(:article_category, ArticleCategory.first) article.update_attribute(:article_category, ArticleCategory.first)
# end end
# # order-articles # order-articles
# add_column :order_articles, :article_price_id, :integer add_column :order_articles, :article_price_id, :integer
#
# # == GroupOrder # == GroupOrder
# change_column :group_orders, :updated_by_user_id, :integer, :default => nil, :null => true change_column :group_orders, :updated_by_user_id, :integer, :default => nil, :null => true
#
# # == GroupOrderArticle # == GroupOrderArticle
# # The total order result in ordergroup is now saved! # The total order result in ordergroup is now saved!
# add_column :group_order_articles, :result, :integer, :default => nil add_column :group_order_articles, :result, :integer, :default => nil
#
# # == StockArticle # == StockArticle
# add_column :articles, :type, :string add_column :articles, :type, :string
# add_column :articles, :quantity, :integer, :default => 0 add_column :articles, :quantity, :integer, :default => 0
#
# # == StockChanges # == StockChanges
# create_table :stock_changes do |t| create_table :stock_changes do |t|
# t.references :delivery t.references :delivery
# t.references :order t.references :order
# t.references :stock_article t.references :stock_article
# t.integer :quantity, :default => 0 t.integer :quantity, :default => 0
# t.datetime :created_at t.datetime :created_at
# end end
# == StockTaking # == StockTaking
create_table :stock_takings do |t| create_table :stock_takings do |t|
@ -152,9 +155,9 @@ class RoadToVersionThree < ActiveRecord::Migration
end end
add_column :stock_changes, :stock_taking_id, :integer add_column :stock_changes, :stock_taking_id, :integer
# # == User # == User
# # Ativate all Users for notification on upcoming tasks # Ativate all Users for notification on upcoming tasks
# User.all.each { |u| u.settings['notify.upcoming_tasks'] = 1 } User.all.each { |u| u.settings['notify.upcoming_tasks'] = 1 }
end end
def self.down def self.down