$pan = new PowerPanel(); $templ = new DeviceTemplate(); $tempPDU = new PowerDistribution(); $tempDept = new Department(); $dc = new DataCenter(); $dcID = $cab->DataCenterID; $dc->DataCenterID = $dcID; $dc->GetDataCenterbyID(); $audit->CabinetID = $cab->CabinetID; // You just have WriteAccess in order to perform/certify a rack audit if (isset($_POST["audit"]) && $_POST["audit"] == "yes" && $person->CanWrite($cab->AssignedTo)) { $audit->Comments = sanitize($_POST["comments"]); // Log the response $audit->CertifyAudit(); // I'm lazy as f**k so retrieve what we just wrong $audit->GetLastAudit(); $tmpUser = new People(); $tmpUser->UserID = $audit->UserID; $tmpUser->GetUserRights(); $audit->UserID = $tmpUser->FirstName == "" && $tmpUser->LastName == "" ? $audit->UserID : $tmpUser->FirstName . " " . $tmpUser->LastName; // Give it back to the user to update the page header('Content-Type: application/json'); echo json_encode($audit); exit; } $audit->AuditStamp = __("Never"); $audit->GetLastAudit(); if ($audit->UserID != "") { $tmpUser = new People(); $tmpUser->UserID = $audit->UserID; $tmpUser->GetUserRights();
/** * Return the timestamp of the cabinet's last audit. * * @param Cabinet $cab * @param string|null $emptyVal * @return string|null */ function getAuditTimestamp($cab, $emptyVal = null) { $auditTimestamp = $emptyVal; $cab_audit = new CabinetAudit(); $cab_audit->CabinetID = $cab->CabinetID; $cab_audit->GetLastAudit(); if ($cab_audit->AuditStamp) { $auditTimestamp = $cab_audit->AuditStamp; } return $auditTimestamp; }