Incorporated changes for release 1.4.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
writeups.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2023 Rod Wright
|
||||
Copyright (C) 2024 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -14,6 +14,15 @@ if (array_key_exists('print',$_REQUEST)) {
|
||||
$print=false;
|
||||
}
|
||||
|
||||
// redirect to login page if access_mode is untrusted and user is
|
||||
// not logged in
|
||||
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
|
||||
header("Cache-Control:no-cache, must-revalidate");
|
||||
header("Pragma:no-cache");
|
||||
header("Location:login.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
// import session variables
|
||||
if (isset($_SESSION['userid'])) {
|
||||
$userid=$_SESSION['userid'];
|
||||
@@ -44,6 +53,7 @@ extract($incoming, EXTR_SKIP);
|
||||
* showyesterday
|
||||
* show7day
|
||||
* show30day
|
||||
* showdays
|
||||
* viewtype
|
||||
* togroup
|
||||
* addtogroup
|
||||
@@ -209,8 +219,24 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
echo "
|
||||
<input type=\"submit\" name=\"showtoday\" value=\"Today\">
|
||||
<input type=\"submit\" name=\"showyesterday\" value=\"Yesterday\">
|
||||
<input type=\"submit\" name=\"show7day\" value=\"Last 7 Days\">
|
||||
<input type=\"submit\" name=\"show30day\" value=\"Last 30 Days\">
|
||||
<select name=\"showdays\" id=\"showdays\">
|
||||
<option value=\"\">Date range...</option>
|
||||
<option value=\"-3\">Last 3 days</option>
|
||||
<option value=\"-7\">Last 7 days</option>
|
||||
<option value=\"-30\">Last 30 days</option>
|
||||
<option value=\"-90\">Last 90 days</option>
|
||||
<option value=\"-180\">Last 180 days</option></option>
|
||||
<option value=\"-365\">Last 365 days</option>
|
||||
<option value=\"-\">All past</option>
|
||||
<option value=\"+3\">Next 3 days</option>
|
||||
<option value=\"+7\">Next 7 days</option>
|
||||
<option value=\"+30\">Next 30 days</option>
|
||||
<option value=\"+90\">Next 90 days</option>
|
||||
<option value=\"+180\">Next 180 days</option></option>
|
||||
<option value=\"+365\">Next 365 days</option>
|
||||
<option value=\"+\">All future</option>
|
||||
</select>
|
||||
|
||||
";
|
||||
}
|
||||
echo "
|
||||
@@ -381,13 +407,28 @@ if (isset($showyesterday)) {
|
||||
$start_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_sub(curdate(),interval 1 day)"))[0];
|
||||
$end_date=$start_date;
|
||||
}
|
||||
if (isset($show7day)) {
|
||||
$start_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_sub(curdate(),interval 7 day)"))[0];
|
||||
$end_date=$today;
|
||||
}
|
||||
if (isset($show30day)) {
|
||||
$start_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_sub(curdate(),interval 30 day)"))[0];
|
||||
$end_date=$today;
|
||||
|
||||
if (isset($showdays) && $showdays != "") {
|
||||
$minmaxqry=mysqli_query($drs_db,"select min(report_date),max(report_date) from writeups");
|
||||
$minmaxdates=mysqli_fetch_row($minmaxqry);
|
||||
$direction=$showdays[0];
|
||||
$numdays=substr($showdays,1);
|
||||
if ($direction=="-") {
|
||||
if ($numdays=="") {
|
||||
$start_date=$minmaxdates[0];
|
||||
} else {
|
||||
$start_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_sub(curdate(),interval $numdays day)"))[0];
|
||||
}
|
||||
$end_date=$today;
|
||||
}
|
||||
if ($direction=="+") {
|
||||
$start_date=$today;
|
||||
if ($numdays=="") {
|
||||
$end_date=$minmaxdates[1];
|
||||
} else {
|
||||
$end_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_add(curdate(),interval $numdays day)"))[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($view)) {
|
||||
|
||||
Reference in New Issue
Block a user