mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-18 13:28:32 -04:00
Tack on the void return type onto the Employee:logout method.
This commit is contained in:
@@ -22,13 +22,13 @@ class Employees extends Persons
|
||||
/**
|
||||
* Returns employee table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search(): void
|
||||
public function getSearch(): void
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getGet('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getGet('order', FILTER_SANITIZE_STRING);
|
||||
$search = $this->request->getVar('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
$offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT);
|
||||
$sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING);
|
||||
$order = $this->request->getVar('order', FILTER_SANITIZE_STRING);
|
||||
|
||||
$employees = $this->employee->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->employee->get_found_rows($search);
|
||||
@@ -47,14 +47,14 @@ class Employees extends Persons
|
||||
*/
|
||||
public function suggest(): void
|
||||
{
|
||||
$suggestions = $this->employee->get_search_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING), 25, TRUE);
|
||||
$suggestions = $this->employee->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING), 25, TRUE);
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function suggest_search(): void
|
||||
{
|
||||
$suggestions = $this->employee->get_search_suggestions($this->request->getPost('term', FILTER_SANITIZE_STRING));
|
||||
$suggestions = $this->employee->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class Employees extends Persons
|
||||
/**
|
||||
* Loads the employee edit form
|
||||
*/
|
||||
public function view(int $employee_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function getView(int $employee_id = NEW_ENTRY): void
|
||||
{
|
||||
$person_info = $this->employee->get_info($employee_id);
|
||||
foreach(get_object_vars($person_info) as $property => $value)
|
||||
@@ -98,7 +98,7 @@ class Employees extends Persons
|
||||
/**
|
||||
* Inserts/updates an employee
|
||||
*/
|
||||
public function save(int $employee_id = -1): void //TODO: Replace -1 with a constant
|
||||
public function postSave(int $employee_id = NEW_ENTRY): void
|
||||
{
|
||||
$first_name = $this->request->getPost('first_name', FILTER_SANITIZE_STRING); //TODO: duplicated code
|
||||
$last_name = $this->request->getPost('last_name', FILTER_SANITIZE_STRING);
|
||||
@@ -162,7 +162,7 @@ class Employees extends Persons
|
||||
if($this->employee->save_employee($person_data, $employee_data, $grants_array, $employee_id))
|
||||
{
|
||||
// New employee
|
||||
if($employee_id == -1)
|
||||
if($employee_id == NEW_ENTRY)
|
||||
{
|
||||
echo json_encode ([
|
||||
'success' => TRUE,
|
||||
@@ -184,7 +184,7 @@ class Employees extends Persons
|
||||
echo json_encode ([
|
||||
'success' => FALSE,
|
||||
'message' => lang('Employees.error_adding_updating') . ' ' . $first_name . ' ' . $last_name,
|
||||
'id' => -1
|
||||
'id' => NEW_ENTRY
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ class Employees extends Persons
|
||||
/**
|
||||
* This deletes employees from the employees table
|
||||
*/
|
||||
public function delete(): void
|
||||
public function postDelete(): void
|
||||
{
|
||||
$employees_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_STRING);
|
||||
|
||||
@@ -215,7 +215,7 @@ class Employees extends Persons
|
||||
*/
|
||||
public function check_username($employee_id): void
|
||||
{
|
||||
$exists = $this->employee->username_exists($employee_id, $this->request->getGet('username', FILTER_SANITIZE_STRING));
|
||||
$exists = $this->employee->username_exists($employee_id, $this->request->getVar('username', FILTER_SANITIZE_STRING));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user