More work on flags
This commit is contained in:
@@ -54,7 +54,9 @@ if ($print) {
|
||||
|
||||
framework("begin","$logname Search","Search",$print);
|
||||
|
||||
//var_dump($_REQUEST);
|
||||
// echo "REQUEST variables: <br>";
|
||||
// var_dump($_REQUEST);
|
||||
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
@@ -199,24 +201,9 @@ if ($search) {
|
||||
$logconstraints[]="lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
||||
}
|
||||
// build the clauses and run the query
|
||||
echo "logfromtables: ";
|
||||
foreach ($logfromtables as $lft) {
|
||||
echo "$lft ";
|
||||
}
|
||||
echo "<br><br>";
|
||||
|
||||
echo "logconstraints: ";
|
||||
foreach ($logconstraints as $lc) {
|
||||
echo "$lc ";
|
||||
}
|
||||
echo "<br><br>";
|
||||
|
||||
$logfromclause=implode(",",array_unique($logfromtables));
|
||||
echo "logfromclause: $logfromclause <br><br>";
|
||||
$logwhereclause=implode(" and ",$logconstraints);
|
||||
echo "logwhereclause: $logwhereclause <br><br>";
|
||||
$logrowqry=mysqli_query($db,"select lognotes.* from $logfromclause where $logwhereclause order by lognotes.date asc, lognotes.time asc");
|
||||
echo "select lognotes.* from $logfromclause where $logwhereclause order by lognotes.date asc, lognotes.time asc";
|
||||
}
|
||||
if ($target[0]=="") $target=[];
|
||||
if (in_array("maintform",$target)) {
|
||||
@@ -268,15 +255,15 @@ if ($search) {
|
||||
$mffromtables[]="maintforms";
|
||||
$mffromtables[]="flagmap";
|
||||
$flagconstraints[]="flagmap.maintformid=maintforms.maintformid and flagmap.flagid in (";
|
||||
foreach ($srchflags as $flagid) {
|
||||
$flagconstraints[]="\"$flagid\"";
|
||||
foreach ($srchflags as $thisflagid) {
|
||||
$flagconstraints[]="\"$thisflagid\"";
|
||||
$flagconstraints[]=",";
|
||||
}
|
||||
// remove final comma
|
||||
array_splice($flagconstraints, -1, 1);
|
||||
$flagconstraints[]=") group by flagmap.maintformid having count(distinct flagmap.flagid)=$flagcount";
|
||||
// make flagconstraints a single string so that the final implode doesn't split it
|
||||
$logconstraints[]=join('', $flagconstraints);
|
||||
$mfconstraints[]=join('', $flagconstraints);
|
||||
}
|
||||
// uid
|
||||
if ($srchuid != "any" && $srchuid != "") {
|
||||
@@ -687,9 +674,10 @@ if ($search) {
|
||||
if ($target[0]=="") $target=[];
|
||||
if (in_array("log",$target)) {
|
||||
// run lognotes query and show results
|
||||
if(mysqli_num_rows($logrowqry)) {
|
||||
$log_num_results=mysqli_num_rows($logrowqry);
|
||||
if($log_num_results) {
|
||||
echo "
|
||||
<b>Results from Logbook</b><br><br>
|
||||
<b>Results from Logbook: $log_num_results</b><br><br>
|
||||
<table border=\"1\" width=\"100%\">
|
||||
<tr><th>Note ID</th><th>Date/Time</th><th>Shift</th><th>Tech</th><th>Subject</th><th>Note</th><th>References</th></tr>
|
||||
";
|
||||
@@ -748,9 +736,10 @@ if ($search) {
|
||||
if ($target[0]=="") $target=[];
|
||||
if (in_array("maintform",$target)) {
|
||||
// run maintforms query and show results
|
||||
if(mysqli_num_rows($mfrowqry)) {
|
||||
$mf_num_results=mysqli_num_rows($mfrowqry);
|
||||
if($mf_num_results) {
|
||||
echo "
|
||||
<b>Results from Maintenance Forms</b><br><br>
|
||||
<b>Results from Maintenance Forms: $mf_num_results</b><br><br>
|
||||
<br><table border=\"1\" width=\"100%\">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
@@ -811,9 +800,10 @@ if ($search) {
|
||||
if ($target[0]=="") $target=[];
|
||||
if (in_array("part",$target)) {
|
||||
// run parts query and show results
|
||||
if(mysqli_num_rows($prowqry)) {
|
||||
$p_num_results=mysqli_num_rows($prowqry);
|
||||
if($p_num_results) {
|
||||
echo "
|
||||
<b>Results from Parts</b><br><br>
|
||||
<b>Results from Parts: $p_num_results</b><br><br>
|
||||
<table width=\"100%\" border=\"1\" cellpadding=\"5\">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
|
||||
Reference in New Issue
Block a user