Skip to content

Commit cab5186

Browse files
committed
- updated the file header to describe the actual two-mode flow
- removed the unused appraisal frequency query and variable - replaced the stale inline comment that still referred to Edit=Yes with one that matches the current shared-field structure Files changed in commit: HRAppraisalEntry.php HRPerformanceAppraisals.php
1 parent 9fae5f2 commit cab5186

2 files changed

Lines changed: 19 additions & 23 deletions

File tree

HRAppraisalEntry.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
* Performance Appraisal Entry/Edit
55
*
66
* Allows HR managers to create new performance appraisals for employees
7-
* and edit existing appraisal records. Three URL modes are supported:
7+
* and edit existing appraisal records. The script has two modes:
88
*
9-
* (no params) -- blank form to create a new appraisal
10-
* AppraisalID=N&Edit=Yes -- edit form pre-filled from the database
11-
* AppraisalID=N -- read-only view with a link to switch to edit
12-
* AppraisalID=N&Delete=1 -- delete the appraisal and redirect
9+
* (no params) -- blank form to create a new appraisal
10+
* AppraisalID=N -- edit form pre-filled from the database
11+
* AppraisalID=N&Delete=1 -- delete the appraisal and redirect
1312
*/
1413

1514
require(__DIR__ . '/includes/session.php');
@@ -38,17 +37,6 @@
3837
/* Edit mode: an AppraisalID is present in the URL */
3938
$EditMode = (isset($_GET['AppraisalID']) AND (int)$_GET['AppraisalID'] > 0);
4039

41-
/* Get appraisal frequency from system options */
42-
$SQL = "SELECT optionvalue
43-
FROM hrsystemoptions
44-
WHERE optionname = 'AppraisalFrequency'";
45-
$OptionsResult = DB_query($SQL);
46-
$AppraisalFrequency = 365;
47-
if (DB_num_rows($OptionsResult) > 0) {
48-
$OptionRow = DB_fetch_array($OptionsResult);
49-
$AppraisalFrequency = $OptionRow['optionvalue'];
50-
}
51-
5240
/* Handle form submission (both new and edit) */
5341
if (isset($_POST['Submit'])) {
5442

@@ -275,7 +263,7 @@
275263

276264
/*
277265
* Edit appraisal section: fields pre-filled from the database.
278-
* Only rendered when AppraisalID and Edit=Yes are both present in the URL.
266+
* Shared fields below use the $Db-prefixed variables loaded above.
279267
*/
280268

281269
echo '<field>

HRPerformanceAppraisals.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010

1111
include(__DIR__ . '/includes/header.php');
1212

13+
/* Rating labels for hrperfappraisals.overallrating (INT 1-5) */
14+
$RatingLabels = array(
15+
5 => __('Outstanding'),
16+
4 => __('Exceeds Expectations'),
17+
3 => __('Meets Expectations'),
18+
2 => __('Needs Improvement'),
19+
1 => __('Unsatisfactory'),
20+
);
21+
1322
// Get system options
1423
$SQL = "SELECT optionname, optionvalue FROM hrsystemoptions WHERE optionname = 'AppraisalFrequency'";
1524
$OptionsResult = DB_query($SQL);
@@ -19,6 +28,8 @@
1928
$AppraisalFrequency = $OptionRow['optionvalue'];
2029
}
2130

31+
echo '<a class="toplink" href="' . $RootPath . '/HRAppraisalEntry.php">' . __('Create New Appraisal') . '</a>';
32+
2233
echo '<p class="page_title_text">
2334
<img alt="" src="' . $RootPath . '/css/' . $Theme . '/images/star.png" title="' . __('Performance Appraisals') . '" /> ' .
2435
__('Performance Appraisals Management') . '
@@ -97,8 +108,6 @@
97108

98109
$Result = DB_query($SQL);
99110

100-
echo '<a class="toplink" href="' . $RootPath . '/HRAppraisalEntry.php">' . __('Create New Appraisal') . '</a>';
101-
102111
echo '<table class="selection">
103112
<thead>
104113
<tr>
@@ -116,7 +125,7 @@
116125
<th>' . __('Status') . '</th>
117126
<th>' . __('Rating') . '</th>
118127
<th>' . __('Manager') . '</th>
119-
<th>' . __('Actions') . '</th>
128+
<th></th>
120129
</tr>
121130
</thead>
122131
<tbody>';
@@ -136,11 +145,10 @@
136145
<td>' . ConvertSQLDate($MyRow['reviewperiodstart']) . ' - ' . ConvertSQLDate($MyRow['reviewperiodend']) . '</td>
137146
<td>' . ConvertSQLDate($MyRow['duedate']) . '</td>
138147
<td>' . htmlspecialchars($MyRow['status'], ENT_QUOTES, 'UTF-8') . '</td>
139-
<td>' . ($MyRow['overallrating'] ? htmlspecialchars($MyRow['overallrating'], ENT_QUOTES, 'UTF-8') : '-') . '</td>
148+
<td>' . (isset($RatingLabels[$MyRow['overallrating']]) ? htmlspecialchars($RatingLabels[$MyRow['overallrating']], ENT_QUOTES, 'UTF-8') : '-') . '</td>
140149
<td>' . htmlspecialchars($MyRow['managername'], ENT_QUOTES, 'UTF-8') . '</td>
141150
<td class="centre">
142-
<a href="' . $RootPath . '/HRAppraisalEntry.php?AppraisalID=' . urlencode($MyRow['appraisalid']) . '">' . __('Edit') . '</a> |
143-
<a href="' . $RootPath . '/HRAppraisalEntry.php?AppraisalID=' . urlencode($MyRow['appraisalid']) . '&View=1">' . __('View') . '</a>
151+
<a href="' . $RootPath . '/HRAppraisalEntry.php?AppraisalID=' . urlencode($MyRow['appraisalid']) . '">' . __('Edit') . '</a>
144152
</td>
145153
</tr>';
146154
}

0 commit comments

Comments
 (0)