Merge branch 'master' into master-to-rails3
Conflicts: Gemfile README_DEVEL app/controllers/articles_controller.rb app/controllers/orders_controller.rb app/controllers/tasks_controller.rb app/models/task.rb app/views/articles/_import_search_results.haml app/views/articles/index.haml app/views/messages/new.haml app/views/ordering/_order_head.haml app/views/ordering/my_order_result.haml app/views/orders/show.haml app/views/stockit/new.html.haml db/schema.rb
This commit is contained in:
commit
0edd29dfd4
15 changed files with 44 additions and 22 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@ nbproject/
|
||||||
config/environments/development.rb
|
config/environments/development.rb
|
||||||
capfile
|
capfile
|
||||||
*.swp
|
*.swp
|
||||||
|
*~
|
||||||
public/**/*_cached.*
|
public/**/*_cached.*
|
||||||
.idea
|
.idea
|
||||||
.get-dump.yml
|
.get-dump.yml
|
||||||
|
|
1
Gemfile
1
Gemfile
|
@ -1,5 +1,6 @@
|
||||||
# A sample Gemfile
|
# A sample Gemfile
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
ruby "1.9.3"
|
||||||
|
|
||||||
gem "rails", '3.2.9'
|
gem "rails", '3.2.9'
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,7 @@ class TasksController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@task = Task.find(params[:id])
|
@task = Task.find(params[:id])
|
||||||
@task.attributes=(params[:task])
|
@task.attributes=(params[:task])
|
||||||
if @task.errors.empty?
|
if @task.errors.empty? && @task.save
|
||||||
@task.save
|
|
||||||
flash[:notice] = "Aufgabe wurde aktualisiert"
|
flash[:notice] = "Aufgabe wurde aktualisiert"
|
||||||
if @task.workgroup
|
if @task.workgroup
|
||||||
redirect_to workgroup_tasks_url(workgroup_id: @task.workgroup_id)
|
redirect_to workgroup_tasks_url(workgroup_id: @task.workgroup_id)
|
||||||
|
|
|
@ -139,6 +139,12 @@ module ApplicationHelper
|
||||||
:target => "_blank"
|
:target => "_blank"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# offers a link for writing message to user
|
||||||
|
# checks for nil (useful for relations)
|
||||||
|
def link_to_user_message_if_valid(user)
|
||||||
|
user.nil? ? '??' : ( link_to user.nick, user_message_path(user), :title => 'Nachricht schreiben' )
|
||||||
|
end
|
||||||
|
|
||||||
def bootstrap_flash
|
def bootstrap_flash
|
||||||
flash_messages = []
|
flash_messages = []
|
||||||
flash.each do |type, message|
|
flash.each do |type, message|
|
||||||
|
|
|
@ -12,13 +12,17 @@ class Order < ActiveRecord::Base
|
||||||
has_many :comments, :class_name => "OrderComment", :order => "created_at"
|
has_many :comments, :class_name => "OrderComment", :order => "created_at"
|
||||||
has_many :stock_changes
|
has_many :stock_changes
|
||||||
belongs_to :supplier
|
belongs_to :supplier
|
||||||
belongs_to :updated_by, :class_name => "User", :foreign_key => "updated_by_user_id"
|
belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by_user_id'
|
||||||
|
belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by_user_id'
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
validates_presence_of :starts
|
validates_presence_of :starts
|
||||||
validate :starts_before_ends, :include_articles
|
validate :starts_before_ends, :include_articles
|
||||||
|
|
||||||
# Callbacks
|
# Callbacks
|
||||||
|
before_create do |order|
|
||||||
|
order.created_by = User.current_user
|
||||||
|
end
|
||||||
after_update :update_price_of_group_orders
|
after_update :update_price_of_group_orders
|
||||||
after_save :save_order_articles
|
after_save :save_order_articles
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,5 @@ class SharedSupplier < ActiveRecord::Base
|
||||||
has_one :supplier
|
has_one :supplier
|
||||||
has_many :shared_articles, :foreign_key => :supplier_id
|
has_many :shared_articles, :foreign_key => :supplier_id
|
||||||
|
|
||||||
# save the lists as an array
|
|
||||||
serialize :lists
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,10 @@ class Task < ActiveRecord::Base
|
||||||
|
|
||||||
# Get users from comma seperated ids
|
# Get users from comma seperated ids
|
||||||
# and makes the users responsible for the task
|
# and makes the users responsible for the task
|
||||||
|
# TODO: check for maximal number of users
|
||||||
def user_list=(ids)
|
def user_list=(ids)
|
||||||
list = ids.split(",")
|
list = ids.split(",")
|
||||||
new_users = list - users.collect(&:id)
|
new_users = (list - users.collect(&:id)).uniq
|
||||||
old_users = users.reject { |user| list.include?(user.id) }
|
old_users = users.reject { |user| list.include?(user.id) }
|
||||||
|
|
||||||
logger.debug "[debug] New users: #{new_users}"
|
logger.debug "[debug] New users: #{new_users}"
|
||||||
|
|
|
@ -17,6 +17,7 @@ class User < ActiveRecord::Base
|
||||||
has_many :tasks, :through => :assignments
|
has_many :tasks, :through => :assignments
|
||||||
has_many :send_messages, :class_name => "Message", :foreign_key => "sender_id"
|
has_many :send_messages, :class_name => "Message", :foreign_key => "sender_id"
|
||||||
has_many :pages, :foreign_key => 'updated_by'
|
has_many :pages, :foreign_key => 'updated_by'
|
||||||
|
has_many :created_orders, :class_name => 'Order', :foreign_key => 'created_by_user_id', :dependent => :nullify
|
||||||
|
|
||||||
attr_accessor :password, :setting_attributes
|
attr_accessor :password, :setting_attributes
|
||||||
|
|
||||||
|
@ -80,10 +81,6 @@ class User < ActiveRecord::Base
|
||||||
settings['messages.sendAsEmail'] == "1" && email.present?
|
settings['messages.sendAsEmail'] == "1" && email.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def ordergroup_name
|
|
||||||
ordergroup.name if ordergroup
|
|
||||||
end
|
|
||||||
|
|
||||||
# Sets the user's password. It will be stored encrypted along with a random salt.
|
# Sets the user's password. It will be stored encrypted along with a random salt.
|
||||||
def set_password
|
def set_password
|
||||||
unless password.blank?
|
unless password.blank?
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
- unless @order.note.blank?
|
- unless @order.note.blank?
|
||||||
%dt Notiz
|
%dt Notiz
|
||||||
%dd= @order.note
|
%dd= @order.note
|
||||||
|
%dt Erstellt von
|
||||||
|
%dd= link_to_user_message_if_valid(@order.created_by)
|
||||||
%dt Ende
|
%dt Ende
|
||||||
%dd= format_time(@order.ends)
|
%dd= format_time(@order.ends)
|
||||||
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
|
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
|
||||||
|
|
|
@ -32,8 +32,12 @@
|
||||||
%small{:style => "color:grey"}
|
%small{:style => "color:grey"}
|
||||||
Eventuell musst Du Dich dem Verteiler erst bekannt machen.
|
Eventuell musst Du Dich dem Verteiler erst bekannt machen.
|
||||||
%br/
|
%br/
|
||||||
|
- if Foodsoft.config[:mailing_list_subscribe].blank?
|
||||||
|
Erklärungen zum Verteiler findest Du im
|
||||||
|
= link_to 'Wiki (Abschnitt Mailing-Liste)', wiki_page_path('MailingListe')
|
||||||
|
- else
|
||||||
z.b. mit einer Mail an
|
z.b. mit einer Mail an
|
||||||
= mail_to FoodsoftConfig[:mailing_list_subscribe]
|
= mail_to Foodsoft.config[:mailing_list_subscribe]
|
||||||
|
|
||||||
#recipients
|
#recipients
|
||||||
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json }
|
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json }
|
||||||
|
|
|
@ -8,17 +8,17 @@
|
||||||
%dl.dl-horizontal
|
%dl.dl-horizontal
|
||||||
%dt Lieferantin
|
%dt Lieferantin
|
||||||
%dd= @order.name
|
%dd= @order.name
|
||||||
|
- if @note.present?
|
||||||
%dt Notiz
|
%dt Notiz
|
||||||
%dd= @order.note
|
%dd= @order.note
|
||||||
|
%dt Erstellt von
|
||||||
|
%dd= link_to_user_message_if_valid(@order.created_by)
|
||||||
%dt Beginn
|
%dt Beginn
|
||||||
%dd= format_time(@order.starts)
|
%dd= format_time(@order.starts)
|
||||||
%dt Ende
|
%dt Ende
|
||||||
%dd= format_time(@order.ends)
|
%dd= format_time(@order.ends)
|
||||||
%dt Gruppenbestellungen:
|
%dt Gruppenbestellungen:
|
||||||
%dd
|
%dd #{@order.group_orders.count} (#{@order.group_orders.includes(:ordergroup).all.map {|g| g.ordergroup.name}.join(', ')})
|
||||||
= @order.group_orders.count
|
|
||||||
= "[#{@order.group_orders.includes(:ordergroup).all.collect{|g| g.ordergroup.name}.join(', ')}]"
|
|
||||||
|
|
||||||
%dt Netto/Bruttosumme aller Artikel:
|
%dt Netto/Bruttosumme aller Artikel:
|
||||||
%dd= "#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))}"
|
%dd= "#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))}"
|
||||||
%dt Bestellte Artikel:
|
%dt Bestellte Artikel:
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class AddCreatedByUserIdToOrders < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
add_column :orders, :created_by_user_id, :integer
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
remove_column :orders, :created_by_user_id
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20120929155541) do
|
ActiveRecord::Schema.define(:version => 20121112093327) do
|
||||||
|
|
||||||
create_table "article_categories", :force => true do |t|
|
create_table "article_categories", :force => true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", :default => "", :null => false
|
||||||
|
@ -253,6 +253,7 @@ ActiveRecord::Schema.define(:version => 20120929155541) do
|
||||||
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"
|
||||||
t.decimal "foodcoop_result", :precision => 8, :scale => 2
|
t.decimal "foodcoop_result", :precision => 8, :scale => 2
|
||||||
|
t.integer "created_by_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "orders", ["state"], :name => "index_orders_on_state"
|
add_index "orders", ["state"], :name => "index_orders_on_state"
|
||||||
|
|
Loading…
Reference in a new issue