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.
def gross_price
((price + deposit) * (tax / 100 + 1))
((price + deposit) * (tax / 100 + 1)).round(2)
end
# The price for the foodcoop-member.
def fc_price
(gross_price * (APP_CONFIG[:price_markup] / 100 + 1))
(gross_price * (APP_CONFIG[:price_markup] / 100 + 1)).round(2)
end
end

View file

@ -2,7 +2,7 @@
#element_navigation
= 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
@ -30,9 +30,9 @@
%b=h number_to_currency(@group_order.price)
- else
%b Du hast nicht bestellt.
%p
= "Abgerechnet von #{@order.updated_by.nick}" if @order.finished?
= "<b>Bestellung</b>" if @order.closed?
- if @order.closed?
%p
= "Abgerechnet von #{@order.updated_by.nick}"
= link_to "Kommentare lesen/schreiben", "#comments"
// directly switch to active orders

View file

@ -39,7 +39,7 @@
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>" valign="top">
<td class="name">
<% 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 %>
<%= order_article.article.name %>
<% end %>
@ -81,20 +81,20 @@
<tfoot>
<tr>
<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>
<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>
<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>
<td style="text-align:left;"><%= link_to_top %></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>
</tfoot>
</table>

View file

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

View file

@ -2,6 +2,6 @@
- form_for @order do |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
Neue Bestellung anlegen für
%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
%br/
.left_column{:style => "width:55em"}
@ -27,13 +27,13 @@
%td=h order.name
%td=h format_time(order.ends) unless order.ends.nil?
%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
= link_to "Anzeigen", 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
=_ "There aren't open orders at the moment."
Derzeit gibt es keine laufende Bestellungen.
.left_column{:style => "width:75em"}
.box_title

View file

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

View file

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

View file

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