@@ -95,8 +95,8 @@ def build_zip(record_summary: RecordSummary, user_information: Dict[str, str]) -
9595
9696 pdf_with_warnings = FormFilling ._build_pdf_for_case (case_without_deleted_charges , user_information , sid )
9797 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 } "
100100 file_path = path .join (temp_dir , file_name )
101101 writer = PdfWriter ()
102102 writer .addpages (pdf .pages )
@@ -108,7 +108,7 @@ def build_zip(record_summary: RecordSummary, user_information: Dict[str, str]) -
108108
109109 # TODO: Extract to method
110110 pdf = FormFilling ._build_certificate_of_mailing_pdf (user_information )
111- file_name = f"certificate_of_mailing .pdf"
111+ file_name = f"OSP_Form .pdf"
112112 file_path = path .join (temp_dir , file_name )
113113 writer = PdfWriter ()
114114 writer .addpages (pdf .pages )
@@ -137,7 +137,7 @@ def _unify_sids(record_summary: RecordSummary) -> str:
137137 @staticmethod
138138 def _build_certificate_of_mailing_pdf (user_information : Dict [str , str ]) -> PdfReader :
139139 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" )
141141 pdf = PdfReader (pdf_path )
142142 for field in pdf .Root .AcroForm .Fields :
143143 field_name = field .T .lower ().replace (" " , "_" ).replace ("(" , "" ).replace (")" , "" )
@@ -265,7 +265,8 @@ def _build_pdf_for_eligible_case(
265265 form = from_dict (data_class = FormDataWithOrder , data = form_data_dict )
266266 location = case .summary .location .lower ()
267267 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 )
269270 pdf = PdfReader (pdf_path )
270271 for field in pdf .Root .AcroForm .Fields :
271272 field_name = field .T .lower ().replace (" " , "_" ).replace ("(" , "" ).replace (")" , "" )
@@ -364,3 +365,14 @@ def _build_pdf_path(location: str, convictions: List[Charge]) -> str:
364365 return path .join (Path (__file__ ).parent , "files" , "oregon_with_arrest_order.pdf" )
365366 else :
366367 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