Allow ignoring apple restriction for specific ordergroup.
This commit is contained in:
parent
ff4ab44bcc
commit
cd91436f7f
6 changed files with 20 additions and 2 deletions
|
@ -74,9 +74,11 @@ class Ordergroup < Group
|
||||||
|
|
||||||
# If the the option stop_ordering_under is set, the ordergroup is only allowed to participate in an order,
|
# If the the option stop_ordering_under is set, the ordergroup is only allowed to participate in an order,
|
||||||
# when the apples value is above the configured amount.
|
# when the apples value is above the configured amount.
|
||||||
|
# The restriction can be deactivated for each ordergroup.
|
||||||
# Only ordergroups, which have participated in more than 5 order are affected
|
# Only ordergroups, which have participated in more than 5 order are affected
|
||||||
def not_enough_apples?
|
def not_enough_apples?
|
||||||
FoodsoftConfig[:stop_ordering_under].present? and
|
FoodsoftConfig[:stop_ordering_under].present? and
|
||||||
|
!ignore_apple_restriction and
|
||||||
apples < FoodsoftConfig[:stop_ordering_under] and
|
apples < FoodsoftConfig[:stop_ordering_under] and
|
||||||
group_orders.count > 5
|
group_orders.count > 5
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,5 +7,6 @@
|
||||||
= f.input :contact_person
|
= f.input :contact_person
|
||||||
= f.input :contact_phone
|
= f.input :contact_phone
|
||||||
= f.input :contact_address
|
= f.input :contact_address
|
||||||
|
= f.input :ignore_apple_restriction
|
||||||
= f.submit
|
= f.submit
|
||||||
= link_to "oder abbrechen", admin_ordergroups_path
|
= link_to "oder abbrechen", admin_ordergroups_path
|
||||||
|
|
|
@ -26,3 +26,7 @@
|
||||||
=h "#{group.task_name} am #{weekday(group.weekday)}"
|
=h "#{group.task_name} am #{weekday(group.weekday)}"
|
||||||
- else
|
- else
|
||||||
kein wöchentlicher Job definiert
|
kein wöchentlicher Job definiert
|
||||||
|
- else
|
||||||
|
%tr
|
||||||
|
%td Äpfel-Bestellbeschränkung
|
||||||
|
%td= group.ignore_apple_restriction ? 'deaktiviert' : 'aktiviert'
|
||||||
|
|
|
@ -307,6 +307,7 @@ de:
|
||||||
contact_person: "Kontaktperson"
|
contact_person: "Kontaktperson"
|
||||||
contact_phone: "Telefon"
|
contact_phone: "Telefon"
|
||||||
contact_address: "Adresse"
|
contact_address: "Adresse"
|
||||||
|
ignore_apple_restriction: "Bestellstop bei zu wenig Äpfeln ignorieren"
|
||||||
task:
|
task:
|
||||||
duration: 'Dauer'
|
duration: 'Dauer'
|
||||||
user_list: 'Verantwortliche'
|
user_list: 'Verantwortliche'
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class AddIgnoreAppleRestrictionToGroups < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
add_column :groups, :ignore_apple_restriction, :boolean, default: false
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
remove_column :groups, :ignore_apple_restriction
|
||||||
|
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 => 20120824114234) do
|
ActiveRecord::Schema.define(:version => 20120929155541) 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
|
||||||
|
@ -172,6 +172,7 @@ ActiveRecord::Schema.define(:version => 20120824114234) do
|
||||||
t.text "stats"
|
t.text "stats"
|
||||||
t.integer "task_duration", :default => 1
|
t.integer "task_duration", :default => 1
|
||||||
t.integer "next_weekly_tasks_number", :default => 8
|
t.integer "next_weekly_tasks_number", :default => 8
|
||||||
|
t.boolean "ignore_apple_restriction", :default => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "groups", ["name"], :name => "index_groups_on_name", :unique => true
|
add_index "groups", ["name"], :name => "index_groups_on_name", :unique => true
|
||||||
|
|
Loading…
Reference in a new issue