handle case that user changed source_no while there are items in basket

This commit is contained in:
Martin Brodbeck 2018-08-08 10:37:34 +02:00
parent badd1595e1
commit e45143abc1

View file

@ -106,7 +106,9 @@ void Marketplace::finishCurrentSale(std::unique_ptr<Sale> sale)
return; return;
for (auto iter = basket_.begin(); iter != basket_.end(); ++iter) { for (auto iter = basket_.begin(); iter != basket_.end(); ++iter) {
sale->addArticle((*iter).get()); iter->get()->setSourceNo(sale->getSourceNo()); // update source_no for article in the case
// the user has changed it in the meanwhile
sale->addArticle(iter->get());
(*iter)->getSeller()->addArticle(std::move(*iter)); (*iter)->getSeller()->addArticle(std::move(*iter));
} }