Various reformats. Changed boolean variables from 1/0 to TRUE/FALSE in multiple files.
This commit is contained in:
3
BUGS
3
BUGS
@@ -1,4 +1,5 @@
|
|||||||
BUGS
|
BUGS
|
||||||
|
|
||||||
1. Adding a reference to a note using the magnifying glass icon is possible even if not logged in. This results in a blank tech and shift.
|
1. Adding a reference to a note using the magnifying glass icon is possible even if not logged in. This results in a blank tech and shift.
|
||||||
SOMEWHAT FIXED. If not logged in and the partview argument is not 1, redirects to login page. (This is not the optimal solution. There needs to be a specific view only state.)
|
SOMEWHAT FIXED. If not logged in and the partview argument is not 1, redirects to login page. (This is not the optimal solution. There
|
||||||
|
needs to be a specific view only state.)
|
||||||
|
|||||||
8
TODO.txt
8
TODO.txt
@@ -1,15 +1,15 @@
|
|||||||
TODO.txt
|
TODO.txt
|
||||||
|
|
||||||
1. Create a weblink hot button on the add logbook entry page to insert a weblink. DONE
|
1. Create a weblink hot button on the add logbook entry page to insert a weblink. DONE
|
||||||
2. Allow admins to create global templates.
|
2. Allow admins to create global templates. DONE
|
||||||
3. Create a way to restore the global page colors. (db change reqd)
|
3. Create a way to restore the global page colors. (db change reqd)
|
||||||
4. Pick a logbook subject to associate with a scheduled task to populate for the logbook entry. (db change reqd)
|
4. Pick a logbook subject to associate with a scheduled task to populate for the logbook entry. (db change reqd)
|
||||||
5. Add info messages to scheduled task page edits.
|
5. Add info messages to scheduled task page edits.
|
||||||
6. Allow scheduled tasks to be completed as a group instead of having to complete each member.
|
6. Allow scheduled tasks to be completed as a group instead of having to complete each member.
|
||||||
7. Implement popup calendars for date entry fields. DONE
|
7. Implement popup calendars for date entry fields. DONE
|
||||||
8. Improve template management interface. It can be confusing. It needs its own page.
|
8. Improve template management interface. It can be confusing. It needs its own page. DONE
|
||||||
9. Remove refs from templates. (db change reqd)
|
9. Remove refs from templates. (db change reqd) DONE
|
||||||
10. Replace dynamic flag_ table creation with a flagassignment table. (db change reqd)
|
10. Replace dynamic flag_ table creation with a flagassignment table. (db change reqd) DONE
|
||||||
11. allow partids to be autogenerated if user doesn't supply one (db change reqd)
|
11. allow partids to be autogenerated if user doesn't supply one (db change reqd)
|
||||||
12. If there are no flags, don't offer to set them on reference chain
|
12. If there are no flags, don't offer to set them on reference chain
|
||||||
13. make some flags immutable so they won't be synced on reference chain.
|
13. make some flags immutable so they won't be synced on reference chain.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,81 +2,85 @@
|
|||||||
|
|
||||||
-- ---------- version 5.2.1 -------------
|
-- ---------- version 5.2.1 -------------
|
||||||
-- Make confname a unique column
|
-- Make confname a unique column
|
||||||
ALTER TABLE configs ADD UNIQUE(confname);
|
ALTER TABLE configs ADD UNIQUE (confname);
|
||||||
|
|
||||||
-- Delete db name, user, and password configs
|
-- Delete db name, user, and password configs
|
||||||
DELETE FROM configs where confname="ol_dbname";
|
DELETE FROM configs where confname = "ol_dbname";
|
||||||
DELETE FROM configs where confname="ol_dbuser";
|
|
||||||
DELETE FROM configs where confname="ol_dbpass";
|
DELETE FROM configs where confname = "ol_dbuser";
|
||||||
|
|
||||||
|
DELETE FROM configs where confname = "ol_dbpass";
|
||||||
|
|
||||||
-- Add config option for server side error logging
|
-- Add config option for server side error logging
|
||||||
INSERT IGNORE INTO configs(confname,confvalue) values('log_errors','0')
|
INSERT IGNORE INTO
|
||||||
|
configs (confname, confvalue)
|
||||||
|
values ('log_errors', '0')
|
||||||
|
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.2.1" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.2.1" WHERE confname = "ol_version";
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
|
|
||||||
-- ---------- version 5.2.2 -------------
|
-- ---------- version 5.2.2 -------------
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.2.2" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.2.2" WHERE confname = "ol_version";
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
|
|
||||||
-- ---------- version 5.2.3 -------------
|
-- ---------- version 5.2.3 -------------
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.2.3" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.2.3" WHERE confname = "ol_version";
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
|
|
||||||
-- ---------- version 5.2.4 -------------
|
-- ---------- version 5.2.4 -------------
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.2.4" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.2.4" WHERE confname = "ol_version";
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
|
|
||||||
-- ---------- version 5.2.4.1 -----------
|
-- ---------- version 5.2.4.1 -----------
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.2.4.1" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.2.4.1" WHERE confname = "ol_version";
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
|
|
||||||
-- ---------- version 5.2.4.2 -----------
|
-- ---------- version 5.2.4.2 -----------
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.2.4.2" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.2.4.2" WHERE confname = "ol_version";
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
|
|
||||||
-- ---------- version 5.2.4.3 -----------
|
-- ---------- version 5.2.4.3 -----------
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.2.4.3" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.2.4.3" WHERE confname = "ol_version";
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
|
|
||||||
-- ---------- version 5.2.4.4 -----------
|
-- ---------- version 5.2.4.4 -----------
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.2.4.4" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.2.4.4" WHERE confname = "ol_version";
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
|
|
||||||
-- ---------- version 5.2.5 -------------
|
-- ---------- version 5.2.5 -------------
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.2.5" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.2.5" WHERE confname = "ol_version";
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
|
|
||||||
-- ---------- version 5.3.0 -------------
|
-- ---------- version 5.3.0 -------------
|
||||||
-- Update version number
|
-- Update version number
|
||||||
UPDATE configs SET confvalue="5.3.0" WHERE confname="ol_version";
|
UPDATE configs SET confvalue = "5.3.0" WHERE confname = "ol_version";
|
||||||
|
|
||||||
-- Create the flagmap table
|
-- Create the flagmap table
|
||||||
CREATE TABLE IF NOT EXISTS `flagmap` (
|
CREATE TABLE IF NOT EXISTS `flagmap` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`flagid` int(11) NOT NULL,
|
`flagid` int(11) NOT NULL,
|
||||||
`lognoteid` int(11) DEFAULT NULL,
|
`lognoteid` int(11) DEFAULT NULL,
|
||||||
`maintformid` int(11) DEFAULT NULL,
|
`maintformid` int(11) DEFAULT NULL,
|
||||||
`notetemplateid` int(11) DEFAULT NULL,
|
`notetemplateid` int(11) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
||||||
|
|
||||||
-- Create the reflinks table
|
-- Create the reflinks table
|
||||||
CREATE TABLE IF NOT EXISTS `reflinks` (
|
CREATE TABLE IF NOT EXISTS `reflinks` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`noteid` int(11) DEFAULT NULL,
|
`noteid` int(11) DEFAULT NULL,
|
||||||
`templateid` int(11) DEFAULT NULL,
|
`templateid` int(11) DEFAULT NULL,
|
||||||
`target` int(11) NOT NULL,
|
`target` int(11) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
||||||
|
|
||||||
-- --------------------------------------
|
-- --------------------------------------
|
||||||
@@ -8,27 +8,27 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
include("functions.php");
|
include("functions.php");
|
||||||
$version=OL_VERSION;
|
$version = OL_VERSION;
|
||||||
|
|
||||||
$print=$_REQUEST['print'] ?? NULL;
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
framework("begin","About OpenLog","About OpenLog",$print);
|
framework("begin", "About OpenLog", "About OpenLog", $print);
|
||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if(!$print){
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
echo "
|
echo "
|
||||||
<h3 align=\"center\">
|
<h3 align=\"center\">
|
||||||
OpenLog $version
|
OpenLog $version
|
||||||
@@ -88,9 +88,7 @@ border=0></a></td><td><b>Fugue<br>Icons</b></td><td>The icons used in OpenLog ar
|
|||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
";
|
";
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
1132
distfiles/admin.php
1132
distfiles/admin.php
File diff suppressed because it is too large
Load Diff
@@ -28,46 +28,48 @@ include("settings.php");
|
|||||||
|
|
||||||
|
|
||||||
// build the basic color array
|
// build the basic color array
|
||||||
$basic_colors=array(
|
$basic_colors = array(
|
||||||
"White" => "#FFFFFF",
|
"White" => "#FFFFFF",
|
||||||
"Silver" => "#C0C0C0",
|
"Silver" => "#C0C0C0",
|
||||||
"Gray" => "#808080",
|
"Gray" => "#808080",
|
||||||
"Black" => "#000000",
|
"Black" => "#000000",
|
||||||
"Red" => "#FF0000",
|
"Red" => "#FF0000",
|
||||||
"Maroon" => "#800000",
|
"Maroon" => "#800000",
|
||||||
"Orange" => "#FFA500",
|
"Orange" => "#FFA500",
|
||||||
"Yellow" => "#FFFF00",
|
"Yellow" => "#FFFF00",
|
||||||
"Olive" => "#808000",
|
"Olive" => "#808000",
|
||||||
"Lime" => "#00FF00",
|
"Lime" => "#00FF00",
|
||||||
"Green" => "#008000",
|
"Green" => "#008000",
|
||||||
"Aqua" => "#00FFFF",
|
"Aqua" => "#00FFFF",
|
||||||
"Teal" => "#008080",
|
"Teal" => "#008080",
|
||||||
"Blue" => "#0000FF",
|
"Blue" => "#0000FF",
|
||||||
"Navy" => "#000080",
|
"Navy" => "#000080",
|
||||||
"Fuchsia" => "#FF00FF",
|
"Fuchsia" => "#FF00FF",
|
||||||
"Purple" => "#800080");
|
"Purple" => "#800080"
|
||||||
|
);
|
||||||
|
|
||||||
// Generic functions
|
// Generic functions
|
||||||
|
|
||||||
function framework($option,$htmltitle,$pagetitle,$print) {
|
function framework($option, $htmltitle, $pagetitle, $print)
|
||||||
|
{
|
||||||
// generates html code for the beginning and end of all pages
|
// generates html code for the beginning and end of all pages
|
||||||
if ($option=="begin") {
|
if ($option == "begin") {
|
||||||
// generates everything down to the first horiz rule inclusive
|
// generates everything down to the first horiz rule inclusive
|
||||||
// htmltitle is the page title that appears in the window titlebar
|
// htmltitle is the page title that appears in the window titlebar
|
||||||
// pagetitle is what will appear as the title of the page itself
|
// pagetitle is what will appear as the title of the page itself
|
||||||
// print is whether to format for printing or not
|
// print is whether to format for printing or not
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$bgcolor=P_BACKGROUND_COLOR;
|
$bgcolor = P_BACKGROUND_COLOR;
|
||||||
$textcolor=P_TEXT_COLOR;
|
$textcolor = P_TEXT_COLOR;
|
||||||
$linkcolor=P_LINK_COLOR;
|
$linkcolor = P_LINK_COLOR;
|
||||||
$vlinkcolor=P_VLINK_COLOR;
|
$vlinkcolor = P_VLINK_COLOR;
|
||||||
$hdgcolor=P_HEADING_COLOR;
|
$hdgcolor = P_HEADING_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$bgcolor=BACKGROUND_COLOR;
|
$bgcolor = BACKGROUND_COLOR;
|
||||||
$textcolor=TEXT_COLOR;
|
$textcolor = TEXT_COLOR;
|
||||||
$linkcolor=LINK_COLOR;
|
$linkcolor = LINK_COLOR;
|
||||||
$vlinkcolor=VLINK_COLOR;
|
$vlinkcolor = VLINK_COLOR;
|
||||||
$hdgcolor=HEADING_COLOR;
|
$hdgcolor = HEADING_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
@@ -91,13 +93,13 @@ function framework($option,$htmltitle,$pagetitle,$print) {
|
|||||||
<font size=5 color=\"$hdgcolor\"><b> $htmltitle - $pagetitle</b></font><br>
|
<font size=5 color=\"$hdgcolor\"><b> $htmltitle - $pagetitle</b></font><br>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
} else if ($option=="end") {
|
} else if ($option == "end") {
|
||||||
// generates everything from the last horiz rule down to end of page
|
// generates everything from the last horiz rule down to end of page
|
||||||
echo "
|
echo "
|
||||||
<hr><br><br>
|
<hr><br><br>
|
||||||
";
|
";
|
||||||
if (defined("FOOTER_MESSAGE")) {
|
if (defined("FOOTER_MESSAGE")) {
|
||||||
$footer_msg=FOOTER_MESSAGE;
|
$footer_msg = FOOTER_MESSAGE;
|
||||||
echo "
|
echo "
|
||||||
<center>$footer_msg</center><br>
|
<center>$footer_msg</center><br>
|
||||||
";
|
";
|
||||||
@@ -221,14 +223,15 @@ function framework($option,$htmltitle,$pagetitle,$print) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pagetable($option) {
|
function pagetable($option)
|
||||||
if ($option=="begin") {
|
{
|
||||||
|
if ($option == "begin") {
|
||||||
echo "
|
echo "
|
||||||
<br>
|
<br>
|
||||||
<table border=\"0\" width=\"100%\" cellpadding=\"10\">
|
<table border=\"0\" width=\"100%\" cellpadding=\"10\">
|
||||||
<tr>
|
<tr>
|
||||||
";
|
";
|
||||||
} else if ($option=="end") {
|
} else if ($option == "end") {
|
||||||
echo "
|
echo "
|
||||||
</tr></table>
|
</tr></table>
|
||||||
";
|
";
|
||||||
@@ -240,14 +243,15 @@ function pagetable($option) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageblock($block,$option) {
|
function pageblock($block, $option)
|
||||||
|
{
|
||||||
global $sbcolor;
|
global $sbcolor;
|
||||||
if ($block=="left") {
|
if ($block == "left") {
|
||||||
if ($option=="begin") {
|
if ($option == "begin") {
|
||||||
echo "
|
echo "
|
||||||
<td width=\"210\" bgcolor=\"$sbcolor\" valign=\"top\">
|
<td width=\"210\" bgcolor=\"$sbcolor\" valign=\"top\">
|
||||||
";
|
";
|
||||||
} else if ($option=="end") {
|
} else if ($option == "end") {
|
||||||
echo "
|
echo "
|
||||||
</td>
|
</td>
|
||||||
";
|
";
|
||||||
@@ -257,12 +261,12 @@ function pageblock($block,$option) {
|
|||||||
";
|
";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else if ($block=="right") {
|
} else if ($block == "right") {
|
||||||
if ($option=="begin") {
|
if ($option == "begin") {
|
||||||
echo "
|
echo "
|
||||||
<td valign=\"top\">
|
<td valign=\"top\">
|
||||||
";
|
";
|
||||||
} else if ($option=="end") {
|
} else if ($option == "end") {
|
||||||
echo "
|
echo "
|
||||||
</td>
|
</td>
|
||||||
";
|
";
|
||||||
@@ -280,11 +284,12 @@ function pageblock($block,$option) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sidemenu($noprint=false) {
|
function sidemenu($noprint = false)
|
||||||
|
{
|
||||||
// Displays sidebar menu
|
// Displays sidebar menu
|
||||||
global $db,$mbgcolor,$noprint;
|
global $db, $mbgcolor, $noprint;
|
||||||
$doparts=PARTS_FUNCTIONS;
|
$doparts = PARTS_FUNCTIONS;
|
||||||
$doschedmaint=SCHEDMAINT_FUNCTIONS;
|
$doschedmaint = SCHEDMAINT_FUNCTIONS;
|
||||||
echo "
|
echo "
|
||||||
<hr><br>
|
<hr><br>
|
||||||
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
|
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
|
||||||
@@ -333,8 +338,8 @@ function sidemenu($noprint=false) {
|
|||||||
</table>
|
</table>
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
$loginid=$_SESSION['login'];
|
$loginid = $_SESSION['login'];
|
||||||
$loggedinas=mysqli_fetch_row(mysqli_query($db,"select techname from techs where techid=\"$loginid\""))[0];
|
$loggedinas = mysqli_fetch_row(mysqli_query($db, "select techname from techs where techid=\"$loginid\""))[0];
|
||||||
echo "
|
echo "
|
||||||
<hr>
|
<hr>
|
||||||
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
|
<table bgcolor=\"$mbgcolor\" border=\"1\" width=\"100%\">
|
||||||
@@ -359,22 +364,23 @@ function sidemenu($noprint=false) {
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
function banner($print) {
|
function banner($print)
|
||||||
|
{
|
||||||
// displays a banner
|
// displays a banner
|
||||||
global $db;
|
global $db;
|
||||||
$bannerid=BANNER;
|
$bannerid = BANNER;
|
||||||
// get banner parameters from banner table
|
// get banner parameters from banner table
|
||||||
$banrow=mysqli_fetch_assoc(mysqli_query($db,"select * from banners where bannerid=\"$bannerid\""));
|
$banrow = mysqli_fetch_assoc(mysqli_query($db, "select * from banners where bannerid=\"$bannerid\""));
|
||||||
if (!$banrow) {
|
if (!$banrow) {
|
||||||
$bannerid=1;
|
$bannerid = 1;
|
||||||
} else {
|
} else {
|
||||||
$bannertext=$banrow["bannername"];
|
$bannertext = $banrow["bannername"];
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$bannercolor="#FFFFFF";
|
$bannercolor = "#FFFFFF";
|
||||||
$bannertxtcolor="#000000";
|
$bannertxtcolor = "#000000";
|
||||||
} else {
|
} else {
|
||||||
$bannercolor=$banrow["bannercolor"];
|
$bannercolor = $banrow["bannercolor"];
|
||||||
$bannertxtcolor=$banrow["textcolor"];
|
$bannertxtcolor = $banrow["textcolor"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($bannerid != 1) {
|
if ($bannerid != 1) {
|
||||||
@@ -385,18 +391,20 @@ function banner($print) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dblookup($dbhandle,$table,$in_field,$out_field,$in_data) {
|
function dblookup($dbhandle, $table, $in_field, $out_field, $in_data)
|
||||||
|
{
|
||||||
// look up a single field in a database given a value for a single field
|
// look up a single field in a database given a value for a single field
|
||||||
$dbqry=mysqli_query($dbhandle,"select $out_field from $table where $in_field=\"$in_data\"");
|
$dbqry = mysqli_query($dbhandle, "select $out_field from $table where $in_field=\"$in_data\"");
|
||||||
if (mysqli_num_rows($dbqry)) {
|
if (mysqli_num_rows($dbqry)) {
|
||||||
$out_data=mysqli_fetch_row($dbqry)[0];
|
$out_data = mysqli_fetch_row($dbqry)[0];
|
||||||
} else {
|
} else {
|
||||||
$out_data=NULL;
|
$out_data = NULL;
|
||||||
}
|
}
|
||||||
return($out_data);
|
return ($out_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function calendar($year,$month,$day,$link_url) {
|
function calendar($year, $month, $day, $link_url)
|
||||||
|
{
|
||||||
// takes a numeric year, month, day, and the basic url for the day links as arguments
|
// takes a numeric year, month, day, and the basic url for the day links as arguments
|
||||||
// Shows a calendar with clickable dates.
|
// Shows a calendar with clickable dates.
|
||||||
// Based on an embeddable calendar by Yves Glodt.
|
// Based on an embeddable calendar by Yves Glodt.
|
||||||
@@ -405,27 +413,27 @@ function calendar($year,$month,$day,$link_url) {
|
|||||||
$YearToShow = $year;
|
$YearToShow = $year;
|
||||||
$MonthToShow = $month;
|
$MonthToShow = $month;
|
||||||
$DayToShow = $day;
|
$DayToShow = $day;
|
||||||
$NumberOfDays = date(t,mktime(0,0,0,$MonthToShow+1,0,$YearToShow,-1));
|
$NumberOfDays = date(t, mktime(0, 0, 0, $MonthToShow + 1, 0, $YearToShow, -1));
|
||||||
if ($month==1) {
|
if ($month == 1) {
|
||||||
$mbackyear=$year-1;
|
$mbackyear = $year - 1;
|
||||||
$mbackmonth=12;
|
$mbackmonth = 12;
|
||||||
} else {
|
} else {
|
||||||
$mbackyear=$year;
|
$mbackyear = $year;
|
||||||
$mbackmonth=$month-1;
|
$mbackmonth = $month - 1;
|
||||||
}
|
}
|
||||||
if ($month==12) {
|
if ($month == 12) {
|
||||||
$mfwdyear=$year+1;
|
$mfwdyear = $year + 1;
|
||||||
$mfwdmonth=1;
|
$mfwdmonth = 1;
|
||||||
} else {
|
} else {
|
||||||
$mfwdyear=$year;
|
$mfwdyear = $year;
|
||||||
$mfwdmonth=$month+1;
|
$mfwdmonth = $month + 1;
|
||||||
}
|
}
|
||||||
$ybackyear=$year-1;
|
$ybackyear = $year - 1;
|
||||||
$ybackmonth=$month;
|
$ybackmonth = $month;
|
||||||
$yfwdyear=$year+1;
|
$yfwdyear = $year + 1;
|
||||||
$yfwdmonth=$month;
|
$yfwdmonth = $month;
|
||||||
|
|
||||||
$MonthNames = array(1=>'January','February','March','April','May','June','July','August','September','October','November','December');
|
$MonthNames = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
|
||||||
|
|
||||||
echo <<<EOT
|
echo <<<EOT
|
||||||
<table border="1" cellpadding="1" cellspacing="0">
|
<table border="1" cellpadding="1" cellspacing="0">
|
||||||
@@ -452,39 +460,39 @@ function calendar($year,$month,$day,$link_url) {
|
|||||||
|
|
||||||
EOT;
|
EOT;
|
||||||
|
|
||||||
$FirstDayOfWeek = date(l,mktime(0,0,0,$MonthToShow,1,$YearToShow));
|
$FirstDayOfWeek = date(l, mktime(0, 0, 0, $MonthToShow, 1, $YearToShow));
|
||||||
|
|
||||||
switch ($FirstDayOfWeek) {
|
switch ($FirstDayOfWeek) {
|
||||||
case 'Monday':
|
case 'Monday':
|
||||||
$offset = 1;
|
$offset = 1;
|
||||||
break;
|
break;
|
||||||
case 'Tuesday':
|
case 'Tuesday':
|
||||||
$offset = 2;
|
$offset = 2;
|
||||||
break;
|
break;
|
||||||
case 'Wednesday':
|
case 'Wednesday':
|
||||||
$offset = 3;
|
$offset = 3;
|
||||||
break;
|
break;
|
||||||
case 'Thursday':
|
case 'Thursday':
|
||||||
$offset = 4;
|
$offset = 4;
|
||||||
break;
|
break;
|
||||||
case 'Friday':
|
case 'Friday':
|
||||||
$offset = 5;
|
$offset = 5;
|
||||||
break;
|
break;
|
||||||
case 'Saturday':
|
case 'Saturday':
|
||||||
$offset = 6;
|
$offset = 6;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($offset > 0) {
|
if ($offset > 0) {
|
||||||
print "<tr align=\"center\">\n";
|
print "<tr align=\"center\">\n";
|
||||||
echo str_repeat("<td class=\"n\"> </td>\n",$offset);
|
echo str_repeat("<td class=\"n\"> </td>\n", $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i=1; $i <= $NumberOfDays; $i++) {
|
for ($i = 1; $i <= $NumberOfDays; $i++) {
|
||||||
$DayOfWeek = date(l,mktime(0,0,0,$MonthToShow,$i,$YearToShow));
|
$DayOfWeek = date(l, mktime(0, 0, 0, $MonthToShow, $i, $YearToShow));
|
||||||
if($DayOfWeek == 'Sunday') {
|
if ($DayOfWeek == 'Sunday') {
|
||||||
print "<tr align=\"center\">\n";
|
print "<tr align=\"center\">\n";
|
||||||
}
|
}
|
||||||
if ($i != $DayToShow) {
|
if ($i != $DayToShow) {
|
||||||
@@ -492,27 +500,28 @@ EOT;
|
|||||||
} else {
|
} else {
|
||||||
print "<td><a href=\"$link_url?y=$YearToShow&m=$MonthToShow&d=$i\"><b><font size=\"+1\" color=\"#FF0000\">$i</font></b></a></td>\n";
|
print "<td><a href=\"$link_url?y=$YearToShow&m=$MonthToShow&d=$i\"><b><font size=\"+1\" color=\"#FF0000\">$i</font></b></a></td>\n";
|
||||||
}
|
}
|
||||||
if($DayOfWeek == 'Saturday') {
|
if ($DayOfWeek == 'Saturday') {
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( ($offset == 5) && ($NumberOfDays > 30) ) || ( ($offset == 6) && ($NumberOfDays > 29) ) ) {
|
if ((($offset == 5) && ($NumberOfDays > 30)) || (($offset == 6) && ($NumberOfDays > 29))) {
|
||||||
if (42-$NumberOfDays-$offset > 0) {
|
if (42 - $NumberOfDays - $offset > 0) {
|
||||||
echo str_repeat("<td class=\"n\"> </td>\n",42-$NumberOfDays-$offset);
|
echo str_repeat("<td class=\"n\"> </td>\n", 42 - $NumberOfDays - $offset);
|
||||||
}
|
}
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
} elseif ( ($NumberOfDays != 28) || ($offset > 0) ) {
|
} elseif (($NumberOfDays != 28) || ($offset > 0)) {
|
||||||
if (35-$NumberOfDays-$offset > 0) {
|
if (35 - $NumberOfDays - $offset > 0) {
|
||||||
echo str_repeat("<td class=\"n\"> </td>\n",35-$NumberOfDays-$offset);
|
echo str_repeat("<td class=\"n\"> </td>\n", 35 - $NumberOfDays - $offset);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function colorpicker($baseurl) {
|
function colorpicker($baseurl)
|
||||||
|
{
|
||||||
// takes a standard url and tacks the color number on to the end of it
|
// takes a standard url and tacks the color number on to the end of it
|
||||||
// giving a palette of links
|
// giving a palette of links
|
||||||
echo "
|
echo "
|
||||||
@@ -595,54 +604,57 @@ function colorpicker($baseurl) {
|
|||||||
// Project functions
|
// Project functions
|
||||||
|
|
||||||
|
|
||||||
function getsetting($setting_name,$tech_id) {
|
function getsetting($setting_name, $tech_id)
|
||||||
|
{
|
||||||
// get the value of a setting for a tech
|
// get the value of a setting for a tech
|
||||||
global $db;
|
global $db;
|
||||||
$confinfo=mysqli_fetch_assoc(mysqli_query($db,"select confid,confvalue from configs where confname=\"$setting_name\""));
|
$confinfo = mysqli_fetch_assoc(mysqli_query($db, "select confid,confvalue from configs where confname=\"$setting_name\""));
|
||||||
$confid=$confinfo["confid"];
|
$confid = $confinfo["confid"];
|
||||||
$confvalue=$confinfo["confvalue"];
|
$confvalue = $confinfo["confvalue"];
|
||||||
$custqry=mysqli_query($db,"select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$tech_id\"");
|
$custqry = mysqli_query($db, "select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$tech_id\"");
|
||||||
if (mysqli_num_rows($custqry)) {
|
if (mysqli_num_rows($custqry)) {
|
||||||
$custvalue=mysqli_fetch_row($custqry)[0];
|
$custvalue = mysqli_fetch_row($custqry)[0];
|
||||||
}
|
}
|
||||||
// if value in custom table, use it
|
// if value in custom table, use it
|
||||||
if (mysqli_num_rows($custqry)) {
|
if (mysqli_num_rows($custqry)) {
|
||||||
$retvalue=$custvalue;
|
$retvalue = $custvalue;
|
||||||
$table="customs";
|
$table = "customs";
|
||||||
} else {
|
} else {
|
||||||
$retvalue=$confvalue;
|
$retvalue = $confvalue;
|
||||||
$table="configs";
|
$table = "configs";
|
||||||
}
|
}
|
||||||
$result=array('value' => $retvalue,'table' => $table,'id' => $confid);
|
$result = array('value' => $retvalue, 'table' => $table, 'id' => $confid);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function putsetting($setting_name,$setting_value,$tech_id) {
|
function putsetting($setting_name, $setting_value, $tech_id)
|
||||||
|
{
|
||||||
// set the value of a setting for a tech
|
// set the value of a setting for a tech
|
||||||
global $db;
|
global $db;
|
||||||
$confinfo=mysqli_fetch_assoc(mysqli_query($db,"select confid,confvalue from configs where confname=\"$setting_name\""));
|
$confinfo = mysqli_fetch_assoc(mysqli_query($db, "select confid,confvalue from configs where confname=\"$setting_name\""));
|
||||||
$confid=$confinfo["confid"];
|
$confid = $confinfo["confid"];
|
||||||
$confvalue=$confinfo["confvalue"];
|
$confvalue = $confinfo["confvalue"];
|
||||||
$custqry=mysqli_query($db,"select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$tech_id\"");
|
$custqry = mysqli_query($db, "select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$tech_id\"");
|
||||||
if (mysqli_num_rows($custqry)) {
|
if (mysqli_num_rows($custqry)) {
|
||||||
if ($setting_value == $confvalue) {
|
if ($setting_value == $confvalue) {
|
||||||
mysqli_query($db,"delete from customs where customtech=\"$tech_id\" and customconfnum=\"$confid\"");
|
mysqli_query($db, "delete from customs where customtech=\"$tech_id\" and customconfnum=\"$confid\"");
|
||||||
}
|
}
|
||||||
$custvalue=mysqli_fetch_row($custqry)[0];
|
$custvalue = mysqli_fetch_row($custqry)[0];
|
||||||
if ($custvalue != $setting_value) {
|
if ($custvalue != $setting_value) {
|
||||||
mysqli_query($db,"update customs set customconfvalue=\"$setting_value\" where customconfnum=\"$confid\" and customtech=\"$tech_id\"");
|
mysqli_query($db, "update customs set customconfvalue=\"$setting_value\" where customconfnum=\"$confid\" and customtech=\"$tech_id\"");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mysqli_query($db,"insert into customs(customtech,customconfnum,customconfvalue) values(\"$tech_id\",\"$confid\",\"$setting_value\")");
|
mysqli_query($db, "insert into customs(customtech,customconfnum,customconfvalue) values(\"$tech_id\",\"$confid\",\"$setting_value\")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function islink($il_note) {
|
function islink($il_note)
|
||||||
|
{
|
||||||
// takes a noteid number as an argument
|
// takes a noteid number as an argument
|
||||||
// determines if the argument is a link in a reference chain
|
// determines if the argument is a link in a reference chain
|
||||||
// returns 1 if note is a link, 0 if not
|
// returns 1 if note is a link, 0 if not
|
||||||
global $db;
|
global $db;
|
||||||
$refqry=mysqli_query($db,"select id from reflinks where noteid is not null and (noteid='$il_note' or target='$il_note')");
|
$refqry = mysqli_query($db, "select id from reflinks where noteid is not null and (noteid='$il_note' or target='$il_note')");
|
||||||
if (mysqli_num_rows($refqry)) {
|
if (mysqli_num_rows($refqry)) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -651,97 +663,101 @@ function islink($il_note) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function generate_chain($chainlink) {
|
function generate_chain($chainlink)
|
||||||
|
{
|
||||||
// generate a reference chain
|
// generate a reference chain
|
||||||
// takes a single parameter, a noteid
|
// takes a single parameter, a noteid
|
||||||
// finds all notes that are members of a chain containing the supplied noteid
|
// finds all notes that are members of a chain containing the supplied noteid
|
||||||
// returns a sorted array (chainarray) of all notes in chain
|
// returns a sorted array (chainarray) of all notes in chain
|
||||||
global $db;
|
global $db;
|
||||||
// create notes and refs arrays from the reflinks table
|
// create notes and refs arrays from the reflinks table
|
||||||
$notes=[];
|
$notes = [];
|
||||||
$targets=[];
|
$targets = [];
|
||||||
$linkqry=mysqli_query($db,"select noteid,target from reflinks where noteid is not null");
|
$linkqry = mysqli_query($db, "select noteid,target from reflinks where noteid is not null");
|
||||||
while ($link=mysqli_fetch_assoc($linkqry)) {
|
while ($link = mysqli_fetch_assoc($linkqry)) {
|
||||||
$notes[]=$link['noteid'];
|
$notes[] = $link['noteid'];
|
||||||
$targets[]=$link['target'];
|
$targets[] = $link['target'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$chainarray=array(); // create the chainarray
|
$chainarray = array(); // create the chainarray
|
||||||
$chainarray[]=$chainlink; // add the incoming noteid for which the chain should be generated
|
$chainarray[] = $chainlink; // add the incoming noteid for which the chain should be generated
|
||||||
$captr=0; // chainarray pointer
|
$captr = 0; // chainarray pointer
|
||||||
while($captr<count($chainarray)) { // as long as the chainarray is growing
|
while ($captr < count($chainarray)) { // as long as the chainarray is growing
|
||||||
$nptr=0; // note pointer
|
$nptr = 0; // note pointer
|
||||||
// run through the notes array, adding all targets for this note to the chainarray
|
// run through the notes array, adding all targets for this note to the chainarray
|
||||||
while($nptr<count($notes)) {
|
while ($nptr < count($notes)) {
|
||||||
if(($notes[$nptr]==$chainarray[$captr]) && ( ! in_array($targets[$nptr],$chainarray))) {
|
if (($notes[$nptr] == $chainarray[$captr]) && (! in_array($targets[$nptr], $chainarray))) {
|
||||||
$chainarray[]=$targets[$nptr];
|
$chainarray[] = $targets[$nptr];
|
||||||
}
|
}
|
||||||
$nptr=$nptr+1;
|
$nptr = $nptr + 1;
|
||||||
}
|
}
|
||||||
// run through the targets array, adding all notes for this target to the chainarray
|
// run through the targets array, adding all notes for this target to the chainarray
|
||||||
$tptr=0; //target pointer
|
$tptr = 0; //target pointer
|
||||||
while($tptr<count($targets)) {
|
while ($tptr < count($targets)) {
|
||||||
if(($targets[$tptr]==$chainarray[$captr]) && ( ! in_array($notes[$tptr],$chainarray))) {
|
if (($targets[$tptr] == $chainarray[$captr]) && (! in_array($notes[$tptr], $chainarray))) {
|
||||||
$chainarray[]=$notes[$tptr];
|
$chainarray[] = $notes[$tptr];
|
||||||
}
|
}
|
||||||
$tptr=$tptr+1;
|
$tptr = $tptr + 1;
|
||||||
}
|
}
|
||||||
$captr=$captr+1;
|
$captr = $captr + 1;
|
||||||
}
|
}
|
||||||
// sort and return the output array
|
// sort and return the output array
|
||||||
sort($chainarray);
|
sort($chainarray);
|
||||||
return($chainarray);
|
return ($chainarray);
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertweblinks($rawstring) {
|
function convertweblinks($rawstring)
|
||||||
|
{
|
||||||
// takes a string, finds urls, and returns the string with urls converted to clickable links
|
// takes a string, finds urls, and returns the string with urls converted to clickable links
|
||||||
$urlchunksize=URL_CHUNK_SIZE;
|
$urlchunksize = URL_CHUNK_SIZE;
|
||||||
// define regex pattern for urls
|
// define regex pattern for urls
|
||||||
$urlpatt="/<weblink\b[^>]*>(.*?)<\/weblink>/";
|
$urlpatt = "/<weblink\b[^>]*>(.*?)<\/weblink>/";
|
||||||
preg_match_all($urlpatt,$rawstring,$weblinks, PREG_SET_ORDER);
|
preg_match_all($urlpatt, $rawstring, $weblinks, PREG_SET_ORDER);
|
||||||
foreach ($weblinks as $urlblock) {
|
foreach ($weblinks as $urlblock) {
|
||||||
// split up really long url
|
// split up really long url
|
||||||
$spliturl=str_split($urlblock[1],$urlchunksize);
|
$spliturl = str_split($urlblock[1], $urlchunksize);
|
||||||
unset($urlstack);
|
unset($urlstack);
|
||||||
foreach ($spliturl as $urlchunk) {
|
foreach ($spliturl as $urlchunk) {
|
||||||
$urlstack[]="<a href=\"$urlblock[1]\" target=\"_blank\">$urlchunk</a>";
|
$urlstack[] = "<a href=\"$urlblock[1]\" target=\"_blank\">$urlchunk</a>";
|
||||||
}
|
}
|
||||||
$hyperlink=implode("<br>",$urlstack);
|
$hyperlink = implode("<br>", $urlstack);
|
||||||
$rawstring=str_replace($urlblock[0],$hyperlink,$rawstring);
|
$rawstring = str_replace($urlblock[0], $hyperlink, $rawstring);
|
||||||
}
|
}
|
||||||
return $rawstring;
|
return $rawstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showlinklist($print) {
|
function showlinklist($print)
|
||||||
|
{
|
||||||
global $db;
|
global $db;
|
||||||
$linkresult=mysqli_query($db,"select linkid from links where status=\"1\"");
|
$linkresult = mysqli_query($db, "select linkid from links where status=\"1\"");
|
||||||
if (mysqli_num_rows($linkresult) && !$print) {
|
if (mysqli_num_rows($linkresult) && !$print) {
|
||||||
echo "
|
echo "
|
||||||
<b>Links</b><br>
|
<b>Links</b><br>
|
||||||
";
|
";
|
||||||
$link=mysqli_query($db,"select displaytxt,urltxt from links where status=\"1\" order by linkpriority asc");
|
$link = mysqli_query($db, "select displaytxt,urltxt from links where status=\"1\" order by linkpriority asc");
|
||||||
while ($linkrow = mysqli_fetch_row($link)) {
|
while ($linkrow = mysqli_fetch_row($link)) {
|
||||||
printf("<a href=\"%s\">%s</a><br>",$linkrow[1],$linkrow[0]);
|
printf("<a href=\"%s\">%s</a><br>", $linkrow[1], $linkrow[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function nag($tech_id) {
|
function nag($tech_id)
|
||||||
|
{
|
||||||
// nags the user if something is pending
|
// nags the user if something is pending
|
||||||
global $db, $today;
|
global $db, $today;
|
||||||
// maintenance forms
|
// maintenance forms
|
||||||
$mfpending=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mftech=\"$tech_id\" and pending=1"));
|
$mfpending = mysqli_num_rows(mysqli_query($db, "select maintformid from maintforms where mftech=\"$tech_id\" and pending=1"));
|
||||||
if ($mfpending) {
|
if ($mfpending) {
|
||||||
echo "<font color=\"#FF0000\">NOTICE</font>: You have one or more maintenance forms to complete. <a href=\"maintform.php\">Click here to complete them</a>.<br><hr>";
|
echo "<font color=\"#FF0000\">NOTICE</font>: You have one or more maintenance forms to complete. <a href=\"maintform.php\">Click here to complete them</a>.<br><hr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// scheduled maintenance events
|
// scheduled maintenance events
|
||||||
$ucevents=get_upcoming_events();
|
$ucevents = get_upcoming_events();
|
||||||
$due=false;
|
$due = false;
|
||||||
$overdue=false;
|
$overdue = false;
|
||||||
foreach ($ucevents as $event) {
|
foreach ($ucevents as $event) {
|
||||||
if ($event['duedate'] == $today) $due=true;
|
if ($event['duedate'] == $today) $due = true;
|
||||||
if ($event['duedate'] < $today) $overdue=true;
|
if ($event['duedate'] < $today) $overdue = true;
|
||||||
}
|
}
|
||||||
if ($due) {
|
if ($due) {
|
||||||
echo "<font color=\"#FF0000\">NOTICE</font>: One or more scheduled maintenance events are due today. <a href=\"schedmaint.php\">Click here to view them</a>.<br><hr>";
|
echo "<font color=\"#FF0000\">NOTICE</font>: One or more scheduled maintenance events are due today. <a href=\"schedmaint.php\">Click here to view them</a>.<br><hr>";
|
||||||
@@ -751,7 +767,8 @@ function nag($tech_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_part_data($partinputdata) {
|
function get_part_data($partinputdata)
|
||||||
|
{
|
||||||
// given an associative array of partid, uid, partnum, sernum,
|
// given an associative array of partid, uid, partnum, sernum,
|
||||||
// return an associative array of
|
// return an associative array of
|
||||||
// partid, uid, partnum, sernum, partname, result
|
// partid, uid, partnum, sernum, partname, result
|
||||||
@@ -799,129 +816,131 @@ function get_part_data($partinputdata) {
|
|||||||
}
|
}
|
||||||
if (! $result) {
|
if (! $result) {
|
||||||
if (mysqli_num_rows($partqry)) {
|
if (mysqli_num_rows($partqry)) {
|
||||||
$partdata=mysqli_fetch_assoc($partqry);
|
$partdata = mysqli_fetch_assoc($partqry);
|
||||||
} else {
|
} else {
|
||||||
$result=1;
|
$result = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect mismatched input data
|
// detect mismatched input data
|
||||||
if ($checkmm) {
|
if ($checkmm) {
|
||||||
if (mysqli_num_rows($mismatchqry)) {
|
if (mysqli_num_rows($mismatchqry)) {
|
||||||
$result=2;
|
$result = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$partdata=array();
|
$partdata = array();
|
||||||
$partdata['result']=$result;
|
$partdata['result'] = $result;
|
||||||
} else {
|
} else {
|
||||||
$partdata['result']=0;
|
$partdata['result'] = 0;
|
||||||
}
|
}
|
||||||
return $partdata;
|
return $partdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_upcoming_events() {
|
function get_upcoming_events()
|
||||||
|
{
|
||||||
// build array of upcoming events
|
// build array of upcoming events
|
||||||
// takes no arguments
|
// takes no arguments
|
||||||
// returns an array containing arrays of upcoming event data
|
// returns an array containing arrays of upcoming event data
|
||||||
global $db, $today;
|
global $db, $today;
|
||||||
$uceventsqry=mysqli_query($db,"select * from events where active_flag=\"1\" and (deferred_flag=\"0\" or (deferred_flag=\"1\" and deferred_date <= \"$today\"))");
|
$uceventsqry = mysqli_query($db, "select * from events where active_flag=\"1\" and (deferred_flag=\"0\" or (deferred_flag=\"1\" and deferred_date <= \"$today\"))");
|
||||||
$ucevents=array();
|
$ucevents = array();
|
||||||
while ($uceventrow=mysqli_fetch_assoc($uceventsqry)) {
|
while ($uceventrow = mysqli_fetch_assoc($uceventsqry)) {
|
||||||
// provide eventid,task,device,start_date,last_date,deferred_flag,deferred_date,active_flag
|
// provide eventid,task,device,start_date,last_date,deferred_flag,deferred_date,active_flag
|
||||||
extract($uceventrow,EXTR_PREFIX_ALL,"eventdata");
|
extract($uceventrow, EXTR_PREFIX_ALL, "eventdata");
|
||||||
|
|
||||||
// provide deviceid,devicename,devicedesc,group_flag,active_flag
|
// provide deviceid,devicename,devicedesc,group_flag,active_flag
|
||||||
$devicedata=mysqli_fetch_assoc(mysqli_query($db,"select * from devices where deviceid=\"$eventdata_device\""));
|
$devicedata = mysqli_fetch_assoc(mysqli_query($db, "select * from devices where deviceid=\"$eventdata_device\""));
|
||||||
extract($devicedata,EXTR_PREFIX_ALL,"devicedata");
|
extract($devicedata, EXTR_PREFIX_ALL, "devicedata");
|
||||||
|
|
||||||
// provide taskid,taskname,taskdesc,frequency,period,weekdays_only,nextdue_relative,refdoc_name,refdoc_url,active_flag
|
// provide taskid,taskname,taskdesc,frequency,period,weekdays_only,nextdue_relative,refdoc_name,refdoc_url,active_flag
|
||||||
$taskdata=mysqli_fetch_assoc(mysqli_query($db,"select * from tasks where taskid=\"$eventdata_task\""));
|
$taskdata = mysqli_fetch_assoc(mysqli_query($db, "select * from tasks where taskid=\"$eventdata_task\""));
|
||||||
extract($taskdata,EXTR_PREFIX_ALL,"taskdata");
|
extract($taskdata, EXTR_PREFIX_ALL, "taskdata");
|
||||||
|
|
||||||
if ( ! ($taskdata_period == "once" && $eventdata_last_date >= $eventdata_start_date)) { // ignore completed one-time events
|
if (! ($taskdata_period == "once" && $eventdata_last_date >= $eventdata_start_date)) { // ignore completed one-time events
|
||||||
$start=date_create($eventdata_start_date); // create start date object
|
$start = date_create($eventdata_start_date); // create start date object
|
||||||
if ($eventdata_last_date=="0000-00-00") { // event has never been done. last date object will be start date object
|
if ($eventdata_last_date == "0000-00-00") { // event has never been done. last date object will be start date object
|
||||||
$lastdatestrg="never";
|
$lastdatestrg = "never";
|
||||||
$last=$start;
|
$last = $start;
|
||||||
} else { // create last date object
|
} else { // create last date object
|
||||||
$lastdatestrg="$eventdata_last_date";
|
$lastdatestrg = "$eventdata_last_date";
|
||||||
$last=date_create($eventdata_last_date);
|
$last = date_create($eventdata_last_date);
|
||||||
}
|
}
|
||||||
if ($taskdata_period=="once") { // nextdue object will be start date object
|
if ($taskdata_period == "once") { // nextdue object will be start date object
|
||||||
$nextdue=$start;
|
$nextdue = $start;
|
||||||
} else { // determine nextdue object from last date object (relative) or interval from start date object (absolute)
|
} else { // determine nextdue object from last date object (relative) or interval from start date object (absolute)
|
||||||
if ($lastdatestrg=="never") { // event has been scheduled to start today but has not been completed
|
if ($lastdatestrg == "never") { // event has been scheduled to start today but has not been completed
|
||||||
$nextdue=$start;
|
$nextdue = $start;
|
||||||
} else if ($last==$start) { // event was completed for the first time on the start date
|
} else if ($last == $start) { // event was completed for the first time on the start date
|
||||||
$nextdue=$start;
|
$nextdue = $start;
|
||||||
date_add($nextdue, date_interval_create_from_date_string("$taskdata_frequency $taskdata_period"));
|
date_add($nextdue, date_interval_create_from_date_string("$taskdata_frequency $taskdata_period"));
|
||||||
} else {
|
} else {
|
||||||
if ($taskdata_nextdue_relative) { // calculate from day of last done date
|
if ($taskdata_nextdue_relative) { // calculate from day of last done date
|
||||||
$nextdue=$last;
|
$nextdue = $last;
|
||||||
date_add($nextdue, date_interval_create_from_date_string("$taskdata_frequency $taskdata_period"));
|
date_add($nextdue, date_interval_create_from_date_string("$taskdata_frequency $taskdata_period"));
|
||||||
} else { // calculate from day of start date
|
} else { // calculate from day of start date
|
||||||
$nextdue=$start;
|
$nextdue = $start;
|
||||||
$testdate=date_create("1970-01-01");
|
$testdate = date_create("1970-01-01");
|
||||||
while ($testdate <= $last) {
|
while ($testdate <= $last) {
|
||||||
date_add($nextdue, date_interval_create_from_date_string("$taskdata_frequency $taskdata_period"));
|
date_add($nextdue, date_interval_create_from_date_string("$taskdata_frequency $taskdata_period"));
|
||||||
$testdate=$nextdue;
|
$testdate = $nextdue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($taskdata_weekdays_only) { // move forward off the weekend if required
|
if ($taskdata_weekdays_only) { // move forward off the weekend if required
|
||||||
$nextduedow=date("w",date_timestamp_get($nextdue));
|
$nextduedow = date("w", date_timestamp_get($nextdue));
|
||||||
if ($nextduedow==0) { // due on a Sunday
|
if ($nextduedow == 0) { // due on a Sunday
|
||||||
date_add($nextdue, date_interval_create_from_date_string("1 days"));
|
date_add($nextdue, date_interval_create_from_date_string("1 days"));
|
||||||
}
|
}
|
||||||
if ($nextduedow==6) { // due on a Saturday
|
if ($nextduedow == 6) { // due on a Saturday
|
||||||
date_add($nextdue, date_interval_create_from_date_string("2 days"));
|
date_add($nextdue, date_interval_create_from_date_string("2 days"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$duedate=date_format($nextdue, 'Y-m-d');
|
$duedate = date_format($nextdue, 'Y-m-d');
|
||||||
$daysaway=date_diff(date_create($today),$nextdue)->format('%a');
|
$daysaway = date_diff(date_create($today), $nextdue)->format('%a');
|
||||||
$direction=date_diff(date_create($today),$nextdue)->format('%R');
|
$direction = date_diff(date_create($today), $nextdue)->format('%R');
|
||||||
if ($direction=="+") {
|
if ($direction == "+") {
|
||||||
if ($daysaway == 0) {
|
if ($daysaway == 0) {
|
||||||
$duedatestrg="<font color=\"#FF0000\"> $duedate </font>";
|
$duedatestrg = "<font color=\"#FF0000\"> $duedate </font>";
|
||||||
} else if ($daysaway < 4) {
|
} else if ($daysaway < 4) {
|
||||||
$duedatestrg="<font color=\"#FFFF00\"> $duedate </font>";
|
$duedatestrg = "<font color=\"#FFFF00\"> $duedate </font>";
|
||||||
} else {
|
} else {
|
||||||
$duedatestrg="<font color=\"#00FF00\"> $duedate </font>";
|
$duedatestrg = "<font color=\"#00FF00\"> $duedate </font>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$duedatestrg="<font size=\"+1\" color=\"#FF0000\"><b> $duedate </b></font><img src=\"icons/exclamation-red.png\" border=\"0\">";
|
$duedatestrg = "<font size=\"+1\" color=\"#FF0000\"><b> $duedate </b></font><img src=\"icons/exclamation-red.png\" border=\"0\">";
|
||||||
}
|
}
|
||||||
$uceventline=array(
|
$uceventline = array(
|
||||||
'eventdata_eventid'=>$eventdata_eventid,
|
'eventdata_eventid' => $eventdata_eventid,
|
||||||
'duedate'=>$duedate,
|
'duedate' => $duedate,
|
||||||
'duedatestrg'=>$duedatestrg,
|
'duedatestrg' => $duedatestrg,
|
||||||
'devicedata_devicedesc'=>$devicedata_devicedesc,
|
'devicedata_devicedesc' => $devicedata_devicedesc,
|
||||||
'devicedata_devicename'=>$devicedata_devicename,
|
'devicedata_devicename' => $devicedata_devicename,
|
||||||
'taskdata_taskdesc'=>$taskdata_taskdesc,
|
'taskdata_taskdesc' => $taskdata_taskdesc,
|
||||||
'taskdata_taskname'=>$taskdata_taskname,
|
'taskdata_taskname' => $taskdata_taskname,
|
||||||
'lastdatestrg'=>$lastdatestrg
|
'lastdatestrg' => $lastdatestrg
|
||||||
);
|
);
|
||||||
$ucevents[]=$uceventline;
|
$ucevents[] = $uceventline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $ucevents;
|
return $ucevents;
|
||||||
}
|
}
|
||||||
|
|
||||||
function format_message($msgtype,$msgtxt) {
|
function format_message($msgtype, $msgtxt)
|
||||||
|
{
|
||||||
// displays a formatted message
|
// displays a formatted message
|
||||||
// $msgtype is 0 for success or anything else for failure
|
// $msgtype is 0 for success or anything else for failure
|
||||||
// $msgtxt is the string to display
|
// $msgtxt is the string to display
|
||||||
if ($msgtype == 0) {
|
if ($msgtype == 0) {
|
||||||
$state="ui-state-highlight";
|
$state = "ui-state-highlight";
|
||||||
$icon="ui-icon-info";
|
$icon = "ui-icon-info";
|
||||||
} else {
|
} else {
|
||||||
$state="ui-state-error";
|
$state = "ui-state-error";
|
||||||
$icon="ui-icon-alert";
|
$icon = "ui-icon-alert";
|
||||||
}
|
}
|
||||||
if ($msgtxt == "") $msgtxt="PROGRAM ERROR: No message text was supplied.";
|
if ($msgtxt == "") $msgtxt = "PROGRAM ERROR: No message text was supplied.";
|
||||||
echo "
|
echo "
|
||||||
<div class=\"$state ui-corner-all\" style=\"margin-top: 20px; padding: 0 .7em;\">
|
<div class=\"$state ui-corner-all\" style=\"margin-top: 20px; padding: 0 .7em;\">
|
||||||
<p><span class=\"ui-icon $icon\" style=\"float: left; margin-right: .3em;\"></span>
|
<p><span class=\"ui-icon $icon\" style=\"float: left; margin-right: .3em;\"></span>
|
||||||
@@ -930,7 +949,8 @@ function format_message($msgtype,$msgtxt) {
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
function templateselect($techid,$operation) {
|
function templateselect($techid, $operation)
|
||||||
|
{
|
||||||
// Displays a line enabling selection of a user or global template
|
// Displays a line enabling selection of a user or global template
|
||||||
// $techid is the id number of the current tech
|
// $techid is the id number of the current tech
|
||||||
// $operation is one of "add" "edit" "delete"
|
// $operation is one of "add" "edit" "delete"
|
||||||
@@ -947,10 +967,10 @@ function templateselect($techid,$operation) {
|
|||||||
<td>
|
<td>
|
||||||
<select name=\"usertemplateid\" title=\"Select the user template you'd like to load and click the Load Template button. User template selection takes precedence.\">
|
<select name=\"usertemplateid\" title=\"Select the user template you'd like to load and click the Load Template button. User template selection takes precedence.\">
|
||||||
";
|
";
|
||||||
$templaterow=mysqli_query($db,"select * from notetemplates where tech=\"$techid\" order by templatename asc");
|
$templaterow = mysqli_query($db, "select * from notetemplates where tech=\"$techid\" order by templatename asc");
|
||||||
printf("<option value=\"%s\" selected>%s</option>","0","Select user template");
|
printf("<option value=\"%s\" selected>%s</option>", "0", "Select user template");
|
||||||
while ($templateitem=mysqli_fetch_assoc($templaterow)) {
|
while ($templateitem = mysqli_fetch_assoc($templaterow)) {
|
||||||
printf("<option value=\"%s\">%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
|
printf("<option value=\"%s\">%s</option>", $templateitem["templateid"], $templateitem["templatename"]);
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
</select> or
|
</select> or
|
||||||
@@ -959,10 +979,10 @@ function templateselect($techid,$operation) {
|
|||||||
echo "
|
echo "
|
||||||
<select name=\"globaltemplateid\" title=\"Select the global template you'd like to load and click the Load Template button. User template selection takes precedence.\">
|
<select name=\"globaltemplateid\" title=\"Select the global template you'd like to load and click the Load Template button. User template selection takes precedence.\">
|
||||||
";
|
";
|
||||||
$templaterow=mysqli_query($db,"select * from notetemplates where tech=\"0\" order by templatename asc");
|
$templaterow = mysqli_query($db, "select * from notetemplates where tech=\"0\" order by templatename asc");
|
||||||
printf("<option value=\"%s\" selected>%s</option>","0","Select global template");
|
printf("<option value=\"%s\" selected>%s</option>", "0", "Select global template");
|
||||||
while ($templateitem=mysqli_fetch_assoc($templaterow)) {
|
while ($templateitem = mysqli_fetch_assoc($templaterow)) {
|
||||||
printf("<option value=\"%s\">%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
|
printf("<option value=\"%s\">%s</option>", $templateitem["templateid"], $templateitem["templatename"]);
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
</select>
|
</select>
|
||||||
@@ -980,4 +1000,3 @@ function templateselect($techid,$operation) {
|
|||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -10,25 +10,25 @@
|
|||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
|
|
||||||
$print=$_REQUEST['print'] ?? NULL;
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
framework("begin","OpenLog License","OpenLog License",$print);
|
framework("begin", "OpenLog License", "OpenLog License", $print);
|
||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if(!$print){
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
echo "
|
echo "
|
||||||
<pre>
|
<pre>
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
@@ -376,9 +376,7 @@ Public License instead of this License.
|
|||||||
</pre>
|
</pre>
|
||||||
";
|
";
|
||||||
|
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -10,72 +10,72 @@
|
|||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
if (!$_SESSION['login'] && !$_REQUEST['partview']) {
|
if (!$_SESSION['login'] && !$_REQUEST['partview']) {
|
||||||
header ("Location: login.php");
|
header("Location: login.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
$techid=$_SESSION['login'] ?? NULL;
|
$techid = $_SESSION['login'] ?? NULL;
|
||||||
$isadmin=dblookup($db,"techs","techid","admin",$techid);
|
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
|
||||||
$efftechid=$_REQUEST['efftechid'] ?? NULL;
|
$efftechid = $_REQUEST['efftechid'] ?? NULL;
|
||||||
$noteid=$_REQUEST['noteid'] ?? NULL;
|
$noteid = $_REQUEST['noteid'] ?? NULL;
|
||||||
$print=$_REQUEST['print'] ?? NULL;
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
$date=$_REQUEST['date'] ?? NULL;
|
$date = $_REQUEST['date'] ?? NULL;
|
||||||
$time=$_REQUEST['time'] ?? NULL;
|
$time = $_REQUEST['time'] ?? NULL;
|
||||||
$note=$_REQUEST['note'] ?? NULL;
|
$note = $_REQUEST['note'] ?? NULL;
|
||||||
$shift=$_REQUEST['shift'] ?? NULL;
|
$shift = $_REQUEST['shift'] ?? NULL;
|
||||||
$subject=$_REQUEST['subject'] ?? NULL;
|
$subject = $_REQUEST['subject'] ?? NULL;
|
||||||
$refstring=$_REQUEST['refstring'] ?? NULL;
|
$refstring = $_REQUEST['refstring'] ?? NULL;
|
||||||
$refto=$_REQUEST['refto'] ?? NULL;
|
$refto = $_REQUEST['refto'] ?? NULL;
|
||||||
$submit=$_REQUEST['submit'] ?? NULL;
|
$submit = $_REQUEST['submit'] ?? NULL;
|
||||||
$add=$_REQUEST['add'] ?? NULL;
|
$add = $_REQUEST['add'] ?? NULL;
|
||||||
$edit=$_REQUEST['edit'] ?? NULL;
|
$edit = $_REQUEST['edit'] ?? NULL;
|
||||||
$delete=$_REQUEST['delete'] ?? NULL;
|
$delete = $_REQUEST['delete'] ?? NULL;
|
||||||
$usertemplateid=$_REQUEST['usertemplateid'] ?? NULL;
|
$usertemplateid = $_REQUEST['usertemplateid'] ?? NULL;
|
||||||
$globaltemplateid=$_REQUEST['globaltemplateid'] ?? NULL;
|
$globaltemplateid = $_REQUEST['globaltemplateid'] ?? NULL;
|
||||||
$loadtemplate=$_REQUEST['loadtemplate'] ?? NULL;
|
$loadtemplate = $_REQUEST['loadtemplate'] ?? NULL;
|
||||||
$templatename=$_REQUEST['templatename'] ?? NULL;
|
$templatename = $_REQUEST['templatename'] ?? NULL;
|
||||||
$removepart=$_REQUEST['removepart'] ?? NULL;
|
$removepart = $_REQUEST['removepart'] ?? NULL;
|
||||||
$syncflags=$_REQUEST['syncflags'] ?? NULL;
|
$syncflags = $_REQUEST['syncflags'] ?? NULL;
|
||||||
$flags=$_POST['flags'] ?? [];
|
$flags = $_POST['flags'] ?? [];
|
||||||
$uids=$_POST['uids'] ?? [];
|
$uids = $_POST['uids'] ?? [];
|
||||||
$partnums=$_POST['partnums'] ?? [];
|
$partnums = $_POST['partnums'] ?? [];
|
||||||
$sernums=$_POST['sernums'] ?? [];
|
$sernums = $_POST['sernums'] ?? [];
|
||||||
$actions=$_POST['actions'] ?? [];
|
$actions = $_POST['actions'] ?? [];
|
||||||
$mfreqs=$_POST['mfreqs'] ?? [];
|
$mfreqs = $_POST['mfreqs'] ?? [];
|
||||||
$schedmaintcomplete=$_REQUEST['schedmaintcomplete'] ?? NULL;
|
$schedmaintcomplete = $_REQUEST['schedmaintcomplete'] ?? NULL;
|
||||||
$partview=$_REQUEST['partview'] ?? NULL;
|
$partview = $_REQUEST['partview'] ?? NULL;
|
||||||
|
|
||||||
$doparts=PARTS_FUNCTIONS;
|
$doparts = PARTS_FUNCTIONS;
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
$techalpha=TECH_ALPHA;
|
$techalpha = TECH_ALPHA;
|
||||||
$subjalpha=SUBJ_ALPHA;
|
$subjalpha = SUBJ_ALPHA;
|
||||||
$uidtext=UID_TEXT;
|
$uidtext = UID_TEXT;
|
||||||
|
|
||||||
$defaultshift=dblookup($db,"techs","techid","shift",$techid);
|
$defaultshift = dblookup($db, "techs", "techid", "shift", $techid);
|
||||||
|
|
||||||
if ($print=="Printer Friendly") {
|
if ($print == "Printer Friendly") {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
if ($partview) $edit=1;
|
if ($partview) $edit = 1;
|
||||||
if (!$add && !$edit && !$delete && !$submit) $add=1;
|
if (!$add && !$edit && !$delete && !$submit) $add = 1;
|
||||||
|
|
||||||
if ($isadmin) {
|
if ($isadmin) {
|
||||||
$authorized=TRUE;
|
$authorized = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$authorized=FALSE;
|
$authorized = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($add) {
|
if ($add) {
|
||||||
framework("begin","$logname","Note Entry",$print);
|
framework("begin", "$logname", "Note Entry", $print);
|
||||||
$authorized=TRUE;
|
$authorized = TRUE;
|
||||||
}
|
}
|
||||||
if ($edit || $delete) {
|
if ($edit || $delete) {
|
||||||
framework("begin","$logname","Note Edit",$print);
|
framework("begin", "$logname", "Note Edit", $print);
|
||||||
$owner=dblookup($db,"lognotes","lognoteid","tech",$noteid);
|
$owner = dblookup($db, "lognotes", "lognoteid", "tech", $noteid);
|
||||||
if ($techid==$owner) $authorized=TRUE;
|
if ($techid == $owner) $authorized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// var_dump($_REQUEST);
|
// var_dump($_REQUEST);
|
||||||
@@ -83,12 +83,12 @@ if ($edit || $delete) {
|
|||||||
// ******** begin database manipulation ********
|
// ******** begin database manipulation ********
|
||||||
|
|
||||||
if ($usertemplateid) {
|
if ($usertemplateid) {
|
||||||
$templateid=$usertemplateid;
|
$templateid = $usertemplateid;
|
||||||
} else if ($globaltemplateid) {
|
} else if ($globaltemplateid) {
|
||||||
$templateid=$globaltemplateid;
|
$templateid = $globaltemplateid;
|
||||||
} else {
|
} else {
|
||||||
$templateid=NULL;
|
$templateid = NULL;
|
||||||
$loadtemplate=NULL;
|
$loadtemplate = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($add) {
|
if ($add) {
|
||||||
@@ -96,150 +96,149 @@ if ($add) {
|
|||||||
// add the entry if submit is pressed
|
// add the entry if submit is pressed
|
||||||
if ($note) {
|
if ($note) {
|
||||||
// sanitize and fix blank date and time
|
// sanitize and fix blank date and time
|
||||||
$date=mysqli_real_escape_string($db,$date);
|
$date = mysqli_real_escape_string($db, $date);
|
||||||
$time=mysqli_real_escape_string($db,$time);
|
$time = mysqli_real_escape_string($db, $time);
|
||||||
if (!$date) $date=$today;
|
if (!$date) $date = $today;
|
||||||
if (!$time) $time=$now;
|
if (!$time) $time = $now;
|
||||||
// determine whether supplied date is future or past
|
// determine whether supplied date is future or past
|
||||||
$datediff=mysqli_fetch_row(mysqli_query($db,"select datediff(\"$date\",CURRENT_DATE)"));
|
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$date\",CURRENT_DATE)"));
|
||||||
// if future, set time to 00:00:01, if past, set to 23:59:59
|
// if future, set time to 00:00:01, if past, set to 23:59:59
|
||||||
if ($datediff[0]<0) {
|
if ($datediff[0] < 0) {
|
||||||
$time="23:59:59";
|
$time = "23:59:59";
|
||||||
}
|
}
|
||||||
if ($datediff[0]>0) {
|
if ($datediff[0] > 0) {
|
||||||
$time="00:00:01";
|
$time = "00:00:01";
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove html tags from note text and sanitize
|
// remove html tags from note text and sanitize
|
||||||
$note=strip_tags($note,"<a>");
|
$note = strip_tags($note, "<a>");
|
||||||
$note=mysqli_real_escape_string($db,$note);
|
$note = mysqli_real_escape_string($db, $note);
|
||||||
|
|
||||||
if (strlen($refstring)) {
|
if (strlen($refstring)) {
|
||||||
// remove everything except numbers and spaces from references and sanitize
|
// remove everything except numbers and spaces from references and sanitize
|
||||||
$refstring=preg_replace("#[^\d ]{1,}#"," ",$refstring);
|
$refstring = preg_replace("#[^\d ]{1,}#", " ", $refstring);
|
||||||
$refstring=mysqli_real_escape_string($db,$refstring);
|
$refstring = mysqli_real_escape_string($db, $refstring);
|
||||||
$refstring=trim($refstring);
|
$refstring = trim($refstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($doparts==1) {
|
if ($doparts == 1) {
|
||||||
// inspect part data
|
// inspect part data
|
||||||
$maxplidx=max(
|
$maxplidx = max(
|
||||||
max(array_keys($uids)),
|
max(array_keys($uids)),
|
||||||
max(array_keys($partnums)),
|
max(array_keys($partnums)),
|
||||||
max(array_keys($sernums))
|
max(array_keys($sernums))
|
||||||
);
|
);
|
||||||
for ($plidx=0;$plidx<=$maxplidx;$plidx++) {
|
for ($plidx = 0; $plidx <= $maxplidx; $plidx++) {
|
||||||
// for each part line, see what info is available
|
// for each part line, see what info is available
|
||||||
// if uid or pn/sn supplied, pull other info from parts
|
// if uid or pn/sn supplied, pull other info from parts
|
||||||
if ($uids[$plidx] != "") {
|
if ($uids[$plidx] != "") {
|
||||||
// see if this uid is in parts table.
|
// see if this uid is in parts table.
|
||||||
$uidqry=mysqli_query($db,"select * from parts where uid=\"$uids[$plidx]\"");
|
$uidqry = mysqli_query($db, "select * from parts where uid=\"$uids[$plidx]\"");
|
||||||
if (mysqli_num_rows($uidqry)) {
|
if (mysqli_num_rows($uidqry)) {
|
||||||
// if so, populate pn/sn
|
// if so, populate pn/sn
|
||||||
$uiddata=mysqli_fetch_assoc($uidqry);
|
$uiddata = mysqli_fetch_assoc($uidqry);
|
||||||
$partnums[$plidx]=$uiddata['partnum'];
|
$partnums[$plidx] = $uiddata['partnum'];
|
||||||
$sernums[$plidx]=$uiddata['sernum'];
|
$sernums[$plidx] = $uiddata['sernum'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
if ($partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
||||||
// see if this pn/sn is in parts table.
|
// see if this pn/sn is in parts table.
|
||||||
$pnsnqry=mysqli_query($db,"select * from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\"");
|
$pnsnqry = mysqli_query($db, "select * from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\"");
|
||||||
if (mysqli_num_rows($pnsnqry)) {
|
if (mysqli_num_rows($pnsnqry)) {
|
||||||
// if so, populate uid
|
// if so, populate uid
|
||||||
$pnsndata=mysqli_fetch_assoc($pnsnqry);
|
$pnsndata = mysqli_fetch_assoc($pnsnqry);
|
||||||
$uids[$plidx]=$pnsndata['uid'];
|
$uids[$plidx] = $pnsndata['uid'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($authorized) {
|
if ($authorized) {
|
||||||
// add the record to lognotes
|
// add the record to lognotes
|
||||||
mysqli_query($db,"insert into lognotes(date,time,shift,tech,subject,lognote) values (\"$date\", \"$time\", \"$shift\",\"$efftechid\",\"$subject\",\"$note\")");
|
mysqli_query($db, "insert into lognotes(date,time,shift,tech,subject,lognote) values (\"$date\", \"$time\", \"$shift\",\"$efftechid\",\"$subject\",\"$note\")");
|
||||||
$newnoteid=mysqli_insert_id($db);
|
$newnoteid = mysqli_insert_id($db);
|
||||||
|
|
||||||
// add references to the reflinks table
|
// add references to the reflinks table
|
||||||
if (strlen($refstring)) {
|
if (strlen($refstring)) {
|
||||||
$refstring=trim($refstring);
|
$refstring = trim($refstring);
|
||||||
$refarray=explode(" ",$refstring);
|
$refarray = explode(" ", $refstring);
|
||||||
foreach ($refarray as $target) {
|
foreach ($refarray as $target) {
|
||||||
mysqli_query($db,"insert into reflinks(noteid,target) values($newnoteid,$target)");
|
mysqli_query($db, "insert into reflinks(noteid,target) values($newnoteid,$target)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$chainmembers=generate_chain($newnoteid);
|
$chainmembers = generate_chain($newnoteid);
|
||||||
|
|
||||||
// update the flagmap table
|
// update the flagmap table
|
||||||
foreach ($flags as $thisflag) {
|
foreach ($flags as $thisflag) {
|
||||||
// set flag for this note
|
// set flag for this note
|
||||||
mysqli_query($db,"insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$newnoteid\")");
|
mysqli_query($db, "insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$newnoteid\")");
|
||||||
if ($syncflags) {
|
if ($syncflags) {
|
||||||
//set flag for reference chain notes
|
//set flag for reference chain notes
|
||||||
foreach ($chainmembers as $refdnote) {
|
foreach ($chainmembers as $refdnote) {
|
||||||
if ($refdnote != $newnoteid) {
|
if ($refdnote != $newnoteid) {
|
||||||
mysqli_query($db,"insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$refdnote\")");
|
mysqli_query($db, "insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$refdnote\")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($doparts==1) {
|
if ($doparts == 1) {
|
||||||
// now run through the part lines
|
// now run through the part lines
|
||||||
for ($plidx=0;$plidx<=$maxplidx;$plidx++) {
|
for ($plidx = 0; $plidx <= $maxplidx; $plidx++) {
|
||||||
// update the parts table
|
// update the parts table
|
||||||
|
|
||||||
// if this line includes a uid and a pn/sn
|
// if this line includes a uid and a pn/sn
|
||||||
if ($uids[$plidx] != "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
if ($uids[$plidx] != "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
||||||
// see if it's in the parts table
|
// see if it's in the parts table
|
||||||
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
|
if (! mysqli_num_rows(mysqli_query($db, "select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
|
||||||
// if not, add it to parts
|
// if not, add it to parts
|
||||||
mysqli_query($db,"insert into parts(uid,partnum,sernum) values(\"$uids[$plidx]\",\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
|
mysqli_query($db, "insert into parts(uid,partnum,sernum) values(\"$uids[$plidx]\",\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
|
||||||
$lpid=mysqli_insert_id($db);
|
$lpid = mysqli_insert_id($db);
|
||||||
} else {
|
} else {
|
||||||
// if so get the partid for the logparts table
|
// if so get the partid for the logparts table
|
||||||
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
|
$lpid = mysqli_fetch_row(mysqli_query($db, "select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
|
||||||
}
|
}
|
||||||
// add it to logparts table
|
// add it to logparts table
|
||||||
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
|
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||||
// create a maintenance form if required
|
// create a maintenance form if required
|
||||||
if ($mfreqs[$plidx]=="on") {
|
if ($mfreqs[$plidx] == "on") {
|
||||||
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
|
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this line includes a uid only
|
// if this line includes a uid only
|
||||||
} else if ($uids[$plidx] != "" && $partnums[$plidx] == "" && $sernums[$plidx] == "") {
|
} else if ($uids[$plidx] != "" && $partnums[$plidx] == "" && $sernums[$plidx] == "") {
|
||||||
// see if this uid is in parts table
|
// see if this uid is in parts table
|
||||||
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum is NULL and sernum is NULL"))) {
|
if (! mysqli_num_rows(mysqli_query($db, "select partid from parts where uid=\"$uids[$plidx]\" and partnum is NULL and sernum is NULL"))) {
|
||||||
// if not, add it to parts
|
// if not, add it to parts
|
||||||
mysqli_query($db,"insert into parts(uid) values(\"$uids[$plidx]\")");
|
mysqli_query($db, "insert into parts(uid) values(\"$uids[$plidx]\")");
|
||||||
$lpid=mysqli_insert_id($db);
|
$lpid = mysqli_insert_id($db);
|
||||||
} else {
|
} else {
|
||||||
// if so get the partid for the logparts table
|
// if so get the partid for the logparts table
|
||||||
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\""))[0];
|
$lpid = mysqli_fetch_row(mysqli_query($db, "select partid from parts where uid=\"$uids[$plidx]\""))[0];
|
||||||
}
|
}
|
||||||
// add it to logparts table
|
// add it to logparts table
|
||||||
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
|
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||||
// create a maintenance form if required
|
// create a maintenance form if required
|
||||||
if ($mfreqs[$plidx]=="on") {
|
if ($mfreqs[$plidx] == "on") {
|
||||||
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
|
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this line includes a pn/sn only
|
// if this line includes a pn/sn only
|
||||||
} else if ($uids[$plidx] == "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
} else if ($uids[$plidx] == "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
||||||
// see if this pn/sn is in the parts table
|
// see if this pn/sn is in the parts table
|
||||||
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid is NULL and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
|
if (! mysqli_num_rows(mysqli_query($db, "select partid from parts where uid is NULL and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
|
||||||
// if not, add it to parts
|
// if not, add it to parts
|
||||||
mysqli_query($db,"insert into parts(partnum,sernum) values(\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
|
mysqli_query($db, "insert into parts(partnum,sernum) values(\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
|
||||||
$lpid=mysqli_insert_id($db);
|
$lpid = mysqli_insert_id($db);
|
||||||
} else {
|
} else {
|
||||||
// if so get the partid for the logparts table
|
// if so get the partid for the logparts table
|
||||||
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
|
$lpid = mysqli_fetch_row(mysqli_query($db, "select partid from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
|
||||||
}
|
}
|
||||||
// add it to logparts table
|
// add it to logparts table
|
||||||
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
|
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||||
// create a maintenance form if required
|
// create a maintenance form if required
|
||||||
if ($mfreqs[$plidx]=="on") {
|
if ($mfreqs[$plidx] == "on") {
|
||||||
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
|
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// no part info was entered
|
// no part info was entered
|
||||||
}
|
}
|
||||||
@@ -249,58 +248,58 @@ if ($add) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($loadtemplate) {
|
if ($loadtemplate) {
|
||||||
$templatevalues=mysqli_fetch_assoc(mysqli_query($db,"select * from notetemplates where templateid=\"$templateid\""));
|
$templatevalues = mysqli_fetch_assoc(mysqli_query($db, "select * from notetemplates where templateid=\"$templateid\""));
|
||||||
$defaultshift=$templatevalues["shift"];
|
$defaultshift = $templatevalues["shift"];
|
||||||
$defaultsubject=$templatevalues["subject"];
|
$defaultsubject = $templatevalues["subject"];
|
||||||
$note=$templatevalues["lognote"];
|
$note = $templatevalues["lognote"];
|
||||||
$refstringqry=mysqli_query($db,"select target from reflinks where templateid=\"$templateid\"");
|
$refstringqry = mysqli_query($db, "select target from reflinks where templateid=\"$templateid\"");
|
||||||
while ($thistgt=mysqli_fetch_row($refstringqry)) {
|
while ($thistgt = mysqli_fetch_row($refstringqry)) {
|
||||||
$refstring=$refstring." ".$thistgt[0];
|
$refstring = $refstring . " " . $thistgt[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($edit) {
|
if ($edit) {
|
||||||
if ($removepart && $authorized) mysqli_query($db,"delete from logparts where lognoteid=\"$noteid\" and logpartid=\"$removepart\"");
|
if ($removepart && $authorized) mysqli_query($db, "delete from logparts where lognoteid=\"$noteid\" and logpartid=\"$removepart\"");
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
if ($note) {
|
if ($note) {
|
||||||
// remove cruft from note text
|
// remove cruft from note text
|
||||||
$note=strip_tags($note,"<a>");
|
$note = strip_tags($note, "<a>");
|
||||||
$note=mysqli_real_escape_string($db,$note);
|
$note = mysqli_real_escape_string($db, $note);
|
||||||
|
|
||||||
// remove cruft from references
|
// remove cruft from references
|
||||||
if (strlen($refstring)) {
|
if (strlen($refstring)) {
|
||||||
$refstring=trim($refstring);
|
$refstring = trim($refstring);
|
||||||
$refstring=preg_replace("#[a-zA-Z]{1,}#","",$refstring);
|
$refstring = preg_replace("#[a-zA-Z]{1,}#", "", $refstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($doparts==1) {
|
if ($doparts == 1) {
|
||||||
// inspect part data
|
// inspect part data
|
||||||
$maxplidx=max(
|
$maxplidx = max(
|
||||||
max(array_keys($uids)),
|
max(array_keys($uids)),
|
||||||
max(array_keys($partnums)),
|
max(array_keys($partnums)),
|
||||||
max(array_keys($sernums))
|
max(array_keys($sernums))
|
||||||
);
|
);
|
||||||
for ($plidx=0;$plidx<=$maxplidx;$plidx++) {
|
for ($plidx = 0; $plidx <= $maxplidx; $plidx++) {
|
||||||
// for each part line, see what info is available
|
// for each part line, see what info is available
|
||||||
// if uid or pn/sn supplied, pull other info from parts
|
// if uid or pn/sn supplied, pull other info from parts
|
||||||
if ($uids[$plidx] != "") {
|
if ($uids[$plidx] != "") {
|
||||||
// see if this uid is in parts table.
|
// see if this uid is in parts table.
|
||||||
$uidqry=mysqli_query($db,"select * from parts where uid=\"$uids[$plidx]\"");
|
$uidqry = mysqli_query($db, "select * from parts where uid=\"$uids[$plidx]\"");
|
||||||
if (mysqli_num_rows($uidqry)) {
|
if (mysqli_num_rows($uidqry)) {
|
||||||
// if so, populate pn/sn
|
// if so, populate pn/sn
|
||||||
$uiddata=mysqli_fetch_assoc($uidqry);
|
$uiddata = mysqli_fetch_assoc($uidqry);
|
||||||
$partnums[$plidx]=$uiddata['partnum'];
|
$partnums[$plidx] = $uiddata['partnum'];
|
||||||
$sernums[$plidx]=$uiddata['sernum'];
|
$sernums[$plidx] = $uiddata['sernum'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
if ($partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
||||||
// see if this pn/sn is in parts table.
|
// see if this pn/sn is in parts table.
|
||||||
$pnsnqry=mysqli_query($db,"select * from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\"");
|
$pnsnqry = mysqli_query($db, "select * from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\"");
|
||||||
if (mysqli_num_rows($pnsnqry)) {
|
if (mysqli_num_rows($pnsnqry)) {
|
||||||
// if so, populate uid
|
// if so, populate uid
|
||||||
$pnsndata=mysqli_fetch_assoc($pnsnqry);
|
$pnsndata = mysqli_fetch_assoc($pnsnqry);
|
||||||
$uids[$plidx]=$pnsndata['uid'];
|
$uids[$plidx] = $pnsndata['uid'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,102 +307,101 @@ if ($edit) {
|
|||||||
|
|
||||||
if ($authorized) {
|
if ($authorized) {
|
||||||
// update lognotes table
|
// update lognotes table
|
||||||
mysqli_query($db,"update lognotes set date=\"$date\", time=\"$time\", shift=\"$shift\", tech=\"$efftechid\", subject=\"$subject\", lognote=\"$note\" where lognoteid=\"$noteid\"");
|
mysqli_query($db, "update lognotes set date=\"$date\", time=\"$time\", shift=\"$shift\", tech=\"$efftechid\", subject=\"$subject\", lognote=\"$note\" where lognoteid=\"$noteid\"");
|
||||||
|
|
||||||
// update the reflinks table
|
// update the reflinks table
|
||||||
mysqli_query($db,"delete from reflinks where noteid=\"$noteid\"");
|
mysqli_query($db, "delete from reflinks where noteid=\"$noteid\"");
|
||||||
if (strlen($refstring)) {
|
if (strlen($refstring)) {
|
||||||
$refstring=trim($refstring);
|
$refstring = trim($refstring);
|
||||||
$refarray=explode(" ",$refstring);
|
$refarray = explode(" ", $refstring);
|
||||||
foreach($refarray as $thisref) {
|
foreach ($refarray as $thisref) {
|
||||||
mysqli_query($db,"insert into reflinks(noteid,target) values(\"$noteid\",\"$thisref\")");
|
mysqli_query($db, "insert into reflinks(noteid,target) values(\"$noteid\",\"$thisref\")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$chainmembers=generate_chain($noteid);
|
$chainmembers = generate_chain($noteid);
|
||||||
|
|
||||||
// update the flagmap table
|
// update the flagmap table
|
||||||
mysqli_query($db,"delete from flagmap where lognoteid=\"$noteid\"");
|
mysqli_query($db, "delete from flagmap where lognoteid=\"$noteid\"");
|
||||||
if ($syncflags) {
|
if ($syncflags) {
|
||||||
foreach ($chainmembers as $refdnote) {
|
foreach ($chainmembers as $refdnote) {
|
||||||
if ($refdnote != $noteid) {
|
if ($refdnote != $noteid) {
|
||||||
mysqli_query($db,"delete from flagmap where lognoteid=\"$refdnote\"");
|
mysqli_query($db, "delete from flagmap where lognoteid=\"$refdnote\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($flags as $thisflag) {
|
foreach ($flags as $thisflag) {
|
||||||
// set flag for this note
|
// set flag for this note
|
||||||
mysqli_query($db,"insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$noteid\")");
|
mysqli_query($db, "insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$noteid\")");
|
||||||
if ($syncflags) {
|
if ($syncflags) {
|
||||||
//set flag for reference chain notes
|
//set flag for reference chain notes
|
||||||
foreach ($chainmembers as $refdnote) {
|
foreach ($chainmembers as $refdnote) {
|
||||||
if ($refdnote != $noteid) {
|
if ($refdnote != $noteid) {
|
||||||
mysqli_query($db,"insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$refdnote\")");
|
mysqli_query($db, "insert into flagmap(flagid,lognoteid) values(\"$thisflag\",\"$refdnote\")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($doparts==1) {
|
if ($doparts == 1) {
|
||||||
// run through the new part lines
|
// run through the new part lines
|
||||||
for ($plidx=0;$plidx<=$maxplidx;$plidx++) {
|
for ($plidx = 0; $plidx <= $maxplidx; $plidx++) {
|
||||||
// update the parts table
|
// update the parts table
|
||||||
|
|
||||||
// if this line includes a uid and a pn/sn
|
// if this line includes a uid and a pn/sn
|
||||||
if ($uids[$plidx] != "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
if ($uids[$plidx] != "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
||||||
// see if it's in the parts table
|
// see if it's in the parts table
|
||||||
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
|
if (! mysqli_num_rows(mysqli_query($db, "select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
|
||||||
// if not, add it to parts
|
// if not, add it to parts
|
||||||
mysqli_query($db,"insert into parts(uid,partnum,sernum) values(\"$uids[$plidx]\",\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
|
mysqli_query($db, "insert into parts(uid,partnum,sernum) values(\"$uids[$plidx]\",\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
|
||||||
$lpid=mysqli_insert_id($db);
|
$lpid = mysqli_insert_id($db);
|
||||||
} else {
|
} else {
|
||||||
// if so get the partid for the logparts table
|
// if so get the partid for the logparts table
|
||||||
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
|
$lpid = mysqli_fetch_row(mysqli_query($db, "select partid from parts where uid=\"$uids[$plidx]\" and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
|
||||||
}
|
}
|
||||||
// add it to logparts table
|
// add it to logparts table
|
||||||
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
|
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||||
// create a maintenance form if required
|
// create a maintenance form if required
|
||||||
if ($mfreqs[$plidx]=="on") {
|
if ($mfreqs[$plidx] == "on") {
|
||||||
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
|
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this line includes a uid only
|
// if this line includes a uid only
|
||||||
} else if ($uids[$plidx] != "" && $partnums[$plidx] == "" && $sernums[$plidx] == "") {
|
} else if ($uids[$plidx] != "" && $partnums[$plidx] == "" && $sernums[$plidx] == "") {
|
||||||
// see if this uid is in parts table
|
// see if this uid is in parts table
|
||||||
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\" and partnum is NULL and sernum is NULL"))) {
|
if (! mysqli_num_rows(mysqli_query($db, "select partid from parts where uid=\"$uids[$plidx]\" and partnum is NULL and sernum is NULL"))) {
|
||||||
// if not, add it to parts
|
// if not, add it to parts
|
||||||
mysqli_query($db,"insert into parts(uid) values(\"$uids[$plidx]\")");
|
mysqli_query($db, "insert into parts(uid) values(\"$uids[$plidx]\")");
|
||||||
$lpid=mysqli_insert_id($db);
|
$lpid = mysqli_insert_id($db);
|
||||||
} else {
|
} else {
|
||||||
// if so get the partid for the logparts table
|
// if so get the partid for the logparts table
|
||||||
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where uid=\"$uids[$plidx]\""))[0];
|
$lpid = mysqli_fetch_row(mysqli_query($db, "select partid from parts where uid=\"$uids[$plidx]\""))[0];
|
||||||
}
|
}
|
||||||
// add it to logparts table
|
// add it to logparts table
|
||||||
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
|
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||||
// create a maintenance form if required
|
// create a maintenance form if required
|
||||||
if ($mfreqs[$plidx]=="on") {
|
if ($mfreqs[$plidx] == "on") {
|
||||||
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
|
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this line includes a pn/sn only
|
// if this line includes a pn/sn only
|
||||||
} else if ($uids[$plidx] == "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
} else if ($uids[$plidx] == "" && $partnums[$plidx] != "" && $sernums[$plidx] != "") {
|
||||||
// see if this pn/sn is in the parts table
|
// see if this pn/sn is in the parts table
|
||||||
if (! mysqli_num_rows(mysqli_query($db,"select partid from parts where uid is NULL and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
|
if (! mysqli_num_rows(mysqli_query($db, "select partid from parts where uid is NULL and partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))) {
|
||||||
// if not, add it to parts
|
// if not, add it to parts
|
||||||
mysqli_query($db,"insert into parts(partnum,sernum) values(\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
|
mysqli_query($db, "insert into parts(partnum,sernum) values(\"$partnums[$plidx]\",\"$sernums[$plidx]\")");
|
||||||
$lpid=mysqli_insert_id($db);
|
$lpid = mysqli_insert_id($db);
|
||||||
} else {
|
} else {
|
||||||
// if so get the partid for the logparts table
|
// if so get the partid for the logparts table
|
||||||
$lpid=mysqli_fetch_row(mysqli_query($db,"select partid from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
|
$lpid = mysqli_fetch_row(mysqli_query($db, "select partid from parts where partnum=\"$partnums[$plidx]\" and sernum=\"$sernums[$plidx]\""))[0];
|
||||||
}
|
}
|
||||||
// add it to logparts table
|
// add it to logparts table
|
||||||
mysqli_query($db,"insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
|
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||||
// create a maintenance form if required
|
// create a maintenance form if required
|
||||||
if ($mfreqs[$plidx]=="on") {
|
if ($mfreqs[$plidx] == "on") {
|
||||||
mysqli_query($db,"insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
|
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// no part info was entered
|
// no part info was entered
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -413,95 +411,95 @@ if ($edit) {
|
|||||||
}
|
}
|
||||||
if ($loadtemplate) {
|
if ($loadtemplate) {
|
||||||
// get the note in question from the selected template
|
// get the note in question from the selected template
|
||||||
$getnote=mysqli_query($db,"select * from notetemplates where templateid=\"$templateid\"");
|
$getnote = mysqli_query($db, "select * from notetemplates where templateid=\"$templateid\"");
|
||||||
} else {
|
} else {
|
||||||
// refresh the note in question from the database
|
// refresh the note in question from the database
|
||||||
$getnote=mysqli_query($db,"select * from lognotes where lognoteid=\"$noteid\"");
|
$getnote = mysqli_query($db, "select * from lognotes where lognoteid=\"$noteid\"");
|
||||||
}
|
}
|
||||||
$notetoedit=mysqli_fetch_assoc($getnote);
|
$notetoedit = mysqli_fetch_assoc($getnote);
|
||||||
}
|
}
|
||||||
if ($delete) {
|
if ($delete) {
|
||||||
// find notes having this note as a target
|
// find notes having this note as a target
|
||||||
$drefnoteqry=mysqli_query($db,"select noteid from reflinks where target=\"$noteid\"");
|
$drefnoteqry = mysqli_query($db, "select noteid from reflinks where target=\"$noteid\"");
|
||||||
while ($drefnoterow=mysqli_fetch_assoc($drefnoteqry)) {
|
while ($drefnoterow = mysqli_fetch_assoc($drefnoteqry)) {
|
||||||
$drefnotes[]=$drefnoterow["noteid"];
|
$drefnotes[] = $drefnoterow["noteid"];
|
||||||
}
|
}
|
||||||
// find targets for this note
|
// find targets for this note
|
||||||
$dreftgtqry=mysqli_query($db,"select target from reflinks where noteid=\"$noteid\"");
|
$dreftgtqry = mysqli_query($db, "select target from reflinks where noteid=\"$noteid\"");
|
||||||
while ($dreftgtrow=mysqli_fetch_assoc($dreftgtqry)) {
|
while ($dreftgtrow = mysqli_fetch_assoc($dreftgtqry)) {
|
||||||
$dreftgts[]=$dreftgtrow["target"];
|
$dreftgts[] = $dreftgtrow["target"];
|
||||||
}
|
}
|
||||||
// for every note having this one as a target, add this note's targets
|
// for every note having this one as a target, add this note's targets
|
||||||
foreach ($drefnotes as $drefnote) {
|
foreach ($drefnotes as $drefnote) {
|
||||||
foreach ($dreftgts as $dreftgt) {
|
foreach ($dreftgts as $dreftgt) {
|
||||||
mysqli_query($db,"insert into reflinks(noteid,target) values(\"$drefnote\",\"$dreftgt\")");
|
mysqli_query($db, "insert into reflinks(noteid,target) values(\"$drefnote\",\"$dreftgt\")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// delete this note from reflinks
|
// delete this note from reflinks
|
||||||
mysqli_query($db,"delete from reflinks where noteid is not null and (noteid=\"$noteid\" or target=\"$noteid\")");
|
mysqli_query($db, "delete from reflinks where noteid is not null and (noteid=\"$noteid\" or target=\"$noteid\")");
|
||||||
|
|
||||||
// delete from lognotes table
|
// delete from lognotes table
|
||||||
mysqli_query($db,"delete from lognotes where lognoteid=\"$noteid\"");
|
mysqli_query($db, "delete from lognotes where lognoteid=\"$noteid\"");
|
||||||
|
|
||||||
// delete occurances from the flagmap table
|
// delete occurances from the flagmap table
|
||||||
mysqli_query($db,"delete from flagmap where lognoteid=\"$noteid\"");
|
mysqli_query($db, "delete from flagmap where lognoteid=\"$noteid\"");
|
||||||
|
|
||||||
// delete occurances from the logparts table
|
// delete occurances from the logparts table
|
||||||
mysqli_query($db,"delete from logparts where lognoteid=\"$noteid\"");
|
mysqli_query($db, "delete from logparts where lognoteid=\"$noteid\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ******** end database manipulation ********
|
// ******** end database manipulation ********
|
||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if (!$print) {
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
banner($print);
|
banner($print);
|
||||||
// display the form
|
// display the form
|
||||||
if ($add) {
|
if ($add) {
|
||||||
$notedate=$today;
|
$notedate = $today;
|
||||||
$notetime=$now;
|
$notetime = $now;
|
||||||
}
|
}
|
||||||
if ($edit || $delete) {
|
if ($edit || $delete) {
|
||||||
$notedate=$notetoedit["date"] ?? $today;
|
$notedate = $notetoedit["date"] ?? $today;
|
||||||
$notetime=$notetoedit["time"] ?? $now;
|
$notetime = $notetoedit["time"] ?? $now;
|
||||||
$defaultshift=$notetoedit["shift"];
|
$defaultshift = $notetoedit["shift"];
|
||||||
$defaultsubject=$notetoedit["subject"];
|
$defaultsubject = $notetoedit["subject"];
|
||||||
|
|
||||||
$note=$notetoedit["lognote"];
|
$note = $notetoedit["lognote"];
|
||||||
// generate reference string for this note
|
// generate reference string for this note
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
$refstring=NULL;
|
$refstring = NULL;
|
||||||
}
|
}
|
||||||
$refstringqry=mysqli_query($db,"select target from reflinks where noteid=\"$noteid\"");
|
$refstringqry = mysqli_query($db, "select target from reflinks where noteid=\"$noteid\"");
|
||||||
while ($thistgt=mysqli_fetch_row($refstringqry)) {
|
while ($thistgt = mysqli_fetch_row($refstringqry)) {
|
||||||
$refstring=$refstring." ".$thistgt[0];
|
$refstring = $refstring . " " . $thistgt[0];
|
||||||
}
|
}
|
||||||
$techid=$notetoedit["tech"];
|
$techid = $notetoedit["tech"];
|
||||||
}
|
}
|
||||||
$techname=dblookup($db,"techs","techid","techname",$techid);
|
$techname = dblookup($db, "techs", "techid", "techname", $techid);
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
if ($note) {
|
if ($note) {
|
||||||
if ($add) {
|
if ($add) {
|
||||||
format_message(0,"<strong>Note added.</strong> You may enter another note or <a href=\"lognotes.php\">return to main page.</a>");
|
format_message(0, "<strong>Note added.</strong> You may enter another note or <a href=\"lognotes.php\">return to main page.</a>");
|
||||||
}
|
}
|
||||||
if ($edit) {
|
if ($edit) {
|
||||||
format_message(0,"<strong>Note changed.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
|
format_message(0, "<strong>Note changed.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
format_message(1,"You didn't enter any note text. Please try again.");
|
format_message(1, "You didn't enter any note text. Please try again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($delete) {
|
if ($delete) {
|
||||||
format_message(0,"<strong>Note deleted.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
|
format_message(0, "<strong>Note deleted.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_SESSION['login']) {
|
if ($_SESSION['login']) {
|
||||||
// show the template selection line
|
// show the template selection line
|
||||||
templateselect($techid,NULL);
|
templateselect($techid, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start note entry section
|
// start note entry section
|
||||||
@@ -520,14 +518,15 @@ if ($isadmin) {
|
|||||||
<td><b>Tech: </b>
|
<td><b>Tech: </b>
|
||||||
<select name=\"efftechid\">
|
<select name=\"efftechid\">
|
||||||
";
|
";
|
||||||
if ($techalpha) $torder="techname"; else $torder="techid";
|
if ($techalpha) $torder = "techname";
|
||||||
$techrow=mysqli_query($db,"select * from techs order by $torder asc");
|
else $torder = "techid";
|
||||||
while ($techitem=mysqli_fetch_assoc($techrow)) {
|
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
|
||||||
|
while ($techitem = mysqli_fetch_assoc($techrow)) {
|
||||||
if ($techitem["status"] == 1) {
|
if ($techitem["status"] == 1) {
|
||||||
if ($techitem["techid"]==$techid) {
|
if ($techitem["techid"] == $techid) {
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$techitem["techid"],$techitem["techname"]);
|
printf("<option value=\"%s\" selected>%s</option>", $techitem["techid"], $techitem["techname"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$techitem["techid"],$techitem["techname"]);
|
printf("<option value=\"%s\">%s</option>", $techitem["techid"], $techitem["techname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -548,13 +547,13 @@ echo "
|
|||||||
<td><b>Shift: </b>
|
<td><b>Shift: </b>
|
||||||
<select name=\"shift\">
|
<select name=\"shift\">
|
||||||
";
|
";
|
||||||
$shiftrow=mysqli_query($db,"select * from shifts");
|
$shiftrow = mysqli_query($db, "select * from shifts");
|
||||||
while ($shiftitem=mysqli_fetch_assoc($shiftrow)) {
|
while ($shiftitem = mysqli_fetch_assoc($shiftrow)) {
|
||||||
if ($shiftitem["status"] == 1) {
|
if ($shiftitem["status"] == 1) {
|
||||||
if ($shiftitem["shiftid"]==$defaultshift) {
|
if ($shiftitem["shiftid"] == $defaultshift) {
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
|
printf("<option value=\"%s\" selected>%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
|
printf("<option value=\"%s\">%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -563,15 +562,16 @@ echo "
|
|||||||
<td colspan=\"2\"><b>Subject: </b>
|
<td colspan=\"2\"><b>Subject: </b>
|
||||||
<select name=\"subject\">
|
<select name=\"subject\">
|
||||||
";
|
";
|
||||||
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
|
if ($subjalpha) $sorder = "subjectname";
|
||||||
$subjrow=mysqli_query($db,"select * from subjects order by $sorder asc");
|
else $sorder = "subjectid";
|
||||||
while ($subjitem=mysqli_fetch_assoc($subjrow)) {
|
$subjrow = mysqli_query($db, "select * from subjects order by $sorder asc");
|
||||||
if ($subjitem["status"]==1) {
|
while ($subjitem = mysqli_fetch_assoc($subjrow)) {
|
||||||
$defaultsubject=$defaultsubject ?? NULL;
|
if ($subjitem["status"] == 1) {
|
||||||
if ($subjitem["subjectid"]==$defaultsubject) {
|
$defaultsubject = $defaultsubject ?? NULL;
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$subjitem["subjectid"],$subjitem["subjectname"]);
|
if ($subjitem["subjectid"] == $defaultsubject) {
|
||||||
|
printf("<option value=\"%s\" selected>%s</option>", $subjitem["subjectid"], $subjitem["subjectname"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$subjitem["subjectid"],$subjitem["subjectname"]);
|
printf("<option value=\"%s\">%s</option>", $subjitem["subjectid"], $subjitem["subjectname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -590,56 +590,66 @@ echo "</textarea><br>
|
|||||||
";
|
";
|
||||||
|
|
||||||
// create an array called theseflags of flagids set for this noteid
|
// create an array called theseflags of flagids set for this noteid
|
||||||
$allflags=mysqli_query($db,"select flagid from flags");
|
$allflags = mysqli_query($db, "select flagid from flags");
|
||||||
unset($theseflags);
|
unset($theseflags);
|
||||||
$theseflags=[];
|
$theseflags = [];
|
||||||
while ($thisflag=mysqli_fetch_row($allflags)) {
|
while ($thisflag = mysqli_fetch_row($allflags)) {
|
||||||
if ($templateid) {
|
if ($templateid) {
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select id from flagmap where flagid=\"$thisflag[0]\" and notetemplateid=\"$templateid\""))) {
|
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and notetemplateid=\"$templateid\""))) {
|
||||||
$theseflags[]=$thisflag[0];
|
$theseflags[] = $thisflag[0];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select id from flagmap where flagid=\"$thisflag[0]\" and lognoteid=\"$noteid\""))) {
|
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and lognoteid=\"$noteid\""))) {
|
||||||
$theseflags[]=$thisflag[0];
|
$theseflags[] = $thisflag[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if adding a note/template, only show active flags, otherwise, show all flags
|
// if adding a note/template, only show active flags, otherwise, show all flags
|
||||||
if ($add) {
|
if ($add) {
|
||||||
$flagslist=mysqli_query($db,"select * from flags where status=1");
|
$flagslist = mysqli_query($db, "select * from flags where status=1");
|
||||||
} else {
|
} else {
|
||||||
$flagslist=mysqli_query($db,"select * from flags");
|
$flagslist = mysqli_query($db, "select * from flags");
|
||||||
}
|
}
|
||||||
$flagsperline=8;
|
$flagsperline = 8;
|
||||||
$flagcount=1;
|
$flagcount = 1;
|
||||||
|
|
||||||
// display checkboxes for all the flags, selecting the ones that are set for this note/template
|
// display checkboxes for all the flags, selecting the ones that are set for this note/template
|
||||||
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
|
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||||
|
|
||||||
if (in_array($flagcheckbox["flagid"],$theseflags)) {
|
if (in_array($flagcheckbox["flagid"], $theseflags)) {
|
||||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
printf(
|
||||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
||||||
|
$flagcheckbox["flagid"],
|
||||||
|
$flagcheckbox["flagcolor"],
|
||||||
|
$flagcheckbox["flagname"],
|
||||||
|
$flagcheckbox["flagsym"]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$flagid=$flagcheckbox["flagid"];
|
$flagid = $flagcheckbox["flagid"];
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
||||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
printf(
|
||||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||||
|
$flagcheckbox["flagid"],
|
||||||
|
$flagcheckbox["flagcolor"],
|
||||||
|
$flagcheckbox["flagname"],
|
||||||
|
$flagcheckbox["flagsym"]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($flagcount<$flagsperline) {
|
if ($flagcount < $flagsperline) {
|
||||||
echo " ";
|
echo " ";
|
||||||
$flagcount++;
|
$flagcount++;
|
||||||
} else {
|
} else {
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
$flagcount=1;
|
$flagcount = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
<br><input type=\"checkbox\" name=\"syncflags\" value=\"1\"><font title=\"Set the selected flags on the other notes in the reference chain\">Set flags on reference chain</font>
|
<br><input type=\"checkbox\" name=\"syncflags\" value=\"1\"><font title=\"Set the selected flags on the other notes in the reference chain\">Set flags on reference chain</font>
|
||||||
";
|
";
|
||||||
|
|
||||||
if ($add && $refto) $refstring=$refto;
|
if ($add && $refto) $refstring = $refto;
|
||||||
echo "
|
echo "
|
||||||
<br><br><b>References: </b>
|
<br><br><b>References: </b>
|
||||||
<input type=\"text\" name=\"refstring\" size=\"20\" value=\"$refstring\" title=\"One or more Note ID numbers separated by spaces\">
|
<input type=\"text\" name=\"refstring\" size=\"20\" value=\"$refstring\" title=\"One or more Note ID numbers separated by spaces\">
|
||||||
@@ -652,13 +662,13 @@ if ($add) {
|
|||||||
<input type=\"submit\" name=\"submit\" value=\"Submit Note\">";
|
<input type=\"submit\" name=\"submit\" value=\"Submit Note\">";
|
||||||
}
|
}
|
||||||
if ($doparts) {
|
if ($doparts) {
|
||||||
$defaultaction=0;
|
$defaultaction = 0;
|
||||||
echo "
|
echo "
|
||||||
<br><br>
|
<br><br>
|
||||||
<table border=\"0\" cellpadding=\"5\">
|
<table border=\"0\" cellpadding=\"5\">
|
||||||
<tr><th>$uidtext</th><th>Part Number</th><th>Serial Number</th><th>Action</th><th>Maint Form</th></tr>
|
<tr><th>$uidtext</th><th>Part Number</th><th>Serial Number</th><th>Action</th><th>Maint Form</th></tr>
|
||||||
";
|
";
|
||||||
for ($partline=0;$partline <=5;$partline++) {
|
for ($partline = 0; $partline <= 5; $partline++) {
|
||||||
echo "
|
echo "
|
||||||
<tr>
|
<tr>
|
||||||
<td align=\"center\"><input type=\"text\" name=\"uids[$partline]\" size=\"8\"></td>
|
<td align=\"center\"><input type=\"text\" name=\"uids[$partline]\" size=\"8\"></td>
|
||||||
@@ -667,13 +677,13 @@ if ($add) {
|
|||||||
<td align=\"center\"><select name=\"actions[$partline]\">
|
<td align=\"center\"><select name=\"actions[$partline]\">
|
||||||
<option value=\"select\">Select Action</option>
|
<option value=\"select\">Select Action</option>
|
||||||
";
|
";
|
||||||
$actrow=mysqli_query($db,"select * from logpartactions");
|
$actrow = mysqli_query($db, "select * from logpartactions");
|
||||||
while ($actitem=mysqli_fetch_assoc($actrow)) {
|
while ($actitem = mysqli_fetch_assoc($actrow)) {
|
||||||
if ($actitem["status"]==1) {
|
if ($actitem["status"] == 1) {
|
||||||
if ($actitem["lpactionid"]==$defaultaction) {
|
if ($actitem["lpactionid"] == $defaultaction) {
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
|
printf("<option value=\"%s\" selected>%s</option>", $actitem["lpactionid"], $actitem["lpactionname"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
|
printf("<option value=\"%s\">%s</option>", $actitem["lpactionid"], $actitem["lpactionname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -707,16 +717,16 @@ if ($edit) {
|
|||||||
<tr><th>$uidtext</th><th>Part Number</th><th>Serial Number</th><th>Action</th><th>Maint Form</th></tr>
|
<tr><th>$uidtext</th><th>Part Number</th><th>Serial Number</th><th>Action</th><th>Maint Form</th></tr>
|
||||||
";
|
";
|
||||||
// populate the existing part lines
|
// populate the existing part lines
|
||||||
$linekey=0;
|
$linekey = 0;
|
||||||
$elineqry=mysqli_query($db,"select logpartid, partid, action from logparts where lognoteid=\"$noteid\"");
|
$elineqry = mysqli_query($db, "select logpartid, partid, action from logparts where lognoteid=\"$noteid\"");
|
||||||
while ($eline=mysqli_fetch_assoc($elineqry)) {
|
while ($eline = mysqli_fetch_assoc($elineqry)) {
|
||||||
$iconpartid=$eline['logpartid'];
|
$iconpartid = $eline['logpartid'];
|
||||||
$lpidvar=$eline['partid'];
|
$lpidvar = $eline['partid'];
|
||||||
$eparts=mysqli_fetch_assoc(mysqli_query($db,"select uid,partnum,sernum from parts where partid=\"$lpidvar\""));
|
$eparts = mysqli_fetch_assoc(mysqli_query($db, "select uid,partnum,sernum from parts where partid=\"$lpidvar\""));
|
||||||
$epuid=$eparts['uid'];
|
$epuid = $eparts['uid'];
|
||||||
$eppn=$eparts['partnum'];
|
$eppn = $eparts['partnum'];
|
||||||
$epsn=$eparts['sernum'];
|
$epsn = $eparts['sernum'];
|
||||||
$defaultaction=$eline['action'];
|
$defaultaction = $eline['action'];
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
<tr>
|
<tr>
|
||||||
@@ -726,9 +736,9 @@ if ($edit) {
|
|||||||
<td align=\"center\">$epsn</td>
|
<td align=\"center\">$epsn</td>
|
||||||
<td align=\"center\">
|
<td align=\"center\">
|
||||||
";
|
";
|
||||||
$actrow=mysqli_query($db,"select * from logpartactions");
|
$actrow = mysqli_query($db, "select * from logpartactions");
|
||||||
while ($actitem=mysqli_fetch_assoc($actrow)) {
|
while ($actitem = mysqli_fetch_assoc($actrow)) {
|
||||||
if ($actitem["lpactionid"]==$defaultaction) {
|
if ($actitem["lpactionid"] == $defaultaction) {
|
||||||
echo "$actitem[lpactionname]";
|
echo "$actitem[lpactionname]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -736,15 +746,15 @@ if ($edit) {
|
|||||||
</td>
|
</td>
|
||||||
";
|
";
|
||||||
// find maint form for this line and show link
|
// find maint form for this line and show link
|
||||||
$mflinknum=mysqli_fetch_assoc(mysqli_query($db,"select maintformid from maintforms where lognoteid=\"$noteid\" and mfpart=\"$lpidvar\""))["maintformid"];
|
$mflinknum = mysqli_fetch_assoc(mysqli_query($db, "select maintformid from maintforms where lognoteid=\"$noteid\" and mfpart=\"$lpidvar\""))["maintformid"];
|
||||||
echo "
|
echo "
|
||||||
<td align=\"center\"><a href=\"maintformentry.php?mfedit=1&maintformid=$mflinknum\" title=\"Click to view/edit this maintenance form\">$mflinknum</a></td>
|
<td align=\"center\"><a href=\"maintformentry.php?mfedit=1&maintformid=$mflinknum\" title=\"Click to view/edit this maintenance form\">$mflinknum</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
// add six empty part lines
|
// add six empty part lines
|
||||||
$defaultaction=0;
|
$defaultaction = 0;
|
||||||
for ($partline=$linekey;$partline <=$linekey+5;$partline++) {
|
for ($partline = $linekey; $partline <= $linekey + 5; $partline++) {
|
||||||
echo "
|
echo "
|
||||||
<tr>
|
<tr>
|
||||||
<td align=\"center\"><input type=\"text\" name=\"uids[$partline]\" size=\"8\"></td>
|
<td align=\"center\"><input type=\"text\" name=\"uids[$partline]\" size=\"8\"></td>
|
||||||
@@ -753,13 +763,13 @@ if ($edit) {
|
|||||||
<td align=\"center\"><select name=\"actions[$partline]\">
|
<td align=\"center\"><select name=\"actions[$partline]\">
|
||||||
<option value=\"select\">Select Action</option>
|
<option value=\"select\">Select Action</option>
|
||||||
";
|
";
|
||||||
$actrow=mysqli_query($db,"select * from logpartactions");
|
$actrow = mysqli_query($db, "select * from logpartactions");
|
||||||
while ($actitem=mysqli_fetch_assoc($actrow)) {
|
while ($actitem = mysqli_fetch_assoc($actrow)) {
|
||||||
if ($actitem["status"]==1) {
|
if ($actitem["status"] == 1) {
|
||||||
if ($actitem["lpactionid"]==$defaultaction) {
|
if ($actitem["lpactionid"] == $defaultaction) {
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
|
printf("<option value=\"%s\" selected>%s</option>", $actitem["lpactionid"], $actitem["lpactionname"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
|
printf("<option value=\"%s\">%s</option>", $actitem["lpactionid"], $actitem["lpactionname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -782,9 +792,7 @@ echo "
|
|||||||
";
|
";
|
||||||
|
|
||||||
banner($print);
|
banner($print);
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -9,56 +9,55 @@
|
|||||||
|
|
||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
$print=$_REQUEST['print'];
|
$print = $_REQUEST['print'];
|
||||||
$tech=$_REQUEST['tech'];
|
$tech = $_REQUEST['tech'];
|
||||||
$pass=$_REQUEST['pass'];
|
$pass = $_REQUEST['pass'];
|
||||||
$login=$_REQUEST['login'];
|
$login = $_REQUEST['login'];
|
||||||
$cancel=$_REQUEST['cancel'];
|
$cancel = $_REQUEST['cancel'];
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
session_destroy();
|
session_destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
$techalpha=TECH_ALPHA;
|
$techalpha = TECH_ALPHA;
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
framework("begin","$logname","Login Page",$print);
|
framework("begin", "$logname", "Login Page", $print);
|
||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if(!$print){
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu("no print");
|
sidemenu("no print");
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
if ($login) {
|
if ($login) {
|
||||||
// log me in
|
// log me in
|
||||||
$pwhash=mysqli_fetch_row(mysqli_query($db,"select techpass from techs where techid=\"$tech\""))[0];
|
$pwhash = mysqli_fetch_row(mysqli_query($db, "select techpass from techs where techid=\"$tech\""))[0];
|
||||||
if (password_verify($pass, $pwhash)) {
|
if (password_verify($pass, $pwhash)) {
|
||||||
$_SESSION['login']=$tech;
|
$_SESSION['login'] = $tech;
|
||||||
$techname=dblookup($db,"techs","techid","techname",$tech);
|
$techname = dblookup($db, "techs", "techid", "techname", $tech);
|
||||||
echo "
|
echo "
|
||||||
Welcome $techname. Please select a menu option at the left to continue.
|
Welcome $techname. Please select a menu option at the left to continue.
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
$adminqry=mysqli_query($db,"select techname from techs where admin=1 and status=1");
|
$adminqry = mysqli_query($db, "select techname from techs where admin=1 and status=1");
|
||||||
echo "
|
echo "
|
||||||
Incorrect password. Please <a href=\"login.php\">try again</a>.<br><br>
|
Incorrect password. Please <a href=\"login.php\">try again</a>.<br><br>
|
||||||
Forgot your password? Contact an administrator:<br><br>
|
Forgot your password? Contact an administrator:<br><br>
|
||||||
";
|
";
|
||||||
while ($admintech=mysqli_fetch_row($adminqry)[0]) {
|
while ($admintech = mysqli_fetch_row($adminqry)[0]) {
|
||||||
echo "$admintech <br>";
|
echo "$admintech <br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if ($cancel) {
|
} else if ($cancel) {
|
||||||
echo "
|
echo "
|
||||||
@@ -72,11 +71,12 @@ if ($login) {
|
|||||||
<b>Tech: </b>
|
<b>Tech: </b>
|
||||||
<select name=\"tech\">
|
<select name=\"tech\">
|
||||||
";
|
";
|
||||||
if ($techalpha) $torder="techname"; else $torder="techid";
|
if ($techalpha) $torder = "techname";
|
||||||
$techrow=mysqli_query($db,"select * from techs order by $torder asc");
|
else $torder = "techid";
|
||||||
while ($techitem=mysqli_fetch_assoc($techrow)) {
|
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
|
||||||
if ($techitem["status"]==1) {
|
while ($techitem = mysqli_fetch_assoc($techrow)) {
|
||||||
printf("<option value=\"%s\">%s</option>",$techitem["techid"],$techitem["techname"]);
|
if ($techitem["status"] == 1) {
|
||||||
|
printf("<option value=\"%s\">%s</option>", $techitem["techid"], $techitem["techname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "</select><br><br>
|
echo "</select><br><br>
|
||||||
@@ -87,16 +87,14 @@ if ($login) {
|
|||||||
<br><hr>
|
<br><hr>
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
$loginid=$_SESSION['login'];
|
$loginid = $_SESSION['login'];
|
||||||
$loggedinas=mysqli_fetch_row(mysqli_query($db,"select techname from techs where techid=\"$loginid\""))[0];
|
$loggedinas = mysqli_fetch_row(mysqli_query($db, "select techname from techs where techid=\"$loginid\""))[0];
|
||||||
echo "
|
echo "
|
||||||
You are already logged in as $loggedinas. Please select a menu option at the left to continue.<br><hr>
|
You are already logged in as $loggedinas. Please select a menu option at the left to continue.<br><hr>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -12,103 +12,107 @@ include("functions.php");
|
|||||||
//$tgt_year=$_REQUEST['y'];
|
//$tgt_year=$_REQUEST['y'];
|
||||||
//$tgt_month=$_REQUEST['m'];
|
//$tgt_month=$_REQUEST['m'];
|
||||||
//$tgt_day=$_REQUEST['d'];
|
//$tgt_day=$_REQUEST['d'];
|
||||||
$tgt_date=$_REQUEST['tgt_date'] ?? "";
|
$tgt_date = $_REQUEST['tgt_date'] ?? "";
|
||||||
$print=$_REQUEST['print'] ?? "";
|
$print = $_REQUEST['print'] ?? "";
|
||||||
if (isset($_SESSION['login'])) $techid=$_SESSION['login'];
|
if (isset($_SESSION['login'])) $techid = $_SESSION['login'];
|
||||||
|
|
||||||
|
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
$tablestyle=LOG_STYLE;
|
$tablestyle = LOG_STYLE;
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use default date values if not supplied
|
// use default date values if not supplied
|
||||||
if ($tgt_date=="") $tgt_date=$today;
|
if ($tgt_date == "") $tgt_date = $today;
|
||||||
|
|
||||||
// define shifttable_classic function
|
// define shifttable_classic function
|
||||||
function shifttable_classic($shift, $tgt_date, $db) {
|
function shifttable_classic($shift, $tgt_date, $db)
|
||||||
|
{
|
||||||
// convert the shift number to a name for display
|
// convert the shift number to a name for display
|
||||||
$doparts=PARTS_FUNCTIONS;
|
$doparts = PARTS_FUNCTIONS;
|
||||||
$showtime=SHOW_TS;
|
$showtime = SHOW_TS;
|
||||||
$shname=dblookup($db,"shifts","shiftid","shiftname",$shift);
|
$shname = dblookup($db, "shifts", "shiftid", "shiftname", $shift);
|
||||||
$dshdrdata=mysqli_query($db,"select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
|
$dshdrdata = mysqli_query($db, "select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
|
||||||
$dshdr=mysqli_fetch_row($dshdrdata);
|
$dshdr = mysqli_fetch_row($dshdrdata);
|
||||||
if ($dshdr) {
|
if ($dshdr) {
|
||||||
// print the shift header
|
// print the shift header
|
||||||
printf("<b><font size=\"+1\">%s</font></b>\n",$shname);
|
printf("<b><font size=\"+1\">%s</font></b>\n", $shname);
|
||||||
$note=mysqli_query($db,"select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
|
$note = mysqli_query($db, "select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
|
||||||
echo "<br><table border=\"1\" width=\"100%\">\n";
|
echo "<br><table border=\"1\" width=\"100%\">\n";
|
||||||
echo "<tr><th width=\"70\">Note ID</th><th width=\"70\">Tech</th><th width=\"100\">Subject</th><th>Note</th><th width=\"70\">References</th></tr>\n";
|
echo "<tr><th width=\"70\">Note ID</th><th width=\"70\">Tech</th><th width=\"100\">Subject</th><th>Note</th><th width=\"70\">References</th></tr>\n";
|
||||||
while ($tablerow = mysqli_fetch_assoc($note)) {
|
while ($tablerow = mysqli_fetch_assoc($note)) {
|
||||||
$thisnote=$tablerow["lognoteid"];
|
$thisnote = $tablerow["lognoteid"];
|
||||||
$refs=" <a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
|
$refs = " <a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
|
||||||
if (islink($thisnote)) {
|
if (islink($thisnote)) {
|
||||||
$refs=$refs." <a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
|
$refs = $refs . " <a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
|
||||||
}
|
}
|
||||||
// convert tech number to name
|
// convert tech number to name
|
||||||
$tname=dblookup($db,"techs","techid","techname",$tablerow["tech"]);
|
$tname = dblookup($db, "techs", "techid", "techname", $tablerow["tech"]);
|
||||||
//convert subject number to name
|
//convert subject number to name
|
||||||
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
|
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $tablerow["subject"]);
|
||||||
// create links of urls in note
|
// create links of urls in note
|
||||||
$fmtnote=convertweblinks($tablerow["lognote"]);
|
$fmtnote = convertweblinks($tablerow["lognote"]);
|
||||||
// generate the flags string
|
// generate the flags string
|
||||||
$flagstring="";
|
$flagstring = "";
|
||||||
$flagqry=mysqli_query($db,"select flagid from flagmap where lognoteid=$thisnote");
|
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$thisnote");
|
||||||
while ($flagid=mysqli_fetch_row($flagqry)) {
|
while ($flagid = mysqli_fetch_row($flagqry)) {
|
||||||
$flagparams=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid[0]\""));
|
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
|
||||||
$flagcolor=$flagparams["flagcolor"];
|
$flagcolor = $flagparams["flagcolor"];
|
||||||
$flagsym=$flagparams["flagsym"];
|
$flagsym = $flagparams["flagsym"];
|
||||||
$flagname=$flagparams["flagname"];
|
$flagname = $flagparams["flagname"];
|
||||||
$flagstring=$flagstring."<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
||||||
}
|
}
|
||||||
if ($flagstring) {
|
if ($flagstring) {
|
||||||
$fmtnote=$fmtnote."<br>".$flagstring." ";
|
$fmtnote = $fmtnote . "<br>" . $flagstring . " ";
|
||||||
} else {
|
} else {
|
||||||
$fmtnote=$fmtnote."<br>";
|
$fmtnote = $fmtnote . "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($doparts) {
|
if ($doparts) {
|
||||||
// turn on the parts indicator if parts were entered with the note
|
// turn on the parts indicator if parts were entered with the note
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select logpartid from logparts where lognoteid=\"$thisnote\""))) {
|
if (mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where lognoteid=\"$thisnote\""))) {
|
||||||
$fmtnote=$fmtnote."<a href=\"logentry.php?partview=1¬eid=$thisnote\">PARTS</a>";
|
$fmtnote = $fmtnote . "<a href=\"logentry.php?partview=1¬eid=$thisnote\">PARTS</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now print the line in the table
|
// now print the line in the table
|
||||||
if ($showtime) {
|
if ($showtime) {
|
||||||
printf(
|
printf(
|
||||||
"<tr>
|
"<tr>
|
||||||
<td valign=\"top\"><a href=\"logentry.php?edit=1¬eid=%s\" title=\"Edit this note\">%s</a> %s</td>
|
<td valign=\"top\"><a href=\"logentry.php?edit=1¬eid=%s\" title=\"Edit this note\">%s</a> %s</td>
|
||||||
<td valign=\"top\"> %s</td>
|
<td valign=\"top\"> %s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
</tr>\n",
|
</tr>\n",
|
||||||
$tablerow["lognoteid"],$tablerow["lognoteid"],$tablerow["time"],
|
$tablerow["lognoteid"],
|
||||||
$tname,
|
$tablerow["lognoteid"],
|
||||||
$subjname,
|
$tablerow["time"],
|
||||||
$fmtnote,
|
$tname,
|
||||||
$refs
|
$subjname,
|
||||||
|
$fmtnote,
|
||||||
|
$refs
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
printf(
|
printf(
|
||||||
"<tr>
|
"<tr>
|
||||||
<td valign=\"top\"><a href=\"logentry.php?edit=1¬eid=%s\">%s</a></td>
|
<td valign=\"top\"><a href=\"logentry.php?edit=1¬eid=%s\">%s</a></td>
|
||||||
<td valign=\"top\"> %s</td>
|
<td valign=\"top\"> %s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
</tr>\n",
|
</tr>\n",
|
||||||
$tablerow["lognoteid"],$tablerow["lognoteid"],
|
$tablerow["lognoteid"],
|
||||||
$tname,
|
$tablerow["lognoteid"],
|
||||||
$subjname,
|
$tname,
|
||||||
$fmtnote,
|
$subjname,
|
||||||
$refs
|
$fmtnote,
|
||||||
|
$refs
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,82 +125,85 @@ function shifttable_classic($shift, $tgt_date, $db) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// define the shifttable_clean function
|
// define the shifttable_clean function
|
||||||
function shifttable_clean($shift, $tgt_date, $db) {
|
function shifttable_clean($shift, $tgt_date, $db)
|
||||||
|
{
|
||||||
// convert the shift number to a name for display
|
// convert the shift number to a name for display
|
||||||
$doparts=PARTS_FUNCTIONS;
|
$doparts = PARTS_FUNCTIONS;
|
||||||
$showtime=SHOW_TS;
|
$showtime = SHOW_TS;
|
||||||
$shname=dblookup($db,"shifts","shiftid","shiftname",$shift);
|
$shname = dblookup($db, "shifts", "shiftid", "shiftname", $shift);
|
||||||
$dshdrdata=mysqli_query($db,"select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
|
$dshdrdata = mysqli_query($db, "select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
|
||||||
$dshdr=mysqli_fetch_row($dshdrdata);
|
$dshdr = mysqli_fetch_row($dshdrdata);
|
||||||
if ($dshdr) {
|
if ($dshdr) {
|
||||||
// print the shift header
|
// print the shift header
|
||||||
printf("<b><font size=\"+1\">%s</font></b>\n",$shname);
|
printf("<b><font size=\"+1\">%s</font></b>\n", $shname);
|
||||||
$note=mysqli_query($db,"select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
|
$note = mysqli_query($db, "select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
|
||||||
echo "<br><br>";
|
echo "<br><br>";
|
||||||
echo "<table border=\"0\" width=\"100%\"><tr><td>\n";
|
echo "<table border=\"0\" width=\"100%\"><tr><td>\n";
|
||||||
while ($tablerow = mysqli_fetch_assoc($note)) {
|
while ($tablerow = mysqli_fetch_assoc($note)) {
|
||||||
$thisnote=$tablerow["lognoteid"];
|
$thisnote = $tablerow["lognoteid"];
|
||||||
$refs=" <a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
|
$refs = " <a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
|
||||||
if (islink($tablerow["lognoteid"])) {
|
if (islink($tablerow["lognoteid"])) {
|
||||||
$refs=$refs." <a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
|
$refs = $refs . " <a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
|
||||||
}
|
}
|
||||||
// convert tech number to name
|
// convert tech number to name
|
||||||
$tname=dblookup($db,"techs","techid","techname",$tablerow["tech"]);
|
$tname = dblookup($db, "techs", "techid", "techname", $tablerow["tech"]);
|
||||||
//convert subject number to name
|
//convert subject number to name
|
||||||
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
|
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $tablerow["subject"]);
|
||||||
// create links of urls in note
|
// create links of urls in note
|
||||||
$fmtnote=convertweblinks($tablerow["lognote"]);
|
$fmtnote = convertweblinks($tablerow["lognote"]);
|
||||||
// generate the flags string
|
// generate the flags string
|
||||||
$flagstring="";
|
$flagstring = "";
|
||||||
$flagqry=mysqli_query($db,"select flagid from flagmap where lognoteid=$thisnote");
|
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$thisnote");
|
||||||
while ($flagid=mysqli_fetch_row($flagqry)) {
|
while ($flagid = mysqli_fetch_row($flagqry)) {
|
||||||
$flagparams=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid[0]\""));
|
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
|
||||||
$flagcolor=$flagparams["flagcolor"];
|
$flagcolor = $flagparams["flagcolor"];
|
||||||
$flagsym=$flagparams["flagsym"];
|
$flagsym = $flagparams["flagsym"];
|
||||||
$flagname=$flagparams["flagname"];
|
$flagname = $flagparams["flagname"];
|
||||||
$flagstring=$flagstring."<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
||||||
}
|
}
|
||||||
if ($flagstring) {
|
if ($flagstring) {
|
||||||
$fmtnote=$fmtnote."<br>".$flagstring." ";
|
$fmtnote = $fmtnote . "<br>" . $flagstring . " ";
|
||||||
} else {
|
} else {
|
||||||
$fmtnote=$fmtnote."<br>";
|
$fmtnote = $fmtnote . "<br>";
|
||||||
}
|
}
|
||||||
if ($doparts) {
|
if ($doparts) {
|
||||||
// turn on the parts indicator if parts were entered with the note
|
// turn on the parts indicator if parts were entered with the note
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select logpartid from logparts where lognoteid=\"$thisnote\""))) {
|
if (mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where lognoteid=\"$thisnote\""))) {
|
||||||
$fmtnote=$fmtnote."<a href=\"logentry.php?edit=1¬eid=$thisnote\" title=\"Click here to see note and parts data.\">PARTS</a>";
|
$fmtnote = $fmtnote . "<a href=\"logentry.php?edit=1¬eid=$thisnote\" title=\"Click here to see note and parts data.\">PARTS</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now print the line in the table
|
// now print the line in the table
|
||||||
if ($showtime) {
|
if ($showtime) {
|
||||||
printf(
|
printf(
|
||||||
"<a href=\"logentry.php?edit=1¬eid=%s\" title=\"Note ID. Click to edit.\">%s</a>
|
"<a href=\"logentry.php?edit=1¬eid=%s\" title=\"Note ID. Click to edit.\">%s</a>
|
||||||
<b>%s
|
<b>%s
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
%s</b>
|
%s</b>
|
||||||
<br>%s<br>
|
<br>%s<br>
|
||||||
<hr>\n",
|
<hr>\n",
|
||||||
$tablerow["lognoteid"],$tablerow["lognoteid"],
|
$tablerow["lognoteid"],
|
||||||
$tablerow["time"],
|
$tablerow["lognoteid"],
|
||||||
$tname,
|
$tablerow["time"],
|
||||||
$subjname,
|
$tname,
|
||||||
$refs,
|
$subjname,
|
||||||
$fmtnote
|
$refs,
|
||||||
|
$fmtnote
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
printf(
|
printf(
|
||||||
"<a href=\"logentry.php?edit=1¬eid=%s\">%s</a>
|
"<a href=\"logentry.php?edit=1¬eid=%s\">%s</a>
|
||||||
<b>%s
|
<b>%s
|
||||||
%s
|
%s
|
||||||
%s</b>
|
%s</b>
|
||||||
<br>%s<br>
|
<br>%s<br>
|
||||||
<hr>\n",
|
<hr>\n",
|
||||||
$tablerow["lognoteid"],$tablerow["lognoteid"],
|
$tablerow["lognoteid"],
|
||||||
$tname,
|
$tablerow["lognoteid"],
|
||||||
$subjname,
|
$tname,
|
||||||
$refs,
|
$subjname,
|
||||||
$fmtnote
|
$refs,
|
||||||
|
$fmtnote
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,11 +215,11 @@ function shifttable_clean($shift, $tgt_date, $db) {
|
|||||||
echo "<br><br>\n";
|
echo "<br><br>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
framework("begin","$logname","Online Logbook",$print);
|
framework("begin", "$logname", "Online Logbook", $print);
|
||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if(!$print) {
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
//calendar($tgt_year,$tgt_month,$tgt_day,"lognotes.php");
|
//calendar($tgt_year,$tgt_month,$tgt_day,"lognotes.php");
|
||||||
echo "<div id=\"caldate\" style=\"display: none;\">";
|
echo "<div id=\"caldate\" style=\"display: none;\">";
|
||||||
echo htmlspecialchars($tgt_date);
|
echo htmlspecialchars($tgt_date);
|
||||||
@@ -225,29 +232,27 @@ if(!$print) {
|
|||||||
sidemenu();
|
sidemenu();
|
||||||
echo "<br><br>";
|
echo "<br><br>";
|
||||||
showlinklist($print);
|
showlinklist($print);
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
} else {
|
} else {
|
||||||
echo "
|
echo "
|
||||||
<center><b>$tgt_year-$tgt_month-$tgt_day</b></center><br>
|
<center><b>$tgt_year-$tgt_month-$tgt_day</b></center><br>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
banner($print);
|
banner($print);
|
||||||
if (isset($techid)) nag($techid);
|
if (isset($techid)) nag($techid);
|
||||||
//$date=date("Y-m-d",mktime(0,0,0,$tgt_month,$tgt_day,$tgt_year));
|
//$date=date("Y-m-d",mktime(0,0,0,$tgt_month,$tgt_day,$tgt_year));
|
||||||
$qry=mysqli_query($db,"select shiftid from shifts where status=1 order by shiftid asc");
|
$qry = mysqli_query($db, "select shiftid from shifts where status=1 order by shiftid asc");
|
||||||
while ($shnum=mysqli_fetch_row($qry)) {
|
while ($shnum = mysqli_fetch_row($qry)) {
|
||||||
if ($tablestyle==1) {
|
if ($tablestyle == 1) {
|
||||||
shifttable_classic($shnum[0],$tgt_date,$db);
|
shifttable_classic($shnum[0], $tgt_date, $db);
|
||||||
} else if ($tablestyle==2) {
|
} else if ($tablestyle == 2) {
|
||||||
shifttable_clean($shnum[0],$tgt_date,$db);
|
shifttable_clean($shnum[0], $tgt_date, $db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
banner($print);
|
banner($print);
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -9,39 +9,40 @@
|
|||||||
|
|
||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
if (isset($_SESSION['login'])) $techid=$_SESSION['login'];
|
if (isset($_SESSION['login'])) $techid = $_SESSION['login'];
|
||||||
|
|
||||||
$print=$_REQUEST['print'] ?? NULL;
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
$histdays=$_REQUEST['histdays'] ?? NULL;
|
$histdays = $_REQUEST['histdays'] ?? NULL;
|
||||||
$submit=$_REQUEST['submit'] ?? NULL;
|
$submit = $_REQUEST['submit'] ?? NULL;
|
||||||
|
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
$uidtext=UID_TEXT;
|
$uidtext = UID_TEXT;
|
||||||
|
|
||||||
if ($histdays=="") $histdays=30;
|
if ($histdays == "") $histdays = 30;
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// define pendtable function
|
// define pendtable function
|
||||||
function pendtable($tech_id, $db) {
|
function pendtable($tech_id, $db)
|
||||||
$uidtext=UID_TEXT;
|
{
|
||||||
|
$uidtext = UID_TEXT;
|
||||||
// print section header
|
// print section header
|
||||||
if ($tech_id) {
|
if ($tech_id) {
|
||||||
echo "
|
echo "
|
||||||
<b><font size=\"+1\">Your Pending Maintenance Forms</font></b><br>
|
<b><font size=\"+1\">Your Pending Maintenance Forms</font></b><br>
|
||||||
";
|
";
|
||||||
$pmf=mysqli_query($db,"select * from maintforms where mftech=\"$tech_id\" and pending=\"1\" order by mfdate desc, mftime desc");
|
$pmf = mysqli_query($db, "select * from maintforms where mftech=\"$tech_id\" and pending=\"1\" order by mfdate desc, mftime desc");
|
||||||
} else {
|
} else {
|
||||||
echo "
|
echo "
|
||||||
<b><font size=\"+1\">All Pending Maintenance Forms</font></b><br>
|
<b><font size=\"+1\">All Pending Maintenance Forms</font></b><br>
|
||||||
";
|
";
|
||||||
$pmf=mysqli_query($db,"select * from maintforms where pending=\"1\" order by mfdate desc, mftime desc");
|
$pmf = mysqli_query($db, "select * from maintforms where pending=\"1\" order by mfdate desc, mftime desc");
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
<br><table border=\"1\" width=\"100%\">
|
<br><table border=\"1\" width=\"100%\">
|
||||||
@@ -60,26 +61,26 @@ function pendtable($tech_id, $db) {
|
|||||||
";
|
";
|
||||||
while ($pendrow = mysqli_fetch_assoc($pmf)) {
|
while ($pendrow = mysqli_fetch_assoc($pmf)) {
|
||||||
// look up part data
|
// look up part data
|
||||||
$uid=dblookup($db,"parts","partid","uid",$pendrow["mfpart"]);
|
$uid = dblookup($db, "parts", "partid", "uid", $pendrow["mfpart"]);
|
||||||
if ($uid=="") $uid=" ";
|
if ($uid == "") $uid = " ";
|
||||||
$partno=dblookup($db,"parts","partid","partnum",$pendrow["mfpart"]);
|
$partno = dblookup($db, "parts", "partid", "partnum", $pendrow["mfpart"]);
|
||||||
if ($partno=="") $partno=" ";
|
if ($partno == "") $partno = " ";
|
||||||
$serno=dblookup($db,"parts","partid","sernum",$pendrow["mfpart"]);
|
$serno = dblookup($db, "parts", "partid", "sernum", $pendrow["mfpart"]);
|
||||||
if ($serno=="") $serno=" ";
|
if ($serno == "") $serno = " ";
|
||||||
$partname=dblookup($db,"parts","partid","partname",$pendrow["mfpart"]);
|
$partname = dblookup($db, "parts", "partid", "partname", $pendrow["mfpart"]);
|
||||||
if ($partname=="") $partname=" ";
|
if ($partname == "") $partname = " ";
|
||||||
// look up tech name
|
// look up tech name
|
||||||
$tname=dblookup($db,"techs","techid","techname",$pendrow["mftech"]);
|
$tname = dblookup($db, "techs", "techid", "techname", $pendrow["mftech"]);
|
||||||
if ($pendrow["lognoteid"]==0) {
|
if ($pendrow["lognoteid"] == 0) {
|
||||||
$noteidval=" ";
|
$noteidval = " ";
|
||||||
$notetag="%s%s";
|
$notetag = "%s%s";
|
||||||
} else {
|
} else {
|
||||||
$noteidval=$pendrow["lognoteid"];
|
$noteidval = $pendrow["lognoteid"];
|
||||||
$notetag="<a href=\"logentry.php?edit=1¬eid=%s\">%s</a>";
|
$notetag = "<a href=\"logentry.php?edit=1¬eid=%s\">%s</a>";
|
||||||
}
|
}
|
||||||
if (!$tech_id) {
|
if (!$tech_id) {
|
||||||
printf(
|
printf(
|
||||||
"<tr>
|
"<tr>
|
||||||
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
|
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
@@ -89,18 +90,20 @@ function pendtable($tech_id, $db) {
|
|||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td align=\"center\" valign=\"top\">$notetag</td>
|
<td align=\"center\" valign=\"top\">$notetag</td>
|
||||||
</tr>",
|
</tr>",
|
||||||
$pendrow["maintformid"],$pendrow["maintformid"],
|
$pendrow["maintformid"],
|
||||||
$pendrow["mfdate"],
|
$pendrow["maintformid"],
|
||||||
$tname,
|
$pendrow["mfdate"],
|
||||||
$uid,
|
$tname,
|
||||||
$partno,
|
$uid,
|
||||||
$serno,
|
$partno,
|
||||||
$partname,
|
$serno,
|
||||||
$noteidval,$noteidval
|
$partname,
|
||||||
|
$noteidval,
|
||||||
|
$noteidval
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
printf(
|
printf(
|
||||||
"<tr>
|
"<tr>
|
||||||
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
|
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
@@ -109,13 +112,15 @@ function pendtable($tech_id, $db) {
|
|||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td align=\"center\" valign=\"top\">$notetag</td>
|
<td align=\"center\" valign=\"top\">$notetag</td>
|
||||||
</tr>",
|
</tr>",
|
||||||
$pendrow["maintformid"],$pendrow["maintformid"],
|
$pendrow["maintformid"],
|
||||||
$pendrow["mfdate"],
|
$pendrow["maintformid"],
|
||||||
$uid,
|
$pendrow["mfdate"],
|
||||||
$partno,
|
$uid,
|
||||||
$serno,
|
$partno,
|
||||||
$partname,
|
$serno,
|
||||||
$noteidval,$noteidval
|
$partname,
|
||||||
|
$noteidval,
|
||||||
|
$noteidval
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,9 +130,10 @@ function pendtable($tech_id, $db) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// define histtable function
|
// define histtable function
|
||||||
function histtable($hist_days,$db) {
|
function histtable($hist_days, $db)
|
||||||
$uidtext=UID_TEXT;
|
{
|
||||||
$dayopts=array(30,90,180,365);
|
$uidtext = UID_TEXT;
|
||||||
|
$dayopts = array(30, 90, 180, 365);
|
||||||
// print section header
|
// print section header
|
||||||
echo "
|
echo "
|
||||||
<form method=\"post\" action=\"maintform.php\">
|
<form method=\"post\" action=\"maintform.php\">
|
||||||
@@ -135,13 +141,13 @@ function histtable($hist_days,$db) {
|
|||||||
<select name=\"histdays\">
|
<select name=\"histdays\">
|
||||||
";
|
";
|
||||||
foreach ($dayopts as $chunk) {
|
foreach ($dayopts as $chunk) {
|
||||||
if ($chunk==$hist_days) {
|
if ($chunk == $hist_days) {
|
||||||
echo "<option value=\"$chunk\" selected>$chunk</option>";
|
echo "<option value=\"$chunk\" selected>$chunk</option>";
|
||||||
} else {
|
} else {
|
||||||
echo "<option value=\"$chunk\">$chunk</option>";
|
echo "<option value=\"$chunk\">$chunk</option>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$histqry=mysqli_query($db,"select * from maintforms where mfdate > subdate(now(), interval $hist_days day) order by mfdate desc, mftime desc");
|
$histqry = mysqli_query($db, "select * from maintforms where mfdate > subdate(now(), interval $hist_days day) order by mfdate desc, mftime desc");
|
||||||
echo "
|
echo "
|
||||||
</select>
|
</select>
|
||||||
<b><font size=\"+1\"> Days</font></b>
|
<b><font size=\"+1\"> Days</font></b>
|
||||||
@@ -160,24 +166,24 @@ function histtable($hist_days,$db) {
|
|||||||
";
|
";
|
||||||
while ($histrow = mysqli_fetch_assoc($histqry)) {
|
while ($histrow = mysqli_fetch_assoc($histqry)) {
|
||||||
// look up part data
|
// look up part data
|
||||||
$uid=dblookup($db,"parts","partid","uid",$histrow["mfpart"]);
|
$uid = dblookup($db, "parts", "partid", "uid", $histrow["mfpart"]);
|
||||||
$partno=dblookup($db,"parts","partid","partnum",$histrow["mfpart"]);
|
$partno = dblookup($db, "parts", "partid", "partnum", $histrow["mfpart"]);
|
||||||
if ($partno=="") $partno=" ";
|
if ($partno == "") $partno = " ";
|
||||||
$serno=dblookup($db,"parts","partid","sernum",$histrow["mfpart"]);
|
$serno = dblookup($db, "parts", "partid", "sernum", $histrow["mfpart"]);
|
||||||
if ($serno=="") $serno=" ";
|
if ($serno == "") $serno = " ";
|
||||||
$partname=dblookup($db,"parts","partid","partname",$histrow["mfpart"]);
|
$partname = dblookup($db, "parts", "partid", "partname", $histrow["mfpart"]);
|
||||||
if ($partname=="") $partname=" ";
|
if ($partname == "") $partname = " ";
|
||||||
// look up tech name
|
// look up tech name
|
||||||
$tname=dblookup($db,"techs","techid","techname",$histrow["mftech"]);
|
$tname = dblookup($db, "techs", "techid", "techname", $histrow["mftech"]);
|
||||||
if ($histrow["lognoteid"]==0) {
|
if ($histrow["lognoteid"] == 0) {
|
||||||
$noteidval=" ";
|
$noteidval = " ";
|
||||||
$notetag="%s%s";
|
$notetag = "%s%s";
|
||||||
} else {
|
} else {
|
||||||
$noteidval=$histrow["lognoteid"];
|
$noteidval = $histrow["lognoteid"];
|
||||||
$notetag="<a href=\"logentry.php?edit=1¬eid=%s\">%s</a>";
|
$notetag = "<a href=\"logentry.php?edit=1¬eid=%s\">%s</a>";
|
||||||
}
|
}
|
||||||
printf(
|
printf(
|
||||||
"<tr>
|
"<tr>
|
||||||
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
|
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
@@ -187,14 +193,16 @@ function histtable($hist_days,$db) {
|
|||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td align=\"center\" valign=\"top\">$notetag</td>
|
<td align=\"center\" valign=\"top\">$notetag</td>
|
||||||
</tr>",
|
</tr>",
|
||||||
$histrow["maintformid"],$histrow["maintformid"],
|
$histrow["maintformid"],
|
||||||
$histrow["mfdate"],
|
$histrow["maintformid"],
|
||||||
$tname,
|
$histrow["mfdate"],
|
||||||
$uid,
|
$tname,
|
||||||
$partno,
|
$uid,
|
||||||
$serno,
|
$partno,
|
||||||
$partname,
|
$serno,
|
||||||
$noteidval,$noteidval
|
$partname,
|
||||||
|
$noteidval,
|
||||||
|
$noteidval
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
@@ -202,30 +210,28 @@ function histtable($hist_days,$db) {
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
framework("begin","$logname","Maintenance Forms",$print);
|
framework("begin", "$logname", "Maintenance Forms", $print);
|
||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if(!$print) {
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
banner($print);
|
banner($print);
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
$haspending=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mftech=\"$techid\" and pending=\"1\""));
|
$haspending = mysqli_num_rows(mysqli_query($db, "select maintformid from maintforms where mftech=\"$techid\" and pending=\"1\""));
|
||||||
if ($haspending) {
|
if ($haspending) {
|
||||||
pendtable($techid,$db);
|
pendtable($techid, $db);
|
||||||
echo "<br><hr><br>";
|
echo "<br><hr><br>";
|
||||||
}
|
}
|
||||||
pendtable(0,$db);
|
pendtable(0, $db);
|
||||||
echo "<br><hr><br>";
|
echo "<br><hr><br>";
|
||||||
histtable($histdays,$db);
|
histtable($histdays, $db);
|
||||||
echo "<br><br>";
|
echo "<br><br>";
|
||||||
banner($print);
|
banner($print);
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -11,121 +11,123 @@ include("functions.php");
|
|||||||
|
|
||||||
|
|
||||||
if (!$_SESSION['login'] && ($_REQUEST['mfadd'] || $_REQUEST['actionadd'])) {
|
if (!$_SESSION['login'] && ($_REQUEST['mfadd'] || $_REQUEST['actionadd'])) {
|
||||||
header ("Location: login.php");
|
header("Location: login.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
$loggedinas=$_SESSION['login'];
|
$loggedinas = $_SESSION['login'];
|
||||||
$isadmin=dblookup($db,"techs","techid","admin",$loggedinas);
|
$isadmin = dblookup($db, "techs", "techid", "admin", $loggedinas);
|
||||||
|
|
||||||
function getmfdata($maintformid) {
|
function getmfdata($maintformid)
|
||||||
|
{
|
||||||
// pull maintenance form data from maintforms table
|
// pull maintenance form data from maintforms table
|
||||||
global $db;
|
global $db;
|
||||||
$mfdata=mysqli_fetch_assoc(mysqli_query($db,"select * from maintforms where maintformid=\"$maintformid\""));
|
$mfdata = mysqli_fetch_assoc(mysqli_query($db, "select * from maintforms where maintformid=\"$maintformid\""));
|
||||||
return $mfdata;
|
return $mfdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getactiondata($maintactionid) {
|
function getactiondata($maintactionid)
|
||||||
|
{
|
||||||
// pull maintenance action data from maintactions table
|
// pull maintenance action data from maintactions table
|
||||||
global $db;
|
global $db;
|
||||||
$actiondata=mysqli_fetch_assoc(mysqli_query($db,"select * from maintactions where maintactionid=\"$maintactionid\""));
|
$actiondata = mysqli_fetch_assoc(mysqli_query($db, "select * from maintactions where maintactionid=\"$maintactionid\""));
|
||||||
return $actiondata;
|
return $actiondata;
|
||||||
}
|
}
|
||||||
|
|
||||||
$print=$_REQUEST['print'] ?? NULL;
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
|
|
||||||
$maintformid=$_REQUEST['maintformid'] ?? NULL;
|
$maintformid = $_REQUEST['maintformid'] ?? NULL;
|
||||||
$lognoteid=$_REQUEST['lognoteid'] ?? NULL;
|
$lognoteid = $_REQUEST['lognoteid'] ?? NULL;
|
||||||
$mfdate=$_REQUEST['date'] ?? NULL;
|
$mfdate = $_REQUEST['date'] ?? NULL;
|
||||||
$mftime=$_REQUEST['time'] ?? NULL;
|
$mftime = $_REQUEST['time'] ?? NULL;
|
||||||
$mfsubmit=$_REQUEST['mfsubmit'] ?? NULL;
|
$mfsubmit = $_REQUEST['mfsubmit'] ?? NULL;
|
||||||
$mfadd=$_REQUEST['mfadd'] ?? NULL;
|
$mfadd = $_REQUEST['mfadd'] ?? NULL;
|
||||||
$mfedit=$_REQUEST['mfedit'] ?? NULL;
|
$mfedit = $_REQUEST['mfedit'] ?? NULL;
|
||||||
$mfdelete=$_REQUEST['mfdelete'] ?? NULL;
|
$mfdelete = $_REQUEST['mfdelete'] ?? NULL;
|
||||||
$mfpartloc=$_REQUEST['mfpartloc'] ?? NULL;
|
$mfpartloc = $_REQUEST['mfpartloc'] ?? NULL;
|
||||||
$mfmalfunction=$_REQUEST['mfmalfunction'] ?? NULL;
|
$mfmalfunction = $_REQUEST['mfmalfunction'] ?? NULL;
|
||||||
$nha=$_REQUEST['nha'] ?? NULL;
|
$nha = $_REQUEST['nha'] ?? NULL;
|
||||||
$repord=$_REQUEST['repord'] ?? NULL;
|
$repord = $_REQUEST['repord'] ?? NULL;
|
||||||
$mfpart=$_REQUEST['mfpart'] ?? NULL;
|
$mfpart = $_REQUEST['mfpart'] ?? NULL;
|
||||||
$uid=$_REQUEST['uid'] ?? NULL;
|
$uid = $_REQUEST['uid'] ?? NULL;
|
||||||
$partnum=$_REQUEST['partnum'] ?? NULL;
|
$partnum = $_REQUEST['partnum'] ?? NULL;
|
||||||
$sernum=$_REQUEST['sernum'] ?? NULL;
|
$sernum = $_REQUEST['sernum'] ?? NULL;
|
||||||
$partname=$_REQUEST['partname'] ?? NULL;
|
$partname = $_REQUEST['partname'] ?? NULL;
|
||||||
$actionadd=$_REQUEST['actionadd'] ?? NULL;
|
$actionadd = $_REQUEST['actionadd'] ?? NULL;
|
||||||
$actionedit=$_REQUEST['actionedit'] ?? NULL;
|
$actionedit = $_REQUEST['actionedit'] ?? NULL;
|
||||||
$actiondelete=$_REQUEST['actiondelete'] ?? NULL;
|
$actiondelete = $_REQUEST['actiondelete'] ?? NULL;
|
||||||
$maintactionid=$_REQUEST['maintactionid'] ?? NULL;
|
$maintactionid = $_REQUEST['maintactionid'] ?? NULL;
|
||||||
$actiondate=$_REQUEST['actiondate'] ?? NULL;
|
$actiondate = $_REQUEST['actiondate'] ?? NULL;
|
||||||
$actiontime=$_REQUEST['actiontime'] ?? NULL;
|
$actiontime = $_REQUEST['actiontime'] ?? NULL;
|
||||||
$actiontech=$_REQUEST['actiontech'] ?? NULL;
|
$actiontech = $_REQUEST['actiontech'] ?? NULL;
|
||||||
$action=$_REQUEST['action'] ?? NULL;
|
$action = $_REQUEST['action'] ?? NULL;
|
||||||
$actionaddsubmit=$_REQUEST['actionaddsubmit'] ?? NULL;
|
$actionaddsubmit = $_REQUEST['actionaddsubmit'] ?? NULL;
|
||||||
$actioneditsubmit=$_REQUEST['actioneditsubmit'] ?? NULL;
|
$actioneditsubmit = $_REQUEST['actioneditsubmit'] ?? NULL;
|
||||||
$printfmt=$_REQUEST['printfmt'] ?? NULL;
|
$printfmt = $_REQUEST['printfmt'] ?? NULL;
|
||||||
if ($printfmt) $print=TRUE;
|
if ($printfmt) $print = TRUE;
|
||||||
$flags=$_POST['flags'] ?? [];
|
$flags = $_POST['flags'] ?? [];
|
||||||
|
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
$uidtext=UID_TEXT;
|
$uidtext = UID_TEXT;
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
if ($printfmt) {
|
if ($printfmt) {
|
||||||
framework("begin","","",$print);
|
framework("begin", "", "", $print);
|
||||||
} else if ($mfedit) {
|
} else if ($mfedit) {
|
||||||
framework("begin","$logname","Maintenance Form Edit",$print);
|
framework("begin", "$logname", "Maintenance Form Edit", $print);
|
||||||
if ($loggedinas) $mfauthorized=TRUE;
|
if ($loggedinas) $mfauthorized = TRUE;
|
||||||
} else if ($mfdelete) {
|
} else if ($mfdelete) {
|
||||||
framework("begin","$logname","Maintenance Form Edit",$print);
|
framework("begin", "$logname", "Maintenance Form Edit", $print);
|
||||||
$mfowner=dblookup($db,"maintforms","maintformid","mftech",$maintformid);
|
$mfowner = dblookup($db, "maintforms", "maintformid", "mftech", $maintformid);
|
||||||
if (($loggedinas==$mfowner) || $isadmin) $mfauthorized=TRUE;
|
if (($loggedinas == $mfowner) || $isadmin) $mfauthorized = TRUE;
|
||||||
} else if ($actionadd) {
|
} else if ($actionadd) {
|
||||||
framework("begin","$logname","Maintenance Action Entry",$print);
|
framework("begin", "$logname", "Maintenance Action Entry", $print);
|
||||||
$mfowner=dblookup($db,"maintforms","maintformid","mftech",$maintformid);
|
$mfowner = dblookup($db, "maintforms", "maintformid", "mftech", $maintformid);
|
||||||
if ($loggedinas) {
|
if ($loggedinas) {
|
||||||
$mfauthorized=TRUE;
|
$mfauthorized = TRUE;
|
||||||
$actionauthorized=TRUE;
|
$actionauthorized = TRUE;
|
||||||
}
|
}
|
||||||
} else if ($actionedit || $actiondelete) {
|
} else if ($actionedit || $actiondelete) {
|
||||||
framework("begin","$logname","Maintenance Action Edit",$print);
|
framework("begin", "$logname", "Maintenance Action Edit", $print);
|
||||||
$mfowner=dblookup($db,"maintforms","maintformid","mftech",$maintformid);
|
$mfowner = dblookup($db, "maintforms", "maintformid", "mftech", $maintformid);
|
||||||
if ($loggedinas) $mfauthorized=TRUE;
|
if ($loggedinas) $mfauthorized = TRUE;
|
||||||
$actionowner=dblookup($db,"maintactions","maintactionid","actiontech",$maintactionid);
|
$actionowner = dblookup($db, "maintactions", "maintactionid", "actiontech", $maintactionid);
|
||||||
if (($loggedinas==$actionowner) || $isadmin) $actionauthorized=TRUE;
|
if (($loggedinas == $actionowner) || $isadmin) $actionauthorized = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$mfadd=TRUE;
|
$mfadd = TRUE;
|
||||||
framework("begin","$logname","Maintenance Form Entry",$print);
|
framework("begin", "$logname", "Maintenance Form Entry", $print);
|
||||||
$mftech=$loggedinas;
|
$mftech = $loggedinas;
|
||||||
$mfauthorized=TRUE;
|
$mfauthorized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ******** begin database manipulation ********
|
// ******** begin database manipulation ********
|
||||||
|
|
||||||
//var_dump($_REQUEST);
|
//var_dump($_REQUEST);
|
||||||
|
|
||||||
$pdatamismatch=NULL;
|
$pdatamismatch = NULL;
|
||||||
if ((($mfedit || $actionadd || $actionedit) && ! $mfsubmit) || $printfmt) {
|
if ((($mfedit || $actionadd || $actionedit) && ! $mfsubmit) || $printfmt) {
|
||||||
// pull mf data from database
|
// pull mf data from database
|
||||||
$mftoedit=getmfdata($maintformid);
|
$mftoedit = getmfdata($maintformid);
|
||||||
$partdatainput=[];
|
$partdatainput = [];
|
||||||
if ($mftoedit['mfpart']) $partdatainput['partid']=$mftoedit['mfpart'];
|
if ($mftoedit['mfpart']) $partdatainput['partid'] = $mftoedit['mfpart'];
|
||||||
if ($uid) $partdatainput['uid']=$uid;
|
if ($uid) $partdatainput['uid'] = $uid;
|
||||||
if ($partnum) $partdatainput['partnum']=$partnum;
|
if ($partnum) $partdatainput['partnum'] = $partnum;
|
||||||
if ($sernum) $partdatainput['sernum']=$sernum;
|
if ($sernum) $partdatainput['sernum'] = $sernum;
|
||||||
$partinfo=get_part_data($partdatainput);
|
$partinfo = get_part_data($partdatainput);
|
||||||
if ($partinfo['result']==2) {
|
if ($partinfo['result'] == 2) {
|
||||||
$pdatamismatch=TRUE;
|
$pdatamismatch = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$pdatamismatch=FALSE;
|
$pdatamismatch = FALSE;
|
||||||
if ($partinfo['partid']) $mfpart=$partinfo['partid'];
|
if ($partinfo['partid']) $mfpart = $partinfo['partid'];
|
||||||
if ($partinfo['uid']) $uid=$partinfo['uid'];
|
if ($partinfo['uid']) $uid = $partinfo['uid'];
|
||||||
if ($partinfo['partnum']) $partnum=$partinfo['partnum'];
|
if ($partinfo['partnum']) $partnum = $partinfo['partnum'];
|
||||||
if ($partinfo['sernum']) $sernum=$partinfo['sernum'];
|
if ($partinfo['sernum']) $sernum = $partinfo['sernum'];
|
||||||
if ($partinfo['partname']) $partname=$partinfo['partname'];
|
if ($partinfo['partname']) $partname = $partinfo['partname'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,54 +136,54 @@ if ($mfadd) {
|
|||||||
// add the entry if submit is pressed
|
// add the entry if submit is pressed
|
||||||
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
|
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
|
||||||
// determine whether supplied date is future or past
|
// determine whether supplied date is future or past
|
||||||
$datediff=mysqli_fetch_row(mysqli_query($db,"select datediff(\"$mfdate\",CURRENT_DATE)"));
|
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$mfdate\",CURRENT_DATE)"));
|
||||||
// if future, set time to 00:00:01, if past, set to 23:59:59
|
// if future, set time to 00:00:01, if past, set to 23:59:59
|
||||||
if ($datediff[0]<0) {
|
if ($datediff[0] < 0) {
|
||||||
$mftime="23:59:59:";
|
$mftime = "23:59:59:";
|
||||||
}
|
}
|
||||||
if ($datediff[0]>0) {
|
if ($datediff[0] > 0) {
|
||||||
$mftime="00:00:01:";
|
$mftime = "00:00:01:";
|
||||||
}
|
}
|
||||||
// remove cruft from malfunction text
|
// remove cruft from malfunction text
|
||||||
$mfmalfunction=htmlentities($mfmalfunction);
|
$mfmalfunction = htmlentities($mfmalfunction);
|
||||||
$mfmalfunction=addslashes($mfmalfunction);
|
$mfmalfunction = addslashes($mfmalfunction);
|
||||||
|
|
||||||
if ($mfauthorized) {
|
if ($mfauthorized) {
|
||||||
$partdatainput=array();
|
$partdatainput = array();
|
||||||
if ($uid) $partdatainput['uid']=$uid;
|
if ($uid) $partdatainput['uid'] = $uid;
|
||||||
if ($partnum) $partdatainput['partnum']=$partnum;
|
if ($partnum) $partdatainput['partnum'] = $partnum;
|
||||||
if ($sernum) $partdatainput['sernum']=$sernum;
|
if ($sernum) $partdatainput['sernum'] = $sernum;
|
||||||
$partinfo=get_part_data($partdatainput);
|
$partinfo = get_part_data($partdatainput);
|
||||||
// add to parts table
|
// add to parts table
|
||||||
if ($partinfo['result']==1) {
|
if ($partinfo['result'] == 1) {
|
||||||
// if this part has not been seen before, add it to the parts table and get partid
|
// if this part has not been seen before, add it to the parts table and get partid
|
||||||
mysqli_query($db,"insert into parts(uid,partnum,sernum,partname) values(\"$uid\",\"$partnum\",\"$sernum\",\"$partname\")");
|
mysqli_query($db, "insert into parts(uid,partnum,sernum,partname) values(\"$uid\",\"$partnum\",\"$sernum\",\"$partname\")");
|
||||||
$mfpart=mysqli_insert_id($db);
|
$mfpart = mysqli_insert_id($db);
|
||||||
} else if ($partinfo['result']==2) {
|
} else if ($partinfo['result'] == 2) {
|
||||||
$pdatamismatch=TRUE;
|
$pdatamismatch = TRUE;
|
||||||
} else {
|
} else {
|
||||||
// if it is in parts table, get partid for this record
|
// if it is in parts table, get partid for this record
|
||||||
$pdatamismatch=FALSE;
|
$pdatamismatch = FALSE;
|
||||||
$mfpart=$partinfo['partid'];
|
$mfpart = $partinfo['partid'];
|
||||||
}
|
}
|
||||||
if ($uid =="" || $partnum == "" || $sernum == "") {
|
if ($uid == "" || $partnum == "" || $sernum == "") {
|
||||||
// have the maintenance form stay pending due to incomplete part data
|
// have the maintenance form stay pending due to incomplete part data
|
||||||
$pending=1;
|
$pending = 1;
|
||||||
} else {
|
} else {
|
||||||
$pending=0;
|
$pending = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the record to maintforms
|
// add the record to maintforms
|
||||||
if (! $pdatamismatch) {
|
if (! $pdatamismatch) {
|
||||||
mysqli_query($db,"insert into maintforms(mfdate,mftime,mftech,mfpart,mfpartloc,mfmalfunction,nha,repord,lognoteid,pending)
|
mysqli_query($db, "insert into maintforms(mfdate,mftime,mftech,mfpart,mfpartloc,mfmalfunction,nha,repord,lognoteid,pending)
|
||||||
values (\"$mfdate\", \"$mftime\",\"$loggedinas\",\"$mfpart\",\"$mfpartloc\",\"$mfmalfunction\",\"$nha\",\"$repord\",\"$lognoteid\",\"$pending\")");
|
values (\"$mfdate\", \"$mftime\",\"$loggedinas\",\"$mfpart\",\"$mfpartloc\",\"$mfmalfunction\",\"$nha\",\"$repord\",\"$lognoteid\",\"$pending\")");
|
||||||
$newmaintformid=mysqli_insert_id($db);
|
$newmaintformid = mysqli_insert_id($db);
|
||||||
$mfidtoprint=$newmaintformid;
|
$mfidtoprint = $newmaintformid;
|
||||||
|
|
||||||
// update the flagmap table
|
// update the flagmap table
|
||||||
foreach ($flags as $thisflag) {
|
foreach ($flags as $thisflag) {
|
||||||
// set flag for this maintenance form
|
// set flag for this maintenance form
|
||||||
mysqli_query($db,"insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$$newmaintformid\")");
|
mysqli_query($db, "insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$$newmaintformid\")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,66 +191,66 @@ if ($mfadd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($mfedit) {
|
if ($mfedit) {
|
||||||
$mfidtoprint=$maintformid;
|
$mfidtoprint = $maintformid;
|
||||||
if ($mfsubmit && $mfauthorized) {
|
if ($mfsubmit && $mfauthorized) {
|
||||||
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
|
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
|
||||||
// remove cruft from malfunction text
|
// remove cruft from malfunction text
|
||||||
$mfmalfunction=htmlentities($mfmalfunction);
|
$mfmalfunction = htmlentities($mfmalfunction);
|
||||||
$mfmalfunction=addslashes($mfmalfunction);
|
$mfmalfunction = addslashes($mfmalfunction);
|
||||||
|
|
||||||
// update parts table
|
// update parts table
|
||||||
if ($uid =="" || $partnum == "" || $sernum == "") {
|
if ($uid == "" || $partnum == "" || $sernum == "") {
|
||||||
// have the maintenance form stay pending due to incomplete part data
|
// have the maintenance form stay pending due to incomplete part data
|
||||||
$pending=1;
|
$pending = 1;
|
||||||
} else {
|
} else {
|
||||||
$pending=0;
|
$pending = 0;
|
||||||
}
|
}
|
||||||
if (! $pdatamismatch) {
|
if (! $pdatamismatch) {
|
||||||
mysqli_query($db,"update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$mfpart\"");
|
mysqli_query($db, "update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$mfpart\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the record in maintforms
|
// update the record in maintforms
|
||||||
if (! $pdatamismatch) {
|
if (! $pdatamismatch) {
|
||||||
mysqli_query($db,"update maintforms set mfdate=\"$mfdate\", mftime=\"$mftime\", mfpart=\"$mfpart\", mfpartloc=\"$mfpartloc\",
|
mysqli_query($db, "update maintforms set mfdate=\"$mfdate\", mftime=\"$mftime\", mfpart=\"$mfpart\", mfpartloc=\"$mfpartloc\",
|
||||||
mfmalfunction=\"$mfmalfunction\", nha=\"$nha\", repord=\"$repord\", lognoteid=\"$lognoteid\", pending=\"$pending\" where maintformid=\"$maintformid\"");
|
mfmalfunction=\"$mfmalfunction\", nha=\"$nha\", repord=\"$repord\", lognoteid=\"$lognoteid\", pending=\"$pending\" where maintformid=\"$maintformid\"");
|
||||||
|
|
||||||
// update the flagmap table
|
// update the flagmap table
|
||||||
mysqli_query($db,"delete from flagmap where maintformid=\"$maintformid\"");
|
mysqli_query($db, "delete from flagmap where maintformid=\"$maintformid\"");
|
||||||
foreach ($flags as $thisflag) {
|
foreach ($flags as $thisflag) {
|
||||||
// set flag for this maintenance form
|
// set flag for this maintenance form
|
||||||
mysqli_query($db,"insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$maintformid\")");
|
mysqli_query($db, "insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$maintformid\")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// refresh the maintenance form in question from the database
|
// refresh the maintenance form in question from the database
|
||||||
$mftoedit=getmfdata($maintformid);
|
$mftoedit = getmfdata($maintformid);
|
||||||
}
|
}
|
||||||
if ($mfdelete && $mfauthorized) {
|
if ($mfdelete && $mfauthorized) {
|
||||||
// delete from maintforms table
|
// delete from maintforms table
|
||||||
mysqli_query($db,"delete from maintforms where maintformid=\"$maintformid\"");
|
mysqli_query($db, "delete from maintforms where maintformid=\"$maintformid\"");
|
||||||
// delete occurances from the flagmap table
|
// delete occurances from the flagmap table
|
||||||
mysqli_query($db,"delete from flagmap where maintformid=\"$maintformid\"");
|
mysqli_query($db, "delete from flagmap where maintformid=\"$maintformid\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($actionadd) {
|
if ($actionadd) {
|
||||||
if ($actionaddsubmit) {
|
if ($actionaddsubmit) {
|
||||||
if ($action) {
|
if ($action) {
|
||||||
// determine whether supplied date is future or past
|
// determine whether supplied date is future or past
|
||||||
$datediff=mysqli_fetch_row(mysqli_query($db,"select datediff(\"$actiondate\",CURRENT_DATE)"));
|
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$actiondate\",CURRENT_DATE)"));
|
||||||
// if future, set time to 00:00:01, if past, set to 23:59:59
|
// if future, set time to 00:00:01, if past, set to 23:59:59
|
||||||
if ($datediff[0]<0) {
|
if ($datediff[0] < 0) {
|
||||||
$actiontime="23:59:59:";
|
$actiontime = "23:59:59:";
|
||||||
}
|
}
|
||||||
if ($datediff[0]>0) {
|
if ($datediff[0] > 0) {
|
||||||
$actiontime="00:00:01:";
|
$actiontime = "00:00:01:";
|
||||||
}
|
}
|
||||||
// remove cruft from action text
|
// remove cruft from action text
|
||||||
$action=htmlentities($action);
|
$action = htmlentities($action);
|
||||||
$action=addslashes($action);
|
$action = addslashes($action);
|
||||||
|
|
||||||
// add to maintactions table
|
// add to maintactions table
|
||||||
mysqli_query($db,"insert into maintactions (actiondate,actiontime,maintformnum,actiontech,action)
|
mysqli_query($db, "insert into maintactions (actiondate,actiontime,maintformnum,actiontech,action)
|
||||||
values (\"$actiondate\",\"$actiontime\",\"$maintformid\",\"$loggedinas\",\"$action\")");
|
values (\"$actiondate\",\"$actiontime\",\"$maintformid\",\"$loggedinas\",\"$action\")");
|
||||||
echo mysqli_error($db);
|
echo mysqli_error($db);
|
||||||
}
|
}
|
||||||
@@ -259,19 +261,19 @@ if ($actionedit) {
|
|||||||
if ($actioneditsubmit && $actionauthorized) {
|
if ($actioneditsubmit && $actionauthorized) {
|
||||||
// update the action
|
// update the action
|
||||||
// remove cruft from action text
|
// remove cruft from action text
|
||||||
$action=htmlentities($action);
|
$action = htmlentities($action);
|
||||||
$action=addslashes($action);
|
$action = addslashes($action);
|
||||||
|
|
||||||
// update maintactions table
|
// update maintactions table
|
||||||
mysqli_query($db,"update maintactions set actiondate=\"$actiondate\", actiontime=\"$actiontime\", action=\"$action\" where maintactionid=\"$maintactionid\"");
|
mysqli_query($db, "update maintactions set actiondate=\"$actiondate\", actiontime=\"$actiontime\", action=\"$action\" where maintactionid=\"$maintactionid\"");
|
||||||
}
|
}
|
||||||
// refresh the action in question from the database
|
// refresh the action in question from the database
|
||||||
$actiontoedit=getactiondata($maintactionid);
|
$actiontoedit = getactiondata($maintactionid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($actiondelete && $actionauthorized) {
|
if ($actiondelete && $actionauthorized) {
|
||||||
// delete the action
|
// delete the action
|
||||||
mysqli_query($db,"delete from maintactions where maintactionid=\"$maintactionid\"");
|
mysqli_query($db, "delete from maintactions where maintactionid=\"$maintactionid\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -279,66 +281,67 @@ if ($actiondelete && $actionauthorized) {
|
|||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if (!$print) {
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
banner($print);
|
banner($print);
|
||||||
// display the form
|
// display the form
|
||||||
if ($mfadd || $actionadd) {
|
if ($mfadd || $actionadd) {
|
||||||
$mfdate=$today;
|
$mfdate = $today;
|
||||||
$mftime=$now;
|
$mftime = $now;
|
||||||
$actiondate=$today;
|
$actiondate = $today;
|
||||||
$actiontime=$now;
|
$actiontime = $now;
|
||||||
}
|
}
|
||||||
if ($mfedit || $mfdelete || $actionadd || $actionedit || $actiondelete || $printfmt) {
|
if ($mfedit || $mfdelete || $actionadd || $actionedit || $actiondelete || $printfmt) {
|
||||||
$mfdate=$mftoedit["mfdate"];
|
$mfdate = $mftoedit["mfdate"];
|
||||||
$mftime=$mftoedit["mftime"];
|
$mftime = $mftoedit["mftime"];
|
||||||
$mfpart=$mftoedit["mfpart"];
|
$mfpart = $mftoedit["mfpart"];
|
||||||
$mfpartloc=$mftoedit["mfpartloc"];
|
$mfpartloc = $mftoedit["mfpartloc"];
|
||||||
$mfmalfunction=$mftoedit["mfmalfunction"];
|
$mfmalfunction = $mftoedit["mfmalfunction"];
|
||||||
$nha=$mftoedit["nha"];
|
$nha = $mftoedit["nha"];
|
||||||
$repord=$mftoedit["repord"];
|
$repord = $mftoedit["repord"];
|
||||||
$lognoteid=$mftoedit["lognoteid"];
|
$lognoteid = $mftoedit["lognoteid"];
|
||||||
if ($mfedit || $mfdelete || $actionadd || $actionedit || $actiondelete || $printfmt) $mftech=$mftoedit["mftech"];
|
if ($mfedit || $mfdelete || $actionadd || $actionedit || $actiondelete || $printfmt) $mftech = $mftoedit["mftech"];
|
||||||
if (! $mftime) $mftime=$now;
|
if (! $mftime) $mftime = $now;
|
||||||
}
|
}
|
||||||
if (($mfedit || $actionadd || $actionedit) && ! ($mfsubmit || $actionaddsubmit || $actioneditsubmit)) {
|
if (($mfedit || $actionadd || $actionedit) && ! ($mfsubmit || $actionaddsubmit || $actioneditsubmit)) {
|
||||||
$partinfo=array();
|
$partinfo = array();
|
||||||
$partinfoinput['partid']=$mfpart;
|
$partinfoinput['partid'] = $mfpart;
|
||||||
$partinfo=get_part_data($partinfoinput);
|
$partinfo = get_part_data($partinfoinput);
|
||||||
$mfpart=$partinfo['partid'];
|
$mfpart = $partinfo['partid'];
|
||||||
$uid=$partinfo['uid'];
|
$uid = $partinfo['uid'];
|
||||||
$partnum=$partinfo['partnum'];
|
$partnum = $partinfo['partnum'];
|
||||||
$sernum=$partinfo['sernum'];
|
$sernum = $partinfo['sernum'];
|
||||||
$partname=$partinfo['partname'];
|
$partname = $partinfo['partname'];
|
||||||
$pluresult=$partinfo['result'];
|
$pluresult = $partinfo['result'];
|
||||||
if ($pluresult==2) $pdatamismatch=TRUE; else $pdatamismatch=FALSE;
|
if ($pluresult == 2) $pdatamismatch = TRUE;
|
||||||
|
else $pdatamismatch = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$techname=dblookup($db,"techs","techid","techname",$mftech);
|
$techname = dblookup($db, "techs", "techid", "techname", $mftech);
|
||||||
if ($mfsubmit) {
|
if ($mfsubmit) {
|
||||||
if ($mfmalfunction) {
|
if ($mfmalfunction) {
|
||||||
if (($uid || ($partnum && $sernum)) || $mfpart) {
|
if (($uid || ($partnum && $sernum)) || $mfpart) {
|
||||||
if ($mfadd) {
|
if ($mfadd) {
|
||||||
format_message(0,"Maintenance Form added. You may enter another one or <a href=\"maintform.php\">return to Maintenance Forms page.</a>");
|
format_message(0, "Maintenance Form added. You may enter another one or <a href=\"maintform.php\">return to Maintenance Forms page.</a>");
|
||||||
}
|
}
|
||||||
if ($mfedit) {
|
if ($mfedit) {
|
||||||
format_message(0,"Maintenance Form changed. <a href=\"maintform.php\">Return to Maintenance Forms page.</a>");
|
format_message(0, "Maintenance Form changed. <a href=\"maintform.php\">Return to Maintenance Forms page.</a>");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
format_message(1,"You didn't enter any part information. Please try again.");
|
format_message(1, "You didn't enter any part information. Please try again.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
format_message(1,"You didn't enter any malfunction description. Please try again.");
|
format_message(1, "You didn't enter any malfunction description. Please try again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($mfdelete) {
|
if ($mfdelete) {
|
||||||
format_message(0,"Maintenance Form Deleted. <a href=\"maintform.php\">Return to Maintenance Forms page.</a>");
|
format_message(0, "Maintenance Form Deleted. <a href=\"maintform.php\">Return to Maintenance Forms page.</a>");
|
||||||
}
|
}
|
||||||
if ($pdatamismatch) {
|
if ($pdatamismatch) {
|
||||||
$advtxt="
|
$advtxt = "
|
||||||
<img src=\"icons/exclamation-red.png\" border=\"0\">
|
<img src=\"icons/exclamation-red.png\" border=\"0\">
|
||||||
<b>Warning:</b> The $uidtext doesn't match the Part Number/Serial Number associated
|
<b>Warning:</b> The $uidtext doesn't match the Part Number/Serial Number associated
|
||||||
with it in our database. Please ensure the part information
|
with it in our database. Please ensure the part information
|
||||||
@@ -346,7 +349,7 @@ if ($pdatamismatch) {
|
|||||||
the <a href=\"parts.php\">Parts</a> page to correct the database.</b>
|
the <a href=\"parts.php\">Parts</a> page to correct the database.</b>
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
$advtxt="
|
$advtxt = "
|
||||||
<font size=\"-1\">You can enter a $uidtext or Part Number/Serial Number or both.</font>
|
<font size=\"-1\">You can enter a $uidtext or Part Number/Serial Number or both.</font>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
@@ -376,32 +379,32 @@ if ($printfmt) {
|
|||||||
";
|
";
|
||||||
|
|
||||||
// create an array called theseflags of flagids set for this maintformid
|
// create an array called theseflags of flagids set for this maintformid
|
||||||
$allflags=mysqli_query($db,"select flagid from flags");
|
$allflags = mysqli_query($db, "select flagid from flags");
|
||||||
unset($theseflags);
|
unset($theseflags);
|
||||||
$theseflags=[];
|
$theseflags = [];
|
||||||
while ($thisflag=mysqli_fetch_row($allflags)) {
|
while ($thisflag = mysqli_fetch_row($allflags)) {
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select id from flagmap where flagid=\"$thisflag[0]\" and maintformid=\"$maintformid\""))) {
|
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and maintformid=\"$maintformid\""))) {
|
||||||
$theseflags[]=$thisflag[0];
|
$theseflags[] = $thisflag[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// display flag symbols for set flags
|
// display flag symbols for set flags
|
||||||
$flagslist=mysqli_query($db,"select * from flags");
|
$flagslist = mysqli_query($db, "select * from flags");
|
||||||
while ($flagsymbol=mysqli_fetch_assoc($flagslist)) {
|
while ($flagsymbol = mysqli_fetch_assoc($flagslist)) {
|
||||||
if ($theseflags[0]=="") $theseflags=[];
|
if ($theseflags[0] == "") $theseflags = [];
|
||||||
if (!empty($theseflags) && in_array($flagsymbol["flagid"],$theseflags)) {
|
if (!empty($theseflags) && in_array($flagsymbol["flagid"], $theseflags)) {
|
||||||
echo $flagsymbol['flagsym']." ";
|
echo $flagsymbol['flagsym'] . " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
</table><hr>
|
</table><hr>
|
||||||
<b><u>Maintenance Actions</u></b><br>
|
<b><u>Maintenance Actions</u></b><br>
|
||||||
";
|
";
|
||||||
$maintactionqry=mysqli_query($db,"select * from maintactions where maintformnum=\"$maintformid\" order by actiondate asc, actiontime asc");
|
$maintactionqry = mysqli_query($db, "select * from maintactions where maintformnum=\"$maintformid\" order by actiondate asc, actiontime asc");
|
||||||
while ($actiontable=mysqli_fetch_assoc($maintactionqry)) {
|
while ($actiontable = mysqli_fetch_assoc($maintactionqry)) {
|
||||||
$actiondate=$actiontable["actiondate"];
|
$actiondate = $actiontable["actiondate"];
|
||||||
$actiontime=$actiontable["actiontime"];
|
$actiontime = $actiontable["actiontime"];
|
||||||
$tname=dblookup($db,"techs","techid","techname",$actiontable["actiontech"]);
|
$tname = dblookup($db, "techs", "techid", "techname", $actiontable["actiontech"]);
|
||||||
$actiontext=convertweblinks($actiontable["action"]);
|
$actiontext = convertweblinks($actiontable["action"]);
|
||||||
// print the actions
|
// print the actions
|
||||||
echo "<table border=\"0\" cellpadding=\"5\">
|
echo "<table border=\"0\" cellpadding=\"5\">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -463,39 +466,49 @@ if ($printfmt) {
|
|||||||
<tr><td>
|
<tr><td>
|
||||||
";
|
";
|
||||||
// create an array called theseflags of flagids set for this maintformid
|
// create an array called theseflags of flagids set for this maintformid
|
||||||
$allflags=mysqli_query($db,"select flagid from flags");
|
$allflags = mysqli_query($db, "select flagid from flags");
|
||||||
unset($theseflags);
|
unset($theseflags);
|
||||||
$theseflags=[];
|
$theseflags = [];
|
||||||
while ($thisflag=mysqli_fetch_row($allflags)) {
|
while ($thisflag = mysqli_fetch_row($allflags)) {
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select id from flagmap where flagid=\"$thisflag[0]\" and maintformid=\"$maintformid\""))) {
|
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and maintformid=\"$maintformid\""))) {
|
||||||
$theseflags[]=$thisflag[0];
|
$theseflags[] = $thisflag[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($mfadd) {
|
if ($mfadd) {
|
||||||
$flagslist=mysqli_query($db,"select * from flags where status=1");
|
$flagslist = mysqli_query($db, "select * from flags where status=1");
|
||||||
} else {
|
} else {
|
||||||
$flagslist=mysqli_query($db,"select * from flags");
|
$flagslist = mysqli_query($db, "select * from flags");
|
||||||
}
|
}
|
||||||
$flagsperline=8;
|
$flagsperline = 8;
|
||||||
$flagcount=1;
|
$flagcount = 1;
|
||||||
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
|
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||||
//if ($theseflags[0]=="") $theseflags=[];
|
//if ($theseflags[0]=="") $theseflags=[];
|
||||||
if (in_array($flagcheckbox["flagid"],$theseflags)) {
|
if (in_array($flagcheckbox["flagid"], $theseflags)) {
|
||||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
printf(
|
||||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
||||||
|
$flagcheckbox["flagid"],
|
||||||
|
$flagcheckbox["flagcolor"],
|
||||||
|
$flagcheckbox["flagname"],
|
||||||
|
$flagcheckbox["flagsym"]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$flagid=$flagcheckbox["flagid"];
|
$flagid = $flagcheckbox["flagid"];
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
||||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
printf(
|
||||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||||
|
$flagcheckbox["flagid"],
|
||||||
|
$flagcheckbox["flagcolor"],
|
||||||
|
$flagcheckbox["flagname"],
|
||||||
|
$flagcheckbox["flagsym"]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($flagcount<$flagsperline) {
|
if ($flagcount < $flagsperline) {
|
||||||
echo " ";
|
echo " ";
|
||||||
$flagcount++;
|
$flagcount++;
|
||||||
} else {
|
} else {
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
$flagcount=1;
|
$flagcount = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
@@ -550,16 +563,16 @@ if ($printfmt) {
|
|||||||
if ($actionadd || $actionedit) {
|
if ($actionadd || $actionedit) {
|
||||||
// show the action form
|
// show the action form
|
||||||
if ($actionadd) {
|
if ($actionadd) {
|
||||||
$matime=$now;
|
$matime = $now;
|
||||||
$actiontext="";
|
$actiontext = "";
|
||||||
$actiontech=$loggedinas;
|
$actiontech = $loggedinas;
|
||||||
} else if ($actionedit) {
|
} else if ($actionedit) {
|
||||||
$actiontext=$actiontoedit['action'];
|
$actiontext = $actiontoedit['action'];
|
||||||
$actiontech=$actiontoedit['actiontech'];
|
$actiontech = $actiontoedit['actiontech'];
|
||||||
$actiondate=$actiontoedit['actiondate'];
|
$actiondate = $actiontoedit['actiondate'];
|
||||||
$actiontime=$actiontoedit['actiontime'];
|
$actiontime = $actiontoedit['actiontime'];
|
||||||
}
|
}
|
||||||
$tname=dblookup($db,"techs","techid","techname",$actiontech);
|
$tname = dblookup($db, "techs", "techid", "techname", $actiontech);
|
||||||
echo "<table width=\"70\" border=\"0\" cellpadding=\"5\">
|
echo "<table width=\"70\" border=\"0\" cellpadding=\"5\">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Tech: $tname
|
<td>Tech: $tname
|
||||||
@@ -603,19 +616,19 @@ if ($printfmt) {
|
|||||||
echo "<br><br>";
|
echo "<br><br>";
|
||||||
|
|
||||||
|
|
||||||
$maintactionqry=mysqli_query($db,"select * from maintactions where maintformnum=\"$maintformid\" order by actiondate asc, actiontime asc");
|
$maintactionqry = mysqli_query($db, "select * from maintactions where maintformnum=\"$maintformid\" order by actiondate asc, actiontime asc");
|
||||||
while ($actiontable=mysqli_fetch_assoc($maintactionqry)) {
|
while ($actiontable = mysqli_fetch_assoc($maintactionqry)) {
|
||||||
$maintactionid=$actiontable["maintactionid"];
|
$maintactionid = $actiontable["maintactionid"];
|
||||||
$actiondate=$actiontable["actiondate"];
|
$actiondate = $actiontable["actiondate"];
|
||||||
$actiontime=$actiontable["actiontime"];
|
$actiontime = $actiontable["actiontime"];
|
||||||
$maintformnum=$actiontable["maintformnum"];
|
$maintformnum = $actiontable["maintformnum"];
|
||||||
$tname=dblookup($db,"techs","techid","techname",$actiontable["actiontech"]);
|
$tname = dblookup($db, "techs", "techid", "techname", $actiontable["actiontech"]);
|
||||||
$actiontext=convertweblinks($actiontable["action"]);
|
$actiontext = convertweblinks($actiontable["action"]);
|
||||||
// print the table
|
// print the table
|
||||||
echo "<table width=\"100%\" border=\"1\" cellpadding=\"5\">
|
echo "<table width=\"100%\" border=\"1\" cellpadding=\"5\">
|
||||||
<tr><td>
|
<tr><td>
|
||||||
";
|
";
|
||||||
if (($loggedinas==$actiontable["actiontech"]) || $isadmin) {
|
if (($loggedinas == $actiontable["actiontech"]) || $isadmin) {
|
||||||
echo "
|
echo "
|
||||||
<a href=\"maintformentry.php?maintformid=$maintformid&actionedit=1&maintactionid=$maintactionid\"><img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"Edit this action\" alt=\"Edit this action\"></a>
|
<a href=\"maintformentry.php?maintformid=$maintformid&actionedit=1&maintactionid=$maintactionid\"><img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"Edit this action\" alt=\"Edit this action\"></a>
|
||||||
<a href=\"maintformentry.php?maintformid=$maintformid&actiondelete=1&maintactionid=$maintactionid\"><img src=\"icons/minus-button.png\" border=\"0\" title=\"Delete this action\" alt=\"Delete this action\"></a>
|
<a href=\"maintformentry.php?maintformid=$maintformid&actiondelete=1&maintactionid=$maintactionid\"><img src=\"icons/minus-button.png\" border=\"0\" title=\"Delete this action\" alt=\"Delete this action\"></a>
|
||||||
@@ -645,9 +658,7 @@ if ($printfmt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
banner($print);
|
banner($print);
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -11,39 +11,39 @@ include("functions.php");
|
|||||||
|
|
||||||
|
|
||||||
if (!isset($_SESSION['login'])) {
|
if (!isset($_SESSION['login'])) {
|
||||||
header ("Location: login.php");
|
header("Location: login.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
$loggedinas=$_SESSION['login'];
|
$loggedinas = $_SESSION['login'];
|
||||||
$isadmin=dblookup($db,"techs","techid","admin",$loggedinas);
|
$isadmin = dblookup($db, "techs", "techid", "admin", $loggedinas);
|
||||||
|
|
||||||
$print=$_REQUEST['print'] ?? NULL;
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
$add=$_REQUEST['add'] ?? NULL;
|
$add = $_REQUEST['add'] ?? NULL;
|
||||||
$edit=$_REQUEST['edit'] ?? NULL;
|
$edit = $_REQUEST['edit'] ?? NULL;
|
||||||
$delete=$_REQUEST['delete'] ?? NULL;
|
$delete = $_REQUEST['delete'] ?? NULL;
|
||||||
|
|
||||||
$partid=$_REQUEST['partid'] ?? NULL;
|
$partid = $_REQUEST['partid'] ?? NULL;
|
||||||
$uid=$_REQUEST['uid'] ?? NULL;
|
$uid = $_REQUEST['uid'] ?? NULL;
|
||||||
$partnum=$_REQUEST['partnum'] ?? NULL;
|
$partnum = $_REQUEST['partnum'] ?? NULL;
|
||||||
$sernum=$_REQUEST['sernum'] ?? NULL;
|
$sernum = $_REQUEST['sernum'] ?? NULL;
|
||||||
$partname=$_REQUEST['partname'] ?? NULL;
|
$partname = $_REQUEST['partname'] ?? NULL;
|
||||||
$submit=$_REQUEST['submit'] ?? NULL;
|
$submit = $_REQUEST['submit'] ?? NULL;
|
||||||
|
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
$uidtext=UID_TEXT;
|
$uidtext = UID_TEXT;
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
if ($edit || $delete) {
|
if ($edit || $delete) {
|
||||||
framework("begin","$logname","Part Edit",$print);
|
framework("begin", "$logname", "Part Edit", $print);
|
||||||
} else {
|
} else {
|
||||||
$add=1;
|
$add = 1;
|
||||||
framework("begin","$logname","Part Entry",$print);
|
framework("begin", "$logname", "Part Entry", $print);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ******** begin database manipulation ********
|
// ******** begin database manipulation ********
|
||||||
@@ -53,11 +53,11 @@ if ($add) {
|
|||||||
if ($submit) {
|
if ($submit) {
|
||||||
// add the entry if submit is pressed
|
// add the entry if submit is pressed
|
||||||
if ($uid || ($partnum && $sernum)) {
|
if ($uid || ($partnum && $sernum)) {
|
||||||
$partexists=mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uid\" or (partnum=\"$partnum\" and sernum=\"$sernum\")"));
|
$partexists = mysqli_num_rows(mysqli_query($db, "select partid from parts where uid=\"$uid\" or (partnum=\"$partnum\" and sernum=\"$sernum\")"));
|
||||||
if (! $partexists) {
|
if (! $partexists) {
|
||||||
// add to parts table
|
// add to parts table
|
||||||
mysqli_query($db,"insert into parts(uid,partnum,sernum,partname) values(\"$uid\",\"$partnum\",\"$sernum\",\"$partname\")");
|
mysqli_query($db, "insert into parts(uid,partnum,sernum,partname) values(\"$uid\",\"$partnum\",\"$sernum\",\"$partname\")");
|
||||||
$partid=mysqli_insert_id($db);
|
$partid = mysqli_insert_id($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,18 +66,18 @@ if ($edit) {
|
|||||||
if ($submit) {
|
if ($submit) {
|
||||||
if ($uid || ($partnum && $sernum)) {
|
if ($uid || ($partnum && $sernum)) {
|
||||||
// update parts table
|
// update parts table
|
||||||
mysqli_query($db,"update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$partid\"");
|
mysqli_query($db, "update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$partid\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($delete) {
|
if ($delete) {
|
||||||
// check for occurrence in logparts table
|
// check for occurrence in logparts table
|
||||||
$inlogparts=mysqli_num_rows(mysqli_query($db,"select logpartid from logparts where partid=\"$partid\""));
|
$inlogparts = mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where partid=\"$partid\""));
|
||||||
// check for occurrence in maintforms table
|
// check for occurrence in maintforms table
|
||||||
$inmaintforms=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mfpart=\"$partid\""));
|
$inmaintforms = mysqli_num_rows(mysqli_query($db, "select maintformid from maintforms where mfpart=\"$partid\""));
|
||||||
// delete from parts table
|
// delete from parts table
|
||||||
if(!$inlogparts && !$inmaintforms) {
|
if (!$inlogparts && !$inmaintforms) {
|
||||||
mysqli_query($db,"delete from parts where partid=\"$partid\"");
|
mysqli_query($db, "delete from parts where partid=\"$partid\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,24 +85,24 @@ if ($delete) {
|
|||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if (!$print) {
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
banner($print);
|
banner($print);
|
||||||
// display the form
|
// display the form
|
||||||
$partdatainput=array();
|
$partdatainput = array();
|
||||||
$partdatainput['partid']=$partid;
|
$partdatainput['partid'] = $partid;
|
||||||
$partinfo=get_part_data($partdatainput);
|
$partinfo = get_part_data($partdatainput);
|
||||||
if ($partinfo['result']==2) {
|
if ($partinfo['result'] == 2) {
|
||||||
$pdatamismatch=TRUE;
|
$pdatamismatch = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$pdatamismatch=FALSE;
|
$pdatamismatch = FALSE;
|
||||||
$uid = (array_key_exists('uid',$partinfo)) ? $partinfo['uid'] : NULL;
|
$uid = (array_key_exists('uid', $partinfo)) ? $partinfo['uid'] : NULL;
|
||||||
$partnum = (array_key_exists('partnum',$partinfo)) ? $partinfo['partnum'] : NULL;
|
$partnum = (array_key_exists('partnum', $partinfo)) ? $partinfo['partnum'] : NULL;
|
||||||
$sernum = (array_key_exists('sernum',$partinfo)) ? $partinfo['sernum'] : NULL;
|
$sernum = (array_key_exists('sernum', $partinfo)) ? $partinfo['sernum'] : NULL;
|
||||||
$partname = (array_key_exists('partname',$partinfo)) ? $partinfo['partname'] : NULL;
|
$partname = (array_key_exists('partname', $partinfo)) ? $partinfo['partname'] : NULL;
|
||||||
}
|
}
|
||||||
if ($delete) {
|
if ($delete) {
|
||||||
if ($inmaintforms) {
|
if ($inmaintforms) {
|
||||||
@@ -168,9 +168,7 @@ echo "
|
|||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
banner($print);
|
banner($print);
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -10,50 +10,50 @@
|
|||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
if (isset($_SESSION['login'])) {
|
if (isset($_SESSION['login'])) {
|
||||||
$loggedin=1;
|
$loggedin = TRUE;
|
||||||
} else {
|
} else {
|
||||||
unset($loggedin);
|
$loggedin = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$print=$_REQUEST['print'] ?? NULL;
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
$add=$_REQUEST['add'] ?? NULL;
|
$add = $_REQUEST['add'] ?? NULL;
|
||||||
$sort=$_REQUEST['sort'] ?? NULL;
|
$sort = $_REQUEST['sort'] ?? NULL;
|
||||||
$order=$_REQUEST['order'] ?? NULL;
|
$order = $_REQUEST['order'] ?? NULL;
|
||||||
|
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
$uidtext=UID_TEXT;
|
$uidtext = UID_TEXT;
|
||||||
|
|
||||||
if ($add) {
|
if ($add) {
|
||||||
header ("Location: partentry.php?add=1");
|
header("Location: partentry.php?add=1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $sort) $sort="uid";
|
if (! $sort) $sort = "uid";
|
||||||
if ($order == "asc") {
|
if ($order == "asc") {
|
||||||
$order="desc";
|
$order = "desc";
|
||||||
} else if ($order == "desc") {
|
} else if ($order == "desc") {
|
||||||
$order="asc";
|
$order = "asc";
|
||||||
} else {
|
} else {
|
||||||
$order="asc";
|
$order = "asc";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
framework("begin","$logname","Parts",$print);
|
framework("begin", "$logname", "Parts", $print);
|
||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if(!$print) {
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
banner($print);
|
banner($print);
|
||||||
if ($loggedin) {
|
if ($loggedin) {
|
||||||
echo "
|
echo "
|
||||||
@@ -71,15 +71,16 @@ echo "
|
|||||||
<th><a href=\"parts.php?sort=partname&order=$order\" title=\"Sort by Part Name\">Part Name</a></th>
|
<th><a href=\"parts.php?sort=partname&order=$order\" title=\"Sort by Part Name\">Part Name</a></th>
|
||||||
</tr>
|
</tr>
|
||||||
";
|
";
|
||||||
$partqry=mysqli_query($db,"select * from parts order by $sort $order");
|
$partqry = mysqli_query($db, "select * from parts order by $sort $order");
|
||||||
while ($partline=mysqli_fetch_assoc($partqry)) {
|
while ($partline = mysqli_fetch_assoc($partqry)) {
|
||||||
if (!$partline['uid']) {
|
if (!$partline['uid']) {
|
||||||
$pluidtxt="none";
|
$pluidtxt = "none";
|
||||||
} else {
|
} else {
|
||||||
$pluidtxt=$partline['uid'];
|
$pluidtxt = $partline['uid'];
|
||||||
}
|
}
|
||||||
if ($loggedin) {
|
if ($loggedin) {
|
||||||
printf("
|
printf(
|
||||||
|
"
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href=\"partentry.php?edit=1&partid=%s\" title=\"Edit this part\">%s</a>
|
<a href=\"partentry.php?edit=1&partid=%s\" title=\"Edit this part\">%s</a>
|
||||||
@@ -87,22 +88,24 @@ while ($partline=mysqli_fetch_assoc($partqry)) {
|
|||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
<td>%s</td>",
|
<td>%s</td>",
|
||||||
$partline['partid'],$pluidtxt,
|
$partline['partid'],
|
||||||
$partline['partnum'],
|
$pluidtxt,
|
||||||
$partline['sernum'],
|
$partline['partnum'],
|
||||||
$partline['partname']
|
$partline['sernum'],
|
||||||
|
$partline['partname']
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
printf("
|
printf(
|
||||||
|
"
|
||||||
<tr>
|
<tr>
|
||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
<td>%s</td>",
|
<td>%s</td>",
|
||||||
$pluidtxt,
|
$pluidtxt,
|
||||||
$partline['partnum'],
|
$partline['partnum'],
|
||||||
$partline['sernum'],
|
$partline['sernum'],
|
||||||
$partline['partname']
|
$partline['partname']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
@@ -115,9 +118,7 @@ echo "
|
|||||||
|
|
||||||
echo "<br><br>";
|
echo "<br><br>";
|
||||||
banner($print);
|
banner($print);
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -10,43 +10,43 @@
|
|||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
if (!isset($_SESSION['login'])) {
|
if (!isset($_SESSION['login'])) {
|
||||||
header ("Location: login.php");
|
header("Location: login.php");
|
||||||
}
|
}
|
||||||
$techid=$_SESSION['login'] ?? NULL;
|
$techid = $_SESSION['login'] ?? NULL;
|
||||||
$print=$_REQUEST['print'] ?? NULL;
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
$table=$_REQUEST['table'] ?? NULL;
|
$table = $_REQUEST['table'] ?? NULL;
|
||||||
$updateinfo=$_REQUEST['updateinfo'] ?? NULL;
|
$updateinfo = $_REQUEST['updateinfo'] ?? NULL;
|
||||||
$updatedisplay=$_REQUEST['updatedisplay'] ?? NULL;
|
$updatedisplay = $_REQUEST['updatedisplay'] ?? NULL;
|
||||||
$setcolor=$_REQUEST['setcolor'] ?? NULL;
|
$setcolor = $_REQUEST['setcolor'] ?? NULL;
|
||||||
$name=$_REQUEST['name'] ?? NULL;
|
$name = $_REQUEST['name'] ?? NULL;
|
||||||
$pass=$_REQUEST['pass'] ?? NULL;
|
$pass = $_REQUEST['pass'] ?? NULL;
|
||||||
$passconf=$_REQUEST['passconf'] ?? NULL;
|
$passconf = $_REQUEST['passconf'] ?? NULL;
|
||||||
$shift=$_REQUEST['shift'] ?? NULL;
|
$shift = $_REQUEST['shift'] ?? NULL;
|
||||||
$display_urlchunk=$_REQUEST['display_urlchunk'] ?? NULL;
|
$display_urlchunk = $_REQUEST['display_urlchunk'] ?? NULL;
|
||||||
$display_showts=$_REQUEST['display_showts'] ?? NULL;
|
$display_showts = $_REQUEST['display_showts'] ?? NULL;
|
||||||
$display_techalpha=$_REQUEST['display_techalpha'] ?? NULL;
|
$display_techalpha = $_REQUEST['display_techalpha'] ?? NULL;
|
||||||
$display_subjalpha=$_REQUEST['display_subjalpha'] ?? NULL;
|
$display_subjalpha = $_REQUEST['display_subjalpha'] ?? NULL;
|
||||||
$display_logstyle=$_REQUEST['display_logstyle'] ?? NULL;
|
$display_logstyle = $_REQUEST['display_logstyle'] ?? NULL;
|
||||||
$modcolor=$_REQUEST['modcolor'] ?? NULL;
|
$modcolor = $_REQUEST['modcolor'] ?? NULL;
|
||||||
$hexcolor=$_REQUEST['hexcolor'] ?? NULL;
|
$hexcolor = $_REQUEST['hexcolor'] ?? NULL;
|
||||||
$resetcustom=$_REQUEST["resetcustom"] ?? NULL;
|
$resetcustom = $_REQUEST["resetcustom"] ?? NULL;
|
||||||
|
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
framework("begin","$logname","My Profile",$print);
|
framework("begin", "$logname", "My Profile", $print);
|
||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if(!$print){
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
|
|
||||||
// ******** begin database manipulation ********
|
// ******** begin database manipulation ********
|
||||||
if ($updateinfo) {
|
if ($updateinfo) {
|
||||||
@@ -54,89 +54,92 @@ if(!$print){
|
|||||||
// do error checking
|
// do error checking
|
||||||
// test for name supplied
|
// test for name supplied
|
||||||
if (strlen(trim($name))) {
|
if (strlen(trim($name))) {
|
||||||
$namesuppld=1;
|
$namesuppld = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$namesuppld=0;
|
$namesuppld = FALSE;
|
||||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name cannot be blank.<br>";
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name cannot be blank.<br>";
|
||||||
}
|
}
|
||||||
// test for name unique
|
// test for name unique
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select techid from techs where techname=\"$name\" and techid!=\"$techid\""))) {
|
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\" and techid!=\"$techid\""))) {
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select techid from techs where techname=\"$name\""))) {
|
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) {
|
||||||
$nameunique=0;
|
$nameunique = FALSE;
|
||||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name already exists.<br>";
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name already exists.<br>";
|
||||||
} else {
|
} else {
|
||||||
$nameunique=1;
|
$nameunique = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$nameunique=1;
|
$nameunique = TRUE;
|
||||||
}
|
}
|
||||||
// test for matching passwords
|
// test for matching passwords
|
||||||
if ($pass!="password_is_unchanged") {
|
if ($pass != "password_is_unchanged") {
|
||||||
if ($pass==$passconf) {
|
if ($pass == $passconf) {
|
||||||
$passmatch=1;
|
$passmatch = TRUE;
|
||||||
$passhash=password_hash($pass,PASSWORD_DEFAULT);
|
$passhash = password_hash($pass, PASSWORD_DEFAULT);
|
||||||
$namepassupdqry=("update techs set techname=\"$name\",techpass=\"$passhash\" where techid=\"$techid\"");
|
$namepassupdqry = ("update techs set techname=\"$name\",techpass=\"$passhash\" where techid=\"$techid\"");
|
||||||
} else {
|
} else {
|
||||||
$passmatch=0;
|
$passmatch = FALSE;
|
||||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> The passwords you supplied don't match.<br>";
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> The passwords you supplied don't match.<br>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$passmatch=1;
|
$passmatch = TRUE;
|
||||||
$namepassupdqry="update techs set techname=\"$name\" where techid=\"$techid\"";
|
$namepassupdqry = "update techs set techname=\"$name\" where techid=\"$techid\"";
|
||||||
}
|
}
|
||||||
if ($namesuppld && $nameunique && $passmatch) {
|
if ($namesuppld && $nameunique && $passmatch) {
|
||||||
mysqli_query($db,$namepassupdqry);
|
mysqli_query($db, $namepassupdqry);
|
||||||
mysqli_query($db,"update techs set shift=\"$shift\" where techid=\"$techid\"");
|
mysqli_query($db, "update techs set shift=\"$shift\" where techid=\"$techid\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($updatedisplay) {
|
if ($updatedisplay) {
|
||||||
// display settings
|
// display settings
|
||||||
if ($display_showts) $display_showts=1; else $display_showts=0;
|
if ($display_showts) $display_showts = 1;
|
||||||
if ($display_techalpha=="a") $display_techalpha=1; else $display_techalpha=0;
|
else $display_showts = 0;
|
||||||
if ($display_subjalpha=="a") $display_subjalpha=1; else $display_subjalpha=0;
|
if ($display_techalpha == "a") $display_techalpha = 1;
|
||||||
|
else $display_techalpha = 0;
|
||||||
|
if ($display_subjalpha == "a") $display_subjalpha = 1;
|
||||||
|
else $display_subjalpha = 0;
|
||||||
// test for urlchunk supplied
|
// test for urlchunk supplied
|
||||||
if (strlen(trim($display_urlchunk))) {
|
if (strlen(trim($display_urlchunk))) {
|
||||||
$chunksuppld=1;
|
$chunksuppld = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$chunksuppld=0;
|
$chunksuppld = FALSE;
|
||||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> URL chunk size cannot be blank.<br>";
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> URL chunk size cannot be blank.<br>";
|
||||||
}
|
}
|
||||||
if ($chunksuppld) {
|
if ($chunksuppld) {
|
||||||
putsetting('url_chunk_size',$display_urlchunk,$techid);
|
putsetting('url_chunk_size', $display_urlchunk, $techid);
|
||||||
putsetting('show_ts',$display_showts,$techid);
|
putsetting('show_ts', $display_showts, $techid);
|
||||||
putsetting('tech_alpha',$display_techalpha,$techid);
|
putsetting('tech_alpha', $display_techalpha, $techid);
|
||||||
putsetting('subj_alpha',$display_subjalpha,$techid);
|
putsetting('subj_alpha', $display_subjalpha, $techid);
|
||||||
putsetting('log_style',$display_logstyle,$techid);
|
putsetting('log_style', $display_logstyle, $techid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($setcolor) {
|
if ($setcolor) {
|
||||||
// color settings
|
// color settings
|
||||||
$hexcolor="#".ltrim($hexcolor);
|
$hexcolor = "#" . ltrim($hexcolor);
|
||||||
putsetting($modcolor,$hexcolor,$techid);
|
putsetting($modcolor, $hexcolor, $techid);
|
||||||
}
|
}
|
||||||
if ($resetcustom) mysqli_query($db,"delete from customs where customtech=\"$techid\"");
|
if ($resetcustom) mysqli_query($db, "delete from customs where customtech=\"$techid\"");
|
||||||
|
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
// pull my current data from tables
|
// pull my current data from tables
|
||||||
$curname=dblookup($db,"techs","techid","techname",$techid);
|
$curname = dblookup($db, "techs", "techid", "techname", $techid);
|
||||||
$curshift=dblookup($db,"techs","techid","shift",$techid);
|
$curshift = dblookup($db, "techs", "techid", "shift", $techid);
|
||||||
$pass=$passconf="password_is_unchanged";
|
$pass = $passconf = "password_is_unchanged";
|
||||||
// other values from customs
|
// other values from customs
|
||||||
$curlchunk=getsetting('url_chunk_size',$techid)["value"];
|
$curlchunk = getsetting('url_chunk_size', $techid)["value"];
|
||||||
$curts=getsetting('show_ts',$techid)["value"];
|
$curts = getsetting('show_ts', $techid)["value"];
|
||||||
$curtdo=getsetting('tech_alpha',$techid)["value"];
|
$curtdo = getsetting('tech_alpha', $techid)["value"];
|
||||||
$cursdo=getsetting('subj_alpha',$techid)["value"];
|
$cursdo = getsetting('subj_alpha', $techid)["value"];
|
||||||
$curbgc=getsetting('background_color',$techid)["value"];
|
$curbgc = getsetting('background_color', $techid)["value"];
|
||||||
$cursbc=getsetting('sidebar_color',$techid)["value"];
|
$cursbc = getsetting('sidebar_color', $techid)["value"];
|
||||||
$curmbgc=getsetting('menubg_color',$techid)["value"];
|
$curmbgc = getsetting('menubg_color', $techid)["value"];
|
||||||
$curtc=getsetting('text_color',$techid)["value"];
|
$curtc = getsetting('text_color', $techid)["value"];
|
||||||
$curlc=getsetting('link_color',$techid)["value"];
|
$curlc = getsetting('link_color', $techid)["value"];
|
||||||
$curvlc=getsetting('vlink_color',$techid)["value"];
|
$curvlc = getsetting('vlink_color', $techid)["value"];
|
||||||
$curhc=getsetting('heading_color',$techid)["value"];
|
$curhc = getsetting('heading_color', $techid)["value"];
|
||||||
$curlogstyle=getsetting('log_style',$techid)["value"];
|
$curlogstyle = getsetting('log_style', $techid)["value"];
|
||||||
|
|
||||||
// show the form
|
// show the form
|
||||||
echo "
|
echo "
|
||||||
@@ -149,19 +152,19 @@ Password: <input type=\"password\" name=\"pass\" size=\"40\" value=\"$pass
|
|||||||
Repeat Password: <input type=\"password\" name=\"passconf\" size=\"40\" value=\"$passconf\"><br><br>
|
Repeat Password: <input type=\"password\" name=\"passconf\" size=\"40\" value=\"$passconf\"><br><br>
|
||||||
<font size=\"-1\">Need a random password? </font>
|
<font size=\"-1\">Need a random password? </font>
|
||||||
";
|
";
|
||||||
$rpw=substr(str_shuffle(password_hash(microtime(),PASSWORD_DEFAULT)), 10, 12);
|
$rpw = substr(str_shuffle(password_hash(microtime(), PASSWORD_DEFAULT)), 10, 12);
|
||||||
echo "
|
echo "
|
||||||
$rpw<br><br>
|
$rpw<br><br>
|
||||||
<b>Shift: </b>
|
<b>Shift: </b>
|
||||||
<select name=\"shift\">
|
<select name=\"shift\">
|
||||||
";
|
";
|
||||||
$shiftrow=mysqli_query($db,"select * from shifts");
|
$shiftrow = mysqli_query($db, "select * from shifts");
|
||||||
while ($shiftitem=mysqli_fetch_assoc($shiftrow)) {
|
while ($shiftitem = mysqli_fetch_assoc($shiftrow)) {
|
||||||
if ($shiftitem["status"] == 1) {
|
if ($shiftitem["status"] == 1) {
|
||||||
if ($shiftitem["shiftid"]==$curshift) {
|
if ($shiftitem["shiftid"] == $curshift) {
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
|
printf("<option value=\"%s\" selected>%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
|
printf("<option value=\"%s\">%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,12 +179,12 @@ echo "
|
|||||||
<b>My Display Preferences</b><br><br>
|
<b>My Display Preferences</b><br><br>
|
||||||
Log style (the look of the log notes display): <select name=\"display_logstyle\">
|
Log style (the look of the log notes display): <select name=\"display_logstyle\">
|
||||||
";
|
";
|
||||||
$logstyleqry=mysqli_query($db,"select styleid,stylename from styles where styletype=\"logdisplay\"");
|
$logstyleqry = mysqli_query($db, "select styleid,stylename from styles where styletype=\"logdisplay\"");
|
||||||
while ($logstylerow=mysqli_fetch_assoc($logstyleqry)) {
|
while ($logstylerow = mysqli_fetch_assoc($logstyleqry)) {
|
||||||
if ($logstylerow["styleid"]==$curlogstyle) {
|
if ($logstylerow["styleid"] == $curlogstyle) {
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$logstylerow["styleid"],$logstylerow["stylename"]);
|
printf("<option value=\"%s\" selected>%s</option>", $logstylerow["styleid"], $logstylerow["stylename"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$logstylerow["styleid"],$logstylerow["stylename"]);
|
printf("<option value=\"%s\">%s</option>", $logstylerow["styleid"], $logstylerow["stylename"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
@@ -236,7 +239,7 @@ echo "
|
|||||||
<hr>
|
<hr>
|
||||||
<b>My Color Preferences</b><br><br>
|
<b>My Color Preferences</b><br><br>
|
||||||
";
|
";
|
||||||
switch($modcolor) {
|
switch ($modcolor) {
|
||||||
case "background_color":
|
case "background_color":
|
||||||
echo "<table border=\"0\"><tr><td>Page background color</td><td>";
|
echo "<table border=\"0\"><tr><td>Page background color</td><td>";
|
||||||
colorpicker("profile.php?setcolor=1&modcolor=background_color&hexcolor=");
|
colorpicker("profile.php?setcolor=1&modcolor=background_color&hexcolor=");
|
||||||
@@ -290,9 +293,7 @@ echo "
|
|||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
|
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -9,69 +9,70 @@
|
|||||||
|
|
||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
$print=$_REQUEST['print'] ?? "";
|
$print = $_REQUEST['print'] ?? "";
|
||||||
$chainnote=$_REQUEST['chainnote'];
|
$chainnote = $_REQUEST['chainnote'] ?? NULL;
|
||||||
|
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
framework("begin","$logname","Reference Chain Display",$print);
|
framework("begin", "$logname", "Reference Chain Display", $print);
|
||||||
|
|
||||||
// ******** begin database manipulation ********
|
// ******** begin database manipulation ********
|
||||||
|
|
||||||
$master=generate_chain($chainnote);
|
$master = generate_chain($chainnote);
|
||||||
|
|
||||||
// ******** end database manipulation ********
|
// ******** end database manipulation ********
|
||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if(!$print){
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
banner($print);
|
banner($print);
|
||||||
// display the chain
|
// display the chain
|
||||||
$mptr=0;
|
$mptr = 0;
|
||||||
echo "<br><br><table border=\"1\" width=\"100%\">";
|
echo "<br><br><table border=\"1\" width=\"100%\">";
|
||||||
echo "<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>";
|
echo "<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>";
|
||||||
while($mptr<count($master)) {
|
while ($mptr < count($master)) {
|
||||||
if(mysqli_num_rows(mysqli_query($db,"select * from lognotes where lognoteid=$master[$mptr]"))) {
|
if (mysqli_num_rows(mysqli_query($db, "select * from lognotes where lognoteid=$master[$mptr]"))) {
|
||||||
$tablerow = mysqli_fetch_assoc(mysqli_query($db,"select * from lognotes where lognoteid=$master[$mptr]"));
|
$tablerow = mysqli_fetch_assoc(mysqli_query($db, "select * from lognotes where lognoteid=$master[$mptr]"));
|
||||||
$noteid=$tablerow["lognoteid"];
|
$noteid = $tablerow["lognoteid"];
|
||||||
$urldatestr="y=".date("Y",strtotime($tablerow["date"]))."&m=".date("m",strtotime($tablerow["date"]))."&d=".date("d",strtotime($tablerow["date"]));
|
$urldatestr = "y=" . date("Y", strtotime($tablerow["date"])) . "&m=" . date("m", strtotime($tablerow["date"])) . "&d=" . date("d", strtotime($tablerow["date"]));
|
||||||
$refs=" <a href=\"logentry.php?add=1&refto=$noteid\"><img src=\"icons/plus.png\" border=\"0\" alt=\"Add referring note\" title=\"Add referring note\"></a> <a href=\"lognotes.php?$urldatestr\" title=\"View note in log\"><img src=\"icons/magnifier--arrow.png\"></a>";
|
$refs = " <a href=\"logentry.php?add=1&refto=$noteid\"><img src=\"icons/plus.png\" border=\"0\" alt=\"Add referring note\" title=\"Add referring note\"></a> <a href=\"lognotes.php?$urldatestr\" title=\"View note in log\"><img src=\"icons/magnifier--arrow.png\"></a>";
|
||||||
// convert the shift number to a name
|
// convert the shift number to a name
|
||||||
$shname=dblookup($db,"shifts","shiftid","shiftname",$tablerow["shift"]);
|
$shname = dblookup($db, "shifts", "shiftid", "shiftname", $tablerow["shift"]);
|
||||||
// convert tech number to name
|
// convert tech number to name
|
||||||
$tname=dblookup($db,"techs","techid","techname",$tablerow["tech"]);
|
$tname = dblookup($db, "techs", "techid", "techname", $tablerow["tech"]);
|
||||||
//convert subject number to name
|
//convert subject number to name
|
||||||
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
|
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $tablerow["subject"]);
|
||||||
// create links of urls in note
|
// create links of urls in note
|
||||||
$fmtnote=convertweblinks($tablerow["lognote"]);
|
$fmtnote = convertweblinks($tablerow["lognote"]);
|
||||||
// generate the flags string
|
// generate the flags string
|
||||||
$flagstring="";
|
$flagstring = "";
|
||||||
$flagmapqry=mysqli_query($db,"select flagid from flagmap where lognoteid=$noteid");
|
$flagmapqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$noteid");
|
||||||
if (mysqli_num_rows($flagmapqry)) {
|
if (mysqli_num_rows($flagmapqry)) {
|
||||||
while ($flagids=mysqli_fetch_row($flagmapqry)) {
|
while ($flagids = mysqli_fetch_row($flagmapqry)) {
|
||||||
$flagid=$flagids[0];
|
$flagid = $flagids[0];
|
||||||
$flagparam=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid\""));
|
$flagparam = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid\""));
|
||||||
$flagcolor=$flagparam["flagcolor"];
|
$flagcolor = $flagparam["flagcolor"];
|
||||||
$flagsym=$flagparam["flagsym"];
|
$flagsym = $flagparam["flagsym"];
|
||||||
$flagstring=$flagstring."<font color=\"$flagcolor\">$flagsym</font> ";
|
$flagstring = $flagstring . "<font color=\"$flagcolor\">$flagsym</font> ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($flagstring) $fmtnote=$fmtnote."<br>".$flagstring;
|
if ($flagstring) $fmtnote = $fmtnote . "<br>" . $flagstring;
|
||||||
printf("
|
printf(
|
||||||
|
"
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href=\"logentry.php?edit=1¬eid=%s\">%s</a></td>
|
<td><a href=\"logentry.php?edit=1¬eid=%s\">%s</a></td>
|
||||||
<td>%s / %s</td>
|
<td>%s / %s</td>
|
||||||
@@ -81,23 +82,24 @@ while($mptr<count($master)) {
|
|||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
</tr>",
|
</tr>",
|
||||||
$tablerow["lognoteid"],$tablerow["lognoteid"],
|
$tablerow["lognoteid"],
|
||||||
$tablerow["date"],$tablerow["time"],
|
$tablerow["lognoteid"],
|
||||||
$shname,
|
$tablerow["date"],
|
||||||
$tname,
|
$tablerow["time"],
|
||||||
$subjname,
|
$shname,
|
||||||
$fmtnote,
|
$tname,
|
||||||
$refs);
|
$subjname,
|
||||||
|
$fmtnote,
|
||||||
|
$refs
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
printf("<tr><td colspan=\"7\"><font color=\"red\">Note Id <b> %s</b> has been deleted and cannot be displayed.</font></td></tr>\n",$master[$mptr]);
|
printf("<tr><td colspan=\"7\"><font color=\"red\">Note Id <b> %s</b> has been deleted and cannot be displayed.</font></td></tr>\n", $master[$mptr]);
|
||||||
}
|
}
|
||||||
$mptr=$mptr+1;
|
$mptr = $mptr + 1;
|
||||||
}
|
}
|
||||||
echo "</table><br><br>";
|
echo "</table><br><br>";
|
||||||
banner($print);
|
banner($print);
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -11,55 +11,53 @@
|
|||||||
$today = date("Y-m-d");
|
$today = date("Y-m-d");
|
||||||
$now = date("H:i:s");
|
$now = date("H:i:s");
|
||||||
|
|
||||||
$sttl=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"session_ttl_days\""))[0];
|
$sttl = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"session_ttl_days\""))[0];
|
||||||
$ostype=strtoupper(substr(php_uname('s'), 0, 3));
|
$ostype = strtoupper(substr(php_uname('s'), 0, 3));
|
||||||
if ($ostype == 'WIN') {
|
if ($ostype == 'WIN') {
|
||||||
$sdir=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"win_server_session_dir\""))[0];
|
$sdir = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"win_server_session_dir\""))[0];
|
||||||
} else {
|
} else {
|
||||||
$sdir=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"unix_server_session_dir\""))[0];
|
$sdir = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"unix_server_session_dir\""))[0];
|
||||||
}
|
}
|
||||||
$lifetime=60 * 60 * 24 * $sttl;
|
$lifetime = 60 * 60 * 24 * $sttl;
|
||||||
if (!is_dir($sdir)) mkdir($sdir, 0700, true);
|
if (!is_dir($sdir)) mkdir($sdir, 0700, true);
|
||||||
ini_set('session.cookie_lifetime', $lifetime);
|
ini_set('session.cookie_lifetime', $lifetime);
|
||||||
ini_set('session.gc_maxlifetime', $lifetime);
|
ini_set('session.gc_maxlifetime', $lifetime);
|
||||||
ini_set('session.save_path', $sdir);
|
ini_set('session.save_path', $sdir);
|
||||||
|
|
||||||
$ss=session_status();
|
$ss = session_status();
|
||||||
if ($ss==PHP_SESSION_NONE) session_start();
|
if ($ss == PHP_SESSION_NONE) session_start();
|
||||||
|
|
||||||
// get config options from database and assign them to constants
|
// get config options from database and assign them to constants
|
||||||
unset($techid);
|
unset($techid);
|
||||||
if (isset($_SESSION['login']) && $_SESSION['login'] != '') {
|
if (isset($_SESSION['login']) && $_SESSION['login'] != '') {
|
||||||
$techid=$_SESSION['login'];
|
$techid = $_SESSION['login'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$configqry=mysqli_query($db,"select confname,confvalue,confid from configs");
|
$configqry = mysqli_query($db, "select confname,confvalue,confid from configs");
|
||||||
while ($configrow = mysqli_fetch_assoc($configqry)) {
|
while ($configrow = mysqli_fetch_assoc($configqry)) {
|
||||||
$constname=strtoupper($configrow["confname"]);
|
$constname = strtoupper($configrow["confname"]);
|
||||||
if (isset($techid)) {
|
if (isset($techid)) {
|
||||||
$confid=$configrow["confid"];
|
$confid = $configrow["confid"];
|
||||||
$custqry=mysqli_query($db,"select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$techid\"");
|
$custqry = mysqli_query($db, "select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$techid\"");
|
||||||
if (mysqli_num_rows($custqry)) {
|
if (mysqli_num_rows($custqry)) {
|
||||||
$custrow=mysqli_fetch_row($custqry);
|
$custrow = mysqli_fetch_row($custqry);
|
||||||
$custval=$custrow[0];
|
$custval = $custrow[0];
|
||||||
} else {
|
} else {
|
||||||
unset($custval);
|
unset($custval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($custval)) {
|
if (isset($custval)) {
|
||||||
$constvalue=$custval;
|
$constvalue = $custval;
|
||||||
} else {
|
} else {
|
||||||
$constvalue=$configrow["confvalue"];
|
$constvalue = $configrow["confvalue"];
|
||||||
}
|
}
|
||||||
define("$constname","$constvalue");
|
define("$constname", "$constvalue");
|
||||||
}
|
}
|
||||||
|
|
||||||
// error reporting
|
// error reporting
|
||||||
$logerrors=LOG_ERRORS;
|
$logerrors = LOG_ERRORS;
|
||||||
if ($logerrors==1) {
|
if ($logerrors == 1) {
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
} else {
|
} else {
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -10,72 +10,73 @@
|
|||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
if (!$_SESSION['login'] && !$_REQUEST['partview']) {
|
if (!$_SESSION['login'] && !$_REQUEST['partview']) {
|
||||||
header ("Location: login.php");
|
header("Location: login.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
$techid=$_SESSION['login'] ?? NULL;
|
$techid = $_SESSION['login'] ?? NULL;
|
||||||
$isadmin=dblookup($db,"techs","techid","admin",$techid);
|
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
|
||||||
$print=$_REQUEST['print'] ?? NULL;
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
$efftechid=$_REQUEST['efftechid'] ?? NULL;
|
$efftechid = $_REQUEST['efftechid'] ?? NULL;
|
||||||
$shift=$_REQUEST['shift'] ?? NULL;
|
$shift = $_REQUEST['shift'] ?? NULL;
|
||||||
$subject=$_REQUEST['subject'] ?? NULL;
|
$subject = $_REQUEST['subject'] ?? NULL;
|
||||||
$note=$_REQUEST['note'] ?? NULL;
|
$note = $_REQUEST['note'] ?? NULL;
|
||||||
$flags=$_POST['flags'] ?? [];
|
$flags = $_POST['flags'] ?? [];
|
||||||
$refstring=$_REQUEST['refstring'] ?? NULL;
|
$refstring = $_REQUEST['refstring'] ?? NULL;
|
||||||
$submit=$_REQUEST['submit'] ?? NULL;
|
$submit = $_REQUEST['submit'] ?? NULL;
|
||||||
$operation=$_REQUEST['operation'] ?? NULL;
|
$operation = $_REQUEST['operation'] ?? NULL;
|
||||||
$templateid=$_REQUEST['templateid'] ?? NULL;
|
$templateid = $_REQUEST['templateid'] ?? NULL;
|
||||||
$templatename=$_REQUEST['templatename'] ?? NULL;
|
$templatename = $_REQUEST['templatename'] ?? NULL;
|
||||||
$usertemplateid=$_REQUEST['usertemplateid'] ?? NULL;
|
$usertemplateid = $_REQUEST['usertemplateid'] ?? NULL;
|
||||||
$globaltemplateid=$_REQUEST['globaltemplateid'] ?? NULL;
|
$globaltemplateid = $_REQUEST['globaltemplateid'] ?? NULL;
|
||||||
$loadtemplate=$_REQUEST['loadtemplate'] ?? NULL;
|
$loadtemplate = $_REQUEST['loadtemplate'] ?? NULL;
|
||||||
|
|
||||||
|
|
||||||
$logname=LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
$techalpha=TECH_ALPHA;
|
$techalpha = TECH_ALPHA;
|
||||||
$subjalpha=SUBJ_ALPHA;
|
$subjalpha = SUBJ_ALPHA;
|
||||||
|
|
||||||
$defaultshift=dblookup($db,"techs","techid","shift",$techid);
|
$defaultshift = dblookup($db, "techs", "techid", "shift", $techid);
|
||||||
|
|
||||||
if ($print=="Printer Friendly") {
|
if ($print == "Printer Friendly") {
|
||||||
$sbcolor=P_SIDEBAR_COLOR;
|
$sbcolor = P_SIDEBAR_COLOR;
|
||||||
$mbgcolor=P_MENUBG_COLOR;
|
$mbgcolor = P_MENUBG_COLOR;
|
||||||
} else {
|
} else {
|
||||||
$sbcolor=SIDEBAR_COLOR;
|
$sbcolor = SIDEBAR_COLOR;
|
||||||
$mbgcolor=MENUBG_COLOR;
|
$mbgcolor = MENUBG_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
framework("begin","$logname","Note Templates",$print);
|
framework("begin", "$logname", "Note Templates", $print);
|
||||||
|
|
||||||
// make basic determination about authorization
|
// make basic determination about authorization
|
||||||
if ($isadmin) {
|
if ($isadmin) {
|
||||||
$authorized=TRUE;
|
$authorized = TRUE;
|
||||||
} else if ($efftechid==$techid) {
|
} else if ($efftechid == $techid) {
|
||||||
$authorized=TRUE;
|
$authorized = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$authorized=FALSE;
|
$authorized = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// var_dump($_REQUEST);
|
// var_dump($_REQUEST);
|
||||||
|
|
||||||
function templatetable($db,$techid,$user) {
|
function templatetable($db, $techid, $user)
|
||||||
|
{
|
||||||
// Show template table
|
// Show template table
|
||||||
$isadmin=dblookup($db,"techs","techid","admin",$techid);
|
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
|
||||||
$templatequery=mysqli_query($db,"select * from notetemplates where tech=\"$user\" order by templatename asc");
|
$templatequery = mysqli_query($db, "select * from notetemplates where tech=\"$user\" order by templatename asc");
|
||||||
$tblusername=dblookup($db,"techs","techid","techname",$user);
|
$tblusername = dblookup($db, "techs", "techid", "techname", $user);
|
||||||
if (mysqli_num_rows($templatequery)) {
|
if (mysqli_num_rows($templatequery)) {
|
||||||
$hastemplates=TRUE;
|
$hastemplates = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$hastemplates=FALSE;
|
$hastemplates = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<b><font size=\"+1\">";
|
echo "<b><font size=\"+1\">";
|
||||||
if ($hastemplates) {
|
if ($hastemplates) {
|
||||||
// print the user header
|
// print the user header
|
||||||
if ($user=="0") {
|
if ($user == "0") {
|
||||||
echo "Global Templates</font></b>";
|
echo "Global Templates</font></b>";
|
||||||
} else {
|
} else {
|
||||||
if ($user==$techid) {
|
if ($user == $techid) {
|
||||||
echo "My templates</font></b>";
|
echo "My templates</font></b>";
|
||||||
} else {
|
} else {
|
||||||
echo "Templates for $tblusername</font></b>";
|
echo "Templates for $tblusername</font></b>";
|
||||||
@@ -85,62 +86,62 @@ function templatetable($db,$techid,$user) {
|
|||||||
echo "<br><table border=\"1\" width=\"100%\">";
|
echo "<br><table border=\"1\" width=\"100%\">";
|
||||||
echo "<tr><th width=\"70\">Template Name</th><th width=\"100\">Shift</th><th width=\"100\">Subject</th><th>Note</th><th width=\"70\">References</th></tr>";
|
echo "<tr><th width=\"70\">Template Name</th><th width=\"100\">Shift</th><th width=\"100\">Subject</th><th>Note</th><th width=\"70\">References</th></tr>";
|
||||||
while ($tablerow = mysqli_fetch_assoc($templatequery)) {
|
while ($tablerow = mysqli_fetch_assoc($templatequery)) {
|
||||||
$templateid=$tablerow["templateid"];
|
$templateid = $tablerow["templateid"];
|
||||||
$templatename=$tablerow["templatename"];
|
$templatename = $tablerow["templatename"];
|
||||||
// convert shift number to name
|
// convert shift number to name
|
||||||
$shiftname=dblookup($db,"shifts","shiftid","shiftname",$tablerow["shift"]);
|
$shiftname = dblookup($db, "shifts", "shiftid", "shiftname", $tablerow["shift"]);
|
||||||
// convert subject number to name
|
// convert subject number to name
|
||||||
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
|
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $tablerow["subject"]);
|
||||||
// create links of urls in note
|
// create links of urls in note
|
||||||
$fmtnote=convertweblinks($tablerow["lognote"]);
|
$fmtnote = convertweblinks($tablerow["lognote"]);
|
||||||
// generate the flags string
|
// generate the flags string
|
||||||
$flagstring="";
|
$flagstring = "";
|
||||||
$flagqry=mysqli_query($db,"select flagid from flagmap where notetemplateid=$templateid");
|
$flagqry = mysqli_query($db, "select flagid from flagmap where notetemplateid=$templateid");
|
||||||
while ($flagid=mysqli_fetch_row($flagqry)) {
|
while ($flagid = mysqli_fetch_row($flagqry)) {
|
||||||
$flagparams=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid[0]\""));
|
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
|
||||||
$flagcolor=$flagparams["flagcolor"];
|
$flagcolor = $flagparams["flagcolor"];
|
||||||
$flagsym=$flagparams["flagsym"];
|
$flagsym = $flagparams["flagsym"];
|
||||||
$flagname=$flagparams["flagname"];
|
$flagname = $flagparams["flagname"];
|
||||||
$flagstring=$flagstring."<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
||||||
}
|
}
|
||||||
if ($flagstring) {
|
if ($flagstring) {
|
||||||
$fmtnote=$fmtnote."<br>".$flagstring." ";
|
$fmtnote = $fmtnote . "<br>" . $flagstring . " ";
|
||||||
} else {
|
} else {
|
||||||
$fmtnote=$fmtnote."<br>";
|
$fmtnote = $fmtnote . "<br>";
|
||||||
}
|
}
|
||||||
// generate a reference string
|
// generate a reference string
|
||||||
$refstring=NULL;
|
$refstring = NULL;
|
||||||
$refstringqry=mysqli_query($db,"select target from reflinks where templateid=\"$templateid\"");
|
$refstringqry = mysqli_query($db, "select target from reflinks where templateid=\"$templateid\"");
|
||||||
while ($tgt=mysqli_fetch_row($refstringqry)) {
|
while ($tgt = mysqli_fetch_row($refstringqry)) {
|
||||||
$refstring=$refstring." ".$tgt[0];
|
$refstring = $refstring . " " . $tgt[0];
|
||||||
}
|
}
|
||||||
// now print the line in the table
|
// now print the line in the table
|
||||||
if (!$isadmin && $user=="0") {
|
if (!$isadmin && $user == "0") {
|
||||||
$nameblock="$templatename</a>";
|
$nameblock = "$templatename</a>";
|
||||||
} else {
|
} else {
|
||||||
$nameblock="<a href=\"templates.php?operation=edit&templateid=$templateid\">$templatename</a>";
|
$nameblock = "<a href=\"templates.php?operation=edit&templateid=$templateid\">$templatename</a>";
|
||||||
}
|
}
|
||||||
printf(
|
printf(
|
||||||
"<tr>
|
"<tr>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\"> %s</td>
|
<td valign=\"top\"> %s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
<td valign=\"top\">%s</td>
|
<td valign=\"top\">%s</td>
|
||||||
</tr>\n",
|
</tr>\n",
|
||||||
$nameblock,
|
$nameblock,
|
||||||
$shiftname,
|
$shiftname,
|
||||||
$subjname,
|
$subjname,
|
||||||
$fmtnote,
|
$fmtnote,
|
||||||
$refstring
|
$refstring
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
echo "</table><br><hr><br>";
|
echo "</table><br><hr><br>";
|
||||||
} else {
|
} else {
|
||||||
if ($user=="0") {
|
if ($user == "0") {
|
||||||
echo "There are no global templates</font></b>";
|
echo "There are no global templates</font></b>";
|
||||||
} else {
|
} else {
|
||||||
if ($user==$techid) {
|
if ($user == $techid) {
|
||||||
echo "You have no templates</font></b>";
|
echo "You have no templates</font></b>";
|
||||||
} else {
|
} else {
|
||||||
echo "$tblusername has no templates</font></b>";
|
echo "$tblusername has no templates</font></b>";
|
||||||
@@ -154,108 +155,108 @@ function templatetable($db,$techid,$user) {
|
|||||||
// ******** begin database manipulation ********
|
// ******** begin database manipulation ********
|
||||||
|
|
||||||
if ($usertemplateid) {
|
if ($usertemplateid) {
|
||||||
$templateid=$usertemplateid;
|
$templateid = $usertemplateid;
|
||||||
} else if ($globaltemplateid) {
|
} else if ($globaltemplateid) {
|
||||||
$templateid=$globaltemplateid;
|
$templateid = $globaltemplateid;
|
||||||
} else {
|
} else {
|
||||||
$loadtemplate=NULL;
|
$loadtemplate = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($operation=="add") {
|
if ($operation == "add") {
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
if ($note) {
|
if ($note) {
|
||||||
// remove cruft from note text
|
// remove cruft from note text
|
||||||
$note=strip_tags($note,"<a>");
|
$note = strip_tags($note, "<a>");
|
||||||
$note=mysqli_real_escape_string($db,$note);
|
$note = mysqli_real_escape_string($db, $note);
|
||||||
|
|
||||||
if ($authorized) {
|
if ($authorized) {
|
||||||
// check if name supplied
|
// check if name supplied
|
||||||
if ($templatename) {
|
if ($templatename) {
|
||||||
$namesupplied=TRUE;
|
$namesupplied = TRUE;
|
||||||
// check if supplied name already exists
|
// check if supplied name already exists
|
||||||
if (! mysqli_num_rows(mysqli_query($db,"select templateid from notetemplates where tech=\"$efftechid\" and templatename=\"$templatename\""))) {
|
if (! mysqli_num_rows(mysqli_query($db, "select templateid from notetemplates where tech=\"$efftechid\" and templatename=\"$templatename\""))) {
|
||||||
// add the record to notetemplates
|
// add the record to notetemplates
|
||||||
mysqli_query($db,"insert into notetemplates(templatename,shift,tech,subject,lognote) values (\"$templatename\", \"$shift\",\"$efftechid\",\"$subject\",\"$note\")");
|
mysqli_query($db, "insert into notetemplates(templatename,shift,tech,subject,lognote) values (\"$templatename\", \"$shift\",\"$efftechid\",\"$subject\",\"$note\")");
|
||||||
$newtemplateid=mysqli_insert_id($db);
|
$newtemplateid = mysqli_insert_id($db);
|
||||||
|
|
||||||
// update the flagmap table
|
// update the flagmap table
|
||||||
foreach ($flags as $thisflag) {
|
foreach ($flags as $thisflag) {
|
||||||
// set flag for this note
|
// set flag for this note
|
||||||
mysqli_query($db,"insert into flagmap(flagid,notetemplateid) values(\"$thisflag\",\"$newtemplateid\")");
|
mysqli_query($db, "insert into flagmap(flagid,notetemplateid) values(\"$thisflag\",\"$newtemplateid\")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// add references to the reflinks table
|
// add references to the reflinks table
|
||||||
if (strlen($refstring)) {
|
if (strlen($refstring)) {
|
||||||
$refstring=trim($refstring);
|
$refstring = trim($refstring);
|
||||||
$refarray=explode(" ",$refstring);
|
$refarray = explode(" ", $refstring);
|
||||||
foreach ($refarray as $target) {
|
foreach ($refarray as $target) {
|
||||||
mysqli_query($db,"insert into reflinks(templateid,target) values($newtemplateid,$target)");
|
mysqli_query($db, "insert into reflinks(templateid,target) values($newtemplateid,$target)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$templateid=$newtemplateid;
|
$templateid = $newtemplateid;
|
||||||
} else {
|
} else {
|
||||||
$nameexists=TRUE;
|
$nameexists = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$namesupplied=FALSE;
|
$namesupplied = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($operation=="edit" || $operation=="delete") {
|
if ($operation == "edit" || $operation == "delete") {
|
||||||
// test to see if this templateid is owned by techid to prevent hijacking
|
// test to see if this templateid is owned by techid to prevent hijacking
|
||||||
$owner=dblookup($db,"notetemplates","templateid","tech",$templateid);
|
$owner = dblookup($db, "notetemplates", "templateid", "tech", $templateid);
|
||||||
if (!$isadmin && ($owner!=$techid)) $authorized=FALSE;
|
if (!$isadmin && ($owner != $techid)) $authorized = FALSE;
|
||||||
|
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
if ($note) {
|
if ($note) {
|
||||||
// remove cruft from note text
|
// remove cruft from note text
|
||||||
$note=strip_tags($note,"<a>");
|
$note = strip_tags($note, "<a>");
|
||||||
$note=mysqli_real_escape_string($db,$note);
|
$note = mysqli_real_escape_string($db, $note);
|
||||||
|
|
||||||
if ($templatename) {
|
if ($templatename) {
|
||||||
$namesupplied=TRUE;
|
$namesupplied = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$namesupplied=FALSE;
|
$namesupplied = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($authorized) {
|
if ($authorized) {
|
||||||
// check if name was supplied
|
// check if name was supplied
|
||||||
if ($templatename) {
|
if ($templatename) {
|
||||||
// update notetemplates
|
// update notetemplates
|
||||||
mysqli_query($db,"update notetemplates set templatename=\"$templatename\", shift=\"$shift\", tech=\"$efftechid\", subject=\"$subject\", lognote=\"$note\" where templateid=\"$templateid\"");
|
mysqli_query($db, "update notetemplates set templatename=\"$templatename\", shift=\"$shift\", tech=\"$efftechid\", subject=\"$subject\", lognote=\"$note\" where templateid=\"$templateid\"");
|
||||||
|
|
||||||
// update the flagmap table
|
// update the flagmap table
|
||||||
mysqli_query($db,"delete from flagmap where notetemplateid=\"$templateid\"");
|
mysqli_query($db, "delete from flagmap where notetemplateid=\"$templateid\"");
|
||||||
foreach ($flags as $thisflag) {
|
foreach ($flags as $thisflag) {
|
||||||
// set flag for this note
|
// set flag for this note
|
||||||
mysqli_query($db,"insert into flagmap(flagid,notetemplateid) values(\"$thisflag\",\"$templateid\")");
|
mysqli_query($db, "insert into flagmap(flagid,notetemplateid) values(\"$thisflag\",\"$templateid\")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the reflinks table
|
// update the reflinks table
|
||||||
mysqli_query($db,"delete from reflinks where templateid=\"$templateid\"");
|
mysqli_query($db, "delete from reflinks where templateid=\"$templateid\"");
|
||||||
if (strlen($refstring)) {
|
if (strlen($refstring)) {
|
||||||
$refstring=trim($refstring);
|
$refstring = trim($refstring);
|
||||||
$refarray=explode(" ",$refstring);
|
$refarray = explode(" ", $refstring);
|
||||||
foreach ($refarray as $target) {
|
foreach ($refarray as $target) {
|
||||||
mysqli_query($db,"insert into reflinks(templateid,target) values($templateid,$target)");
|
mysqli_query($db, "insert into reflinks(templateid,target) values($templateid,$target)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($operation=="delete") {
|
if ($operation == "delete") {
|
||||||
if ($authorized) {
|
if ($authorized) {
|
||||||
// update notetemplates
|
// update notetemplates
|
||||||
mysqli_query($db,"delete from notetemplates where templateid=\"$templateid\"");
|
mysqli_query($db, "delete from notetemplates where templateid=\"$templateid\"");
|
||||||
// update the flagmap table
|
// update the flagmap table
|
||||||
mysqli_query($db,"delete from flagmap where notetemplateid=\"$templateid\"");
|
mysqli_query($db, "delete from flagmap where notetemplateid=\"$templateid\"");
|
||||||
// update the reflinks table
|
// update the reflinks table
|
||||||
mysqli_query($db,"delete from reflinks where templateid=\"$templateid\"");
|
mysqli_query($db, "delete from reflinks where templateid=\"$templateid\"");
|
||||||
$templateid=NULL;
|
$templateid = NULL;
|
||||||
$note=NULL;
|
$note = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,117 +265,117 @@ if ($operation=="edit" || $operation=="delete") {
|
|||||||
|
|
||||||
pagetable("begin");
|
pagetable("begin");
|
||||||
if (!$print) {
|
if (!$print) {
|
||||||
pageblock("left","begin");
|
pageblock("left", "begin");
|
||||||
sidemenu();
|
sidemenu();
|
||||||
pageblock("left","end");
|
pageblock("left", "end");
|
||||||
}
|
}
|
||||||
pageblock("right","begin");
|
pageblock("right", "begin");
|
||||||
banner($print);
|
banner($print);
|
||||||
|
|
||||||
|
|
||||||
if ($submit || $operation=="delete") {
|
if ($submit || $operation == "delete") {
|
||||||
// show success/failure messages
|
// show success/failure messages
|
||||||
$nameexists=$nameexists ?? NULL;
|
$nameexists = $nameexists ?? NULL;
|
||||||
$namesupplied=$namesupplied ?? NULL;
|
$namesupplied = $namesupplied ?? NULL;
|
||||||
|
|
||||||
if ($operation=="add") {
|
if ($operation == "add") {
|
||||||
$addfail=FALSE;
|
$addfail = FALSE;
|
||||||
if ($nameexists) {
|
if ($nameexists) {
|
||||||
format_message(1,"Template creation failed because the name you supplied already exists. Please try again.");
|
format_message(1, "Template creation failed because the name you supplied already exists. Please try again.");
|
||||||
$addfail=TRUE;
|
$addfail = TRUE;
|
||||||
}
|
}
|
||||||
if (!$namesupplied) {
|
if (!$namesupplied) {
|
||||||
format_message(1,"Template creation failed because you didn't supply a name. Please try again.");
|
format_message(1, "Template creation failed because you didn't supply a name. Please try again.");
|
||||||
$addfail=TRUE;
|
$addfail = TRUE;
|
||||||
}
|
}
|
||||||
if (!$note) {
|
if (!$note) {
|
||||||
format_message(1,"Template creation failed because you didn't enter any note text. Please try again.");
|
format_message(1, "Template creation failed because you didn't enter any note text. Please try again.");
|
||||||
$addfail=TRUE;
|
$addfail = TRUE;
|
||||||
}
|
}
|
||||||
if (!$authorized) {
|
if (!$authorized) {
|
||||||
format_message(1,"Template creation failed because you are not authorized to do so.");
|
format_message(1, "Template creation failed because you are not authorized to do so.");
|
||||||
$addfail=TRUE;
|
$addfail = TRUE;
|
||||||
}
|
}
|
||||||
if (!$addfail) format_message(0,"<strong>Template created.</strong>");
|
if (!$addfail) format_message(0, "<strong>Template created.</strong>");
|
||||||
}
|
}
|
||||||
if ($operation=="edit") {
|
if ($operation == "edit") {
|
||||||
$editfail=FALSE;
|
$editfail = FALSE;
|
||||||
if (!$namesupplied) {
|
if (!$namesupplied) {
|
||||||
format_message(1,"Template save failed because you didn't supply a name. Please try again.");
|
format_message(1, "Template save failed because you didn't supply a name. Please try again.");
|
||||||
$editfail=TRUE;
|
$editfail = TRUE;
|
||||||
}
|
}
|
||||||
if (!$note) {
|
if (!$note) {
|
||||||
format_message(1,"Template save failed because you didn't enter any note text. Please try again.");
|
format_message(1, "Template save failed because you didn't enter any note text. Please try again.");
|
||||||
$editfail=TRUE;
|
$editfail = TRUE;
|
||||||
}
|
}
|
||||||
if (!$authorized) {
|
if (!$authorized) {
|
||||||
format_message(1,"Template save failed because you are not authorized to do so.");
|
format_message(1, "Template save failed because you are not authorized to do so.");
|
||||||
$editfail=TRUE;
|
$editfail = TRUE;
|
||||||
}
|
}
|
||||||
if (!$editfail) format_message(0,"<strong>Template modified.</strong>");
|
if (!$editfail) format_message(0, "<strong>Template modified.</strong>");
|
||||||
}
|
}
|
||||||
if ($operation=="delete") {
|
if ($operation == "delete") {
|
||||||
$deletefail=FALSE;
|
$deletefail = FALSE;
|
||||||
if (!$authorized) {
|
if (!$authorized) {
|
||||||
format_message(1,"Template delete failed because you are not authorized to do so.");
|
format_message(1, "Template delete failed because you are not authorized to do so.");
|
||||||
$deletefail=TRUE;
|
$deletefail = TRUE;
|
||||||
}
|
}
|
||||||
if (!$deletefail) format_message(0,"<strong>Template deleted.</strong>");
|
if (!$deletefail) format_message(0, "<strong>Template deleted.</strong>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($operation=="delete") {
|
if ($operation == "delete") {
|
||||||
// just show the link back to the templates page
|
// just show the link back to the templates page
|
||||||
echo "
|
echo "
|
||||||
<br><a href=\"templates.php\">Manage templates</a><br><br><br><br>
|
<br><a href=\"templates.php\">Manage templates</a><br><br><br><br>
|
||||||
";
|
";
|
||||||
} else if ($operation=="add" || $operation=="edit") {
|
} else if ($operation == "add" || $operation == "edit") {
|
||||||
// Display the input form
|
// Display the input form
|
||||||
if ($loadtemplate) {
|
if ($loadtemplate) {
|
||||||
// make templateid the selected template
|
// make templateid the selected template
|
||||||
if ($usertemplateid) {
|
if ($usertemplateid) {
|
||||||
$templateid=$usertemplateid;
|
$templateid = $usertemplateid;
|
||||||
} else if ($globaltemplateid) {
|
} else if ($globaltemplateid) {
|
||||||
$templateid=$globaltemplateid;
|
$templateid = $globaltemplateid;
|
||||||
} else {
|
} else {
|
||||||
$templateid=NULL;
|
$templateid = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($operation=="edit" || $loadtemplate) {
|
if ($operation == "edit" || $loadtemplate) {
|
||||||
// use values from the templateid supplied with a defined tech id
|
// use values from the templateid supplied with a defined tech id
|
||||||
$loadeddata=mysqli_fetch_assoc(mysqli_query($db,"select * from notetemplates where templateid=\"$templateid\""));
|
$loadeddata = mysqli_fetch_assoc(mysqli_query($db, "select * from notetemplates where templateid=\"$templateid\""));
|
||||||
$filltemplatename=$loadeddata["templatename"];
|
$filltemplatename = $loadeddata["templatename"];
|
||||||
if ($efftechid) {
|
if ($efftechid) {
|
||||||
$filltech=$efftechid;
|
$filltech = $efftechid;
|
||||||
} else if ($isadmin && $loadeddata["tech"]=="0") {
|
} else if ($isadmin && $loadeddata["tech"] == "0") {
|
||||||
$filltech="0";
|
$filltech = "0";
|
||||||
} else {
|
} else {
|
||||||
$filltech=$techid;
|
$filltech = $techid;
|
||||||
}
|
}
|
||||||
$fillshift=$loadeddata["shift"];
|
$fillshift = $loadeddata["shift"];
|
||||||
$fillsubject=$loadeddata["subject"];
|
$fillsubject = $loadeddata["subject"];
|
||||||
$fillnote=$loadeddata["lognote"];
|
$fillnote = $loadeddata["lognote"];
|
||||||
} else {
|
} else {
|
||||||
// use empty values with a defined tech id
|
// use empty values with a defined tech id
|
||||||
$filltemplatename=NULL;
|
$filltemplatename = NULL;
|
||||||
if ($efftechid) {
|
if ($efftechid) {
|
||||||
$filltech=$efftechid;
|
$filltech = $efftechid;
|
||||||
} else {
|
} else {
|
||||||
$filltech=$techid;
|
$filltech = $techid;
|
||||||
}
|
}
|
||||||
$fillshift=$defaultshift;
|
$fillshift = $defaultshift;
|
||||||
$fillsubject=NULL;
|
$fillsubject = NULL;
|
||||||
$fillnote=NULL;
|
$fillnote = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($operation=="add") $optext="Creating new";
|
if ($operation == "add") $optext = "Creating new";
|
||||||
if ($operation=="edit") $optext="Editing";
|
if ($operation == "edit") $optext = "Editing";
|
||||||
echo "
|
echo "
|
||||||
<br><b>$optext template</b><br><hr>
|
<br><b>$optext template</b><br><hr>
|
||||||
";
|
";
|
||||||
|
|
||||||
// show the template selection line
|
// show the template selection line
|
||||||
templateselect($techid,$operation);
|
templateselect($techid, $operation);
|
||||||
|
|
||||||
// start template entry section
|
// start template entry section
|
||||||
echo "
|
echo "
|
||||||
@@ -388,25 +389,26 @@ if ($operation=="delete") {
|
|||||||
<tr><td colspan=\"2\"><b>Tech: </b>
|
<tr><td colspan=\"2\"><b>Tech: </b>
|
||||||
<select name=\"efftechid\">
|
<select name=\"efftechid\">
|
||||||
";
|
";
|
||||||
if ($filltech=="0") {
|
if ($filltech == "0") {
|
||||||
echo "<option value=\"0\" selected>--Global Template--</option>";
|
echo "<option value=\"0\" selected>--Global Template--</option>";
|
||||||
} else {
|
} else {
|
||||||
echo "<option value=\"0\">--Global Template--</option>";
|
echo "<option value=\"0\">--Global Template--</option>";
|
||||||
}
|
}
|
||||||
if ($techalpha) $torder="techname"; else $torder="techid";
|
if ($techalpha) $torder = "techname";
|
||||||
$techrow=mysqli_query($db,"select * from techs order by $torder asc");
|
else $torder = "techid";
|
||||||
while ($techitem=mysqli_fetch_assoc($techrow)) {
|
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
|
||||||
if ($techitem["techid"]==$filltech) {
|
while ($techitem = mysqli_fetch_assoc($techrow)) {
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$techitem["techid"],$techitem["techname"]);
|
if ($techitem["techid"] == $filltech) {
|
||||||
|
printf("<option value=\"%s\" selected>%s</option>", $techitem["techid"], $techitem["techname"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$techitem["techid"],$techitem["techname"]);
|
printf("<option value=\"%s\">%s</option>", $techitem["techid"], $techitem["techname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
</select></td></tr>
|
</select></td></tr>
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
$authorized=TRUE;
|
$authorized = TRUE;
|
||||||
echo "
|
echo "
|
||||||
<input type=\"hidden\" name=\"efftechid\" value=\"$techid\">
|
<input type=\"hidden\" name=\"efftechid\" value=\"$techid\">
|
||||||
";
|
";
|
||||||
@@ -416,13 +418,13 @@ if ($operation=="delete") {
|
|||||||
<td><b>Shift: </b>
|
<td><b>Shift: </b>
|
||||||
<select name=\"shift\">
|
<select name=\"shift\">
|
||||||
";
|
";
|
||||||
$shiftrow=mysqli_query($db,"select * from shifts");
|
$shiftrow = mysqli_query($db, "select * from shifts");
|
||||||
while ($shiftitem=mysqli_fetch_assoc($shiftrow)) {
|
while ($shiftitem = mysqli_fetch_assoc($shiftrow)) {
|
||||||
if ($shiftitem["status"] == 1) {
|
if ($shiftitem["status"] == 1) {
|
||||||
if ($shiftitem["shiftid"]==$fillshift) {
|
if ($shiftitem["shiftid"] == $fillshift) {
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
|
printf("<option value=\"%s\" selected>%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
|
printf("<option value=\"%s\">%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -431,14 +433,15 @@ if ($operation=="delete") {
|
|||||||
<td><b>Subject: </b>
|
<td><b>Subject: </b>
|
||||||
<select name=\"subject\">
|
<select name=\"subject\">
|
||||||
";
|
";
|
||||||
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
|
if ($subjalpha) $sorder = "subjectname";
|
||||||
$subjrow=mysqli_query($db,"select * from subjects order by $sorder asc");
|
else $sorder = "subjectid";
|
||||||
while ($subjitem=mysqli_fetch_assoc($subjrow)) {
|
$subjrow = mysqli_query($db, "select * from subjects order by $sorder asc");
|
||||||
if ($subjitem["status"]==1) {
|
while ($subjitem = mysqli_fetch_assoc($subjrow)) {
|
||||||
if ($subjitem["subjectid"]==$fillsubject) {
|
if ($subjitem["status"] == 1) {
|
||||||
printf("<option value=\"%s\" selected>%s</option>",$subjitem["subjectid"],$subjitem["subjectname"]);
|
if ($subjitem["subjectid"] == $fillsubject) {
|
||||||
|
printf("<option value=\"%s\" selected>%s</option>", $subjitem["subjectid"], $subjitem["subjectname"]);
|
||||||
} else {
|
} else {
|
||||||
printf("<option value=\"%s\">%s</option>",$subjitem["subjectid"],$subjitem["subjectname"]);
|
printf("<option value=\"%s\">%s</option>", $subjitem["subjectid"], $subjitem["subjectname"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -457,47 +460,57 @@ if ($operation=="delete") {
|
|||||||
|
|
||||||
// create an array called theseflags and optionally load it with flagids set for this template
|
// create an array called theseflags and optionally load it with flagids set for this template
|
||||||
unset($theseflags);
|
unset($theseflags);
|
||||||
$theseflags=[];
|
$theseflags = [];
|
||||||
if ($templateid) {
|
if ($templateid) {
|
||||||
$allflags=mysqli_query($db,"select flagid from flags");
|
$allflags = mysqli_query($db, "select flagid from flags");
|
||||||
while ($thisflag=mysqli_fetch_row($allflags)) {
|
while ($thisflag = mysqli_fetch_row($allflags)) {
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select id from flagmap where flagid=\"$thisflag[0]\" and notetemplateid=\"$templateid\""))) {
|
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$thisflag[0]\" and notetemplateid=\"$templateid\""))) {
|
||||||
$theseflags[]=$thisflag[0];
|
$theseflags[] = $thisflag[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$flagslist=mysqli_query($db,"select * from flags where status=1");
|
$flagslist = mysqli_query($db, "select * from flags where status=1");
|
||||||
$flagsperline=8;
|
$flagsperline = 8;
|
||||||
$flagcount=1;
|
$flagcount = 1;
|
||||||
|
|
||||||
// display checkboxes for all the flags, selecting the ones that are set for this template
|
// display checkboxes for all the flags, selecting the ones that are set for this template
|
||||||
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
|
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||||
if ($operation=="edit" && in_array($flagcheckbox["flagid"],$theseflags)) {
|
if ($operation == "edit" && in_array($flagcheckbox["flagid"], $theseflags)) {
|
||||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
printf(
|
||||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
||||||
|
$flagcheckbox["flagid"],
|
||||||
|
$flagcheckbox["flagcolor"],
|
||||||
|
$flagcheckbox["flagname"],
|
||||||
|
$flagcheckbox["flagsym"]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$flagid=$flagcheckbox["flagid"];
|
$flagid = $flagcheckbox["flagid"];
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
||||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
printf(
|
||||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||||
|
$flagcheckbox["flagid"],
|
||||||
|
$flagcheckbox["flagcolor"],
|
||||||
|
$flagcheckbox["flagname"],
|
||||||
|
$flagcheckbox["flagsym"]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($flagcount<$flagsperline) {
|
if ($flagcount < $flagsperline) {
|
||||||
echo " ";
|
echo " ";
|
||||||
$flagcount++;
|
$flagcount++;
|
||||||
} else {
|
} else {
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
$flagcount=1;
|
$flagcount = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($operation=="edit" || $loadtemplate) {
|
if ($operation == "edit" || $loadtemplate) {
|
||||||
// generate a reference string
|
// generate a reference string
|
||||||
$refstring=NULL;
|
$refstring = NULL;
|
||||||
$refstringqry=mysqli_query($db,"select target from reflinks where templateid=\"$templateid\"");
|
$refstringqry = mysqli_query($db, "select target from reflinks where templateid=\"$templateid\"");
|
||||||
while ($tgt=mysqli_fetch_row($refstringqry)) {
|
while ($tgt = mysqli_fetch_row($refstringqry)) {
|
||||||
$refstring=$refstring." ".$tgt[0];
|
$refstring = $refstring . " " . $tgt[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
@@ -506,13 +519,13 @@ if ($operation=="delete") {
|
|||||||
|
|
||||||
";
|
";
|
||||||
|
|
||||||
if ($operation=="add" && $authorized) {
|
if ($operation == "add" && $authorized) {
|
||||||
echo "
|
echo "
|
||||||
<input type=\"hidden\" name=\"operation\" value=\"add\">
|
<input type=\"hidden\" name=\"operation\" value=\"add\">
|
||||||
<input type=\"submit\" name=\"submit\" value=\"Save Template\">
|
<input type=\"submit\" name=\"submit\" value=\"Save Template\">
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
if ($operation=="edit" && $authorized) {
|
if ($operation == "edit" && $authorized) {
|
||||||
echo "
|
echo "
|
||||||
<input type=\"hidden\" name=\"operation\" value=\"edit\">
|
<input type=\"hidden\" name=\"operation\" value=\"edit\">
|
||||||
<input type=\"hidden\" name=\"templateid\" value=\"$templateid\">
|
<input type=\"hidden\" name=\"templateid\" value=\"$templateid\">
|
||||||
@@ -530,25 +543,23 @@ if ($operation=="delete") {
|
|||||||
echo "<br><font size= \"+1\"><b><a href=\"templates.php?operation=add\">Create or copy a template</a></b></font><br><hr>";
|
echo "<br><font size= \"+1\"><b><a href=\"templates.php?operation=add\">Create or copy a template</a></b></font><br><hr>";
|
||||||
|
|
||||||
// Show my user template table
|
// Show my user template table
|
||||||
templatetable($db,$techid,$techid);
|
templatetable($db, $techid, $techid);
|
||||||
|
|
||||||
// Show global template table
|
// Show global template table
|
||||||
templatetable($db,$techid,"0");
|
templatetable($db, $techid, "0");
|
||||||
|
|
||||||
if ($isadmin) {
|
if ($isadmin) {
|
||||||
// Show template tables for other users
|
// Show template tables for other users
|
||||||
$techqry=mysqli_query($db,"select techid from techs where techid != $techid and techid != 0");
|
$techqry = mysqli_query($db, "select techid from techs where techid != $techid and techid != 0");
|
||||||
while ($techtblrow=(mysqli_fetch_row($techqry))) {
|
while ($techtblrow = (mysqli_fetch_row($techqry))) {
|
||||||
templatetable($db,$techid,$techtblrow[0]);
|
templatetable($db, $techid, $techtblrow[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
banner($print);
|
banner($print);
|
||||||
pageblock("right","end");
|
pageblock("right", "end");
|
||||||
pagetable("end");
|
pagetable("end");
|
||||||
|
|
||||||
framework("end","","",$print);
|
framework("end", "", "", $print);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# install.sh
|
# install.sh
|
||||||
# OpenLog Online Logbook
|
# OpenLog Online Logbook
|
||||||
# Copyright (C) 2025 Rod Wright
|
# Copyright (C) 2026 Rod Wright
|
||||||
|
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user