projectal.entities.department

 1from projectal.entity import Entity
 2from projectal import api
 3from projectal.linkers import *
 4
 5
 6class Department(Entity, StaffLinker, DepartmentLinker, CompanyLinker, NoteLinker,
 7                 TagLinker):
 8    """
 9    Implementation of the [Department](https://projectal.com/docs/latest/#tag/Department) API.
10    """
11    _path = 'department'
12    _name = 'department'
13    _links = [StaffLinker, DepartmentLinker, NoteLinker, TagLinker]
14    _links_reverse = [CompanyLinker]
15
16    @staticmethod
17    def tree(holder=None, level=None, active_staff=True, inactive_staff=True,
18             generic_staff=False):
19        """
20        Return department list in tree format
21
22        `holder`: Project, Company, or Staff. If None, the full department chart
23        is returned (default: `None`)
24
25        `level`: If `True`, only returns the top level of the
26        hierarchy (default: `False`)
27
28        `active_staff`: If `True`, includes the list of staff in each
29        department who are considered 'active' (i.e, today is within
30        their start and end dates) (default: `True`)
31
32        'inactive_staff`: If `True`, includes the list of staff in each
33        department who are considered 'inactive' (i.e, today is outside
34        their start and end dates) (default: `True`)
35
36        `generic_staff`: Include generic staff in results
37        """
38        url = '/api/department/tree?'
39        params = []
40        params.append('uuId={}'.format(holder['uuId'])) if holder else None
41        params.append('level=true') if level else None
42        params.append('activeStaff={}'.format('true' if active_staff else 'false'))
43        params.append('inactiveStaff={}'.format('true' if inactive_staff else 'false'))
44        params.append('genericStaff={}'.format('true' if generic_staff else 'false'))
45        url += '&'.join(params)
46
47        return api.get(url)
 7class Department(Entity, StaffLinker, DepartmentLinker, CompanyLinker, NoteLinker,
 8                 TagLinker):
 9    """
10    Implementation of the [Department](https://projectal.com/docs/latest/#tag/Department) API.
11    """
12    _path = 'department'
13    _name = 'department'
14    _links = [StaffLinker, DepartmentLinker, NoteLinker, TagLinker]
15    _links_reverse = [CompanyLinker]
16
17    @staticmethod
18    def tree(holder=None, level=None, active_staff=True, inactive_staff=True,
19             generic_staff=False):
20        """
21        Return department list in tree format
22
23        `holder`: Project, Company, or Staff. If None, the full department chart
24        is returned (default: `None`)
25
26        `level`: If `True`, only returns the top level of the
27        hierarchy (default: `False`)
28
29        `active_staff`: If `True`, includes the list of staff in each
30        department who are considered 'active' (i.e, today is within
31        their start and end dates) (default: `True`)
32
33        'inactive_staff`: If `True`, includes the list of staff in each
34        department who are considered 'inactive' (i.e, today is outside
35        their start and end dates) (default: `True`)
36
37        `generic_staff`: Include generic staff in results
38        """
39        url = '/api/department/tree?'
40        params = []
41        params.append('uuId={}'.format(holder['uuId'])) if holder else None
42        params.append('level=true') if level else None
43        params.append('activeStaff={}'.format('true' if active_staff else 'false'))
44        params.append('inactiveStaff={}'.format('true' if inactive_staff else 'false'))
45        params.append('genericStaff={}'.format('true' if generic_staff else 'false'))
46        url += '&'.join(params)
47
48        return api.get(url)

Implementation of the Department API.

@staticmethod
def tree( holder=None, level=None, active_staff=True, inactive_staff=True, generic_staff=False):
17    @staticmethod
18    def tree(holder=None, level=None, active_staff=True, inactive_staff=True,
19             generic_staff=False):
20        """
21        Return department list in tree format
22
23        `holder`: Project, Company, or Staff. If None, the full department chart
24        is returned (default: `None`)
25
26        `level`: If `True`, only returns the top level of the
27        hierarchy (default: `False`)
28
29        `active_staff`: If `True`, includes the list of staff in each
30        department who are considered 'active' (i.e, today is within
31        their start and end dates) (default: `True`)
32
33        'inactive_staff`: If `True`, includes the list of staff in each
34        department who are considered 'inactive' (i.e, today is outside
35        their start and end dates) (default: `True`)
36
37        `generic_staff`: Include generic staff in results
38        """
39        url = '/api/department/tree?'
40        params = []
41        params.append('uuId={}'.format(holder['uuId'])) if holder else None
42        params.append('level=true') if level else None
43        params.append('activeStaff={}'.format('true' if active_staff else 'false'))
44        params.append('inactiveStaff={}'.format('true' if inactive_staff else 'false'))
45        params.append('genericStaff={}'.format('true' if generic_staff else 'false'))
46        url += '&'.join(params)
47
48        return api.get(url)

Return department list in tree format

holder: Project, Company, or Staff. If None, the full department chart is returned (default: None)

level: If True, only returns the top level of the hierarchy (default: False)

active_staff: If True, includes the list of staff in each department who are considered 'active' (i.e, today is within their start and end dates) (default: True)

'inactive_staff: IfTrue, includes the list of staff in each department who are considered 'inactive' (i.e, today is outside their start and end dates) (default:True`)

generic_staff: Include generic staff in results