diff --git a/distfiles/logentry.php b/distfiles/logentry.php index 6f4f2bf..db36724 100644 --- a/distfiles/logentry.php +++ b/distfiles/logentry.php @@ -40,7 +40,7 @@ $uids = $_POST['uids'] ?? []; $partnums = $_POST['partnums'] ?? []; $sernums = $_POST['sernums'] ?? []; $actions = $_POST['actions'] ?? []; -$mfreqs = $_POST['mfreqs'] ?? []; +$mfreqs = $_POST['mfreqs'] ?? ["off"]; $schedmaintcomplete = $_REQUEST['schedmaintcomplete'] ?? NULL; $partview = $_REQUEST['partview'] ?? NULL; @@ -199,7 +199,7 @@ if ($add) { // add it to logparts table mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")"); // create a maintenance form if required - if ($mfreqs[$plidx] == "on") { + if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") { mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")"); } @@ -217,7 +217,7 @@ if ($add) { // add it to logparts table mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")"); // create a maintenance form if required - if ($mfreqs[$plidx] == "on") { + if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") { mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")"); } @@ -235,7 +235,7 @@ if ($add) { // add it to logparts table mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")"); // create a maintenance form if required - if ($mfreqs[$plidx] == "on") { + if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") { mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")"); } } else { @@ -364,7 +364,7 @@ if ($edit) { // add it to logparts table mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")"); // create a maintenance form if required - if ($mfreqs[$plidx] == "on") { + if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") { mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")"); } @@ -382,7 +382,7 @@ if ($edit) { // add it to logparts table mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")"); // create a maintenance form if required - if ($mfreqs[$plidx] == "on") { + if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") { mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")"); } @@ -400,7 +400,7 @@ if ($edit) { // add it to logparts table mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")"); // create a maintenance form if required - if ($mfreqs[$plidx] == "on") { + if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") { mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")"); } } else { @@ -619,7 +619,6 @@ $flagcount = 1; // display checkboxes for all the flags, selecting the ones that are set for this note/template while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) { - if (in_array($flagcheckbox["flagid"], $theseflags)) { printf( "%s", @@ -648,9 +647,15 @@ while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) { $flagcount = 1; } } -echo " -
Set flags on reference chain -"; +if (mysqli_num_rows($flagslist)) { + echo " +
Set flags on reference chain + "; +} else { + echo " + + "; +} if ($add && $refto) $refstring = $refto; echo " @@ -678,16 +683,12 @@ if ($add) {