| @@ -123,11 +123,21 @@ | ||
| 123 | 123 | unset($report_files[$k]); |
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | + // instantiate the report object | |
| 128 | + $reportInstance = new $classname; | |
| 129 | + | |
| 130 | + // ensure the report is compatible with the current environment | |
| 131 | + if ($reportInstance->preflight() === false) { | |
| 132 | + // exclude non-compatible report | |
| 133 | + unset($report_files[$k]); | |
| 134 | + continue; | |
| 135 | + } | |
| 136 | + | |
| 127 | 137 | if ($report_file == 'revenue' && $this->global_reports) { |
| 128 | 138 | // make the "revenue" the first element of the list |
| 129 | - array_unshift($this->global_reports, new $classname); | |
| 139 | + array_unshift($this->global_reports, $reportInstance); | |
| 130 | 140 | } elseif (strpos($report_file, 'istat') !== false || strpos($report_file, 'polizia') !== false) { |
| 131 | 141 | // this is a country (italy) specific report so we push it to a separate array |
| 132 | 142 | $country_key = 'IT'; |
| 133 | 143 | if (!isset($this->country_reports[$country_key])) { |
| @@ -132,9 +142,9 @@ | ||
| 132 | 142 | $country_key = 'IT'; |
| 133 | 143 | if (!isset($this->country_reports[$country_key])) { |
| 134 | 144 | $this->country_reports[$country_key] = []; |
| 135 | 145 | } |
| 136 | - $this->country_reports[$country_key][] = new $classname; | |
| 146 | + $this->country_reports[$country_key][] = $reportInstance; | |
| 137 | 147 | } elseif (substr($report_file, 2, 1) == '_') { |
| 138 | 148 | // this is probably a country specific report so we push it to a separate array (two-letter country code + underscore in file name) |
| 139 | 149 | $country_key = strtoupper(substr($report_file, 0, 2)); |
| 140 | 150 | if (!isset($this->country_reports[$country_key])) { |
| @@ -139,12 +149,12 @@ | ||
| 139 | 149 | $country_key = strtoupper(substr($report_file, 0, 2)); |
| 140 | 150 | if (!isset($this->country_reports[$country_key])) { |
| 141 | 151 | $this->country_reports[$country_key] = []; |
| 142 | 152 | } |
| 143 | - $this->country_reports[$country_key][] = new $classname; | |
| 153 | + $this->country_reports[$country_key][] = $reportInstance; | |
| 144 | 154 | } else { |
| 145 | 155 | // push this object as a global report |
| 146 | - $this->global_reports[] = new $classname; | |
| 156 | + $this->global_reports[] = $reportInstance; | |
| 147 | 157 | } |
| 148 | 158 | } |
| 149 | 159 | |
| 150 | 160 | // get countries information for the reports |