Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaf 3891 - Remove unused empUID argument #2058

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion LEAF_Nexus/api/controllers/EmployeeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ 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]);
Expand All @@ -84,6 +84,21 @@ public function post($act)
return json_encode($return_value);
});

$this->index['POST']->register('employee/refresh/[text]', function ($args) use ($employee, $national_db) {
mgaoVA marked this conversation as resolved.
Show resolved Hide resolved
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/batch', function ($args) use ($employee, $national_db) {
if (!$national_db) {
$return_value = $employee->refreshBatch();
Expand Down
6 changes: 3 additions & 3 deletions LEAF_Nexus/templates/view_employee.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="toolbar" class="toolbar_right toolbar noprint">
<div id="tools"><h1>Tools</h1>
<!--{if $is_admin == true}-->
<div onclick="refreshEmp('<!--{$summary.employee.userName|escape:"quotes"}-->', '<!--{$empUID}-->');"><img src="dynicons/?img=system-software-update.svg&w=32" style="vertical-align: middle" alt="Refresh Employee" title="Refresh Employee" /> Refresh Employee</div>
<div onclick="refreshEmp('<!--{$summary.employee.userName|escape:"quotes"}-->');"><img src="dynicons/?img=system-software-update.svg&w=32" style="vertical-align: middle" alt="Refresh Employee" title="Refresh Employee" /> Refresh Employee</div>
<br />
<!--{/if}-->
<div onclick="assignBackup();"><img src="dynicons/?img=gnome-system-users.svg&amp;w=32" style="vertical-align: middle" alt="Set Backup" title="Set Backup" /> Assign Backup</div>
Expand Down Expand Up @@ -80,12 +80,12 @@
<!--{include file="site_elements/genericJS_toolbarAlignment.tpl"}-->


function refreshEmp(userName, empUID) {
function refreshEmp(userName) {
var CSRFToken = '<!--{$CSRFToken}-->';

$.ajax({
type: 'POST',
url: "./api/employee/refresh/_" + userName + "/" + empUID,
url: "./api/employee/refresh/_" + userName,
dataType: "json",
data: {CSRFToken: CSRFToken},
success: function(res) {
Expand Down