fix: add get_office_employee_url()
method for corepos handler
This commit is contained in:
parent
e6921c8533
commit
1a9929c734
|
@ -180,6 +180,28 @@ class CoreposHandler(GenericHandler):
|
|||
if office_url:
|
||||
return f'{office_url}/item/departments/DepartmentEditor.php?did={dept_id}'
|
||||
|
||||
def get_office_employee_url(
|
||||
self,
|
||||
employee_id,
|
||||
office_url=None,
|
||||
require=False):
|
||||
"""
|
||||
Returns the CORE Office URL for an Employee.
|
||||
|
||||
:param employee_id: Employee ID for the URL.
|
||||
|
||||
:param office_url: Root URL from :meth:`get_office_url()`.
|
||||
|
||||
:param require: If true, an error is raised when URL cannot be
|
||||
determined.
|
||||
|
||||
:returns: URL as string.
|
||||
"""
|
||||
if not office_url:
|
||||
office_url = self.get_office_url(require=require)
|
||||
if office_url:
|
||||
return f'{office_url}/admin/Cashiers/CashierEditor.php?emp_no={employee_id}'
|
||||
|
||||
def get_office_likecode_url(
|
||||
self,
|
||||
likecode_id,
|
||||
|
|
|
@ -115,6 +115,16 @@ class TestCoreposHandler(ConfigTestCase):
|
|||
self.config.setdefault('corepos.office.url', 'http://localhost/fannie/')
|
||||
self.assertEqual(handler.get_office_department_url(7), 'http://localhost/fannie/item/departments/DepartmentEditor.php?did=7')
|
||||
|
||||
def test_get_office_employee_url(self):
|
||||
handler = self.make_handler()
|
||||
|
||||
# null
|
||||
self.assertIsNone(handler.get_office_employee_url(7))
|
||||
|
||||
# typical
|
||||
self.config.setdefault('corepos.office.url', 'http://localhost/fannie/')
|
||||
self.assertEqual(handler.get_office_employee_url(7), 'http://localhost/fannie/admin/Cashiers/CashierEditor.php?emp_no=7')
|
||||
|
||||
def test_get_office_likecode_url(self):
|
||||
handler = self.make_handler()
|
||||
|
||||
|
|
Loading…
Reference in a new issue