1362 useatEdit->setCurrentIndex(product->yeasts.at(product->yeasts_row).use); |
1362 useatEdit->setCurrentIndex(product->yeasts.at(product->yeasts_row).use); |
1363 |
1363 |
1364 yeast_instock_changed(true); |
1364 yeast_instock_changed(true); |
1365 yeast_load_packages(product->yeasts.at(product->yeasts_row).laboratory, product->yeasts.at(product->yeasts_row).form); |
1365 yeast_load_packages(product->yeasts.at(product->yeasts_row).laboratory, product->yeasts.at(product->yeasts_row).form); |
1366 |
1366 |
1367 int index = -1; |
1367 /* |
|
1368 * Try to set the yeastpack dropdown to the selected entry if set. |
|
1369 */ |
|
1370 int index = 0; |
1368 if (! product->yeasts.at(product->yeasts_row).yp_uuid.isNull() && (product->yeasts.at(product->yeasts_row).yp_uuid.length() == 36)) { |
1371 if (! product->yeasts.at(product->yeasts_row).yp_uuid.isNull() && (product->yeasts.at(product->yeasts_row).yp_uuid.length() == 36)) { |
1369 query.prepare("SELECT * FROM inventory_yeastpack WHERE laboratory=:laboratory AND form=:form AND valid='1' ORDER BY laboratory,package"); |
1372 query.prepare("SELECT * FROM inventory_yeastpack WHERE laboratory=:laboratory AND form=:form AND valid='1' ORDER BY laboratory,package"); |
1370 query.bindValue(":laboratory", product->yeasts.at(product->yeasts_row).laboratory); |
1373 query.bindValue(":laboratory", product->yeasts.at(product->yeasts_row).laboratory); |
1371 query.bindValue(":form", product->yeasts.at(product->yeasts_row).form); |
1374 query.bindValue(":form", product->yeasts.at(product->yeasts_row).form); |
1372 qDebug() << " search" << product->yeasts.at(product->yeasts_row).laboratory << product->yeasts.at(product->yeasts_row).form; |
|
1373 query.exec(); |
1375 query.exec(); |
1374 while (query.next()) { |
1376 while (query.next()) { |
1375 index++; |
1377 index++; |
1376 if (query.value("uuid").toString() == product->yeasts.at(product->yeasts_row).yp_uuid) |
1378 if (query.value("uuid").toString() == product->yeasts.at(product->yeasts_row).yp_uuid) { |
|
1379 this->ypackageEdit->setCurrentIndex(index); |
1377 break; |
1380 break; |
|
1381 } |
1378 } |
1382 } |
1379 qDebug() << " result" << index << (query.value("uuid").toString() == product->yeasts.at(product->yeasts_row).yp_uuid); |
|
1380 } |
1383 } |
1381 |
1384 |
1382 connect(yselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_select_changed); |
1385 connect(yselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_select_changed); |
1383 connect(ypackageEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_package_changed); |
1386 connect(ypackageEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_package_changed); |
1384 connect(yamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::yeast_amount_changed); |
1387 connect(yamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::yeast_amount_changed); |