Fix network device description/machinenotes display and edit

- Fix ADO cursor issue where reading rs("description") twice caused
  empty values (IsNull check consumed the field value)
- Change all device pages to read description field once using
  `description = rs("description") & ""` pattern
- Add deviceDescription variable in displaydevice.asp
- Fix machinetypeid mapping: IDF=17, Camera=18 (was swapped)
- Add model dropdown fix to include currently assigned model
- Add server application tracking feature
- Various other improvements and fixes

Files affected:
- displaydevice.asp, displaylocationdevice.asp
- deviceaccesspoint.asp, deviceserver.asp, deviceswitch.asp
- devicecamera.asp, deviceidf.asp
- savenetworkdevice.asp, networkdevices.asp

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-17 13:47:56 -05:00
parent a5b4013949
commit a4096ace94
25 changed files with 1744 additions and 355 deletions

View File

@@ -725,27 +725,30 @@
return urlParams.get('businessunit') || '';
}
// Calculate fiscal week (GE fiscal year starts first Monday of January)
// Calculate ISO week number
// ISO week 1 is the week containing the first Thursday of the year (or Jan 4th)
// Weeks start on Monday
function getFiscalWeek() {
const today = new Date();
const year = today.getFullYear();
// Find first Monday of current year
let jan1 = new Date(year, 0, 1);
let dayOfWeek = jan1.getDay(); // 0=Sunday, 1=Monday, etc.
let daysToMonday = (dayOfWeek === 0) ? 1 : (dayOfWeek === 1) ? 0 : (8 - dayOfWeek);
let firstMonday = new Date(year, 0, 1 + daysToMonday);
// Find Thursday of current week (ISO weeks are identified by their Thursday)
const dayOfWeek = (today.getDay() + 6) % 7; // 0=Monday, 6=Sunday
const thursday = new Date(today);
thursday.setDate(today.getDate() - dayOfWeek + 3);
// If we're before the first Monday, use previous year
if (today < firstMonday) {
let prevJan1 = new Date(year - 1, 0, 1);
let prevDayOfWeek = prevJan1.getDay();
let prevDaysToMonday = (prevDayOfWeek === 0) ? 1 : (prevDayOfWeek === 1) ? 0 : (8 - prevDayOfWeek);
firstMonday = new Date(year - 1, 0, 1 + prevDaysToMonday);
}
// The year of the Thursday determines the ISO year
const isoYear = thursday.getFullYear();
// Calculate days from first Monday
const diffTime = today - firstMonday;
// Find January 4th of that year (always in week 1)
const jan4 = new Date(isoYear, 0, 4);
// Find Monday of the week containing Jan 4 (start of week 1)
const jan4DayOfWeek = (jan4.getDay() + 6) % 7;
const week1Start = new Date(jan4);
week1Start.setDate(jan4.getDate() - jan4DayOfWeek);
// Calculate week number
const diffTime = today - week1Start;
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
const fiscalWeek = Math.floor(diffDays / 7) + 1;