Compare commits
415 Commits
bootswatch
...
master
Author | SHA1 | Date |
---|---|---|
|
6fcd22b533 | 5 years ago |
|
fb81b23f6b | 6 years ago |
|
5f58ecb77f | 6 years ago |
|
ff9b7ceb9c | 6 years ago |
|
983250665c | 6 years ago |
|
6205642cdb | 6 years ago |
|
b41021f567 | 6 years ago |
|
1de92c0d26 | 6 years ago |
|
510544f4ba | 6 years ago |
|
6180d5d30c | 6 years ago |
|
11d6213208 | 6 years ago |
|
c4a9368a7b | 6 years ago |
|
823874e0a1 | 6 years ago |
|
7fc3fb042d | 6 years ago |
|
a1fc11cd93 | 6 years ago |
|
66fdd15616 | 6 years ago |
|
781e3b0434 | 6 years ago |
|
12a5b57fab | 6 years ago |
|
179df881c1 | 6 years ago |
|
9260af4734 | 6 years ago |
|
7efb6fc11e | 6 years ago |
|
9ee7e3e31b | 6 years ago |
|
205035fa0c | 6 years ago |
|
f39dbdfd87 | 6 years ago |
|
c11a9d3a80 | 6 years ago |
|
4418a36ccf | 6 years ago |
|
e3d4fc89dc | 6 years ago |
|
748ae25fc2 | 6 years ago |
|
27e3729fcf | 6 years ago |
|
4e01fa7971 | 6 years ago |
|
16b1e7c491 | 6 years ago |
|
fccfde3414 | 6 years ago |
|
3458f240b7 | 6 years ago |
|
7a3d2f20a9 | 6 years ago |
|
d15d4bf8d1 | 6 years ago |
|
d4a48c6c73 | 6 years ago |
|
26de217fef | 6 years ago |
|
4d71bf45ad | 6 years ago |
|
4c54ec677c | 6 years ago |
|
1fffac8b8c | 6 years ago |
|
0c04660f3f | 6 years ago |
|
0bb182220a | 6 years ago |
|
a292d0dd30 | 6 years ago |
|
ea8b89ac04 | 6 years ago |
|
bc6299e5cf | 6 years ago |
|
83e2ec500a | 6 years ago |
|
ba733a2619 | 6 years ago |
|
1ca4780d82 | 6 years ago |
|
c133b11bf6 | 6 years ago |
|
a1fcc93f4e | 6 years ago |
|
3ef8494b2a | 6 years ago |
|
b5374b9e6e | 6 years ago |
|
b5890e1f59 | 6 years ago |
|
2e9f040519 | 6 years ago |
|
f02af695b8 | 6 years ago |
|
6cad99e6c3 | 6 years ago |
|
d2096f366e | 6 years ago |
|
db6e971ccc | 6 years ago |
|
c5804612ae | 6 years ago |
|
aed9fda0aa | 6 years ago |
|
b0934f7c4c | 6 years ago |
|
eb32da3c3e | 6 years ago |
|
ad8e242d53 | 6 years ago |
|
988c788710 | 6 years ago |
|
2c0bcb231a | 6 years ago |
|
9d1f2cbfdf | 6 years ago |
|
32a2cde309 | 6 years ago |
|
ec6e67c8af | 6 years ago |
|
444493506d | 6 years ago |
|
0c13a6baf7 | 6 years ago |
|
5608c32c7e | 6 years ago |
|
dc8567620b | 6 years ago |
|
49eefce540 | 6 years ago |
|
17c5607ce7 | 6 years ago |
|
6be05bebfe | 6 years ago |
|
c92191f396 | 6 years ago |
|
50ea0aafd6 | 6 years ago |
|
fff00edbef | 6 years ago |
|
b5af789662 | 6 years ago |
|
c380ea0bc5 | 6 years ago |
|
05af7b17a5 | 6 years ago |
|
ef4ab7a2ea | 6 years ago |
|
4a65599985 | 6 years ago |
|
682e39fe5d | 6 years ago |
|
075c8c006d | 6 years ago |
|
b215f885a9 | 6 years ago |
|
53a9860388 | 6 years ago |
|
007fcb5575 | 6 years ago |
|
d84776d1aa | 6 years ago |
|
5e5a8193e9 | 6 years ago |
|
0823390738 | 6 years ago |
|
be0a8e52ca | 6 years ago |
|
f102baf753 | 6 years ago |
|
035e4f0a79 | 6 years ago |
|
aa1667261d | 6 years ago |
|
f24a80be6a | 6 years ago |
|
c03ca62005 | 6 years ago |
|
2f44516c7b | 6 years ago |
|
52b47075d9 | 6 years ago |
|
1325f17bf8 | 6 years ago |
|
5150656914 | 6 years ago |
|
874cd36bd0 | 6 years ago |
|
aa462d16f8 | 6 years ago |
|
4a73524c32 | 6 years ago |
|
e9db9796e3 | 6 years ago |
|
90df3de829 | 6 years ago |
|
6fa6c7b686 | 6 years ago |
|
9ae259dff6 | 6 years ago |
|
669edf832c | 6 years ago |
|
d97fe5a81c | 6 years ago |
|
e88bb3565d | 6 years ago |
|
306c2d370a | 6 years ago |
|
b3245aa38d | 6 years ago |
|
ed04663d08 | 6 years ago |
|
352b3a9f37 | 6 years ago |
|
f290fd7519 | 6 years ago |
|
56eeaea61e | 6 years ago |
|
34895de5bc | 6 years ago |
|
1017b64913 | 6 years ago |
|
100c22eb78 | 6 years ago |
|
62c1661f04 | 6 years ago |
|
d7ae1f0101 | 6 years ago |
|
6b0854a273 | 6 years ago |
|
3dd897f732 | 6 years ago |
|
e56ef4d608 | 6 years ago |
|
37156a8ac7 | 6 years ago |
|
7fe96fda96 | 6 years ago |
|
9d874e10a5 | 6 years ago |
|
318462164d | 6 years ago |
|
af5ba09d38 | 6 years ago |
|
34b32761ce | 6 years ago |
|
7350c5105d | 6 years ago |
|
fea2d7b3c1 | 6 years ago |
|
f11353c41b | 6 years ago |
|
8bad3ed188 | 6 years ago |
|
f40df54772 | 6 years ago |
|
155b6c5926 | 6 years ago |
|
559f2d7011 | 6 years ago |
|
275a1691d1 | 6 years ago |
|
81b27ddb2e | 6 years ago |
|
904202488d | 6 years ago |
|
2b089f3907 | 6 years ago |
|
35ed664dfd | 6 years ago |
|
48b28fc3cd | 6 years ago |
|
4bd4eec53d | 6 years ago |
|
71bb5af435 | 6 years ago |
|
ff6ec13df4 | 6 years ago |
|
22ecc4804e | 6 years ago |
|
5696968f25 | 6 years ago |
|
d383bc0c00 | 6 years ago |
|
90dc2d691a | 6 years ago |
|
5865cb722d | 6 years ago |
|
dd0edef2ba | 6 years ago |
|
400c216869 | 6 years ago |
|
f2001ec446 | 6 years ago |
|
d2cb5ad251 | 6 years ago |
|
2ffa6c130c | 6 years ago |
|
98a033798f | 6 years ago |
|
4e2b21ae60 | 6 years ago |
|
a57befcc69 | 6 years ago |
|
c4f080184c | 6 years ago |
|
1978948f4a | 6 years ago |
|
af45726fe6 | 6 years ago |
|
df780f4546 | 6 years ago |
|
09b371036a | 7 years ago |
|
7c884582a2 | 7 years ago |
|
cfabdb950d | 7 years ago |
|
f53065f7f6 | 7 years ago |
|
624267fe45 | 7 years ago |
|
401e335e5f | 7 years ago |
|
ad63bcac02 | 7 years ago |
|
1a66485d48 | 7 years ago |
|
770a01a970 | 7 years ago |
|
78cb2de9b6 | 7 years ago |
|
4959ccb815 | 7 years ago |
|
4c2432a35b | 7 years ago |
|
3d73b9a4b2 | 7 years ago |
|
c4b79a722c | 7 years ago |
|
0514965040 | 7 years ago |
|
bd5b3e1322 | 7 years ago |
|
86f1fb3ca2 | 7 years ago |
|
c805fd8eab | 7 years ago |
|
9eab1525ef | 7 years ago |
|
814523ba6e | 7 years ago |
|
13161696ae | 7 years ago |
|
354bb91234 | 7 years ago |
|
05b913c53a | 7 years ago |
|
5ee4ed5864 | 7 years ago |
|
d4b3c9acc9 | 7 years ago |
|
95342815e2 | 7 years ago |
|
f35fb7b207 | 7 years ago |
|
6177bc1794 | 7 years ago |
|
878b2aa096 | 7 years ago |
|
8ee6e1a55f | 7 years ago |
|
d2ee60e053 | 7 years ago |
|
39e61b85c4 | 7 years ago |
|
0a2e37320a | 7 years ago |
|
f70c3635a9 | 7 years ago |
|
8050e10c30 | 7 years ago |
|
3e8085110f | 7 years ago |
|
2faac6be1a | 7 years ago |
|
902f3edcf6 | 7 years ago |
|
3bff7fd30b | 7 years ago |
|
665db7a4d8 | 7 years ago |
|
a7546419a4 | 7 years ago |
|
8d30a041fe | 7 years ago |
|
dd99ebdb0e | 7 years ago |
|
03e7f62684 | 7 years ago |
|
d092a49bab | 7 years ago |
|
2390af6393 | 7 years ago |
|
8b263f66a3 | 7 years ago |
|
3203eed8aa | 7 years ago |
|
a7742614df | 7 years ago |
|
15b971412b | 7 years ago |
|
f8ab89946d | 7 years ago |
|
70435cee62 | 7 years ago |
|
fefe1e23a4 | 7 years ago |
|
477d55d8bf | 7 years ago |
|
eac23907e7 | 7 years ago |
|
eeb5ada610 | 7 years ago |
|
36295d1861 | 7 years ago |
|
3e82065fa4 | 7 years ago |
|
6a763593ee | 7 years ago |
|
d04b40c925 | 7 years ago |
|
f5ff322c33 | 7 years ago |
|
ac5f9309c8 | 7 years ago |
|
79e34ce8cc | 7 years ago |
|
3e7f000630 | 7 years ago |
|
d897fa2a4b | 7 years ago |
|
a8abfcd4a1 | 7 years ago |
|
c00d5641e4 | 7 years ago |
|
6bef518ffa | 7 years ago |
|
311a48487d | 7 years ago |
|
d305ccf9b3 | 7 years ago |
|
c985f80452 | 7 years ago |
|
fd4732d978 | 7 years ago |
|
945e548ef7 | 7 years ago |
|
18128ff263 | 7 years ago |
|
70793cdfae | 7 years ago |
|
30dcb113ae | 7 years ago |
|
443d4ac1f3 | 7 years ago |
|
88964a73eb | 7 years ago |
|
fcaee13ba3 | 7 years ago |
|
fab521ff7c | 7 years ago |
|
7c139a8d0c | 7 years ago |
|
5d8fa97aa2 | 7 years ago |
|
f3c0c191db | 7 years ago |
|
046636c40a | 7 years ago |
|
c241338fbe | 7 years ago |
|
d62370b069 | 7 years ago |
|
ca728839ac | 7 years ago |
|
05617a3b56 | 7 years ago |
|
b77e2e6459 | 7 years ago |
|
2d9c383ddd | 7 years ago |
|
59fa5c2698 | 7 years ago |
|
308f7431e7 | 7 years ago |
|
86a76fc460 | 7 years ago |
|
4e6bbdfed6 | 7 years ago |
|
61fcfc83b0 | 7 years ago |
|
f41fe487fa | 7 years ago |
|
9b7af18f6a | 7 years ago |
|
f6df4fda7e | 7 years ago |
|
17d5d9efcf | 7 years ago |
|
fed59f988f | 7 years ago |
|
62d9f31d14 | 7 years ago |
|
1862b6beb3 | 7 years ago |
|
311697693f | 7 years ago |
|
bc752ff2c3 | 7 years ago |
|
02492dac52 | 7 years ago |
|
647955fdf0 | 7 years ago |
|
78ae5cebff | 7 years ago |
|
a01efb8f92 | 7 years ago |
|
3fde3df882 | 7 years ago |
|
f2cfe967ee | 7 years ago |
|
9839e8916e | 7 years ago |
|
109a4fa25f | 7 years ago |
|
e98213ad4c | 7 years ago |
|
7aa7526a17 | 7 years ago |
|
60ac53fe94 | 7 years ago |
|
0df87dde57 | 7 years ago |
|
8b7f0ace3a | 7 years ago |
|
d35cf4d358 | 7 years ago |
|
cae76032d1 | 7 years ago |
|
f5907bf476 | 7 years ago |
|
78559de051 | 7 years ago |
|
d19c53e99a | 7 years ago |
|
537cbe92f3 | 7 years ago |
|
5235461791 | 7 years ago |
|
97e4f4ae4f | 7 years ago |
|
d007792f3a | 7 years ago |
|
cdd4c83e4f | 7 years ago |
|
0cd0337a39 | 7 years ago |
|
72428be04b | 7 years ago |
|
e3cfdda60b | 7 years ago |
|
219bc18cc6 | 7 years ago |
|
62c059b384 | 7 years ago |
|
2c8a4ad86e | 7 years ago |
|
d29ec0374e | 7 years ago |
|
c99f75c908 | 7 years ago |
|
f54c9bbd03 | 7 years ago |
|
92713506e6 | 7 years ago |
|
6ea38bc90b | 7 years ago |
|
dbf9baca75 | 7 years ago |
|
5aeb90852b | 7 years ago |
|
8b0fe2cdaf | 7 years ago |
|
8aac741b6f | 7 years ago |
|
43264318c4 | 7 years ago |
|
23fc8ef6d5 | 7 years ago |
|
69f2cf4b4c | 7 years ago |
|
e56943d659 | 7 years ago |
|
3485a5b7db | 7 years ago |
|
60decb3cfa | 7 years ago |
|
7e6a5b2ba5 | 7 years ago |
|
c6f4e4ce3e | 7 years ago |
|
0670d74c1e | 7 years ago |
|
44ab918292 | 7 years ago |
|
0ac67766ee | 7 years ago |
|
953747d90d | 7 years ago |
|
62bda38b91 | 7 years ago |
|
db99d2219e | 7 years ago |
|
939f470666 | 7 years ago |
|
05ede52ce5 | 7 years ago |
|
d5589cc1c2 | 7 years ago |
|
4ac430bc19 | 7 years ago |
|
b95876e6a1 | 7 years ago |
|
35f03ee26e | 7 years ago |
|
7b8ae3a1d8 | 7 years ago |
|
ca3bfcde1c | 7 years ago |
|
523fe43b91 | 7 years ago |
|
764fefb25a | 7 years ago |
|
9ed88a1e02 | 7 years ago |
|
46721d4212 | 7 years ago |
|
111dbb30b9 | 7 years ago |
|
d01135ac1b | 7 years ago |
|
d06e80056a | 7 years ago |
|
ce8ff6efe5 | 7 years ago |
|
745ecd42aa | 7 years ago |
|
fedb26fd43 | 7 years ago |
|
6d632be7b8 | 7 years ago |
|
79f41a7652 | 7 years ago |
|
056b02522e | 7 years ago |
|
4d9eeeb1d0 | 7 years ago |
|
477b780805 | 7 years ago |
|
a3709c187b | 7 years ago |
|
3c0148ddc2 | 7 years ago |
|
8de106cbb2 | 7 years ago |
|
9ae189430d | 7 years ago |
|
ea0a612e4f | 7 years ago |
|
41cbdadb72 | 7 years ago |
|
016a50878d | 7 years ago |
|
3c4018ace3 | 7 years ago |
|
37d730dfdc | 7 years ago |
|
0f902f683c | 7 years ago |
|
02ccb65b27 | 7 years ago |
|
3b0c8ad3a6 | 7 years ago |
|
560197eebe | 7 years ago |
|
0dcac4f324 | 7 years ago |
|
3ed01ba92f | 7 years ago |
|
dd699b7165 | 7 years ago |
|
5b7c2f7ec7 | 7 years ago |
|
c8e2128c4c | 7 years ago |
|
be42fe04fb | 7 years ago |
|
7ca00fecbe | 7 years ago |
|
f700addda5 | 7 years ago |
|
5caac8452e | 7 years ago |
|
02d965e2d9 | 7 years ago |
|
45726bd388 | 7 years ago |
|
25fde2aa65 | 7 years ago |
|
29f1eb3503 | 7 years ago |
|
2238a52c40 | 7 years ago |
|
499b604cc3 | 7 years ago |
|
8a2c03a587 | 7 years ago |
|
24cdb08449 | 7 years ago |
|
f7272e8549 | 7 years ago |
|
136ca3f206 | 7 years ago |
|
a1a870ed34 | 7 years ago |
|
aa307e6b15 | 7 years ago |
|
60301f4aab | 7 years ago |
|
7fb7a8bec4 | 7 years ago |
|
38cea82821 | 7 years ago |
|
d76cc27e8e | 7 years ago |
|
c86788e7fd | 7 years ago |
|
9582689f2a | 7 years ago |
|
dd690decb2 | 7 years ago |
|
7d2479d5b6 | 7 years ago |
|
8f52400aea | 7 years ago |
|
1185785dbd | 7 years ago |
|
f7d03f66cd | 7 years ago |
|
05f79ecfa9 | 7 years ago |
|
b6ab6a806e | 7 years ago |
|
3ec2419086 | 7 years ago |
|
6b5a55226b | 7 years ago |
|
7aae9c62af | 7 years ago |
|
260600a7f6 | 7 years ago |
|
326ccaa6be | 7 years ago |
|
c60d2ed866 | 7 years ago |
|
9bffcfdf6a | 7 years ago |
|
65576d5c43 | 7 years ago |
|
efbf38ca33 | 7 years ago |
|
73b3a01bc0 | 7 years ago |
|
84f491bd40 | 7 years ago |
|
ed6df71041 | 7 years ago |
|
4db151de66 | 7 years ago |
|
f209266260 | 7 years ago |
|
932056f731 | 7 years ago |
|
4178703f2b | 7 years ago |
|
7cc69878ca | 7 years ago |
|
68308b02a5 | 7 years ago |
|
297d7f3cfd | 7 years ago |
|
37bd252041 | 7 years ago |
|
5de09b851b | 7 years ago |
|
e91f6842ab | 7 years ago |
|
d5a9d225f2 | 7 years ago |
|
c994b0099e | 7 years ago |
|
234d28a8b8 | 7 years ago |
@ -1,32 +1,90 @@
|
|||||||
image: tetraweb/php
|
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- validate
|
||||||
- test
|
- test
|
||||||
- deploy
|
- package
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update
|
- bash ci/docker_install.sh > /dev/null
|
||||||
- apt-get install zip unzip
|
|
||||||
- cd api
|
validate:7.2:
|
||||||
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
image: php:7.2
|
||||||
- php composer-setup.php
|
stage: validate
|
||||||
- php -r "unlink('composer-setup.php');"
|
script:
|
||||||
- php composer.phar update
|
- bash ci/php_lint.sh ./
|
||||||
|
|
||||||
test:
|
validate:7.1:
|
||||||
|
image: php:7.1
|
||||||
|
stage: validate
|
||||||
|
script:
|
||||||
|
- bash ci/php_lint.sh ./
|
||||||
|
|
||||||
|
validate:7.0:
|
||||||
|
image: php:7.0
|
||||||
|
stage: validate
|
||||||
|
script:
|
||||||
|
- bash ci/php_lint.sh ./
|
||||||
|
|
||||||
|
validate:5.6:
|
||||||
|
image: php:5.6
|
||||||
|
stage: validate
|
||||||
|
script:
|
||||||
|
- bash ci/php_lint.sh ./
|
||||||
|
|
||||||
|
validate:5.5:
|
||||||
|
image: php:5.5
|
||||||
|
stage: validate
|
||||||
|
script:
|
||||||
|
- bash ci/php_lint.sh ./
|
||||||
|
|
||||||
|
validate:5.4:
|
||||||
|
image: php:5.4
|
||||||
|
stage: validate
|
||||||
|
script:
|
||||||
|
- bash ci/php_lint.sh ./
|
||||||
|
|
||||||
|
validate:5.3:
|
||||||
|
image: php:5.3
|
||||||
|
stage: validate
|
||||||
|
script:
|
||||||
|
- bash ci/php_lint.sh ./
|
||||||
|
|
||||||
|
test:7.1:
|
||||||
|
image: php:7.1
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- cd api
|
||||||
|
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||||
|
- php composer-setup.php
|
||||||
|
- php -r "unlink('composer-setup.php');"
|
||||||
|
- php composer.phar update
|
||||||
|
- php composer.phar install
|
||||||
|
- cd Tests
|
||||||
|
- phpunit
|
||||||
|
|
||||||
|
test:7.2:
|
||||||
|
image: php:7.2
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- composer install
|
- cd api
|
||||||
|
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||||
|
- php composer-setup.php
|
||||||
|
- php -r "unlink('composer-setup.php');"
|
||||||
|
- php composer.phar update
|
||||||
|
- php composer.phar install
|
||||||
- cd Tests
|
- cd Tests
|
||||||
- phpunit
|
- phpunit
|
||||||
|
|
||||||
deploy:
|
package:
|
||||||
|
image: tetraweb/php
|
||||||
when: manual
|
when: manual
|
||||||
stage: deploy
|
stage: package
|
||||||
script:
|
script:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install zip unzip
|
||||||
|
- cd api
|
||||||
- composer install --no-dev
|
- composer install --no-dev
|
||||||
- cd ../ci
|
- cd ../ci
|
||||||
- bash build_zip.sh
|
- bash build_zip.sh
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- release.zip
|
- release.zip
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of HESK - PHP Help Desk Software.
|
||||||
|
*
|
||||||
|
* (c) Copyright Klemen Stirn. All rights reserved.
|
||||||
|
* https://www.hesk.com
|
||||||
|
*
|
||||||
|
* For the full copyright and license agreement information visit
|
||||||
|
* https://www.hesk.com/eula.php
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
define('IN_SCRIPT',1);
|
||||||
|
define('HESK_PATH','../');
|
||||||
|
|
||||||
|
/* Get all the required files and functions */
|
||||||
|
require(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/privacy_functions.inc.php');
|
||||||
|
hesk_load_database_functions();
|
||||||
|
|
||||||
|
hesk_session_start();
|
||||||
|
hesk_dbConnect();
|
||||||
|
hesk_isLoggedIn();
|
||||||
|
|
||||||
|
// Check permissions for this feature
|
||||||
|
hesk_checkPermission('can_privacy');
|
||||||
|
|
||||||
|
// A security check
|
||||||
|
hesk_token_check();
|
||||||
|
|
||||||
|
// Tracking ID
|
||||||
|
$trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']);
|
||||||
|
|
||||||
|
// Anonymize the ticket and redirect back
|
||||||
|
if (hesk_anonymizeTicket(0, $trackingID))
|
||||||
|
{
|
||||||
|
hesk_process_messages($hesklang['success_anon'],'admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999),'SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
hesk_error($hesklang['no_permission']);
|
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of HESK - PHP Help Desk Software.
|
||||||
|
*
|
||||||
|
* (c) Copyright Klemen Stirn. All rights reserved.
|
||||||
|
* https://www.hesk.com
|
||||||
|
*
|
||||||
|
* For the full copyright and license agreement information visit
|
||||||
|
* https://www.hesk.com/eula.php
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
define('IN_SCRIPT',1);
|
||||||
|
define('HESK_PATH','../');
|
||||||
|
|
||||||
|
/* Get all the required files and functions */
|
||||||
|
require(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/privacy_functions.inc.php');
|
||||||
|
hesk_load_database_functions();
|
||||||
|
|
||||||
|
hesk_session_start();
|
||||||
|
hesk_dbConnect();
|
||||||
|
hesk_isLoggedIn();
|
||||||
|
|
||||||
|
// Check permissions for this feature
|
||||||
|
hesk_checkPermission('can_export');
|
||||||
|
|
||||||
|
// A security check
|
||||||
|
hesk_token_check();
|
||||||
|
|
||||||
|
// Tracking ID
|
||||||
|
$trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']);
|
||||||
|
|
||||||
|
// Generate SQL for the ticket, make sure the user has access to it
|
||||||
|
$sql = "SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `trackid`='".hesk_dbEscape($trackingID)."' AND ";
|
||||||
|
$sql .= hesk_myCategories();
|
||||||
|
$sql .= " AND " . hesk_myOwnership();
|
||||||
|
$sql .= " LIMIT 1";
|
||||||
|
|
||||||
|
require_once(HESK_PATH . 'inc/custom_fields.inc.php');
|
||||||
|
require_once(HESK_PATH . 'inc/statuses.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/export_functions.inc.php');
|
||||||
|
|
||||||
|
list($success_msg, $tickets_exported) = hesk_export_to_XML($sql, true);
|
||||||
|
|
||||||
|
if ($tickets_exported == 1)
|
||||||
|
{
|
||||||
|
hesk_process_messages($success_msg,'admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999),'SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
hesk_error($hesklang['n2ex']);
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of HESK - PHP Help Desk Software.
|
||||||
|
*
|
||||||
|
* (c) Copyright Klemen Stirn. All rights reserved.
|
||||||
|
* https://www.hesk.com
|
||||||
|
*
|
||||||
|
* For the full copyright and license agreement information visit
|
||||||
|
* https://www.hesk.com/eula.php
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
define('IN_SCRIPT',1);
|
||||||
|
define('HESK_PATH','../');
|
||||||
|
|
||||||
|
/* Get all the required files and functions */
|
||||||
|
require(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
||||||
|
hesk_load_database_functions();
|
||||||
|
|
||||||
|
hesk_session_start();
|
||||||
|
hesk_dbConnect();
|
||||||
|
hesk_isLoggedIn();
|
||||||
|
|
||||||
|
/* Check permissions for this feature */
|
||||||
|
hesk_checkPermission('can_view_tickets');
|
||||||
|
hesk_checkPermission('can_reply_tickets');
|
||||||
|
|
||||||
|
/* A security check */
|
||||||
|
hesk_token_check('POST');
|
||||||
|
|
||||||
|
/* Ticket ID */
|
||||||
|
$trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']);
|
||||||
|
|
||||||
|
$priority = intval( hesk_POST('priority') );
|
||||||
|
if ($priority < 0 || $priority > 3)
|
||||||
|
{
|
||||||
|
hesk_process_messages($hesklang['inpr'],'admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999),'NOTICE');
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
0 => '<font class="critical">'.$hesklang['critical'].'</font>',
|
||||||
|
1 => '<font class="important">'.$hesklang['high'].'</font>',
|
||||||
|
2 => '<font class="medium">'.$hesklang['medium'].'</font>',
|
||||||
|
3 => $hesklang['low']
|
||||||
|
);
|
||||||
|
|
||||||
|
$plain_options = array(
|
||||||
|
0 => 'critical',
|
||||||
|
1 => 'high',
|
||||||
|
2 => 'medium',
|
||||||
|
3 => 'low'
|
||||||
|
);
|
||||||
|
|
||||||
|
$ticketRs = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE `trackid` = '" . hesk_dbEscape($trackingID) . "'");
|
||||||
|
$ticket = hesk_dbFetchAssoc($ticketRs);
|
||||||
|
|
||||||
|
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `priority`='{$priority}' WHERE `trackid`='".hesk_dbEscape($trackingID)."'");
|
||||||
|
|
||||||
|
mfh_insert_audit_trail_record($ticket['id'], 'TICKET', 'audit_priority', hesk_date(), array(
|
||||||
|
0 => $_SESSION['name'].' ('.$_SESSION['user'].')',
|
||||||
|
1 => $plain_options[$priority]
|
||||||
|
));
|
||||||
|
|
||||||
|
if (hesk_dbAffectedRows() != 1)
|
||||||
|
{
|
||||||
|
hesk_process_messages($hesklang['inpr'],'admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999),'NOTICE');
|
||||||
|
}
|
||||||
|
|
||||||
|
hesk_process_messages(sprintf($hesklang['chpri2'],$options[$priority]),'admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999),'SUCCESS');
|
||||||
|
?>
|
File diff suppressed because it is too large
Load Diff
@ -1,142 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// Responsible for loading in all necessary classes. AKA a poor man's DI solution.
|
|
||||||
use BusinessLogic\Attachments\AttachmentHandler;
|
|
||||||
use BusinessLogic\Attachments\AttachmentRetriever;
|
|
||||||
use BusinessLogic\Categories\CategoryRetriever;
|
|
||||||
use BusinessLogic\Emails\BasicEmailSender;
|
|
||||||
use BusinessLogic\Emails\EmailSenderHelper;
|
|
||||||
use BusinessLogic\Emails\EmailTemplateParser;
|
|
||||||
use BusinessLogic\Emails\EmailTemplateRetriever;
|
|
||||||
use BusinessLogic\Emails\MailgunEmailSender;
|
|
||||||
use BusinessLogic\Navigation\CustomNavElementHandler;
|
|
||||||
use BusinessLogic\Security\BanRetriever;
|
|
||||||
use BusinessLogic\Security\UserContextBuilder;
|
|
||||||
use BusinessLogic\Security\UserToTicketChecker;
|
|
||||||
use BusinessLogic\Settings\ApiChecker;
|
|
||||||
use BusinessLogic\Settings\SettingsRetriever;
|
|
||||||
use BusinessLogic\Statuses\StatusRetriever;
|
|
||||||
use BusinessLogic\Tickets\Autoassigner;
|
|
||||||
use BusinessLogic\Tickets\TicketDeleter;
|
|
||||||
use BusinessLogic\Tickets\TicketEditor;
|
|
||||||
use BusinessLogic\Tickets\TicketRetriever;
|
|
||||||
use BusinessLogic\Tickets\TicketCreator;
|
|
||||||
use BusinessLogic\Tickets\NewTicketValidator;
|
|
||||||
use BusinessLogic\Tickets\TicketValidators;
|
|
||||||
use BusinessLogic\Tickets\TrackingIdGenerator;
|
|
||||||
use BusinessLogic\Tickets\VerifiedEmailChecker;
|
|
||||||
use DataAccess\Attachments\AttachmentGateway;
|
|
||||||
use DataAccess\Categories\CategoryGateway;
|
|
||||||
use DataAccess\Files\FileDeleter;
|
|
||||||
use DataAccess\Files\FileReader;
|
|
||||||
use DataAccess\Files\FileWriter;
|
|
||||||
use DataAccess\Logging\LoggingGateway;
|
|
||||||
use DataAccess\Navigation\CustomNavElementGateway;
|
|
||||||
use DataAccess\Security\BanGateway;
|
|
||||||
use DataAccess\Security\UserGateway;
|
|
||||||
use DataAccess\Settings\ModsForHeskSettingsGateway;
|
|
||||||
use DataAccess\Statuses\StatusGateway;
|
|
||||||
use DataAccess\Tickets\TicketGateway;
|
|
||||||
use DataAccess\Tickets\VerifiedEmailGateway;
|
|
||||||
|
|
||||||
|
|
||||||
class ApplicationContext {
|
|
||||||
public $get;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ApplicationContext constructor.
|
|
||||||
*/
|
|
||||||
function __construct() {
|
|
||||||
$this->get = array();
|
|
||||||
|
|
||||||
// Settings
|
|
||||||
$this->get[ModsForHeskSettingsGateway::class] = new ModsForHeskSettingsGateway();
|
|
||||||
|
|
||||||
// API Checker
|
|
||||||
$this->get[ApiChecker::class] = new ApiChecker($this->get[ModsForHeskSettingsGateway::class]);
|
|
||||||
|
|
||||||
// Custom Navigation
|
|
||||||
$this->get[CustomNavElementGateway::class] = new CustomNavElementGateway();
|
|
||||||
$this->get[CustomNavElementHandler::class] = new CustomNavElementHandler($this->get[CustomNavElementGateway::class]);
|
|
||||||
|
|
||||||
// Logging
|
|
||||||
$this->get[LoggingGateway::class] = new LoggingGateway();
|
|
||||||
|
|
||||||
// Verified Email Checker
|
|
||||||
$this->get[VerifiedEmailGateway::class] = new VerifiedEmailGateway();
|
|
||||||
$this->get[VerifiedEmailChecker::class] = new VerifiedEmailChecker($this->get[VerifiedEmailGateway::class]);
|
|
||||||
|
|
||||||
// Users
|
|
||||||
$this->get[UserGateway::class] = new UserGateway();
|
|
||||||
$this->get[UserContextBuilder::class] = new UserContextBuilder($this->get[UserGateway::class]);
|
|
||||||
|
|
||||||
// Categories
|
|
||||||
$this->get[CategoryGateway::class] = new CategoryGateway();
|
|
||||||
$this->get[CategoryRetriever::class] = new CategoryRetriever($this->get[CategoryGateway::class]);
|
|
||||||
|
|
||||||
// Bans
|
|
||||||
$this->get[BanGateway::class] = new BanGateway();
|
|
||||||
$this->get[BanRetriever::class] = new BanRetriever($this->get[BanGateway::class]);
|
|
||||||
|
|
||||||
// Statuses
|
|
||||||
$this->get[StatusGateway::class] = new StatusGateway();
|
|
||||||
|
|
||||||
// Email Sender
|
|
||||||
$this->get[EmailTemplateRetriever::class] = new EmailTemplateRetriever();
|
|
||||||
$this->get[EmailTemplateParser::class] = new EmailTemplateParser($this->get[StatusGateway::class],
|
|
||||||
$this->get[CategoryGateway::class],
|
|
||||||
$this->get[UserGateway::class],
|
|
||||||
$this->get[EmailTemplateRetriever::class]);
|
|
||||||
$this->get[BasicEmailSender::class] = new BasicEmailSender();
|
|
||||||
$this->get[MailgunEmailSender::class] = new MailgunEmailSender();
|
|
||||||
$this->get[EmailSenderHelper::class] = new EmailSenderHelper($this->get[EmailTemplateParser::class],
|
|
||||||
$this->get[BasicEmailSender::class],
|
|
||||||
$this->get[MailgunEmailSender::class]);
|
|
||||||
|
|
||||||
// Tickets
|
|
||||||
$this->get[UserToTicketChecker::class] = new UserToTicketChecker($this->get[UserGateway::class]);
|
|
||||||
$this->get[TicketGateway::class] = new TicketGateway();
|
|
||||||
$this->get[TicketRetriever::class] = new TicketRetriever($this->get[TicketGateway::class],
|
|
||||||
$this->get[UserToTicketChecker::class]);
|
|
||||||
$this->get[TicketValidators::class] = new TicketValidators($this->get[TicketGateway::class]);
|
|
||||||
$this->get[TrackingIdGenerator::class] = new TrackingIdGenerator($this->get[TicketGateway::class]);
|
|
||||||
$this->get[Autoassigner::class] = new Autoassigner($this->get[CategoryGateway::class], $this->get[UserGateway::class]);
|
|
||||||
$this->get[NewTicketValidator::class] = new NewTicketValidator($this->get[CategoryRetriever::class],
|
|
||||||
$this->get[BanRetriever::class],
|
|
||||||
$this->get[TicketValidators::class]);
|
|
||||||
$this->get[TicketCreator::class] = new TicketCreator($this->get[NewTicketValidator::class],
|
|
||||||
$this->get[TrackingIdGenerator::class],
|
|
||||||
$this->get[Autoassigner::class],
|
|
||||||
$this->get[StatusGateway::class],
|
|
||||||
$this->get[TicketGateway::class],
|
|
||||||
$this->get[VerifiedEmailChecker::class],
|
|
||||||
$this->get[EmailSenderHelper::class],
|
|
||||||
$this->get[UserGateway::class],
|
|
||||||
$this->get[ModsForHeskSettingsGateway::class]);
|
|
||||||
$this->get[FileWriter::class] = new FileWriter();
|
|
||||||
$this->get[FileReader::class] = new FileReader();
|
|
||||||
$this->get[FileDeleter::class] = new FileDeleter();
|
|
||||||
$this->get[AttachmentGateway::class] = new AttachmentGateway();
|
|
||||||
$this->get[AttachmentHandler::class] = new AttachmentHandler($this->get[TicketGateway::class],
|
|
||||||
$this->get[AttachmentGateway::class],
|
|
||||||
$this->get[FileWriter::class],
|
|
||||||
$this->get[UserToTicketChecker::class],
|
|
||||||
$this->get[FileDeleter::class]);
|
|
||||||
$this->get[AttachmentRetriever::class] = new AttachmentRetriever($this->get[AttachmentGateway::class],
|
|
||||||
$this->get[FileReader::class],
|
|
||||||
$this->get[TicketGateway::class],
|
|
||||||
$this->get[UserToTicketChecker::class]);
|
|
||||||
$this->get[TicketDeleter::class] =
|
|
||||||
new TicketDeleter($this->get[TicketGateway::class],
|
|
||||||
$this->get[UserToTicketChecker::class],
|
|
||||||
$this->get[AttachmentHandler::class]);
|
|
||||||
$this->get[TicketEditor::class] =
|
|
||||||
new TicketEditor($this->get[TicketGateway::class], $this->get[UserToTicketChecker::class]);
|
|
||||||
|
|
||||||
// Statuses
|
|
||||||
$this->get[StatusRetriever::class] = new StatusRetriever($this->get[StatusGateway::class]);
|
|
||||||
|
|
||||||
// Settings
|
|
||||||
$this->get[SettingsRetriever::class] = new SettingsRetriever($this->get[ModsForHeskSettingsGateway::class]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class BaseClass {
|
||||||
|
static function clazz() {
|
||||||
|
return get_called_class();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class BaseException extends Exception {
|
||||||
|
static function clazz() {
|
||||||
|
return get_called_class();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
class AbstractEvent {
|
||||||
|
public $id;
|
||||||
|
|
||||||
|
public $startTime;
|
||||||
|
|
||||||
|
public $title;
|
||||||
|
|
||||||
|
public $categoryId;
|
||||||
|
|
||||||
|
public $categoryName;
|
||||||
|
|
||||||
|
public $backgroundColor;
|
||||||
|
|
||||||
|
public $foregroundColor;
|
||||||
|
|
||||||
|
public $displayBorder;
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
class BusinessHours {
|
||||||
|
/* @var $dayOfWeek int */
|
||||||
|
public $dayOfWeek;
|
||||||
|
|
||||||
|
/* @var $startTime string */
|
||||||
|
public $startTime;
|
||||||
|
|
||||||
|
/* @var $endTime string */
|
||||||
|
public $endTime;
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
use BusinessLogic\Tickets\AuditTrail;
|
||||||
|
|
||||||
|
class CalendarEvent extends AbstractEvent {
|
||||||
|
public $type = 'CALENDAR';
|
||||||
|
|
||||||
|
public $endTime;
|
||||||
|
|
||||||
|
/* @var $allDay bool */
|
||||||
|
public $allDay;
|
||||||
|
|
||||||
|
public $location;
|
||||||
|
|
||||||
|
public $comments;
|
||||||
|
|
||||||
|
public $reminderValue;
|
||||||
|
|
||||||
|
public $reminderUnits;
|
||||||
|
|
||||||
|
/* @var $auditTrail AuditTrail[] */
|
||||||
|
public $auditTrail = array();
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
use BusinessLogic\DateTimeHelpers;
|
||||||
|
use BusinessLogic\Security\UserContext;
|
||||||
|
use BusinessLogic\Tickets\AuditTrailEntityType;
|
||||||
|
use DataAccess\AuditTrail\AuditTrailGateway;
|
||||||
|
use DataAccess\Calendar\CalendarGateway;
|
||||||
|
|
||||||
|
class CalendarHandler extends \BaseClass {
|
||||||
|
private $calendarGateway;
|
||||||
|
private $auditTrailGateway;
|
||||||
|
|
||||||
|
public function __construct(CalendarGateway $calendarGateway,
|
||||||
|
AuditTrailGateway $auditTrailGateway) {
|
||||||
|
$this->calendarGateway = $calendarGateway;
|
||||||
|
$this->auditTrailGateway = $auditTrailGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEventsForStaff($searchEventsFilter, $heskSettings) {
|
||||||
|
return $this->calendarGateway->getEventsForStaff($searchEventsFilter, $heskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $calendarEvent CalendarEvent
|
||||||
|
* @param $userContext UserContext
|
||||||
|
* @param $heskSettings array
|
||||||
|
* @return CalendarEvent
|
||||||
|
* @throws \Exception If more than one event is returned for the given ID
|
||||||
|
*/
|
||||||
|
public function updateEvent($calendarEvent, $userContext, $heskSettings) {
|
||||||
|
$this->calendarGateway->updateEvent($calendarEvent, $userContext, $heskSettings);
|
||||||
|
|
||||||
|
$this->auditTrailGateway->insertAuditTrailRecord($calendarEvent->id,
|
||||||
|
AuditTrailEntityType::CALENDAR_EVENT,
|
||||||
|
'audit_event_updated',
|
||||||
|
DateTimeHelpers::heskDate($heskSettings),
|
||||||
|
array(0 => $userContext->name . ' (' . $userContext->username . ')'), $heskSettings);
|
||||||
|
|
||||||
|
$eventFilter = new SearchEventsFilter();
|
||||||
|
$eventFilter->eventId = $calendarEvent->id;
|
||||||
|
$eventFilter->reminderUserId = $userContext->id;
|
||||||
|
|
||||||
|
$events = $this->calendarGateway->getEventsForStaff($eventFilter, $heskSettings);
|
||||||
|
|
||||||
|
if (count($events) !== 1) {
|
||||||
|
throw new \Exception("Expected exactly 1 event, found: " . count($events));
|
||||||
|
}
|
||||||
|
|
||||||
|
$event = $events[0];
|
||||||
|
|
||||||
|
return $event;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $calendarEvent CalendarEvent
|
||||||
|
* @param $userContext UserContext
|
||||||
|
* @param $heskSettings array
|
||||||
|
* @return AbstractEvent
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function createEvent($calendarEvent, $userContext, $heskSettings) {
|
||||||
|
$this->calendarGateway->createEvent($calendarEvent, $userContext, $heskSettings);
|
||||||
|
|
||||||
|
$eventFilter = new SearchEventsFilter();
|
||||||
|
$eventFilter->eventId = $calendarEvent->id;
|
||||||
|
$eventFilter->reminderUserId = $userContext->id;
|
||||||
|
|
||||||
|
$events = $this->calendarGateway->getEventsForStaff($eventFilter, $heskSettings);
|
||||||
|
|
||||||
|
if (count($events) !== 1) {
|
||||||
|
throw new \Exception("Expected exactly 1 event, found: " . count($events));
|
||||||
|
}
|
||||||
|
|
||||||
|
$event = $events[0];
|
||||||
|
|
||||||
|
$this->auditTrailGateway->insertAuditTrailRecord($event->id,
|
||||||
|
AuditTrailEntityType::CALENDAR_EVENT,
|
||||||
|
'audit_event_created',
|
||||||
|
DateTimeHelpers::heskDate($heskSettings),
|
||||||
|
array(0 => $userContext->name . ' (' . $userContext->username . ')'), $heskSettings);
|
||||||
|
|
||||||
|
return $event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteEvent($id, $userContext, $heskSettings) {
|
||||||
|
$this->calendarGateway->deleteEvent($id, $userContext, $heskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBusinessHours($heskSettings) {
|
||||||
|
return $this->calendarGateway->getBusinessHours($heskSettings);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
class ReminderUnit {
|
||||||
|
const MINUTE = 0;
|
||||||
|
const HOUR = 1;
|
||||||
|
const DAY = 2;
|
||||||
|
const WEEK = 3;
|
||||||
|
|
||||||
|
static function getByValue($value) {
|
||||||
|
switch ($value) {
|
||||||
|
case 0:
|
||||||
|
return 'MINUTE';
|
||||||
|
case 1:
|
||||||
|
return 'HOUR';
|
||||||
|
case 2:
|
||||||
|
return 'DAY';
|
||||||
|
case 3:
|
||||||
|
return 'WEEK';
|
||||||
|
default:
|
||||||
|
return 'UNKNOWN';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static function getByName($name) {
|
||||||
|
switch ($name) {
|
||||||
|
case 'MINUTE':
|
||||||
|
return self::MINUTE;
|
||||||
|
case 'HOUR':
|
||||||
|
return self::HOUR;
|
||||||
|
case 'DAY':
|
||||||
|
return self::DAY;
|
||||||
|
case 'WEEK':
|
||||||
|
return self::WEEK;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
class SearchEventsFilter {
|
||||||
|
/* @var $startTime int|null */
|
||||||
|
public $startTime;
|
||||||
|
|
||||||
|
/* @var $endTime int|null */
|
||||||
|
public $endTime;
|
||||||
|
|
||||||
|
/* @var $id int|null */
|
||||||
|
public $eventId;
|
||||||
|
|
||||||
|
/* @var $categories int[]|null */
|
||||||
|
public $categories;
|
||||||
|
|
||||||
|
/* @var $reminderUserId int|null */
|
||||||
|
public $reminderUserId;
|
||||||
|
|
||||||
|
/* @var $includeTickets bool */
|
||||||
|
public $includeTickets;
|
||||||
|
|
||||||
|
/* @var $includeUnassignedTickets bool */
|
||||||
|
public $includeUnassignedTickets;
|
||||||
|
|
||||||
|
/* @var $includeTicketsAssignedToOthers bool */
|
||||||
|
public $includeTicketsAssignedToOthers;
|
||||||
|
|
||||||
|
/* @var $includeTicketsAssignedToMe bool */
|
||||||
|
public $includeTicketsAssignedToMe;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
class TicketEvent extends AbstractEvent {
|
||||||
|
public $type = 'TICKET';
|
||||||
|
|
||||||
|
public $trackingId;
|
||||||
|
|
||||||
|
public $subject;
|
||||||
|
|
||||||
|
public $url;
|
||||||
|
|
||||||
|
public $owner;
|
||||||
|
|
||||||
|
public $priority;
|
||||||
|
|
||||||
|
public $status;
|
||||||
|
}
|
@ -0,0 +1,203 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Categories;
|
||||||
|
|
||||||
|
|
||||||
|
use BusinessLogic\Exceptions\AccessViolationException;
|
||||||
|
use BusinessLogic\Exceptions\ValidationException;
|
||||||
|
use BusinessLogic\Navigation\Direction;
|
||||||
|
use BusinessLogic\Security\PermissionChecker;
|
||||||
|
use BusinessLogic\Security\UserPrivilege;
|
||||||
|
use BusinessLogic\ValidationModel;
|
||||||
|
use DataAccess\Categories\CategoryGateway;
|
||||||
|
use DataAccess\Settings\ModsForHeskSettingsGateway;
|
||||||
|
use DataAccess\Tickets\TicketGateway;
|
||||||
|
|
||||||
|
class CategoryHandler extends \BaseClass {
|
||||||
|
/* @var $categoryGateway CategoryGateway */
|
||||||
|
private $categoryGateway;
|
||||||
|
|
||||||
|
/* @var $ticketGateway TicketGateway */
|
||||||
|
private $ticketGateway;
|
||||||
|
|
||||||
|
/* @var $permissionChecker PermissionChecker */
|
||||||
|
private $permissionChecker;
|
||||||
|
|
||||||
|
/* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */
|
||||||
|
private $modsForHeskSettingsGateway;
|
||||||
|
|
||||||
|
function __construct(CategoryGateway $categoryGateway,
|
||||||
|
TicketGateway $ticketGateway,
|
||||||
|
PermissionChecker $permissionChecker,
|
||||||
|
ModsForHeskSettingsGateway $modsForHeskSettingsGateway) {
|
||||||
|
$this->categoryGateway = $categoryGateway;
|
||||||
|
$this->ticketGateway = $ticketGateway;
|
||||||
|
$this->permissionChecker = $permissionChecker;
|
||||||
|
$this->modsForHeskSettingsGateway = $modsForHeskSettingsGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $category Category
|
||||||
|
* @param $userContext
|
||||||
|
* @param $heskSettings array
|
||||||
|
* @return Category The newly created category with ID
|
||||||
|
* @throws ValidationException When validation fails
|
||||||
|
* @throws \Exception When the newly created category was not retrieved
|
||||||
|
*/
|
||||||
|
//TODO Test
|
||||||
|
function createCategory($category, $userContext, $heskSettings) {
|
||||||
|
$modsForHeskSettings = $this->modsForHeskSettingsGateway->getAllSettings($heskSettings);
|
||||||
|
|
||||||
|
$validationModel = $this->validate($category, $userContext);
|
||||||
|
|
||||||
|
if (count($validationModel->errorKeys) > 0) {
|
||||||
|
throw new ValidationException($validationModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $this->categoryGateway->createCategory($category, $heskSettings);
|
||||||
|
|
||||||
|
$allCategories = $this->categoryGateway->getAllCategories($heskSettings, $modsForHeskSettings);
|
||||||
|
|
||||||
|
foreach ($allCategories as $innerCategory) {
|
||||||
|
if ($innerCategory->id === $id) {
|
||||||
|
return $innerCategory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \BaseException("Newly created category {$id} lost! :O");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $category Category
|
||||||
|
* @param $userContext
|
||||||
|
* @param $creating bool
|
||||||
|
* @return ValidationModel
|
||||||
|
* @throws AccessViolationException
|
||||||
|
*/
|
||||||
|
//TODO Test
|
||||||
|
private function validate($category, $userContext, $creating = true) {
|
||||||
|
$validationModel = new ValidationModel();
|
||||||
|
|
||||||
|
if (!$this->permissionChecker->doesUserHavePermission($userContext, UserPrivilege::CAN_MANAGE_CATEGORIES)) {
|
||||||
|
throw new AccessViolationException('User cannot manage categories!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$creating && $category->id < 1) {
|
||||||
|
$validationModel->errorKeys[] = 'ID_MISSING';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category->backgroundColor === null || trim($category->backgroundColor) === '') {
|
||||||
|
$validationModel->errorKeys[] = 'BACKGROUND_COLOR_MISSING';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category->foregroundColor === null || trim($category->foregroundColor) === '') {
|
||||||
|
$validationModel->errorKeys[] = 'FOREGROUND_COLOR_MISSING';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category->name === null || trim($category->name) === '') {
|
||||||
|
$validationModel->errorKeys[] = 'NAME_MISSING';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category->priority === null || intval($category->priority) < 0 || intval($category->priority) > 3) {
|
||||||
|
$validationModel->errorKeys[] = 'INVALID_PRIORITY';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category->autoAssign === null || !is_bool($category->autoAssign)) {
|
||||||
|
$validationModel->errorKeys[] = 'INVALID_AUTOASSIGN';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category->displayBorder === null || !is_bool($category->displayBorder)) {
|
||||||
|
$validationModel->errorKeys[] = 'INVALID_DISPLAY_BORDER';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category->type === null || (intval($category->type) !== 0 && intval($category->type) !== 1)) {
|
||||||
|
$validationModel->errorKeys[] = 'INVALID_TYPE';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $validationModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $category Category
|
||||||
|
* @param $userContext
|
||||||
|
* @param $heskSettings array
|
||||||
|
* @return Category
|
||||||
|
* @throws ValidationException
|
||||||
|
* @throws \Exception When the category is missing
|
||||||
|
*/
|
||||||
|
function editCategory($category, $userContext, $heskSettings) {
|
||||||
|
$modsForHeskSettings = $this->modsForHeskSettingsGateway->getAllSettings($heskSettings);
|
||||||
|
|
||||||
|
$validationModel = $this->validate($category, $userContext, false);
|
||||||
|
|
||||||
|
if (count($validationModel->errorKeys) > 0) {
|
||||||
|
throw new ValidationException($validationModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->categoryGateway->updateCategory($category, $heskSettings);
|
||||||
|
$this->categoryGateway->resortAllCategories($heskSettings);
|
||||||
|
|
||||||
|
$allCategories = $this->categoryGateway->getAllCategories($heskSettings, $modsForHeskSettings);
|
||||||
|
|
||||||
|
foreach ($allCategories as $innerCategory) {
|
||||||
|
if ($innerCategory->id === $category->id) {
|
||||||
|
return $innerCategory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \BaseException("Category {$category->id} vanished! :O");
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteCategory($id, $userContext, $heskSettings) {
|
||||||
|
if (!$this->permissionChecker->doesUserHavePermission($userContext, UserPrivilege::CAN_MANAGE_CATEGORIES)) {
|
||||||
|
throw new AccessViolationException('User cannot manage categories!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id === 1) {
|
||||||
|
throw new \BaseException("Category 1 cannot be deleted!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->ticketGateway->moveTicketsToDefaultCategory($id, $heskSettings);
|
||||||
|
$this->categoryGateway->deleteCategory($id, $heskSettings);
|
||||||
|
$this->categoryGateway->resortAllCategories($heskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortCategory($id, $direction, $heskSettings) {
|
||||||
|
$modsForHeskSettings = $this->modsForHeskSettingsGateway->getAllSettings($heskSettings);
|
||||||
|
|
||||||
|
$categories = $this->categoryGateway->getAllCategories($heskSettings, $modsForHeskSettings);
|
||||||
|
$category = null;
|
||||||
|
foreach ($categories as $innerCategory) {
|
||||||
|
if ($innerCategory->id === intval($id)) {
|
||||||
|
$category = $innerCategory;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category === null) {
|
||||||
|
throw new \BaseException("Could not find category with ID {$id}!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($direction === Direction::UP) {
|
||||||
|
$category->catOrder -= 15;
|
||||||
|
} else {
|
||||||
|
$category->catOrder += 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->categoryGateway->updateCategory($category, $heskSettings);
|
||||||
|
$this->categoryGateway->resortAllCategories($heskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPublicCategories($heskSettings) {
|
||||||
|
$allCategories = $this->categoryGateway->getAllCategories($heskSettings, $this->modsForHeskSettingsGateway->getAllSettings($heskSettings));
|
||||||
|
|
||||||
|
$publicCategories = array();
|
||||||
|
foreach ($allCategories as $category) {
|
||||||
|
if ($category->type === 0) {
|
||||||
|
$publicCategories[] = $category;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $publicCategories;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic;
|
||||||
|
|
||||||
|
|
||||||
|
class DateTimeHelpers {
|
||||||
|
static function heskDate($heskSettings, $dt = '', $isStr = true, $return_str = true) {
|
||||||
|
|
||||||
|
if (!$dt) {
|
||||||
|
$dt = time();
|
||||||
|
} elseif ($isStr) {
|
||||||
|
$dt = strtotime($dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return formatted date
|
||||||
|
return $return_str ? date($heskSettings['timeformat'], $dt) : $dt;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Security;
|
||||||
|
|
||||||
|
|
||||||
|
class PermissionChecker extends \BaseClass {
|
||||||
|
/**
|
||||||
|
* @param $userContext UserContext
|
||||||
|
* @param $permission string
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function doesUserHavePermission($userContext, $permission) {
|
||||||
|
if ($userContext->admin) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($permission, $userContext->permissions)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\ServiceMessages;
|
||||||
|
|
||||||
|
|
||||||
|
class GetServiceMessagesFilter {
|
||||||
|
/* @var $includeStaffServiceMessages bool */
|
||||||
|
public $includeStaffServiceMessages = true;
|
||||||
|
|
||||||
|
/* @var $includeDrafts bool */
|
||||||
|
public $includeDrafts = true;
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\ServiceMessages;
|
||||||
|
|
||||||
|
|
||||||
|
class ServiceMessage extends \BaseClass {
|
||||||
|
/* @var $id int */
|
||||||
|
public $id;
|
||||||
|
|
||||||
|
/* @var $dateCreated string */
|
||||||
|
public $dateCreated;
|
||||||
|
|
||||||
|
/* @var $createdBy int */
|
||||||
|
public $createdBy;
|
||||||
|
|
||||||
|
/* @var $title string */
|
||||||
|
public $title;
|
||||||
|
|
||||||
|
/* @var $message string */
|
||||||
|
public $message;
|
||||||
|
|
||||||
|
/* @var $style string */
|
||||||
|
public $style;
|
||||||
|
|
||||||
|
/* @var $published bool */
|
||||||
|
public $published;
|
||||||
|
|
||||||
|
/* @var $order int */
|
||||||
|
public $order;
|
||||||
|
|
||||||
|
/* @var $icon string */
|
||||||
|
public $icon;
|
||||||
|
|
||||||
|
/* @var $locations string[] */
|
||||||
|
public $locations;
|
||||||
|
|
||||||
|
/* @var $language string */
|
||||||
|
public $language;
|
||||||
|
}
|
@ -0,0 +1,164 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\ServiceMessages;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Test
|
||||||
|
use BusinessLogic\Exceptions\ValidationException;
|
||||||
|
use BusinessLogic\Navigation\Direction;
|
||||||
|
use BusinessLogic\ValidationModel;
|
||||||
|
use DataAccess\ServiceMessages\ServiceMessagesGateway;
|
||||||
|
|
||||||
|
class ServiceMessageHandler extends \BaseClass {
|
||||||
|
/* @var $serviceMessageGateway ServiceMessagesGateway */
|
||||||
|
private $serviceMessageGateway;
|
||||||
|
|
||||||
|
function __construct(ServiceMessagesGateway $serviceMessagesGateway) {
|
||||||
|
$this->serviceMessageGateway = $serviceMessagesGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createServiceMessage($serviceMessage, $heskSettings) {
|
||||||
|
$this->validate($serviceMessage, $heskSettings);
|
||||||
|
|
||||||
|
if ($serviceMessage->icon === null) {
|
||||||
|
switch ($serviceMessage->style) {
|
||||||
|
case ServiceMessageStyle::NONE:
|
||||||
|
$serviceMessage->icon = '';
|
||||||
|
break;
|
||||||
|
case ServiceMessageStyle::INFO:
|
||||||
|
$serviceMessage->icon = 'fa fa-comment';
|
||||||
|
break;
|
||||||
|
case ServiceMessageStyle::NOTICE:
|
||||||
|
$serviceMessage->icon = 'fa fa-exclamation-triangle';
|
||||||
|
break;
|
||||||
|
case ServiceMessageStyle::ERROR:
|
||||||
|
$serviceMessage->icon = 'fa fa-times-circle';
|
||||||
|
break;
|
||||||
|
case ServiceMessageStyle::SUCCESS:
|
||||||
|
$serviceMessage->icon = 'fa fa-check-circle';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->serviceMessageGateway->createServiceMessage($serviceMessage, $heskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getServiceMessages($heskSettings, $searchFilter) {
|
||||||
|
return $this->serviceMessageGateway->getServiceMessages($heskSettings, $searchFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
function editServiceMessage($serviceMessage, $heskSettings) {
|
||||||
|
$this->validate($serviceMessage, $heskSettings, false);
|
||||||
|
|
||||||
|
if ($serviceMessage->icon === null) {
|
||||||
|
switch ($serviceMessage->style) {
|
||||||
|
case ServiceMessageStyle::NONE:
|
||||||
|
$serviceMessage->icon = '';
|
||||||
|
break;
|
||||||
|
case ServiceMessageStyle::INFO:
|
||||||
|
$serviceMessage->icon = 'fa fa-comment';
|
||||||
|
break;
|
||||||
|
case ServiceMessageStyle::NOTICE:
|
||||||
|
$serviceMessage->icon = 'fa fa-exclamation-triangle';
|
||||||
|
break;
|
||||||
|
case ServiceMessageStyle::ERROR:
|
||||||
|
$serviceMessage->icon = 'fa fa-times-circle';
|
||||||
|
break;
|
||||||
|
case ServiceMessageStyle::SUCCESS:
|
||||||
|
$serviceMessage->icon = 'fa fa-check-circle';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->serviceMessageGateway->updateServiceMessage($serviceMessage, $heskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteServiceMessage($id, $heskSettings) {
|
||||||
|
$this->serviceMessageGateway->deleteServiceMessage($id, $heskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortServiceMessage($id, $direction, $heskSettings) {
|
||||||
|
$serviceMessages = $this->serviceMessageGateway->getServiceMessages($heskSettings, new GetServiceMessagesFilter());
|
||||||
|
$serviceMessage = null;
|
||||||
|
foreach ($serviceMessages as $innerServiceMessage) {
|
||||||
|
if (intval($innerServiceMessage->id) === intval($id)) {
|
||||||
|
$serviceMessage = $innerServiceMessage;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($serviceMessage === null) {
|
||||||
|
throw new \BaseException("Could not find service message with ID {$id}!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($direction === Direction::UP) {
|
||||||
|
$serviceMessage->order -= 15;
|
||||||
|
} else {
|
||||||
|
$serviceMessage->order += 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->serviceMessageGateway->updateServiceMessage($serviceMessage, $heskSettings);
|
||||||
|
$this->serviceMessageGateway->resortAllServiceMessages($heskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $serviceMessage ServiceMessage
|
||||||
|
* @param bool $isNew
|
||||||
|
* @throws ValidationException
|
||||||
|
*/
|
||||||
|
private function validate($serviceMessage, $heskSettings, $isNew = true) {
|
||||||
|
$validationModel = new ValidationModel();
|
||||||
|
if ($isNew && $serviceMessage->createdBy < 1) {
|
||||||
|
$validationModel->errorKeys[] = 'MISSING_CREATOR';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($serviceMessage->message === null || trim($serviceMessage->message) === '') {
|
||||||
|
$validationModel->errorKeys[] = 'MISSING_MESSAGE';
|
||||||
|
} else {
|
||||||
|
$htmlPurifier = new \HeskHTMLPurifier($heskSettings['cache_dir']);
|
||||||
|
$serviceMessage->message = $htmlPurifier->heskPurify($serviceMessage->message);
|
||||||
|
}
|
||||||
|
if ($serviceMessage->language === null || trim($serviceMessage->language) === '') {
|
||||||
|
$validationModel->errorKeys[] = 'MISSING_LANGUAGE';
|
||||||
|
}
|
||||||
|
|
||||||
|
$languageFound = false;
|
||||||
|
foreach ($heskSettings['languages'] as $key => $value) {
|
||||||
|
if ($value['folder'] === $serviceMessage->language || $serviceMessage->language === 'ALL') {
|
||||||
|
$languageFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$languageFound && !in_array('MISSING_LANGUAGE', $validationModel->errorKeys)) {
|
||||||
|
$validationModel->errorKeys[] = 'LANGUAGE_NOT_INSTALLED';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($serviceMessage->title === null || trim($serviceMessage->title) === '') {
|
||||||
|
$validationModel->errorKeys[] = 'MISSING_TITLE';
|
||||||
|
}
|
||||||
|
if ($serviceMessage->style === null || trim($serviceMessage->style) === '') {
|
||||||
|
$validationModel->errorKeys[] = 'MISSING_STYLE';
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ServiceMessageStyle::getIdForStyle($serviceMessage->style);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$validationModel->errorKeys[] = 'INVALID_STYLE';
|
||||||
|
}
|
||||||
|
if ($serviceMessage->locations === null || count($serviceMessage->locations) === 0) {
|
||||||
|
$validationModel->errorKeys[] = 'MISSING_LOCATIONS';
|
||||||
|
} else {
|
||||||
|
$locations = ServiceMessageLocation::getAll();
|
||||||
|
foreach ($serviceMessage->locations as $location) {
|
||||||
|
if (!in_array($location, $locations)) {
|
||||||
|
$validationModel->errorKeys[] = 'INVALID_LOCATION';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($validationModel->errorKeys) > 0) {
|
||||||
|
// Validation failed
|
||||||
|
throw new ValidationException($validationModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\ServiceMessages;
|
||||||
|
|
||||||
|
|
||||||
|
class ServiceMessageLocation {
|
||||||
|
const CUSTOMER_HOME = 'CUSTOMER_HOME';
|
||||||
|
const CUSTOMER_KB_HOME = 'CUSTOMER_KB_HOME';
|
||||||
|
const CUSTOMER_VIEW_KB_ARTICLE = 'CUSTOMER_VIEW_KB_ARTICLE';
|
||||||
|
const CUSTOMER_SUBMIT_TICKET = 'CUSTOMER_SUBMIT_TICKET';
|
||||||
|
const CUSTOMER_VIEW_TICKET = 'CUSTOMER_VIEW_TICKET';
|
||||||
|
const STAFF_LOGIN = 'STAFF_LOGIN';
|
||||||
|
const STAFF_HOME = 'STAFF_HOME';
|
||||||
|
const STAFF_KB_HOME = 'STAFF_KB_HOME';
|
||||||
|
const STAFF_VIEW_KB_ARTICLE = 'STAFF_VIEW_KB_ARTICLE';
|
||||||
|
const STAFF_SUBMIT_TICKET = 'STAFF_SUBMIT_TICKET';
|
||||||
|
const STAFF_VIEW_TICKET = 'STAFF_VIEW_TICKET';
|
||||||
|
|
||||||
|
static function getAll() {
|
||||||
|
return array(
|
||||||
|
self::CUSTOMER_HOME,
|
||||||
|
self::CUSTOMER_KB_HOME,
|
||||||
|
self::CUSTOMER_VIEW_KB_ARTICLE,
|
||||||
|
self::CUSTOMER_SUBMIT_TICKET,
|
||||||
|
self::CUSTOMER_VIEW_TICKET,
|
||||||
|
self::STAFF_LOGIN,
|
||||||
|
self::STAFF_HOME,
|
||||||
|
self::STAFF_KB_HOME,
|
||||||
|
self::STAFF_VIEW_KB_ARTICLE,
|
||||||
|
self::STAFF_SUBMIT_TICKET,
|
||||||
|
self::STAFF_VIEW_TICKET,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\ServiceMessages;
|
||||||
|
|
||||||
|
|
||||||
|
class ServiceMessageStyle {
|
||||||
|
const NONE = 'NONE'; // 0
|
||||||
|
const SUCCESS = 'SUCCESS'; // 1
|
||||||
|
const INFO = 'INFO'; // 2
|
||||||
|
const NOTICE = 'NOTICE'; // 3
|
||||||
|
const ERROR = 'ERROR'; // 4
|
||||||
|
|
||||||
|
static function getStyleById($id) {
|
||||||
|
$styles = array(
|
||||||
|
0 => self::NONE,
|
||||||
|
1 => self::SUCCESS,
|
||||||
|
2 => self::INFO,
|
||||||
|
3 => self::NOTICE,
|
||||||
|
4 => self::ERROR
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!isset($styles[$id])) {
|
||||||
|
throw new \Exception("Style {$id} is not a valid service message style.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $styles[$id];
|
||||||
|
}
|
||||||
|
|
||||||
|
static function getIdForStyle($style) {
|
||||||
|
$styles = array(
|
||||||
|
self::NONE => 0,
|
||||||
|
self::SUCCESS => 1,
|
||||||
|
self::INFO => 2,
|
||||||
|
self::NOTICE => 3,
|
||||||
|
self::ERROR => 4
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!isset($styles[$style])) {
|
||||||
|
throw new \Exception("Style {$style} is not a valid service message style.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $styles[$style];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Tickets;
|
||||||
|
|
||||||
|
|
||||||
|
class AuditTrail extends \BaseClass {
|
||||||
|
/* @var $id int */
|
||||||
|
public $id;
|
||||||
|
|
||||||
|
/* @var $entityId int */
|
||||||
|
public $entityId;
|
||||||
|
|
||||||
|
/* @var $entityType string */
|
||||||
|
public $entityType;
|
||||||
|
|
||||||
|
/* @var $languageKey string */
|
||||||
|
public $languageKey;
|
||||||
|
|
||||||
|
/* @var $date string */
|
||||||
|
public $date;
|
||||||
|
|
||||||
|
/* @var $replacementValues string[] */
|
||||||
|
public $replacementValues;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Tickets;
|
||||||
|
|
||||||
|
|
||||||
|
class AuditTrailEntityType extends \BaseClass {
|
||||||
|
const TICKET = 'TICKET';
|
||||||
|
const CALENDAR_EVENT = 'CALENDAR_EVENT';
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Tickets;
|
||||||
|
|
||||||
|
|
||||||
|
class AuditTrailEvent extends \BaseClass {
|
||||||
|
const DUE_DATE_REMOVED = 'audit_due_date_removed';
|
||||||
|
const DUE_DATE_CHANGED = 'audit_due_date_changed';
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue