sellers: get rid of uuid
This commit is contained in:
parent
46d6468e5c
commit
69982fc931
16 changed files with 76 additions and 88 deletions
|
@ -102,7 +102,7 @@ void ReportDialog::onPrintReportButtonClicked()
|
|||
for (unsigned int j = 0;
|
||||
j < ENTRIES_PER_PAGE && (i - 1) * ENTRIES_PER_PAGE + j < sellers.size(); ++j) {
|
||||
int idx = (i - 1) * ENTRIES_PER_PAGE + j;
|
||||
if (sellers.at(idx)->getUuidAsString() == "11111111-1111-1111-1111-111111111111") {
|
||||
if (sellers.at(idx)->getId() == 0) {
|
||||
continue;
|
||||
}
|
||||
content += QString("%1 %2 %3 %4 %5 %6 %7\n")
|
||||
|
@ -121,7 +121,7 @@ void ReportDialog::onPrintReportButtonClicked()
|
|||
}
|
||||
|
||||
// pieces booked on the special account "Sonderkonto"
|
||||
const auto specialSeller = market_->findSellerWithUuid("11111111-1111-1111-1111-111111111111");
|
||||
const auto specialSeller = market_->findSellerWithSellerNo(0);
|
||||
if (specialSeller && specialSeller->numArticlesSold() > 0) {
|
||||
printer.newPage();
|
||||
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
||||
|
|
|
@ -59,7 +59,7 @@ QVariant ReportModel::data(const QModelIndex& index, int role) const
|
|||
|
||||
switch (index.column()) {
|
||||
case 0:
|
||||
return seller->getUuidAsString().c_str();
|
||||
return seller->getId();
|
||||
case 1:
|
||||
return seller->getSellerNo();
|
||||
case 2:
|
||||
|
@ -104,4 +104,4 @@ QVariant ReportModel::headerData(int section, Qt::Orientation orientation, int r
|
|||
// return QStringLiteral("%1").arg(section);
|
||||
} else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ QVariant SellerModel::data(const QModelIndex& index, int role) const
|
|||
*/
|
||||
switch (index.column()) {
|
||||
case 0:
|
||||
return seller->getUuidAsString().c_str();
|
||||
return seller->getId();
|
||||
case 1:
|
||||
return seller->getSellerNo();
|
||||
case 2:
|
||||
|
@ -85,7 +85,7 @@ bool SellerModel::setData(const QModelIndex& index, const QVariant& value, int r
|
|||
|
||||
switch (index.column()) {
|
||||
case 0:
|
||||
seller->setUuidFromString(value.toString().toStdString());
|
||||
seller->setId(value.toInt());
|
||||
break;
|
||||
case 1: {
|
||||
if (value.toInt() < 0)
|
||||
|
@ -126,7 +126,6 @@ bool SellerModel::insertRows(int row, int count, const QModelIndex& parent)
|
|||
{
|
||||
emit beginInsertRows(parent, row, row + count - 1);
|
||||
auto seller = std::make_unique<Seller>();
|
||||
seller->createUuid();
|
||||
seller->setSellerNo(marketplace_->getNextSellerNo());
|
||||
marketplace_->getSellers().push_back(std::move(seller));
|
||||
emit endInsertRows();
|
||||
|
@ -142,7 +141,7 @@ bool SellerModel::removeRows(int row, int count, const QModelIndex& parent)
|
|||
marketplace_->getSellers().erase(
|
||||
std::remove_if(marketplace_->getSellers().begin(), marketplace_->getSellers().end(),
|
||||
[&seller](const std::unique_ptr<Seller>& a) {
|
||||
return a->getUuid() == seller->getUuid();
|
||||
return a->getId() == seller->getId();
|
||||
}),
|
||||
marketplace_->getSellers().end());
|
||||
emit endRemoveRows();
|
||||
|
@ -156,4 +155,4 @@ bool SellerModel::removeRows(int row, int count, const QModelIndex& parent)
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue