|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Export data file. |
|
4
|
|
|
* |
|
5
|
|
|
* @package Action |
|
6
|
|
|
* |
|
7
|
|
|
* @copyright YetiForce S.A. |
|
8
|
|
|
* @license YetiForce Public License 3.0 (licenses/LicenseEN.txt or yetiforce.com) |
|
9
|
|
|
* @author Radosław Skrzypczak <[email protected]> |
|
10
|
|
|
*/ |
|
11
|
|
|
/** |
|
12
|
|
|
* Export data class. |
|
13
|
|
|
*/ |
|
14
|
|
|
class Users_ExportData_Action extends Vtiger_ExportData_Action |
|
|
|
|
|
|
15
|
|
|
{ |
|
16
|
|
|
/** {@inheritdoc} */ |
|
17
|
|
|
public function checkPermission(App\Request $request) |
|
18
|
|
|
{ |
|
19
|
|
|
$this->moduelName = $request->getModule(); |
|
|
|
|
|
|
20
|
|
|
if (!\App\User::getCurrentUserModel()->isAdmin()) { |
|
21
|
|
|
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406); |
|
22
|
|
|
} |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** {@inheritdoc} */ |
|
26
|
|
|
public function process(App\Request $request) |
|
27
|
|
|
{ |
|
28
|
|
|
$this->exportModel = \App\Export\ExportRecords::getInstance($this->moduelName, 'csv') |
|
|
|
|
|
|
29
|
|
|
->setLimit(\App\Config::performance('MAX_NUMBER_EXPORT_RECORDS')) |
|
30
|
|
|
->setFormat(\App\Export\ExportRecords::EXPORT_FORMAT); |
|
31
|
|
|
$this->exportModel->fullData = true; |
|
32
|
|
|
|
|
33
|
|
|
$this->setDataFromRequest($request); |
|
34
|
|
|
$this->exportModel->sendHttpHeader(); |
|
35
|
|
|
$this->exportModel->exportData(); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** {@inheritdoc} */ |
|
39
|
|
|
public function setDataFromRequest(App\Request $request) |
|
40
|
|
|
{ |
|
41
|
|
|
$searchParams = \App\Condition::validSearchParams($this->moduelName, $request->getArray('search_params')); |
|
42
|
|
|
$operator = $request->isEmpty('operator') ? '' : $request->getByType('operator'); |
|
43
|
|
|
if ($operator && $searchValue = \App\Condition::validSearchValue($request->getByType('search_value', \App\Purifier::TEXT), $this->moduelName, $request->getByType('search_key', \App\Purifier::ALNUM), $operator)) { |
|
44
|
|
|
$searchKey = $request->getByType('search_key', \App\Purifier::ALNUM); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
$queryGenerator = $this->exportModel->getQueryGenerator(); |
|
48
|
|
|
$queryGenerator->addCondition('status', 'Active', 'e'); |
|
49
|
|
|
|
|
50
|
|
|
switch ($request->getMode()) { |
|
51
|
|
|
case 'ExportAllData': |
|
52
|
|
|
break; |
|
53
|
|
|
case 'ExportSelectedRecords': |
|
54
|
|
|
$selectedIds = $request->getArray('selected_ids', \App\Purifier::ALNUM); |
|
55
|
|
|
if ($selectedIds && 'all' !== $selectedIds[0]) { |
|
|
|
|
|
|
56
|
|
|
$queryGenerator->addCondition('id', $selectedIds, 'e'); |
|
57
|
|
|
} |
|
58
|
|
|
$queryGenerator->parseAdvFilter($queryGenerator->parseBaseSearchParamsToCondition($searchParams)); |
|
59
|
|
|
if ($excludedIds = $request->getArray('excluded_ids', \App\Purifier::INTEGER)) { |
|
60
|
|
|
$queryGenerator->addCondition('id', $excludedIds, 'n'); |
|
61
|
|
|
} |
|
62
|
|
|
if ($operator && $searchValue && $searchKey) { |
|
|
|
|
|
|
63
|
|
|
$queryGenerator->addCondition($searchKey, $searchValue, $operator); |
|
64
|
|
|
} |
|
65
|
|
|
break; |
|
66
|
|
|
default: |
|
67
|
|
|
throw new \App\Exceptions\IllegalValue('ERR_FIELD_NOT_FOUND||mode'); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths