handle case that user changed source_no while there are items in basket
This commit is contained in:
parent
badd1595e1
commit
e45143abc1
1 changed files with 3 additions and 1 deletions
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue