Merge remote-tracking branch 'foodcoop-rostock/fix-order-article-update'
Conflicts: config/locales/de.yml config/locales/en.yml
This commit is contained in:
commit
6c0de3dc74
6 changed files with 21 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
# An OrderArticle represents a single Article that is part of an Order.
|
# An OrderArticle represents a single Article that is part of an Order.
|
||||||
class OrderArticle < ActiveRecord::Base
|
class OrderArticle < ActiveRecord::Base
|
||||||
|
|
||||||
attr_reader :update_current_price
|
attr_reader :update_global_price
|
||||||
|
|
||||||
belongs_to :order
|
belongs_to :order
|
||||||
belongs_to :article
|
belongs_to :article
|
||||||
|
@ -168,14 +168,20 @@ class OrderArticle < ActiveRecord::Base
|
||||||
if price_attributes.present?
|
if price_attributes.present?
|
||||||
article_price.attributes = price_attributes
|
article_price.attributes = price_attributes
|
||||||
if article_price.changed?
|
if article_price.changed?
|
||||||
# Updates also price attributes of article if update_current_price is selected
|
# Updates also price attributes of article if update_global_price is selected
|
||||||
if update_current_price
|
if update_global_price
|
||||||
article.update_attributes!(price_attributes)
|
article.update_attributes!(price_attributes)
|
||||||
self.article_price = article.article_prices.first # Assign new created article price to order article
|
self.article_price = article.article_prices.first and save # Assign new created article price to order article
|
||||||
else
|
else
|
||||||
# Creates a new article_price if neccessary
|
# Creates a new article_price if neccessary
|
||||||
# Set created_at timestamp to order ends, to make sure the current article price isn't changed
|
# Set created_at timestamp to order ends, to make sure the current article price isn't changed
|
||||||
create_article_price!(price_attributes.merge(created_at: order.ends)) and save
|
create_article_price!(price_attributes.merge(created_at: order.ends)) and save
|
||||||
|
# TODO: The price_attributes do not include an article_id so that
|
||||||
|
# the entry in the database will not "know" which article is
|
||||||
|
# referenced. Let us check the effect of that and change it or
|
||||||
|
# comment on the meaning.
|
||||||
|
# Possibly this is the real reason why the global price is not
|
||||||
|
# affected instead of the `created_at: order.ends` injection.
|
||||||
end
|
end
|
||||||
|
|
||||||
# Updates ordergroup values
|
# Updates ordergroup values
|
||||||
|
@ -185,8 +191,8 @@ class OrderArticle < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_current_price=(value)
|
def update_global_price=(value)
|
||||||
@update_current_price = (value == true or value == '1') ? true : false
|
@update_global_price = (value == true or value == '1') ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Units missing for the next full unit_quantity of the article
|
# Units missing for the next full unit_quantity of the article
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
= render partial: 'shared/article_fields_units', locals: {f_unit: f, f_uq: fprice}
|
= render partial: 'shared/article_fields_units', locals: {f_unit: f, f_uq: fprice}
|
||||||
= render partial: 'shared/article_fields_price', locals: {f: fprice}
|
= render partial: 'shared/article_fields_price', locals: {f: fprice}
|
||||||
|
|
||||||
= form.input :update_current_price, as: :boolean
|
= form.input :update_global_price, as: :boolean
|
||||||
= f.input :order_number
|
= f.input :order_number
|
||||||
.modal-footer
|
.modal-footer
|
||||||
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||||
|
|
|
@ -88,7 +88,7 @@ de:
|
||||||
units_received_short: Geliefert
|
units_received_short: Geliefert
|
||||||
units_to_order: Bestellte Gebinde
|
units_to_order: Bestellte Gebinde
|
||||||
units_to_order_short: Bestellt
|
units_to_order_short: Bestellt
|
||||||
update_current_price: Globalen Preis aktualisieren
|
update_global_price: Globalen Preis aktualisieren
|
||||||
order_comment:
|
order_comment:
|
||||||
text: Kommentiere diese Bestellung ...
|
text: Kommentiere diese Bestellung ...
|
||||||
ordergroup:
|
ordergroup:
|
||||||
|
@ -1319,7 +1319,7 @@ de:
|
||||||
private: Nachricht erscheint nicht im Foodsoft Posteingang
|
private: Nachricht erscheint nicht im Foodsoft Posteingang
|
||||||
order_article:
|
order_article:
|
||||||
units_to_order: Wenn Du die Gesamtanzahl gelieferter Gebinde änderst, musst Du auch die individuelle Anzahl der einzelnen Bestellgruppen anpassen, indem Du auf den Artikelnamen klickst. Sie werden nicht automatisch neuberechnet und andernfalls werden den Bestellgruppen Artikel in Rechnung gestellt, die nicht geliefert wurden!
|
units_to_order: Wenn Du die Gesamtanzahl gelieferter Gebinde änderst, musst Du auch die individuelle Anzahl der einzelnen Bestellgruppen anpassen, indem Du auf den Artikelnamen klickst. Sie werden nicht automatisch neuberechnet und andernfalls werden den Bestellgruppen Artikel in Rechnung gestellt, die nicht geliefert wurden!
|
||||||
update_current_price: Ändert auch den Preis für aktuelle Bestellungen
|
update_global_price: Ändert auch den Preis für zukünftige Bestellungen
|
||||||
stock_article:
|
stock_article:
|
||||||
copy:
|
copy:
|
||||||
name: Bitte ändern
|
name: Bitte ändern
|
||||||
|
|
|
@ -88,7 +88,7 @@ en:
|
||||||
units_received_short: Received
|
units_received_short: Received
|
||||||
units_to_order: Ordered units
|
units_to_order: Ordered units
|
||||||
units_to_order_short: Ordered
|
units_to_order_short: Ordered
|
||||||
update_current_price: Globally update current price
|
update_global_price: Globally update current price
|
||||||
order_comment:
|
order_comment:
|
||||||
text: Add comment to this order ...
|
text: Add comment to this order ...
|
||||||
ordergroup:
|
ordergroup:
|
||||||
|
@ -1319,7 +1319,7 @@ en:
|
||||||
private: Message doesn’t show in Foodsoft mail inbox
|
private: Message doesn’t show in Foodsoft mail inbox
|
||||||
order_article:
|
order_article:
|
||||||
units_to_order: If you change the total amount of delivered units, you also have to change individual group amounts by clicking on the article name. They will not be automatically recalculated and so ordergroups may be accounted for articles that were not delivered!
|
units_to_order: If you change the total amount of delivered units, you also have to change individual group amounts by clicking on the article name. They will not be automatically recalculated and so ordergroups may be accounted for articles that were not delivered!
|
||||||
update_current_price: Also update the price of the current order
|
update_global_price: Also update the price of future orders
|
||||||
stock_article:
|
stock_article:
|
||||||
copy:
|
copy:
|
||||||
name: Please modify
|
name: Please modify
|
||||||
|
|
|
@ -82,7 +82,7 @@ fr:
|
||||||
missing_units: Unités manquantes
|
missing_units: Unités manquantes
|
||||||
missing_units_short:
|
missing_units_short:
|
||||||
units_to_order: Quantité
|
units_to_order: Quantité
|
||||||
update_current_price: Mettre à jour le prix global
|
update_global_price: Mettre à jour le prix global
|
||||||
order_comment:
|
order_comment:
|
||||||
text: Commenter cette commande...
|
text: Commenter cette commande...
|
||||||
ordergroup:
|
ordergroup:
|
||||||
|
@ -1297,7 +1297,7 @@ fr:
|
||||||
private: Le message n'apparaîtra pas dans la boîte de réception du Foodsoft
|
private: Le message n'apparaîtra pas dans la boîte de réception du Foodsoft
|
||||||
order_article:
|
order_article:
|
||||||
units_to_order:
|
units_to_order:
|
||||||
update_current_price: Modifie aussi le prix des commandes en cours
|
update_global_price: # ATTENTION, MEANING CHANGED. OLD (NOW WRONG) TRANSLATION WAS 'Modifie aussi le prix des commandes en cours'
|
||||||
stock_article:
|
stock_article:
|
||||||
copy:
|
copy:
|
||||||
name: Merci de modifier
|
name: Merci de modifier
|
||||||
|
|
|
@ -82,7 +82,7 @@ nl:
|
||||||
missing_units: Missende eenheden
|
missing_units: Missende eenheden
|
||||||
missing_units_short: Nodig
|
missing_units_short: Nodig
|
||||||
units_to_order: Aantal eenheden
|
units_to_order: Aantal eenheden
|
||||||
update_current_price: Huidige prijs overal bijwerken
|
update_global_price: Huidige prijs overal bijwerken
|
||||||
order_comment:
|
order_comment:
|
||||||
text: Commentaar voor deze bestelling toevoegen ...
|
text: Commentaar voor deze bestelling toevoegen ...
|
||||||
ordergroup:
|
ordergroup:
|
||||||
|
@ -1274,7 +1274,7 @@ nl:
|
||||||
private: Bericht wordt niet getoond in de Foodsoft inbox.
|
private: Bericht wordt niet getoond in de Foodsoft inbox.
|
||||||
order_article:
|
order_article:
|
||||||
units_to_order: Als je het aantal geleverde eenheden wijzigt, moet je daarna de hoeveelheden voor huishoudens aanpassen. Klik daarvoor op de artikelnaam. Als je dit vergeet, kunnen huishoudens belast worden voor artikelen die ze niet hebben gekregen!
|
units_to_order: Als je het aantal geleverde eenheden wijzigt, moet je daarna de hoeveelheden voor huishoudens aanpassen. Klik daarvoor op de artikelnaam. Als je dit vergeet, kunnen huishoudens belast worden voor artikelen die ze niet hebben gekregen!
|
||||||
update_current_price: Ook prijs in huidige besteling aanpassen
|
update_global_price: # ATTENTION, MEANING CHANGED. OLD (NOW WRONG) TRANSLATION WAS 'Ook prijs in huidige besteling aanpassen'
|
||||||
stock_article:
|
stock_article:
|
||||||
copy:
|
copy:
|
||||||
name: Wijzigen alsjeblieft
|
name: Wijzigen alsjeblieft
|
||||||
|
|
Loading…
Reference in a new issue