Incorporate changes for 1.2.0

This commit is contained in:
2026-02-24 19:48:08 -05:00
parent 39931c0ca5
commit 3667c4358f
24 changed files with 1833 additions and 1061 deletions

View File

@@ -2,7 +2,7 @@
/*
create.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2020 Rod Wright
Copyright (C) 2021 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -34,8 +34,8 @@ if ($print) {
// load variables from incoming array
$create=$incoming['create'];
$device=$incoming['device'];
$period=$incoming['period'];
$period_effective=$incoming['period_effective'];
$discovered=$incoming['discovered'];
$functional=$incoming['functional'];
$reported_by=$incoming['reported_by'];
$report_date=$incoming['report_date'];
$report_time=$incoming['report_time'];
@@ -56,7 +56,9 @@ $role=dblookup($drs_db,"persons","id","role",$personid);
framework("begin","$appname","New Writeup",$print);
//echo "_REQUEST array <br>";
//var_dump($_REQUEST);
//echo "<br><hr> incoming array <br>";
//var_dump($incoming);
// ******** begin database manipulation ********
@@ -69,7 +71,7 @@ if (!$report_time || $report_time=="automatic") $report_time=$now;
if ($create) {
// add the entry if create is pressed
if ($discrepancy_text && $reported_by && $device && $subsystem && $period) {
if ($discrepancy_text && $reported_by && $device && $subsystem && $discovered) {
// sanitize and fix blank date and time
$report_date=mysqli_real_escape_string($drs_db,$report_date);
$report_time=mysqli_real_escape_string($drs_db,$report_time);
@@ -82,8 +84,8 @@ if ($create) {
$clean_reported_by=mysqli_real_escape_string($drs_db,$reported_by);
// add the record to writeups
mysqli_query($drs_db,"insert into writeups(device,period,period_effective,reported_by,report_date,report_time,subsystem,discrepancy_text,status)
values (\"$device\",\"$period\",\"$period_effective\",\"$clean_reported_by\",\"$report_date\",\"$report_time\",\"$subsystem\",\"$clean_discrepancy_text\",\"$status\")");
mysqli_query($drs_db,"insert into writeups(device,discovered,functional,reported_by,report_date,report_time,subsystem,discrepancy_text,status)
values (\"$device\",\"$discovered\",\"$functional\",\"$clean_reported_by\",\"$report_date\",\"$report_time\",\"$subsystem\",\"$clean_discrepancy_text\",\"$status\")");
}
}
@@ -105,15 +107,15 @@ if ($create) {
$preserve=FALSE;
}
if (!$device) {
format_message(1,"You didn't select a device. Please try again.");
format_message(1,"You didn't select a $device_term. Please try again.");
$preserve=TRUE;
}
if (!$subsystem) {
format_message(1,"You didn't select a subsystem. Please try again.");
$preserve=TRUE;
}
if (!$period) {
format_message(1,"You didn't select a period. Please try again.");
if (!$discovered) {
format_message(1,"You didn't select a $discovered_term. Please try again.");
$preserve=TRUE;
}
if (!$discrepancy_text) {
@@ -140,7 +142,7 @@ if ($status==3) $statusind="<b><font color=\"#FFFF00\">DFRD</font></b>";
echo "
<table border=\"0\" cellpadding=\"5\">
<tr>
<td align=\"left\">Device<br>
<td align=\"left\">$device_term<br>
<select name=\"device\" id=\"device\">
<option value=\"\">Please select...</option>
";
@@ -170,16 +172,23 @@ echo "
</select></td><td></td>
</tr>
<tr>
<td align=\"left\">Period<br>
<select name=\"period\" id=\"period\">
<td align=\"left\">$discovered_term<br>
<select name=\"discovered\" id=\"discoveredselect\">
<option value=\"\">Please select...</option>
";
$prow=mysqli_query($drs_db,"select * from periods where active is true order by times asc");
while ($pitem=mysqli_fetch_assoc($prow)) {
if ($period==$pitem["id"] && $preserve) {
printf("<option value=\"%s\" title=\"Period %s\" selected>%s</option>",$pitem["id"],$pitem["id"],$pitem["times"]);
if ($disc_drop_data=="Name") {
$discddtitle="whendiscovereddesc";
$discddtext="whendiscoveredname";
} else if ($disc_drop_data=="Desc") {
$discddtitle="whendiscoveredname";
$discddtext="whendiscovereddesc";
}
$drow=mysqli_query($drs_db,"select * from discovered where active is true order by whendiscoveredname asc");
while ($ditem=mysqli_fetch_assoc($drow)) {
if ($discoverd==$ditem["id"] && $preserve) {
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$ditem["id"],$ditem["$discddtitle"],$ditem["$discddtext"]);
} else {
printf("<option value=\"%s\" title=\"Period %s\">%s</option>",$pitem["id"],$pitem["id"],$pitem["times"]);
printf("<option value=\"%s\" title=\"%s\">%s</option>",$ditem["id"],$ditem["$discddtitle"],$ditem["$discddtext"]);
}
}
@@ -190,12 +199,12 @@ if (!$preserve) {
$reported_by="";
}
$effstate=$nefstate="";
$funcyesstate=$funcnostate="";
if ($preserve) {
if($period_effective==1) $effstate="checked";
if($period_effective==0) $nefstate="checked";
if($functional==1) $funcyesstate="checked";
if($functional==0) $funcnostate="checked";
} else {
$effstate="checked";
$funcyesstate="checked";
}
echo "
@@ -213,9 +222,9 @@ Discrepancy <font size=\"-2\">(required)</font><br>
<tr>
<td>Reported by <font size=\"-2\">(required)</font><br>
<input type=\"text\" name=\"reported_by\" size=\"30\" value=\"$reported_by\" title=\"Who to contact with questions about this writeup\"></td>
<td>Period effective? &nbsp; <img src=\"icons/question.png\" title=\"" . PERIOD_EFF_HELP_TXT . "\"><br>
<input type=\"radio\" name=\"period_effective\" value=\"1\" $effstate> Yes &nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"period_effective\" value=\"0\" $nefstate> No
<td>$functional_term? &nbsp; <img src=\"icons/question.png\" title=\"" . FUNCTIONAL_HELP_TXT . "\"><br>
<input type=\"radio\" name=\"functional\" value=\"1\" $funcyesstate> Yes &nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"functional\" value=\"0\" $funcnostate> No
</td>
<td align=\"right\" valign=\"bottom\"><input type=\"submit\" name=\"create\" value=\"Submit Writeup\" id=\"createbutton\"></td>
</tr>