Exemple #1
0
 def apply_filters(self, form):
     """Apply filters from details in the CGI form."""
     filter_surname = ws.get_cgi_parameter_str_or_none(form, PARAM.SURNAME)
     if filter_surname:
         self.filter_surname = filter_surname.upper()
     filter_forename = ws.get_cgi_parameter_str_or_none(form,
                                                        PARAM.FORENAME)
     if filter_forename:
         self.filter_forename = filter_forename.upper()
     dt = ws.get_cgi_parameter_datetime(form, PARAM.DOB)
     if dt:
         self.filter_dob_iso8601 = cc_dt.format_datetime(
             dt, DATEFORMAT.ISO8601_DATE_ONLY)  # NB date only
     filter_sex = ws.get_cgi_parameter_str_or_none(form, PARAM.SEX)
     if filter_sex:
         self.filter_sex = filter_sex.upper()
     which_idnum = ws.get_cgi_parameter_int(form, PARAM.WHICH_IDNUM)
     idnum_value = ws.get_cgi_parameter_int(form, PARAM.IDNUM_VALUE)
     if (which_idnum
             and idnum_value is not None
             and which_idnum >= 1
             and which_idnum <= NUMBER_OF_IDNUMS):
         self.clear_filter_idnums()  # Only filter on one ID at a time.
         setattr(self, "filter_idnum" + str(which_idnum), idnum_value)
     filter_task = ws.get_cgi_parameter_str_or_none(form, PARAM.TASK)
     if filter_task:
         self.filter_task = filter_task
     filter_complete = ws.get_cgi_parameter_bool_or_none(form,
                                                         PARAM.COMPLETE)
     if filter_complete is not None:
         self.filter_complete = filter_complete
     filter_include_old_versions = ws.get_cgi_parameter_bool_or_none(
         form, PARAM.INCLUDE_OLD_VERSIONS)
     if filter_include_old_versions is not None:
         self.filter_include_old_versions = filter_include_old_versions
     filter_device = ws.get_cgi_parameter_str_or_none(form, PARAM.DEVICE)
     if filter_device:
         self.filter_device = filter_device
     filter_user = ws.get_cgi_parameter_str_or_none(form, PARAM.USER)
     if filter_user:
         self.filter_user = filter_user
     dt = ws.get_cgi_parameter_datetime(form, PARAM.START_DATETIME)
     if dt:
         self.filter_start_datetime_iso8601 = cc_dt.format_datetime(
             dt, DATEFORMAT.ISO8601)
     dt = ws.get_cgi_parameter_datetime(form, PARAM.END_DATETIME)
     if dt:
         self.filter_end_datetime_iso8601 = cc_dt.format_datetime(
             dt, DATEFORMAT.ISO8601)
     filter_text = ws.get_cgi_parameter_str_or_none(form, PARAM.TEXT)
     if filter_text:
         self.filter_text = filter_text
     self.reset_pagination()
Exemple #2
0
 def apply_filter_end_datetime(self, form):
     """Apply the end date filter."""
     dt = ws.get_cgi_parameter_datetime(form, PARAM.END_DATETIME)
     self.filter_end_datetime_iso8601 = cc_dt.format_datetime(
         dt, DATEFORMAT.ISO8601)
     self.reset_pagination()
Exemple #3
0
 def apply_filter_dob(self, form):
     """Apply the DOB filter."""
     dt = ws.get_cgi_parameter_datetime(form, PARAM.DOB)
     self.filter_dob_iso8601 = cc_dt.format_datetime(
         dt, DATEFORMAT.ISO8601_DATE_ONLY)  # NB date only
     self.reset_pagination()