got respite_delay query working, discovered oddity in respite_rr_date values for multiple respites for same trial_file
After much wrestling, I figured out how to get the value(s) for the respite duration field in the search form to be correctly incorporated into the big mysql query (at line 945 of classes/Search.php)
if ($this->inData('respite-delay')) {
$respiteDelay = $this->_orWhereClause('respite-delay', 'rd.respite_delay_id');
$this->_select->where($respiteDelay);
}
In working on this, I discovered an oddity in the data. For example, a trial for Robert Abel includes a respite delay of one week. If I search just on his firstname and surname, I get one hit and the correct respite_rr_date. If I search for his firstname, lastname and respite_delay of one week, I get the one hit, but this time with a respite_rr_date of 0000-00-00.
His trial_file_id is 3297. In the respites table, three records with respite id 3405, 3406, 3407 all point to trial_file_id_fk 3297, but only the first record in the respites table has the correct value for the respite_rr_date field (1784-11-12), the other two have the value 0000-00-00. It looks like all respites after the first for any given trial_file have a respite_rr_date of 0000-00-00.
I'm not sure why that is or what the implications would be if I changed the approximately 422 instances to have proper values. It looks like the 0000-00-00 value is used in Search.php to distinguish respite-at-report from respite-post-report.