src/EditProduct.cpp

changeset 296
2f4e250cfed9
parent 266
5f0782149028
child 297
c8f0ecc8a1cc
--- a/src/EditProduct.cpp	Sat Jun 18 19:15:22 2022 +0200
+++ b/src/EditProduct.cpp	Sat Jun 18 20:39:59 2022 +0200
@@ -113,6 +113,45 @@
     if (id >= 0) {
 	if (! DB_product::load(product, this, id))
 	    return;
+	/*
+	 * Check status of logfiles.
+	 */
+	if (product->stage > PROD_STAGE_BREW) {
+	    if (! product->log_brew) {
+		query.prepare("SELECT datetime FROM log_brews WHERE code=:code");
+		query.bindValue(":code", product->code);
+		query.exec();
+		if (query.first()) {
+		    qDebug() << "should update log_brews";
+		}
+	    }
+	    if (! product->log_fermentation) {
+		query.prepare("SELECT datetime FROM log_fermenter WHERE code=:code");
+		query.bindValue(":code", product->code);
+		query.exec();
+		if (query.first()) {
+		    qDebug() << "should update log_fermenter";
+		}
+	    }
+	    if (! product->log_ispindel) {
+		query.prepare("SELECT datetime FROM log_ispindel WHERE code=:code");
+                query.bindValue(":code", product->code);
+                query.exec();
+                if (query.first()) {
+                    qDebug() << "should update log_ispindel";
+                }
+	    }
+	}
+	if (product->stage > PROD_STAGE_PACKAGE) {
+	    if (! product->log_co2pressure) {
+		query.prepare("SELECT datetime FROM log_co2pressure WHERE code=:code");
+                query.bindValue(":code", product->code);
+                query.exec();
+                if (query.first()) {
+                    qDebug() << "should update log_co2pressure";
+                }
+	    }
+	}
 
     } else {
 	/* New product, set some defaults */

mercurial