nanterre: permet la suppression des fiches même avec une clé SAGA (fixes #21872)
This commit is contained in:
parent
e2184aadf4
commit
434d5a2f02
|
@ -1422,9 +1422,12 @@ class SuppressionIndividu(IndividuViewMixin, TransactionalView):
|
|||
if conjoint:
|
||||
errors.append(u'cet individu a un conjoint')
|
||||
uuid_authentic = None
|
||||
for application in individu.content['cles_de_federation']:
|
||||
cles_de_federation = individu.content['cles_de_federation']
|
||||
for application in cles_de_federation:
|
||||
if application == 'authentic':
|
||||
uuid_authentic = individu.content['cles_de_federation']['authentic']
|
||||
continue
|
||||
elif application.startswith('saga'):
|
||||
continue
|
||||
else:
|
||||
errors.append(u'cet individu a encore une clé de fédération avec %s' % application)
|
||||
|
||||
|
@ -1442,10 +1445,19 @@ class SuppressionIndividu(IndividuViewMixin, TransactionalView):
|
|||
if not adresse.right_relations.exists() and not adresse.left_relations.exists():
|
||||
adresse.delete()
|
||||
response = {'err': 0}
|
||||
if uuid_authentic:
|
||||
response['cles_de_federation'] = {'authentic': uuid_authentic}
|
||||
response['messages'] = [u'cette fiche avait une clé de fédération sur le portail '
|
||||
u'internet: %s' % uuid_authentic]
|
||||
if cles_de_federation:
|
||||
response['cles_de_federation'] = cles_de_federation
|
||||
response['messages'] = []
|
||||
if 'authentic' in cles_de_federation:
|
||||
response['messages'].append(
|
||||
u'cette fiche avait une clé de fédération sur le portail internet: %s' %
|
||||
cles_de_federation['authentic'])
|
||||
if 'saga_tiers' in cles_de_federation:
|
||||
response['messages'].append(
|
||||
u'cette fiche avait une clé de fédération SAGA: '
|
||||
u'tiers %s métier %s' %
|
||||
(cles_de_federation['saga_tiers'],
|
||||
cles_de_federation.get('saga', 'Aucune')))
|
||||
return Response(response)
|
||||
|
||||
suppression_individu = SuppressionIndividu.as_view()
|
||||
|
|
Loading…
Reference in New Issue