Code Duplication    Length = 12-14 lines in 4 locations

bika/lims/content/worksheet.py 1 location

@@ 1310-1323 (lines=14) @@
1307
            return analyst_member.getProperty('fullname')
1308
        return analyst
1309
1310
    def getObjectWorkflowStates(self):
1311
        """
1312
        This method is used as a metacolumn.
1313
        Returns a dictionary with the workflow id as key and workflow state as
1314
        value.
1315
        :returns: {'review_state':'active',...}
1316
        :rtype: dict
1317
        """
1318
        workflow = getToolByName(self, 'portal_workflow')
1319
        states = {}
1320
        for w in workflow.getWorkflowsFor(self):
1321
            state = w._getWorkflowStateOf(self).id
1322
            states[w.state_var] = state
1323
        return states
1324
1325
    # TODO Workflow - Worksheet - Move to workflow.worksheet.events
1326
    def workflow_script_reject(self):

bika/lims/content/autoimportlog.py 1 location

@@ 74-86 (lines=13) @@
71
            return self.getInstrument().absolute_url_path()
72
        return None
73
74
    def getObjectWorkflowStates(self):
75
        """
76
        This method is used as a metacolumn.
77
        Returns a dictionary with the workflow id as key and workflow state as
78
        value.
79
        :returns: {'review_state':'active',...}
80
        """
81
        workflow = getToolByName(self, 'portal_workflow')
82
        states = {}
83
        for w in workflow.getWorkflowsFor(self):
84
            state = w._getWorkflowStateOf(self).id
85
            states[w.state_var] = state
86
        return states
87
88
89
# Activating the content type in Archetypes' internal types registry

bika/lims/content/person.py 1 location

@@ 301-312 (lines=12) @@
298
        return self.portal_membership.getMemberById(
299
            self.getUsername()) is not None
300
301
    def getObjectWorkflowStates(self):
302
        """Returns a dictionary with the workflow id as key and workflow state
303
        as value.
304
305
        :returns: {'review_state':'active',...}
306
        """
307
        workflow = getToolByName(self, 'portal_workflow')
308
        states = {}
309
        for w in workflow.getWorkflowsFor(self):
310
            state = w._getWorkflowStateOf(self).id
311
            states[w.state_var] = state
312
        return states
313
314
315
registerType(Person, PROJECTNAME)

bika/lims/content/analysisrequest.py 1 location

@@ 2175-2187 (lines=13) @@
2172
        """
2173
        return user_email(self, self.Creator())
2174
2175
    def getObjectWorkflowStates(self):
2176
        """
2177
        This method is used as a metacolumn.
2178
        Returns a dictionary with the workflow id as key and workflow state as
2179
        value.
2180
        :returns: {'review_state':'active',...}
2181
        """
2182
        workflow = getToolByName(self, 'portal_workflow')
2183
        states = {}
2184
        for w in workflow.getWorkflowsFor(self):
2185
            state = w._getWorkflowStateOf(self).id
2186
            states[w.state_var] = state
2187
        return states
2188
2189
    def getPriorityText(self):
2190
        """