From d495e5c2827249d2ecd5822d424e7b34f10895ce Mon Sep 17 00:00:00 2001 From: mgaoVA <16783916+mgaoVA@users.noreply.github.com> Date: Fri, 21 Jul 2023 14:31:46 -0400 Subject: [PATCH 1/2] empUID not used? --- LEAF_Nexus/api/controllers/EmployeeController.php | 2 +- LEAF_Nexus/templates/view_employee.tpl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LEAF_Nexus/api/controllers/EmployeeController.php b/LEAF_Nexus/api/controllers/EmployeeController.php index 8c2dbbc37..0f8c8547b 100644 --- a/LEAF_Nexus/api/controllers/EmployeeController.php +++ b/LEAF_Nexus/api/controllers/EmployeeController.php @@ -69,7 +69,7 @@ public function post($act) }); - $this->index['POST']->register('employee/refresh/[text]/[digit]', function ($args) use ($employee, $national_db) { + $this->index['POST']->register('employee/refresh/[text]', function ($args) use ($employee, $national_db) { if (!$national_db) { $return_value = $employee->refresh($args[0]); } else { diff --git a/LEAF_Nexus/templates/view_employee.tpl b/LEAF_Nexus/templates/view_employee.tpl index 5d704f395..fc6208e9e 100644 --- a/LEAF_Nexus/templates/view_employee.tpl +++ b/LEAF_Nexus/templates/view_employee.tpl @@ -1,7 +1,7 @@

Tools

-
', '');">Refresh Employee Refresh Employee
+
');">Refresh Employee Refresh Employee

Set Backup Assign Backup
@@ -80,12 +80,12 @@ -function refreshEmp(userName, empUID) { +function refreshEmp(userName) { var CSRFToken = ''; $.ajax({ type: 'POST', - url: "./api/employee/refresh/_" + userName + "/" + empUID, + url: "./api/employee/refresh/_" + userName, dataType: "json", data: {CSRFToken: CSRFToken}, success: function(res) { From 0981a366a76a37604aedef66f4fa4748e073496a Mon Sep 17 00:00:00 2001 From: mgaoVA <16783916+mgaoVA@users.noreply.github.com> Date: Tue, 25 Jul 2023 14:45:49 -0400 Subject: [PATCH 2/2] mark deprecated endpoint --- LEAF_Nexus/api/controllers/EmployeeController.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/LEAF_Nexus/api/controllers/EmployeeController.php b/LEAF_Nexus/api/controllers/EmployeeController.php index 0f8c8547b..5de9a90c8 100644 --- a/LEAF_Nexus/api/controllers/EmployeeController.php +++ b/LEAF_Nexus/api/controllers/EmployeeController.php @@ -68,6 +68,21 @@ public function post($act) return print_r($args, true) . print_r($_GET, true); }); + // Deprecated + $this->index['POST']->register('employee/refresh/[text]/[digit]', function ($args) use ($employee, $national_db) { + if (!$national_db) { + $return_value = $employee->refresh($args[0]); + } else { + $return_value = array( + 'status' => array( + 'code' => 4, + 'message' => 'You can\'t update the national orgchart' + ) + ); + } + + return json_encode($return_value); + }); $this->index['POST']->register('employee/refresh/[text]', function ($args) use ($employee, $national_db) { if (!$national_db) {