Set the advertise flag if at least one supplier wants it to be set
This commit is contained in:
parent
8386629088
commit
ffb683bdd0
|
@ -29,6 +29,12 @@ public class UpdateOffersAction {
|
||||||
|
|
||||||
public List<ArticleOffer> finish() {
|
public List<ArticleOffer> finish() {
|
||||||
HashMap<ArticleIdentifier, ArticleOffer> availableOffers = mapOffers();
|
HashMap<ArticleIdentifier, ArticleOffer> availableOffers = mapOffers();
|
||||||
|
|
||||||
|
// Reset all advertise-flags first. They are set again below.
|
||||||
|
for (ArticleOffer offer : availableOffers.values()) {
|
||||||
|
offer.shouldBeAdvertised = false;
|
||||||
|
}
|
||||||
|
|
||||||
for (Entry<ArticleIdentifier, Offer> cheapestOffer : cheapestOffer.entrySet()) {
|
for (Entry<ArticleIdentifier, Offer> cheapestOffer : cheapestOffer.entrySet()) {
|
||||||
String manufacturer = cheapestOffer.getKey().manufacturer;
|
String manufacturer = cheapestOffer.getKey().manufacturer;
|
||||||
String articleNumber = cheapestOffer.getKey().articleNumber;
|
String articleNumber = cheapestOffer.getKey().articleNumber;
|
||||||
|
@ -42,7 +48,11 @@ public class UpdateOffersAction {
|
||||||
Article currentOfferedArticle = cheapestOffer.getValue().apiSupplier.findArticle(manufacturer,
|
Article currentOfferedArticle = cheapestOffer.getValue().apiSupplier.findArticle(manufacturer,
|
||||||
articleNumber);
|
articleNumber);
|
||||||
currentOffer.vatPercent = currentOfferedArticle.vatPercent;
|
currentOffer.vatPercent = currentOfferedArticle.vatPercent;
|
||||||
currentOffer.shouldBeAdvertised = currentOfferedArticle.shouldBeAdvertised;
|
|
||||||
|
// Set advertise-flag if any supplier wants it to be set
|
||||||
|
if (currentOfferedArticle.shouldBeAdvertised) {
|
||||||
|
currentOffer.shouldBeAdvertised = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return offers;
|
return offers;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue