| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | 2 | /** |
| 4 | 3 | * Provides Report Model Class |
| 5 | 4 | */ |
| 6 | 5 | |
| @@ -14,30 +13,11 @@ | ||
| 14 | 13 | class ReportsModel extends Model |
| 15 | 14 | { |
| 16 | 15 | protected static $table = 'bitforms_reports'; |
| 17 | 16 | |
| 18 | - /** | |
| 19 | - * Whether a report payload carries enough to validate. | |
| 20 | - * | |
| 21 | - * The save path feeds this the request's `currentReport`, and the React `$reportSelector` atom | |
| 22 | - * yields `{}` whenever the report list has not resolved — an empty stdClass, which PHP's | |
| 23 | - * empty() reports as non-empty. Callers must therefore ask before acting on it. | |
| 24 | - * | |
| 25 | - * @param mixed $reportData | |
| 26 | - * | |
| 27 | - * @return bool | |
| 28 | - */ | |
| 29 | - public static function isValidatableReport($reportData) | |
| 30 | - { | |
| 31 | - return \is_object($reportData) && !empty($reportData->type) && isset($reportData->details); | |
| 32 | - } | |
| 33 | - | |
| 34 | 17 | public function validateReportFields($reportData, $fieldNames) |
| 35 | 18 | { |
| 36 | 19 | $reportDetails = []; |
| 37 | - if (!self::isValidatableReport($reportData)) { | |
| 38 | - return $reportDetails; | |
| 39 | - } | |
| 40 | 20 | switch ($reportData->type) { |
| 41 | 21 | case 'table': |
| 42 | 22 | $tableAction = 'table_ac'; |
| 43 | 23 | $reportDetails = !is_string($reportData->details) ? $reportData->details : json_decode($reportData->details); |
| @@ -104,9 +84,9 @@ | ||
| 104 | 84 | ); |
| 105 | 85 | } |
| 106 | 86 | $result = $this->app_db->query( |
| 107 | 87 | $this->app_db->prepare( |
| 108 | - "DELETE FROM `{$this->table_name}` $condition_to_check", | |
| 88 | + "DELETE FROM $this->table_name $condition_to_check", | |
| 109 | 89 | $all_values |
| 110 | 90 | ) |
| 111 | 91 | ); |
| 112 | 92 | return $this->getResult($result); |