1 | <?php |
||
2 | /** |
||
3 | * FlexiPeeHP - Example how to upload new version of custom Report |
||
4 | * |
||
5 | * @author Vítězslav Dvořák <[email protected]> |
||
6 | * @copyright (G) 2020 Vitex Software |
||
7 | */ |
||
8 | |||
9 | namespace Example\FlexiPeeHP; |
||
10 | |||
11 | include_once './config.php'; |
||
12 | include_once '../vendor/autoload.php'; |
||
13 | |||
14 | |||
15 | define('EASE_APPNAME', 'ReportUploader'); |
||
16 | define('EASE_LOGGER', 'syslog|console'); |
||
17 | |||
18 | if ($argc < 3) { |
||
19 | echo "usage: " . $argv[0] . " <recordIdent> <formInfoCode> <reportfile> \n"; |
||
20 | echo "example: " . $argv[0] . " code:PokladDen pokDenik WinstromReports/vykazAnalyzaZakazky/analyzaZakazky.jrxml \n"; |
||
21 | } else { |
||
22 | $reportID = $argv[1]; |
||
23 | |||
24 | if ($argc == 3) { |
||
25 | if (is_file($argv[2])) { |
||
26 | $reportFile = $argv[2]; |
||
27 | } else { |
||
28 | $formCode = $argv[2]; |
||
29 | $reportFile = $argv[3]; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | if (strstr($reportFile, '.jrxml')) { |
||
34 | system('jaspercompiler ' . $reportFile); // https://github.com/VitexSoftware/jaspercompiler |
||
35 | $reportFile = str_replace('.jrxml', '.jasper', $reportFile); |
||
36 | } |
||
37 | |||
38 | |||
39 | if (file_exists($reportFile)) { |
||
40 | |||
41 | $reporter = new \FlexiPeeHP\Report($reportID); |
||
42 | $oldReportId = intval($reporter->getDataValue('hlavniReport')); |
||
43 | $attachment = \FlexiPeeHP\Priloha::addAttachmentFromFile($reporter, $reportFile); |
||
44 | if ($reporter->sync(['hlavniReport' => $attachment->getRecordID(), 'id' => $reporter->getRecordID()])) { |
||
45 | if ($oldReportId) { |
||
46 | $attachment->deleteFromFlexiBee($oldReportId); |
||
0 ignored issues
–
show
|
|||
47 | } |
||
48 | $reporter->addStatusMessage(_('Report updated'), 'success'); |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 | |||
53 | |||
54 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.