230 |
230 |
status = self.get_status()
|
231 |
231 |
return status.name if status else _('Unknown')
|
232 |
232 |
|
233 |
|
def is_hidden(self):
|
|
233 |
def is_hidden(self, user=None):
|
234 |
234 |
status = self.get_status()
|
235 |
235 |
if status:
|
236 |
|
return not status.is_visible(self.formdata, get_request().user)
|
|
236 |
return not status.is_visible(self.formdata, user or get_request().user)
|
237 |
237 |
return True
|
238 |
238 |
|
239 |
239 |
|
... | ... | |
509 |
509 |
return wf_status
|
510 |
510 |
return None
|
511 |
511 |
|
512 |
|
def get_visible_evolution_parts(self):
|
|
512 |
def get_visible_evolution_parts(self, user=None):
|
513 |
513 |
last_seen_status = None
|
514 |
514 |
last_seen_author = None
|
515 |
515 |
for evolution_part in self.evolution or []:
|
516 |
|
if evolution_part.is_hidden():
|
|
516 |
if evolution_part.is_hidden(user=user):
|
517 |
517 |
continue
|
518 |
518 |
if (evolution_part.status is None or last_seen_status == evolution_part.status) and (
|
519 |
519 |
evolution_part.who is None or last_seen_author == evolution_part.who):
|
... | ... | |
942 |
942 |
'name': self.formdef.name,
|
943 |
943 |
'id': self.get_display_id()}
|
944 |
944 |
|
945 |
|
def get_json_export_dict(self, include_files=True, anonymise=False):
|
|
945 |
def get_json_export_dict(self, include_files=True, anonymise=False, user=None):
|
946 |
946 |
data = {}
|
947 |
947 |
data['id'] = '%s/%s' % (self.formdef.url_name, self.id)
|
948 |
948 |
data['display_id'] = self.get_display_id()
|
... | ... | |
964 |
964 |
include_files=include_files, anonymise=anonymise)
|
965 |
965 |
|
966 |
966 |
data['workflow'] = {}
|
967 |
|
wf_status = self.get_visible_status()
|
|
967 |
wf_status = self.get_visible_status(user)
|
968 |
968 |
if wf_status:
|
969 |
969 |
data['workflow']['status'] = {'id': wf_status.id, 'name': wf_status.name}
|
970 |
970 |
# Workflow data have unknown purpose, do not store them in anonymised export
|
971 |
|
-
|