Modified templateselect function to show all users templates in user dropdown if current user is admin
This commit is contained in:
@@ -953,8 +953,9 @@ function templateselect($techid, $operation)
|
||||
{
|
||||
// Displays a line enabling selection of a user or global template
|
||||
// $techid is the id number of the current tech
|
||||
// $operation is one of "add" "edit" "delete"
|
||||
// $operation is one of "add" "edit" "delete" or NULL
|
||||
global $db;
|
||||
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
|
||||
echo "
|
||||
<form method=\"post\">
|
||||
";
|
||||
@@ -967,10 +968,19 @@ function templateselect($techid, $operation)
|
||||
<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.\">
|
||||
";
|
||||
$templaterow = mysqli_query($db, "select * from notetemplates where tech=\"$techid\" order by templatename asc");
|
||||
if ($isadmin && $operation!=NULL) {
|
||||
$templaterow = mysqli_query($db, "select * from notetemplates where tech!=\"0\" order by tech asc, templatename asc");
|
||||
} else {
|
||||
$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");
|
||||
while ($templateitem = mysqli_fetch_assoc($templaterow)) {
|
||||
printf("<option value=\"%s\">%s</option>", $templateitem["templateid"], $templateitem["templatename"]);
|
||||
if ($isadmin && $operation!=NULL) {
|
||||
$techname=dblookup($db, "techs", "techid", "techname", $templateitem["tech"]);
|
||||
printf("<option value=\"%s\">%s(%s)</option>", $templateitem["templateid"], $templateitem["templatename"], $techname);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>", $templateitem["templateid"], $templateitem["templatename"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select> or
|
||||
|
||||
Reference in New Issue
Block a user