1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* FlexiPeeHP - Objekt záznamu změn. |
5
|
|
|
* |
6
|
|
|
* @author Vítězslav Dvořák <[email protected]> |
7
|
|
|
* @copyright (C) 2016-2017 Spoje.Net |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace FlexiPeeHP; |
11
|
|
|
|
12
|
|
|
use FlexiPeeHP\RO; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Log změn v evidencích |
16
|
|
|
* |
17
|
|
|
* @link https://www.flexibee.eu/api/dokumentace/ref/changes-api/ Dokumentace |
18
|
|
|
*/ |
19
|
|
|
class Changes extends RO { |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Evidence užitá objektem. |
23
|
|
|
* |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
public $evidence = 'changes'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Povolí oznamování změn |
30
|
|
|
* Allow changes notification |
31
|
|
|
* |
32
|
|
|
* @return boolean |
33
|
|
|
*/ |
34
|
|
|
public function enable() { |
35
|
|
|
$this->performRequest('enable.xml', 'POST', 'xml'); |
36
|
|
|
return $this->lastResponseCode == 200; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Zakáže oznamování změn |
41
|
|
|
* Disallow changes notification |
42
|
|
|
* |
43
|
|
|
* @return boolean |
44
|
|
|
*/ |
45
|
|
|
public function disable() { |
46
|
|
|
$this->performRequest('disable.xml', 'POST', 'xml'); |
47
|
|
|
return $this->lastResponseCode == 200; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Vrátí stav zapnutí ChangesAPI |
52
|
|
|
* |
53
|
|
|
* @return boolean |
54
|
|
|
*/ |
55
|
|
|
public function getStatus() { |
56
|
|
|
$status = $this->performRequest('status.xml', 'GET', 'xml'); |
57
|
|
|
return (($this->lastResponseCode == 200) && ($status['changes'][0]['success'] === 'true')); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Test if given record exists in FlexiBee . |
62
|
|
|
* |
63
|
|
|
* @param array $data |
64
|
|
|
* @return null Method is disabled for Changes |
65
|
|
|
*/ |
66
|
|
|
public function recordExists($data = null) { |
67
|
|
|
return null; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Obtain actual GlobalVersion |
72
|
|
|
* Vrací aktuální globální verzi změn |
73
|
|
|
* |
74
|
|
|
* @link https://www.flexibee.eu/api/dokumentace/ref/changes-api#globalVersion Globální Verze |
75
|
|
|
* @return int |
76
|
|
|
*/ |
77
|
|
|
public function getGlobalVersion() { |
78
|
|
|
$this->getColumnsFromAbraFlexi('id', ['start' => 0, 'limit' => 0]); |
79
|
|
|
return $this->globalVersion; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Convert FlexiBee Response XML to Array |
84
|
|
|
* |
85
|
|
|
* @param string $rawXML |
86
|
|
|
* |
87
|
|
|
* @return array |
88
|
|
|
*/ |
89
|
|
|
public function rawXmlToArray($rawXML) { |
90
|
|
|
return [$this->getEvidence() => parent::rawXmlToArray($rawXML)]; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Changes has no relations |
95
|
|
|
* |
96
|
|
|
* @return null |
97
|
|
|
*/ |
98
|
|
|
public function getVazby($id = null) { |
99
|
|
|
throw new Exception(_('Changes has no relations')); |
|
|
|
|
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
} |
103
|
|
|
|