Incorporate changes for 1.2.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
groups.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2020 Rod Wright
|
||||
Copyright (C) 2021 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -44,14 +44,14 @@ $search=$incoming['search'];
|
||||
$s_status=$incoming['s_status'];
|
||||
$s_device=$incoming['s_device'];
|
||||
$s_subsystem=$incoming['s_subsystem'];
|
||||
$s_period=$incoming['s_period'];
|
||||
$s_discovered=$incoming['s_discovered'];
|
||||
$s_report_date_start=$incoming['s_report_date_start'];
|
||||
$s_report_date_end=$incoming['s_report_date_end'];
|
||||
$s_report_time_start=$incoming['s_report_time_start'];
|
||||
$s_report_time_end=$incoming['s_report_time_end'];
|
||||
$s_discrepancy_text=$incoming['s_discrepancy_text'];
|
||||
$s_reported_by=$incoming['s_reported_by'];
|
||||
$s_period_effective=$incoming['s_period_effective'];
|
||||
$s_functional=$incoming['s_functional'];
|
||||
|
||||
$edit_status=$incoming['edit_status'];
|
||||
$edit_action_by=$incoming['edit_action_by'];
|
||||
@@ -78,7 +78,9 @@ $role=dblookup($drs_db,"users","id","role",$userid);
|
||||
|
||||
framework("begin","$appname","Writeup Groups",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
@@ -205,33 +207,33 @@ if ($search) {
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
}
|
||||
// period
|
||||
if ($s_period) {
|
||||
// discovered
|
||||
if ($s_discovered) {
|
||||
$query_string="{$query_string}(";
|
||||
$period_param="Periods:";
|
||||
foreach ($s_period as $per_val) {
|
||||
$query_string="{$query_string}period=\"{$per_val}\" or ";
|
||||
$period_dsp=$per_val;
|
||||
$period_param="{$period_param} {$period_dsp}, ";
|
||||
$discovered_param="{$discovered_term_short}s:";
|
||||
foreach ($s_discovered as $disc_val) {
|
||||
$query_string="{$query_string}discovered=\"{$disc_val}\" or ";
|
||||
$disc_dsp=$disc_val;
|
||||
$discovered_param="{$discovered_param} {$disc_dsp}, ";
|
||||
}
|
||||
$period_param=rtrim($period_param,", ");
|
||||
$num_periods=mysqli_num_rows(mysqli_query($drs_db,"select id from periods"));
|
||||
if (count($s_period)==$num_periods) $period_param="Periods: any";
|
||||
$discovered_param=rtrim($discovered_param,", ");
|
||||
$num_discovereds=mysqli_num_rows(mysqli_query($drs_db,"select id from discovered"));
|
||||
if (count($s_discovered)==$num_discovereds) $discovered_param="{$discovered_term_short}s: any";
|
||||
$query_string=rtrim($query_string," or ");
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
}
|
||||
// period_effective
|
||||
if ($s_period_effective) {
|
||||
// functional
|
||||
if ($s_functional) {
|
||||
$query_string="{$query_string}(";
|
||||
$eff_param="Period effective:";
|
||||
foreach ($s_period_effective as $eff_val) {
|
||||
$query_string="{$query_string}period_effective=\"{$eff_val}\" or ";
|
||||
if ($eff_val=="0") $eff_dsp="<font color=\"#FF0000\">NEF</font>";
|
||||
if ($eff_val=="1") $eff_dsp="<font color=\"#00FF00\">EFF</font>";
|
||||
$eff_param="{$eff_param} {$eff_dsp}, ";
|
||||
$func_param="$functional_term:";
|
||||
foreach ($s_functional as $func_val) {
|
||||
$query_string="{$query_string}functional=\"{$func_val}\" or ";
|
||||
if ($func_val=="0") $func_dsp="<font color=\"#FF0000\">$functional_no_short</font>";
|
||||
if ($func_val=="1") $func_dsp="<font color=\"#00FF00\">$functional_yes_short</font>";
|
||||
$func_param="{$func_param} {$func_dsp}, ";
|
||||
}
|
||||
$eff_param=rtrim($eff_param,", ");
|
||||
$func_param=rtrim($func_param,", ");
|
||||
$query_string=rtrim($query_string," or ");
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
@@ -416,17 +418,17 @@ if ($action=="add") {
|
||||
<tr>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// Period cell **********************
|
||||
// Discovered cell **********************
|
||||
echo "
|
||||
Period<br>
|
||||
<select name=\"s_period[]\" id=\"ms-period\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
$discovered_term<br>
|
||||
<select name=\"s_discovered[]\" id=\"ms-discovered\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
";
|
||||
$prow=mysqli_query($drs_db,"select * from periods order by times asc");
|
||||
while ($pitem=mysqli_fetch_assoc($prow)) {
|
||||
if (!$search || in_array($pitem["id"],$s_period,true)) {
|
||||
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$pitem["id"],$pitem["id"],$pitem["times"]);
|
||||
$discrow=mysqli_query($drs_db,"select * from discovered order by whendiscoveredname asc");
|
||||
while ($discitem=mysqli_fetch_assoc($discrow)) {
|
||||
if (!$search || in_array($discitem["id"],$s_discovered,true)) {
|
||||
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$discitem["id"],$discitem["whendiscovereddesc"],$discitem["whendiscoveredname"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\" title=\"%s\">%s</option>",$pitem["id"],$pitem["id"],$pitem["times"]);
|
||||
printf("<option value=\"%s\" title=\"%s\">%s</option>",$discitem["id"],$discitem["whendiscovereddesc"],$discitem["whendiscoveredname"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
@@ -488,21 +490,21 @@ if ($action=="add") {
|
||||
</td>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// Period effective cell ************
|
||||
// functional cell ************
|
||||
echo "
|
||||
Sim period effective? <img src=\"icons/question.png\" title=\"" . PERIOD_EFF_HELP_TXT . "\"><br>
|
||||
$functional_term? <img src=\"icons/question.png\" title=\"" . FUNCTIONAL_HELP_TXT . "\"><br>
|
||||
";
|
||||
if ($search) {
|
||||
$effstate=$nefstate="";
|
||||
if (in_array("1",$s_period_effective,true)) $effstate="selected";
|
||||
if (in_array("0",$s_period_effective,true)) $nefstate="selected";
|
||||
$funcyesstate=$funcnostate="";
|
||||
if (in_array("1",$s_functional,true)) $funcyesstate="selected";
|
||||
if (in_array("0",$s_functional,true)) $funcnostate="selected";
|
||||
} else {
|
||||
$effstate=$nefstate="selected";
|
||||
$funcyesstate=$funcnostate="selected";
|
||||
}
|
||||
echo "
|
||||
<select name=\"s_period_effective[]\" id=\"ms-period_effective\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
<option value=\"1\" $effstate title=\"Training objectives were achieved\">Effective</option>
|
||||
<option value=\"0\" $nefstate title=\"Training objectives were not achieved\">Non-effective</option>
|
||||
<select name=\"s_functional[]\" id=\"ms-functional\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
<option value=\"1\" $funcyesstate>$functional_yes</option>
|
||||
<option value=\"0\" $funcnostate>$functional_no</option>
|
||||
</select>
|
||||
</td>
|
||||
";
|
||||
@@ -530,15 +532,15 @@ if ($action=="add") {
|
||||
<th style=\"width:1%;\">Device</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_qry)) {
|
||||
// determine effective icon
|
||||
if($tablerow["period_effective"]==1) {
|
||||
$eff_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"Period Effective\" alt=\"Period Effective\">";
|
||||
// determine functional icon
|
||||
if($tablerow["functional"]==1) {
|
||||
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes\">";
|
||||
} else {
|
||||
$eff_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"Period Non-effective\" alt=\"Period Non-effective\">";
|
||||
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no\">";
|
||||
}
|
||||
|
||||
// determine status indicator
|
||||
@@ -586,7 +588,7 @@ if ($action=="add") {
|
||||
$dname,
|
||||
$tablerow["reported_by"],
|
||||
$disc_txt,
|
||||
$eff_icon
|
||||
$func_icon
|
||||
);
|
||||
}
|
||||
echo "
|
||||
|
||||
Reference in New Issue
Block a user