@@ -95,8 +95,8 @@ def build_zip(record_summary: RecordSummary, user_information: Dict[str, str]) -
95
95
96
96
pdf_with_warnings = FormFilling ._build_pdf_for_case (case_without_deleted_charges , user_information , sid )
97
97
if pdf_with_warnings :
98
- pdf , internal_file_name , warnings = pdf_with_warnings
99
- file_name = f"{ case_without_deleted_charges .summary .name } _{ case_without_deleted_charges .summary .case_number } _{ internal_file_name } "
98
+ pdf , base_file_name , warnings = pdf_with_warnings
99
+ file_name = f"{ case_without_deleted_charges .summary .name } _{ case_without_deleted_charges .summary .case_number } _{ base_file_name } "
100
100
file_path = path .join (temp_dir , file_name )
101
101
writer = PdfWriter ()
102
102
writer .addpages (pdf .pages )
@@ -108,7 +108,7 @@ def build_zip(record_summary: RecordSummary, user_information: Dict[str, str]) -
108
108
109
109
# TODO: Extract to method
110
110
pdf = FormFilling ._build_certificate_of_mailing_pdf (user_information )
111
- file_name = f"certificate_of_mailing .pdf"
111
+ file_name = f"OSP_Form .pdf"
112
112
file_path = path .join (temp_dir , file_name )
113
113
writer = PdfWriter ()
114
114
writer .addpages (pdf .pages )
@@ -137,7 +137,7 @@ def _unify_sids(record_summary: RecordSummary) -> str:
137
137
@staticmethod
138
138
def _build_certificate_of_mailing_pdf (user_information : Dict [str , str ]) -> PdfReader :
139
139
form = from_dict (data_class = CertificateFormData , data = user_information )
140
- pdf_path = path .join (Path (__file__ ).parent , "files" , f"certificate_of_mailing .pdf" )
140
+ pdf_path = path .join (Path (__file__ ).parent , "files" , f"OSP_Form .pdf" )
141
141
pdf = PdfReader (pdf_path )
142
142
for field in pdf .Root .AcroForm .Fields :
143
143
field_name = field .T .lower ().replace (" " , "_" ).replace ("(" , "" ).replace (")" , "" )
@@ -265,7 +265,8 @@ def _build_pdf_for_eligible_case(
265
265
form = from_dict (data_class = FormDataWithOrder , data = form_data_dict )
266
266
location = case .summary .location .lower ()
267
267
pdf_path = FormFilling ._build_pdf_path (location , convictions )
268
- file_name = os .path .basename (pdf_path )
268
+ base_file_name = FormFilling ._build_base_file_name (location , convictions )
269
+ file_name = os .path .basename (base_file_name )
269
270
pdf = PdfReader (pdf_path )
270
271
for field in pdf .Root .AcroForm .Fields :
271
272
field_name = field .T .lower ().replace (" " , "_" ).replace ("(" , "" ).replace (")" , "" )
@@ -364,3 +365,14 @@ def _build_pdf_path(location: str, convictions: List[Charge]) -> str:
364
365
return path .join (Path (__file__ ).parent , "files" , "oregon_with_arrest_order.pdf" )
365
366
else :
366
367
return path .join (Path (__file__ ).parent , "files" , "oregon.pdf" )
368
+
369
+ @staticmethod
370
+ def _build_base_file_name (location : str , convictions : List [Charge ]) -> str :
371
+ # Douglas and Umatilla counties explicitly want the "Order" part of the old forms too.
372
+ if location in ["douglas" , "umatilla" ]:
373
+ if convictions :
374
+ return path .join (Path (__file__ ).parent , "files" , f"{ location } _with_conviction_order.pdf" )
375
+ else :
376
+ return path .join (Path (__file__ ).parent , "files" , f"{ location } _with_arrest_order.pdf" )
377
+ else :
378
+ return path .join (Path (__file__ ).parent , "files" , f"{ location } .pdf" )
0 commit comments