Allow ignoring apple restriction for specific ordergroup.

This commit is contained in:
benni 2012-09-30 13:34:16 +02:00
parent ff4ab44bcc
commit cd91436f7f
6 changed files with 20 additions and 2 deletions

View file

@ -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,
# 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
def not_enough_apples?
FoodsoftConfig[:stop_ordering_under].present? and
!ignore_apple_restriction and
apples < FoodsoftConfig[:stop_ordering_under] and
group_orders.count > 5
end

View file

@ -7,5 +7,6 @@
= f.input :contact_person
= f.input :contact_phone
= f.input :contact_address
= f.input :ignore_apple_restriction
= f.submit
= link_to "oder abbrechen", admin_ordergroups_path

View file

@ -25,4 +25,8 @@
- if group.weekly_task
=h "#{group.task_name} am #{weekday(group.weekday)}"
- else
kein wöchentlicher Job definiert
kein wöchentlicher Job definiert
- else
%tr
%td Äpfel-Bestellbeschränkung
%td= group.ignore_apple_restriction ? 'deaktiviert' : 'aktiviert'