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
1 changed files with 3 additions and 1 deletions

View File

@ -106,7 +106,9 @@ void Marketplace::finishCurrentSale(std::unique_ptr<Sale> sale)
return;
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));
}