Skip to content

Commit 9dca979

Browse files
committed
Fix ERP interface issue
1 parent 7567cf5 commit 9dca979

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

utils/erp.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ def push_fr_data(data, retired=False):
1616
if ERP_API_ENDPOINT == "x":
1717
return
1818
# Contacts
19-
c_ifrc_names = ",".join(
20-
data.contacts.filter(ctype__iexact="Federation").values_list("name", flat=True)
21-
) # normally there is only 1
22-
c_ns_names = ",".join(
23-
data.contacts.filter(ctype__iexact="NationalSociety").values_list("name", flat=True)
24-
) # normally there is only 1
19+
names = list(data.contacts.filter(ctype__iexact="Federation").values_list("name", flat=True))
20+
names[:] = (name[:20] for name in names) # Temporary fix for F&O side field lenght issue
21+
c_ifrc_names = ",".join(names) # normally there is only 1
22+
23+
names = list(data.contacts.filter(ctype__iexact="NationalSociety").values_list("name", flat=True))
24+
names[:] = (name[:20] for name in names) # Temporary fix for F&O side field lenght issue
25+
c_ns_names = ",".join(names) # normally there is only 1
2526

2627
requestTitle = data.event.name if data.event else "-" # Emergency name
2728

@@ -55,9 +56,9 @@ def push_fr_data(data, retired=False):
5556
"""
5657

5758
if data.appeal != RequestChoices.NO:
58-
InitialRequestType, InitialRequestValue = "EA", data.appeal_amount
59+
InitialRequestType, InitialRequestValue = "EA", data.appeal_amount or 0
5960
elif data.dref != RequestChoices.NO:
60-
InitialRequestType, InitialRequestValue = "DREF", data.dref_amount
61+
InitialRequestType, InitialRequestValue = "DREF", data.dref_amount or 0
6162
else:
6263
InitialRequestType, InitialRequestValue = "Empty", 0
6364

0 commit comments

Comments
 (0)