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 @@
/*
writeups.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2020 Rod Wright
Copyright (C) 2021 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -52,6 +52,13 @@ $role=dblookup($drs_db,"users","id","role",$userid);
// define local functions
function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
// grab some important global variables
global $device_term;
global $discovered_term, $discovered_term_short, $disc_drop_data;
global $functional_term, $functional_term_short;
global $functional_yes, $functional_no;
global $functional_yes_short, $functional_no_short;
// show date range selector
echo "
<form method=post action=\"writeups.php\">
@@ -71,7 +78,7 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
echo "
</form>
";
$writeup=mysqli_query($drs_db,"select * from writeups where status=".STAT_OPEN." and report_date between \"$start_date\" and \"$end_date\" order by report_date desc,period desc,report_time desc");
$writeup=mysqli_query($drs_db,"select * from writeups where status=".STAT_OPEN." and report_date between \"$start_date\" and \"$end_date\" order by report_date desc,report_time desc");
if (mysqli_num_rows($writeup)) {
$now=date("H:i l");
echo "
@@ -80,20 +87,20 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
<tr>
<th style=\"width:1%;\">ID</th>
<th style=\"width:100px;\">Date</th>
<th style=\"width:1%;\">Period</th>
<th style=\"width:1%;\">Device</th>
<th style=\"width:1%;\">$discovered_term_short</th>
<th style=\"width:1%;\">$device_term</th>
<th style=\"width:1%;\">Subsystem</th>
<th style=\"width:1%;\">Reported by</th>
<th>Discrepancy</th>
<th style=\"width:1%;\">Msn Eff</th>
<th style=\"width:1%;\">$functional_term_short</th>
</tr>
";
while ($tablerow = mysqli_fetch_assoc($writeup)) {
// determine effective icon
if($tablerow["period_effective"]==1) {
$eff_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"Period Effective\" alt=\"Period Effective\">";
if($tablerow["functional"]==1) {
$funcind="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
} else {
$eff_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"Period Non-effective\" alt=\"Period Non-effective\">";
$funcind="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
}
// convert device number to name
@@ -102,8 +109,12 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
// convert subsystem number to name
$ssname=dblookup($drs_db,"subsystems","id","name",$tablerow["subsystem"]);
// determine times for period
$ptimes=mysqli_fetch_row(mysqli_query($drs_db,"select times from periods where id=\"{$tablerow['period']}\""))[0];
// convert subsystem number to description
$ssdesc=dblookup($drs_db,"subsystems","id","description",$tablerow["subsystem"]);
// determine values for when discovered
$whendiscdesc=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscovereddesc from discovered where id=\"{$tablerow['discovered']}\""))[0];
$whendiscname=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscoveredname from discovered where id=\"{$tablerow['discovered']}\""))[0];
$disc_txt="{$tablerow['discrepancy_text']}";
@@ -133,19 +144,19 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
<td valign=\"top\">%s</td>
<td valign=\"top\"><font title=\"%s\">%s</font></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\"><font title=\"%s\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">%s</td>
</tr>\n",
$tablerow["id"],$tablerow["id"],
$tablerow["report_date"],
$ptimes, $tablerow["period"],
$whendiscdesc, $whendiscname,
$dname,
$ssname,
$ssdesc, $ssname,
$tablerow["reported_by"],
$disc_txt,
$eff_icon
$funcind
);
}
echo "</table>\n";
@@ -164,6 +175,13 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
}
function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$role) {
// grab some important global variables
global $device_term;
global $discovered_term, $discovered_term_short, $disc_drop_data;
global $functional_term, $functional_term_short;
global $functional_yes, $functional_no;
global $functional_yes_short, $functional_no_short;
// show date range selector
$summarystat=$detailstat="";
if ($viewtype=="detail") {
@@ -196,7 +214,7 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
<br><br>
";
}
$writeup=mysqli_query($drs_db,"select * from writeups where report_date between \"$start_date\" and \"$end_date\" order by report_date desc,period desc,report_time desc");
$writeup=mysqli_query($drs_db,"select * from writeups where report_date between \"$start_date\" and \"$end_date\" order by report_date desc,report_time desc");
if (mysqli_num_rows($writeup)) {
$now=date("H:i l");
if ($viewtype == "summary") {
@@ -213,20 +231,20 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
<th style=\"width:1%;\">ID</th>
<th style=\"width:1%;\">Status</th>
<th style=\"width:100px;\">Date</th>
<th style=\"width:1%;\">Period</th>
<th style=\"width:1%;\">Device</th>
<th style=\"width:1%;\">$discovered_term_short</th>
<th style=\"width:1%;\">$device_term</th>
<th style=\"width:1%;\">Subsystem</th>
<th style=\"width:1%;\">Reported by</th>
<th>Discrepancy</th>
<th style=\"width:1%;\">Msn Eff</th>
<th style=\"width:1%;\">$functional_term_short</th>
</tr>
";
while ($tablerow = mysqli_fetch_assoc($writeup)) {
// determine effective icon
if($tablerow["period_effective"]==1) {
$eff_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"Period Effective\" alt=\"Period Effective\">";
if($tablerow["functional"]==1) {
$funcind="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
} else {
$eff_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"Period Non-effective\" alt=\"Period Non-effective\">";
$funcind="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
}
// determine status indicator
@@ -240,9 +258,11 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
// convert subsystem number to name
$ssname=dblookup($drs_db,"subsystems","id","name",$tablerow["subsystem"]);
// determine times for period
$ptimes=mysqli_fetch_row(mysqli_query($drs_db,"select times from periods where id=\"{$tablerow['period']}\""))[0];
$disc_txt="{$tablerow['discrepancy_text']}";
// determine values for when discovered
$whendiscdesc=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscovereddesc from discovered where id=\"{$tablerow['discovered']}\""))[0];
$whendiscname=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscoveredname from discovered where id=\"{$tablerow['discovered']}\""))[0];
$disc_txt="{$tablerow['discrepancy_text']}";
// determine if this is a member of a group
$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\"");
@@ -286,12 +306,12 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
$tablerow["id"],$tablerow["id"],
$statusind,
$tablerow["report_date"],
$ptimes, $tablerow["period"],
$whendiscdesc, $whendiscname,
$dname,
$ssname,
$tablerow["reported_by"],
$disc_txt,
$eff_icon
$funcind
);
}
echo "</table>\n";
@@ -360,7 +380,9 @@ if ($view) {
}
framework("begin","$appname",$pgtitle,$print);
//echo "_REQUEST array <br>";
//var_dump($_REQUEST);
//echo "<br><hr> incoming array <br>";
//var_dump($incoming);