public static function checkReportStoreProjectConfig() { $storePid = LR_REPORT_DATA_PROJECT_ID; $sql = "select app_title, repeatforms from redcap_projects where project_id = {$storePid} "; $q = db_query($sql); // store project exists? if ($q->num_rows === 0) { return "Report store project id ({$storePid}) does not exist. Fix the setting in config.php."; } // not set to be longitudinal? $row = db_fetch_assoc($q); if ($row['repeatforms'] !== '0') { return "Report store project ({$row['app_title']}) <strong>must not</strong> be longitudinal."; } // contains expected fields $expectedFields = array('report_id', 'project_id', 'deleted', 'title', 'report_order', 'user_access', 'user_access_dags', 'user_access_roles', 'user_access_users', 'fields', 'output_dags', 'output_survey_fields', 'output_schedule_dates', 'output_survey_urls', 'limiter_fields', 'advanced_logic', 'filter_dags', 'orderby_field1', 'orderby_sort1', 'orderby_field2', 'orderby_sort2', 'orderby_field3', 'orderby_sort3', 'update_by', 'update_at'); $notFound = array(); $storeFields = REDCap::getDataDictionary($storePid, 'array'); foreach ($expectedFields as $f) { if (!array_key_exists($f, $storeFields)) { $notFound[] = $f; } } if (count($notFound) > 0) { return "Report store project ({$row['app_title']}) is missing the following expected fields: " . implode(', ', $notFound); } return true; }