mirror of
https://github.com/espocrm/espocrm.git
synced 2026-03-06 08:57:01 +00:00
Compare commits
430 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
083e248f21 | ||
|
|
df422f6365 | ||
|
|
47a2fee51d | ||
|
|
4b0be0137c | ||
|
|
38514941b8 | ||
|
|
d79993ba11 | ||
|
|
da62759130 | ||
|
|
2e04fd5a3b | ||
|
|
6174245b22 | ||
|
|
9b9d3d9634 | ||
|
|
e13a722dca | ||
|
|
dba325aa61 | ||
|
|
59dccbedbd | ||
|
|
df32edf85f | ||
|
|
0385513f0e | ||
|
|
710fdebbec | ||
|
|
7b707716f9 | ||
|
|
8cdb2df433 | ||
|
|
6c1fb42f59 | ||
|
|
233da7a0be | ||
|
|
612f73dac9 | ||
|
|
3ae7634b15 | ||
|
|
9cfabebdad | ||
|
|
0522796fe3 | ||
|
|
261e76458a | ||
|
|
4f2d218a82 | ||
|
|
4f531da9f5 | ||
|
|
c8adb52b7a | ||
|
|
5152e1ff36 | ||
|
|
5b1cfbdcfc | ||
|
|
00b690da99 | ||
|
|
ed63848efa | ||
|
|
d174fe3e6f | ||
|
|
e1a505955e | ||
|
|
a30b638a8d | ||
|
|
c37fb02b9e | ||
|
|
3fc5b08969 | ||
|
|
0209bc3cd3 | ||
|
|
db02fc4e55 | ||
|
|
d7787a829e | ||
|
|
acdea144bc | ||
|
|
700bb150bb | ||
|
|
9a22ed262b | ||
|
|
65827b2c02 | ||
|
|
e23e80347b | ||
|
|
ddedbfc999 | ||
|
|
d6144f777c | ||
|
|
a328eff3ae | ||
|
|
45bc019967 | ||
|
|
2aafca7ae4 | ||
|
|
13a38f9767 | ||
|
|
fcf07cdf7c | ||
|
|
723a01c12d | ||
|
|
0c1526cb69 | ||
|
|
e25cd0c1a5 | ||
|
|
a3683b76b8 | ||
|
|
e4e56489d7 | ||
|
|
1db01f1b5f | ||
|
|
d9a134bb3a | ||
|
|
1cb762fae7 | ||
|
|
16e57e38a3 | ||
|
|
42cb6fff5c | ||
|
|
55239615ef | ||
|
|
6083531c4a | ||
|
|
65cae656c3 | ||
|
|
ab928c56ad | ||
|
|
884a135397 | ||
|
|
da2baec89d | ||
|
|
59dfa99ff3 | ||
|
|
e15c748470 | ||
|
|
51fc8ac9b1 | ||
|
|
a4c0d7874f | ||
|
|
2f62a455a3 | ||
|
|
a7a3d8a0a7 | ||
|
|
1a7774341a | ||
|
|
0d4565962f | ||
|
|
a2ff2e2f5e | ||
|
|
b038a9449f | ||
|
|
160d10c5d1 | ||
|
|
4eb842d37d | ||
|
|
7fd78a71fd | ||
|
|
88fb06d982 | ||
|
|
c8a208db4b | ||
|
|
2aaec4ea99 | ||
|
|
b64c897f33 | ||
|
|
64bf4b8296 | ||
|
|
52bb6d10be | ||
|
|
3527abb171 | ||
|
|
8bdbac85a8 | ||
|
|
13eb8630ca | ||
|
|
e749ec6943 | ||
|
|
c0d0c72392 | ||
|
|
f1834147c7 | ||
|
|
e044d34abd | ||
|
|
bfcc5b0b14 | ||
|
|
7a5b3b23e6 | ||
|
|
9e15565227 | ||
|
|
79e6befdf4 | ||
|
|
07ff4cb3d1 | ||
|
|
961a5bb8a0 | ||
|
|
bf5f0e0e7f | ||
|
|
329f05fd5b | ||
|
|
2661511bbc | ||
|
|
cea3c8609b | ||
|
|
35cbbb06ce | ||
|
|
1383a5d5da | ||
|
|
67857ef93c | ||
|
|
f93cc5b472 | ||
|
|
e9df433b27 | ||
|
|
dc300dbbe0 | ||
|
|
c6b905d503 | ||
|
|
73c1cc40eb | ||
|
|
38cf2d8500 | ||
|
|
747c7742da | ||
|
|
5365818d82 | ||
|
|
eddc32ebd7 | ||
|
|
7ae41e414b | ||
|
|
6572d2a998 | ||
|
|
6a2314060f | ||
|
|
6a5e22eaa0 | ||
|
|
98f77041e8 | ||
|
|
5fb0ddb1d2 | ||
|
|
7bfedff3c8 | ||
|
|
cc364bc088 | ||
|
|
81fd286834 | ||
|
|
7d3af14f4d | ||
|
|
37f5244790 | ||
|
|
61fd827dca | ||
|
|
de68abfbb4 | ||
|
|
03ecfdb805 | ||
|
|
2061bf68af | ||
|
|
79f9aae744 | ||
|
|
d6fe7b59eb | ||
|
|
7287854cc0 | ||
|
|
dd5a395061 | ||
|
|
da1b92fdd4 | ||
|
|
f1f23b37c4 | ||
|
|
fea5669078 | ||
|
|
9fb88a6b92 | ||
|
|
3eb6648d2b | ||
|
|
7e8f0db610 | ||
|
|
6c57d9c658 | ||
|
|
bc3e873ef7 | ||
|
|
50105087cc | ||
|
|
f3406f1fcd | ||
|
|
8e105205a4 | ||
|
|
6a496be1fa | ||
|
|
ecc6e9f4ec | ||
|
|
deee30eb3e | ||
|
|
c92ba7f8f6 | ||
|
|
5f46b2f74a | ||
|
|
5c642f93e9 | ||
|
|
915c58e9ab | ||
|
|
ff437c204f | ||
|
|
e25bfbf1d7 | ||
|
|
ab4e16e9e7 | ||
|
|
d60d8bdcae | ||
|
|
a1f641af7a | ||
|
|
5cae8f359a | ||
|
|
19e10aa748 | ||
|
|
0e24774fb9 | ||
|
|
31d31fca73 | ||
|
|
f874aed44f | ||
|
|
04ce825191 | ||
|
|
516f2218d4 | ||
|
|
3cbf1447c9 | ||
|
|
1c3ca4aa5a | ||
|
|
143ab06a74 | ||
|
|
c9609bf707 | ||
|
|
291380c6b4 | ||
|
|
74edceaf67 | ||
|
|
84754077c5 | ||
|
|
e2dae62fa9 | ||
|
|
e0d475e2da | ||
|
|
02cdf522f6 | ||
|
|
8345307760 | ||
|
|
888bb9d3db | ||
|
|
0a0f8da2f4 | ||
|
|
bb5d5a0ccf | ||
|
|
1bd5eac103 | ||
|
|
61957e628b | ||
|
|
97aab07d77 | ||
|
|
c5296bf906 | ||
|
|
707f1a0b5c | ||
|
|
5ffa68bee1 | ||
|
|
a16919f10b | ||
|
|
7050757e4e | ||
|
|
cbd7ef4737 | ||
|
|
d27e9c91e7 | ||
|
|
5e1c7bce33 | ||
|
|
a23ac54da0 | ||
|
|
260c050f36 | ||
|
|
fc5c07927f | ||
|
|
d321f0d701 | ||
|
|
dddedcf088 | ||
|
|
95cbc138f7 | ||
|
|
395063ea35 | ||
|
|
835f95eb52 | ||
|
|
c0f6c91a0e | ||
|
|
b410d0e66f | ||
|
|
52853a4dc4 | ||
|
|
d04f72cfd8 | ||
|
|
a9203b8e22 | ||
|
|
31c7fdcfa6 | ||
|
|
e89c7c9328 | ||
|
|
7808865080 | ||
|
|
5283d1b6ae | ||
|
|
da6546779a | ||
|
|
404e2de3b6 | ||
|
|
9ba2611f3f | ||
|
|
f02dabc540 | ||
|
|
c29da46a97 | ||
|
|
b7702d2418 | ||
|
|
2bc56db4c6 | ||
|
|
dd0ef5455e | ||
|
|
7cffefff1c | ||
|
|
a8396df12a | ||
|
|
901bee6d3f | ||
|
|
3375eff719 | ||
|
|
72a0415207 | ||
|
|
de69652137 | ||
|
|
f6b696aad6 | ||
|
|
e7018965c9 | ||
|
|
126eaed2ca | ||
|
|
8916b5eca8 | ||
|
|
dda34dce5f | ||
|
|
1cd2d6b35e | ||
|
|
9888ec8a6f | ||
|
|
e2d5592d0a | ||
|
|
242d1fcfe5 | ||
|
|
77b0ebfa76 | ||
|
|
ea5321577a | ||
|
|
89508ccc3e | ||
|
|
24d80f86e5 | ||
|
|
23c772e029 | ||
|
|
e0b6c2cf6f | ||
|
|
e67387d9ea | ||
|
|
aac356d2a3 | ||
|
|
2156094407 | ||
|
|
54a6bc9c87 | ||
|
|
03d5bf1ef2 | ||
|
|
b12b3895ec | ||
|
|
42f57409c8 | ||
|
|
69d7ce408d | ||
|
|
15b3c0440c | ||
|
|
e1f0715c4d | ||
|
|
15aec72e97 | ||
|
|
66eade5db7 | ||
|
|
ea733bb48e | ||
|
|
83d9d1d924 | ||
|
|
5935bb012d | ||
|
|
48139b2be8 | ||
|
|
415babde64 | ||
|
|
f5f5f46c75 | ||
|
|
3d89e25349 | ||
|
|
1f57a01d5d | ||
|
|
7c890aa83a | ||
|
|
62a29c86ab | ||
|
|
bd57b6bb8e | ||
|
|
9ab1d16ea0 | ||
|
|
435aa28ca2 | ||
|
|
4bd375f154 | ||
|
|
d6521f9176 | ||
|
|
f8e0e4955a | ||
|
|
7957359c15 | ||
|
|
bdc3731b9a | ||
|
|
6b8af1220b | ||
|
|
58fffeaa84 | ||
|
|
5806785286 | ||
|
|
2f2d9b5f6f | ||
|
|
5af20c1ee0 | ||
|
|
7620be3b40 | ||
|
|
86f591b409 | ||
|
|
533dfe24d0 | ||
|
|
10c51dc46e | ||
|
|
a9d24a1e09 | ||
|
|
0cfe093701 | ||
|
|
11ec99fe6a | ||
|
|
b07e5a6da2 | ||
|
|
151738f896 | ||
|
|
075a370e7a | ||
|
|
e7aa147b90 | ||
|
|
2e988fab6d | ||
|
|
b38e03a53a | ||
|
|
68e01f9e6f | ||
|
|
4d32955e28 | ||
|
|
13a2aa7f03 | ||
|
|
ac91087b82 | ||
|
|
57a4a30402 | ||
|
|
dd3ee8d69a | ||
|
|
accbc9582e | ||
|
|
4a2845d7a5 | ||
|
|
9b2ae8992f | ||
|
|
1bb0038be8 | ||
|
|
6c4e73f1c4 | ||
|
|
72f5dbea87 | ||
|
|
aeb8411695 | ||
|
|
df6db9bd47 | ||
|
|
ab17044da9 | ||
|
|
7356bd98ab | ||
|
|
a631e52f63 | ||
|
|
b925100df7 | ||
|
|
eeba65440c | ||
|
|
95f72933a4 | ||
|
|
4b03e74662 | ||
|
|
b316eeb3eb | ||
|
|
53e6904ce1 | ||
|
|
e2b9647cf1 | ||
|
|
1145406531 | ||
|
|
9ce65c9a2b | ||
|
|
2ec1db8379 | ||
|
|
8074baef56 | ||
|
|
4584211c04 | ||
|
|
290099641b | ||
|
|
d0c3044e8e | ||
|
|
4e983ff440 | ||
|
|
9aba8b0d8f | ||
|
|
ee6ef6694f | ||
|
|
8330137c4e | ||
|
|
bd420ad963 | ||
|
|
e03bedf439 | ||
|
|
5cba246bb2 | ||
|
|
3490c16285 | ||
|
|
957fda9e8e | ||
|
|
b940adc341 | ||
|
|
f44a093ea9 | ||
|
|
0b6dc1ff5f | ||
|
|
907eb5feb5 | ||
|
|
17a339c318 | ||
|
|
3bea161618 | ||
|
|
b39a4a3624 | ||
|
|
2530d13d25 | ||
|
|
67e152c923 | ||
|
|
4934d4ad95 | ||
|
|
9a072949fd | ||
|
|
6e5f8676a1 | ||
|
|
5a52484295 | ||
|
|
a3338b0db7 | ||
|
|
d212d4a193 | ||
|
|
e3f9a0f607 | ||
|
|
91b7635d26 | ||
|
|
532581cb50 | ||
|
|
9b4a3a8ca9 | ||
|
|
564c397258 | ||
|
|
22e81898c0 | ||
|
|
ec863fe09a | ||
|
|
cb9a1d31d8 | ||
|
|
0e8d0495a9 | ||
|
|
fa19e5ebce | ||
|
|
b67e8960fa | ||
|
|
6efd697a1e | ||
|
|
a9379dcf0a | ||
|
|
9798f399bd | ||
|
|
a520510f9b | ||
|
|
fbfe82870f | ||
|
|
3b668f4dbd | ||
|
|
62eb54d853 | ||
|
|
81335454fd | ||
|
|
1b33221fc1 | ||
|
|
152c96838f | ||
|
|
f78af9b204 | ||
|
|
302b9e759f | ||
|
|
dab7e329df | ||
|
|
6a93fe77ca | ||
|
|
0e21a9bf91 | ||
|
|
723f504a56 | ||
|
|
121b324532 | ||
|
|
c54a4eee95 | ||
|
|
2a03797436 | ||
|
|
55dc4d1e77 | ||
|
|
cb51feef48 | ||
|
|
e75c957aad | ||
|
|
e08624fae3 | ||
|
|
e8ac486d4a | ||
|
|
1ded65b85d | ||
|
|
35b2f0e57e | ||
|
|
d6ef8e1b33 | ||
|
|
118025f646 | ||
|
|
0888752e2a | ||
|
|
df5177a565 | ||
|
|
3f03770b6e | ||
|
|
27ebac0722 | ||
|
|
e5b46bc547 | ||
|
|
468a236ce1 | ||
|
|
6fda3dd147 | ||
|
|
9f0705c82d | ||
|
|
0ab0de2371 | ||
|
|
ba7d79ef39 | ||
|
|
c0e51d85b5 | ||
|
|
80334d59ff | ||
|
|
759ad1a8d3 | ||
|
|
7c569d3880 | ||
|
|
7b21b82a2e | ||
|
|
5e86c5da8c | ||
|
|
9998f82596 | ||
|
|
9cb3f5fb3a | ||
|
|
dcce3335cd | ||
|
|
5f9b4d99f3 | ||
|
|
a6f4111383 | ||
|
|
569180ed86 | ||
|
|
f9cc21a06d | ||
|
|
e5ad31a965 | ||
|
|
5252d63260 | ||
|
|
a9fea0b9f5 | ||
|
|
cee91eb6af | ||
|
|
c61765cc31 | ||
|
|
03d3884bf4 | ||
|
|
cb01caddd3 | ||
|
|
45d2cec423 | ||
|
|
6d86c65ea6 | ||
|
|
2571f967b7 | ||
|
|
a93d5a0678 | ||
|
|
be1647548a | ||
|
|
91571fa47c | ||
|
|
cf3220581f | ||
|
|
99b4f7eb5c | ||
|
|
803111b12f | ||
|
|
2ceb686198 | ||
|
|
cefe304c2f | ||
|
|
cbe4f0009b | ||
|
|
2d1aa77ddc | ||
|
|
5357061d52 | ||
|
|
13b7db63d0 | ||
|
|
62b0020c67 | ||
|
|
4512dfd420 | ||
|
|
b1303cb50e | ||
|
|
3facbc782b | ||
|
|
dae249e4b2 | ||
|
|
2497ab6a5e | ||
|
|
2d00b27fb6 |
12
Gruntfile.js
12
Gruntfile.js
@@ -46,7 +46,7 @@ module.exports = function (grunt) {
|
||||
mkdir: {
|
||||
tmp: {
|
||||
options: {
|
||||
mode: 0775,
|
||||
mode: 0755,
|
||||
create: [
|
||||
'build/tmp',
|
||||
]
|
||||
@@ -188,6 +188,16 @@ module.exports = function (grunt) {
|
||||
'build/EspoCRM-<%= pkg.version %>/**/*.html',
|
||||
'build/EspoCRM-<%= pkg.version %>/**/*.txt',
|
||||
]
|
||||
},
|
||||
folders: {
|
||||
options: {
|
||||
mode: '755'
|
||||
},
|
||||
src: [
|
||||
'build/EspoCRM-<%= pkg.version %>/install',
|
||||
'build/EspoCRM-<%= pkg.version %>/api',
|
||||
'build/EspoCRM-<%= pkg.version %>/api/v1',
|
||||
]
|
||||
}
|
||||
},
|
||||
replace: {
|
||||
|
||||
14
LICENSE.txt
14
LICENSE.txt
@@ -631,29 +631,29 @@ to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
EspoCRM - Open Source CRM
|
||||
Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
EspoCRM is free software: you can redistribute it and/or modify
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
EspoCRM is distributed in the hope that it will be useful,
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with EspoCRM. If not, see <http://www.gnu.org/licenses/>.
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
EspoCRM Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
EspoCRM comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
|
||||
12
README.md
12
README.md
@@ -40,20 +40,24 @@ You need to have nodejs and Grunt CLI installed.
|
||||
|
||||
The build will be created in the `build` directory.
|
||||
|
||||
### How to make translation
|
||||
### How to contribute
|
||||
|
||||
Before we can merge your pull request you need to accept our CLA [here](https://github.com/espocrm/cla). It's very simple to do.
|
||||
|
||||
### How to make a translation
|
||||
|
||||
Build po file with command:
|
||||
`node po.js en_EN`
|
||||
(specify needed language instead of en_EN)
|
||||
|
||||
After that tranlate the generated po file.
|
||||
After that translate the generated po file.
|
||||
|
||||
Build json files from the translated po file:
|
||||
|
||||
1. Put your po file espocrm-en_EN.po to the `build` directory
|
||||
1. Put your po file espocrm-en_EN.po into `build` directory
|
||||
2. Run `node lang.js en_EN`
|
||||
|
||||
The files will be created in build directory.
|
||||
Json files will be created in build directory grouped by folders.
|
||||
|
||||
### License
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
require_once('../../bootstrap.php');
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Acl;
|
||||
|
||||
53
application/Espo/Acl/EmailFilter.php
Normal file
53
application/Espo/Acl/EmailFilter.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Acl;
|
||||
|
||||
use \Espo\Entities\User;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class EmailFilter extends \Espo\Core\Acl\Base
|
||||
{
|
||||
public function checkIsOwner(User $user, Entity $entity)
|
||||
{
|
||||
if ($entity->has('parentId') && $entity->has('parentType')) {
|
||||
$parentType = $entity->get('parentType');
|
||||
$parentId = $entity->get('parentId');
|
||||
if (!$parentType || !$parentId) return;
|
||||
|
||||
$parent = $this->getEntityManager()->getEntity($parentType, $parentId);
|
||||
if ($parent && $parent->has('assignedUserId') && $parent->get('assignedUserId') === $user->id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
@@ -63,25 +70,93 @@ class Email extends \Espo\Core\Controllers\Record
|
||||
return $this->getRecordService()->sendTestEmail($data);
|
||||
}
|
||||
|
||||
public function actionMarkAsRead($params, $data, $request)
|
||||
public function postActionMarkAsRead($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
if (empty($data['ids']) || !is_array($data['ids'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$ids = $data['ids'];
|
||||
|
||||
return $this->getRecordService()->markAsReadByIds($ids);
|
||||
return $this->getRecordService()->markAsReadByIdList($ids);
|
||||
}
|
||||
|
||||
public function actionMarkAllAsRead($params, $data, $request)
|
||||
public function postActionMarkAsNotRead($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->markAsNotReadByIdList($ids);
|
||||
}
|
||||
|
||||
public function postActionMarkAllAsRead($params, $data, $request)
|
||||
{
|
||||
return $this->getRecordService()->markAllAsRead();
|
||||
}
|
||||
|
||||
public function postActionMarkAsImportant($params, $data, $request)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->markAsImportantByIdList($ids);
|
||||
}
|
||||
|
||||
public function postActionMarkAsNotImportant($params, $data, $request)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->markAsNotImportantByIdList($ids);
|
||||
}
|
||||
|
||||
public function postActionMoveToTrash($params, $data)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->moveToTrashByIdList($ids);
|
||||
}
|
||||
|
||||
public function postActionRetrieveFromTrash($params, $data)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->retrieveFromTrashByIdList($ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
36
application/Espo/Controllers/EmailFilter.php
Normal file
36
application/Espo/Controllers/EmailFilter.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
class EmailFilter extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
@@ -158,15 +165,31 @@ class EntityManager extends \Espo\Core\Controllers\Base
|
||||
'linkType'
|
||||
];
|
||||
|
||||
$d = array();
|
||||
$additionalParamList = [
|
||||
'relationName',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
|
||||
foreach ($paramList as $item) {
|
||||
if (empty($data[$item])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$d[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
$params[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->createLink($d);
|
||||
foreach ($additionalParamList as $item) {
|
||||
$params[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
if (array_key_exists('linkMultipleField', $data)) {
|
||||
$params['linkMultipleField'] = $data['linkMultipleField'];
|
||||
}
|
||||
if (array_key_exists('linkMultipleFieldForeign', $data)) {
|
||||
$params['linkMultipleFieldForeign'] = $data['linkMultipleFieldForeign'];
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->createLink($params);
|
||||
|
||||
if ($result) {
|
||||
$this->getContainer()->get('dataManager')->rebuild();
|
||||
@@ -192,12 +215,25 @@ class EntityManager extends \Espo\Core\Controllers\Base
|
||||
'labelForeign'
|
||||
];
|
||||
|
||||
$d = array();
|
||||
$additionalParamList = [];
|
||||
|
||||
$params = array();
|
||||
foreach ($paramList as $item) {
|
||||
$d[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
$params[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->updateLink($d);
|
||||
foreach ($additionalParamList as $item) {
|
||||
$params[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
if (array_key_exists('linkMultipleField', $data)) {
|
||||
$params['linkMultipleField'] = $data['linkMultipleField'];
|
||||
}
|
||||
if (array_key_exists('linkMultipleFieldForeign', $data)) {
|
||||
$params['linkMultipleFieldForeign'] = $data['linkMultipleFieldForeign'];
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->updateLink($params);
|
||||
|
||||
if ($result) {
|
||||
$this->getContainer()->get('dataManager')->clearCache();
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
@@ -85,7 +92,7 @@ class ExternalAccount extends \Espo\Core\Controllers\Record
|
||||
|
||||
public function actionPatch($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost() && !$request->isPatch()) {
|
||||
if (!$request->isPut() && !$request->isPost() && !$request->isPatch()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
@@ -29,7 +36,7 @@ class GlobalSearch extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
public function actionSearch($params, $data, $request)
|
||||
{
|
||||
$query = $params['query'];
|
||||
$query = $request->get('q');
|
||||
|
||||
$offset = intval($request->get('offset'));
|
||||
$maxSize = intval($request->get('maxSize'));
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
@@ -133,6 +140,10 @@ class Import extends \Espo\Core\Controllers\Record
|
||||
'action' => $data['action'],
|
||||
);
|
||||
|
||||
if (array_key_exists('updateBy', $data)) {
|
||||
$importParams['updateBy'] = $data['updateBy'];
|
||||
}
|
||||
|
||||
$attachmentId = $data['attachmentId'];
|
||||
|
||||
if (!$this->getAcl()->check($data['entityType'], 'edit')) {
|
||||
@@ -141,5 +152,14 @@ class Import extends \Espo\Core\Controllers\Record
|
||||
|
||||
return $this->getService('Import')->import($data['entityType'], $data['fields'], $attachmentId, $importParams);
|
||||
}
|
||||
|
||||
public function postActionUnmarkAsDuplicate($params, $data)
|
||||
{
|
||||
if (empty($data['id']) || empty($data['entityType']) || empty($data['entityId'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$this->getService('Import')->unmarkAsDuplicate($data['id'], $data['entityType'], $data['entityId']);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
@@ -77,7 +84,7 @@ class Preferences extends \Espo\Core\Controllers\Base
|
||||
$userId = $params['id'];
|
||||
$this->handleUserAccess($userId);
|
||||
|
||||
if (!$request->isPost() && !$request->isPatch()) {
|
||||
if (!$request->isPost() && !$request->isPatch() && !$request->isPut()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,17 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
class Role extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
@@ -26,7 +33,7 @@ use \Espo\Core\Exceptions\Error;
|
||||
|
||||
class Stream extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
const MAX_SIZE_LIMIT = 400;
|
||||
const MAX_SIZE_LIMIT = 200;
|
||||
|
||||
public static $defaultAction = 'list';
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -18,17 +18,27 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\Entities\User;
|
||||
|
||||
class Acl
|
||||
{
|
||||
private $user;
|
||||
|
||||
private $aclManager;
|
||||
|
||||
public function __construct(AclManager $aclManager, \Espo\Entities\User $user)
|
||||
public function __construct(AclManager $aclManager, User $user)
|
||||
{
|
||||
$this->aclManager = $aclManager;
|
||||
$this->user = $user;
|
||||
@@ -78,5 +88,10 @@ class Acl
|
||||
{
|
||||
return $this->getAclManager()->checkScope($this->getUser(), $scope, $action, $isOwner, $inTeam, $entity) ;
|
||||
}
|
||||
|
||||
public function checkUser($permission, User $entity)
|
||||
{
|
||||
return $this->getAclManager()->checkUser($this->getUser(), $permission, $entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Acl;
|
||||
@@ -81,7 +88,7 @@ class Base implements Injectable
|
||||
return $this->getInjection('aclManager');
|
||||
}
|
||||
|
||||
public function checkReadOnlyTeam(User $user, $scope, $data)
|
||||
public function checkReadOnlyTeam(User $user, $data)
|
||||
{
|
||||
if (empty($data) || !is_array($data) || !isset($data['read'])) {
|
||||
return false;
|
||||
@@ -89,7 +96,7 @@ class Base implements Injectable
|
||||
return $data['read'] === 'team';
|
||||
}
|
||||
|
||||
public function checkReadOnlyOwn(User $user, $scope, $data)
|
||||
public function checkReadOnlyOwn(User $user, $data)
|
||||
{
|
||||
if (empty($data) || !is_array($data) || !isset($data['read'])) {
|
||||
return false;
|
||||
@@ -160,10 +167,11 @@ class Base implements Injectable
|
||||
if ($user->id === $entity->get('assignedUserId')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ($entity->has('createdById')) {
|
||||
if ($user->id === $entity->get('createdById')) {
|
||||
return true;
|
||||
} else {
|
||||
if ($entity->has('createdById')) {
|
||||
if ($user->id === $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Acl;
|
||||
@@ -81,7 +88,12 @@ class Table
|
||||
public function getScopeData($scope)
|
||||
{
|
||||
if (array_key_exists($scope, $this->data['table'])) {
|
||||
return $this->data['table'][$scope];
|
||||
$data = $this->data['table'][$scope];
|
||||
if (is_string($data)) {
|
||||
$data = $this->getScopeData($data);
|
||||
return $data;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
@@ -124,7 +131,7 @@ class AclManager
|
||||
return false;
|
||||
}
|
||||
$data = $this->getTable($user)->getScopeData($scope);
|
||||
return $this->getImplementation($scope)->checkReadOnlyTeam($user, $scope, $data);
|
||||
return $this->getImplementation($scope)->checkReadOnlyTeam($user, $data);
|
||||
}
|
||||
|
||||
public function checkReadOnlyOwn(User $user, $scope)
|
||||
@@ -133,7 +140,7 @@ class AclManager
|
||||
return false;
|
||||
}
|
||||
$data = $this->getTable($user)->getScopeData($scope);
|
||||
return $this->getImplementation($scope)->checkReadOnlyOwn($user, $scope, $data);
|
||||
return $this->getImplementation($scope)->checkReadOnlyOwn($user, $data);
|
||||
}
|
||||
|
||||
public function check(User $user, $subject, $action = null, $isOwner = null, $inTeam = null)
|
||||
@@ -177,5 +184,34 @@ class AclManager
|
||||
$data = $this->getTable($user)->getScopeData($scope);
|
||||
return $this->getImplementation($scope)->checkScope($user, $data, $scope, $action, $isOwner, $inTeam, $entity);
|
||||
}
|
||||
|
||||
public function checkUser(User $user, $permission, User $entity)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
if ($this->get($user, $permission) === 'no') {
|
||||
if ($entity->id !== $user->id) {
|
||||
return false;
|
||||
}
|
||||
} else if ($this->get($user, $permission) === 'team') {
|
||||
if ($entity->id != $user->id) {
|
||||
$teamIdList1 = $user->getTeamIdList();
|
||||
$teamIdList2 = $entity->getTeamIdList();
|
||||
|
||||
$inTeam = false;
|
||||
foreach ($teamIdList1 as $id) {
|
||||
if (in_array($id, $teamIdList2)) {
|
||||
$inTeam = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$inTeam) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,17 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
|
||||
class Application
|
||||
{
|
||||
private $metadata;
|
||||
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
class Container
|
||||
{
|
||||
|
||||
@@ -81,16 +87,19 @@ class Container
|
||||
|
||||
protected function loadLog()
|
||||
{
|
||||
$logConfig = $this->get('config')->get('logger');
|
||||
$config = $this->get('config');
|
||||
|
||||
$path = $config->get('logger.path', 'data/logs/espo.log');
|
||||
$rotation = $config->get('logger.rotation', true);
|
||||
|
||||
$log = new \Espo\Core\Utils\Log('Espo');
|
||||
$levelCode = $log->getLevelCode($config->get('logger.level', 'WARNING'));
|
||||
|
||||
$levelCode = $log->getLevelCode($logConfig['level']);
|
||||
|
||||
if ($logConfig['isRotate']) {
|
||||
$handler = new \Espo\Core\Utils\Log\Monolog\Handler\RotatingFileHandler($logConfig['path'], $logConfig['maxRotateFiles'], $levelCode);
|
||||
if ($rotation) {
|
||||
$maxFileNumber = $config->get('logger.maxFileNumber', 30);
|
||||
$handler = new \Espo\Core\Utils\Log\Monolog\Handler\RotatingFileHandler($path, $maxFileNumber, $levelCode);
|
||||
} else {
|
||||
$handler = new \Espo\Core\Utils\Log\Monolog\Handler\StreamHandler($logConfig['path'], $levelCode);
|
||||
$handler = new \Espo\Core\Utils\Log\Monolog\Handler\StreamHandler($path, $levelCode);
|
||||
}
|
||||
$log->pushHandler($handler);
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
@@ -99,7 +106,7 @@ class ControllerManager
|
||||
}
|
||||
|
||||
if (!method_exists($controller, $primaryActionMethodName)) {
|
||||
throw new NotFound("Action '$actionName' (".$request->getMethod().") does not exist in controller '$controller'");
|
||||
throw new NotFound("Action '$actionName' (".$request->getMethod().") does not exist in controller '$controllerName'");
|
||||
}
|
||||
|
||||
if (method_exists($controller, $beforeMethodName)) {
|
||||
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Controllers;
|
||||
|
||||
use \Espo\Core\Container;
|
||||
use \Espo\Core\ServiceFactory;
|
||||
use \Espo\Core\Utils\Util;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Controllers;
|
||||
@@ -124,6 +131,9 @@ class Record extends Base
|
||||
$asc = $request->get('asc') === 'true';
|
||||
$sortBy = $request->get('sortBy');
|
||||
$q = $request->get('q');
|
||||
$primaryFilter = $request->get('primaryFilter');
|
||||
$textFilter = $request->get('textFilter');
|
||||
$boolFilterList = $request->get('boolFilterList');
|
||||
|
||||
if (empty($maxSize)) {
|
||||
$maxSize = self::MAX_SIZE_LIMIT;
|
||||
@@ -132,14 +142,23 @@ class Record extends Base
|
||||
throw new Forbidden("Max should should not exceed " . self::MAX_SIZE_LIMIT . ". Use pagination (offset, limit).");
|
||||
}
|
||||
|
||||
$result = $this->getRecordService()->findEntities(array(
|
||||
$params = array(
|
||||
'where' => $where,
|
||||
'offset' => $offset,
|
||||
'maxSize' => $maxSize,
|
||||
'asc' => $asc,
|
||||
'sortBy' => $sortBy,
|
||||
'q' => $q,
|
||||
));
|
||||
'textFilter' => $textFilter
|
||||
);
|
||||
if ($request->get('primaryFilter')) {
|
||||
$params['primaryFilter'] = $request->get('primaryFilter');
|
||||
}
|
||||
if ($request->get('boolFilterList')) {
|
||||
$params['boolFilterList'] = $request->get('boolFilterList');
|
||||
}
|
||||
|
||||
$result = $this->getRecordService()->findEntities($params);
|
||||
|
||||
return array(
|
||||
'total' => $result['total'],
|
||||
@@ -158,6 +177,7 @@ class Record extends Base
|
||||
$asc = $request->get('asc') === 'true';
|
||||
$sortBy = $request->get('sortBy');
|
||||
$q = $request->get('q');
|
||||
$textFilter = $request->get('textFilter');
|
||||
|
||||
if (empty($maxSize)) {
|
||||
$maxSize = self::MAX_SIZE_LIMIT;
|
||||
@@ -166,15 +186,23 @@ class Record extends Base
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$result = $this->getRecordService()->findLinkedEntities($id, $link, array(
|
||||
$params = array(
|
||||
'where' => $where,
|
||||
'offset' => $offset,
|
||||
'maxSize' => $maxSize,
|
||||
'asc' => $asc,
|
||||
'sortBy' => $sortBy,
|
||||
'q' => $q,
|
||||
));
|
||||
'textFilter' => $textFilter
|
||||
);
|
||||
if ($request->get('primaryFilter')) {
|
||||
$params['primaryFilter'] = $request->get('primaryFilter');
|
||||
}
|
||||
if ($request->get('boolFilterList')) {
|
||||
$params['boolFilterList'] = $request->get('boolFilterList');
|
||||
}
|
||||
|
||||
$result = $this->getRecordService()->findLinkedEntities($id, $link, $params);
|
||||
|
||||
return array(
|
||||
'total' => $result['total'],
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Controllers;
|
||||
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
use \PDO;
|
||||
use Espo\Core\Utils\Json;
|
||||
use Espo\Core\Exceptions\NotFound;
|
||||
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
class DataManager
|
||||
{
|
||||
private $container;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Entities;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Entities;
|
||||
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
use \Espo\Core\Exceptions\NotFound,
|
||||
\Espo\Core\Utils\Util;
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\EntryPoints;
|
||||
@@ -82,6 +89,11 @@ abstract class Base
|
||||
return $this->getContainer()->get('fileManager');
|
||||
}
|
||||
|
||||
protected function getLanguage()
|
||||
{
|
||||
return $this->getContainer()->get('language');
|
||||
}
|
||||
|
||||
public function __construct(Container $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Exceptions;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Exceptions;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Exceptions;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Exceptions;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Exceptions;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Exceptions;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Exceptions;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ExternalAccount;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ExternalAccount\Clients;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ExternalAccount\Clients;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ExternalAccount\Clients;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ExternalAccount\OAuth2;
|
||||
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
use \Espo\Core\Exceptions\Error,
|
||||
\Espo\Core\Utils\Util;
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Hooks;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Htmlizer;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Interfaces;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Interfaces;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Jobs;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Loaders;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Loaders;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Loaders;
|
||||
|
||||
101
application/Espo/Core/Mail/FiltersMatcher.php
Normal file
101
application/Espo/Core/Mail/FiltersMatcher.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Mail;
|
||||
|
||||
|
||||
use \Espo\Entities\Email;
|
||||
|
||||
class FiltersMatcher
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function match(Email $email, $filterList = [])
|
||||
{
|
||||
foreach ($filterList as $filter) {
|
||||
if ($filter->get('from')) {
|
||||
if ($this->matchString(strtolower($filter->get('from')), strtolower($email->get('from')))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ($filter->get('to')) {
|
||||
if ($email->get('to')) {
|
||||
$toArr = explode(';', $email->get('to'));
|
||||
foreach ($toArr as $to) {
|
||||
if ($this->matchString(strtolower($filter->get('to')), strtolower($to))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($filter->get('subject')) {
|
||||
if ($this->matchString($filter->get('subject'), $email->get('name'))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function matchBody(Email $email, $filterList = [])
|
||||
{
|
||||
foreach ($filterList as $filter) {
|
||||
if ($filter->get('bodyContains')) {
|
||||
$phraseList = $filter->get('bodyContains');
|
||||
$body = $email->get('body');
|
||||
$bodyPlain = $email->get('bodyPlain');
|
||||
foreach ($phraseList as $phrase) {
|
||||
if (stripos($bodyPlain, $phrase) !== false) {
|
||||
return true;
|
||||
}
|
||||
if (stripos($body, $phrase) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function matchString($pattern, $value)
|
||||
{
|
||||
if ($pattern == $value) {
|
||||
return true;
|
||||
}
|
||||
$pattern = preg_quote($pattern, '#');
|
||||
$pattern = str_replace('\*', '.*', $pattern).'\z';
|
||||
if (preg_match('#^'.$pattern.'#', $value)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Mail;
|
||||
@@ -25,6 +32,7 @@ namespace Espo\Core\Mail;
|
||||
use \Zend\Mime\Mime as Mime;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\ORM\Email;
|
||||
|
||||
class Importer
|
||||
{
|
||||
@@ -34,11 +42,14 @@ class Importer
|
||||
|
||||
private $config;
|
||||
|
||||
private $filtersMatcher;
|
||||
|
||||
public function __construct($entityManager, $fileManager, $config)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->fileManager = $fileManager;
|
||||
$this->config = $config;
|
||||
$this->filtersMatcher = new FiltersMatcher();
|
||||
}
|
||||
|
||||
protected function getEntityManager()
|
||||
@@ -55,7 +66,12 @@ class Importer
|
||||
return $this->fileManager;
|
||||
}
|
||||
|
||||
public function importMessage($message, $userId, $teamsIds = array())
|
||||
protected function getFiltersMatcher()
|
||||
{
|
||||
return $this->filtersMatcher;
|
||||
}
|
||||
|
||||
public function importMessage($message, $userId = null, $teamsIdList = [], $userIdList = [], $filterList = [])
|
||||
{
|
||||
try {
|
||||
$email = $this->getEntityManager()->getEntity('Email');
|
||||
@@ -69,8 +85,14 @@ class Importer
|
||||
$email->set('name', $subject);
|
||||
$email->set('status', 'Archived');
|
||||
$email->set('attachmentsIds', array());
|
||||
$email->set('assignedUserId', $userId);
|
||||
$email->set('teamsIds', $teamsIds);
|
||||
if ($userId) {
|
||||
$email->set('assignedUserId', $userId);
|
||||
}
|
||||
$email->set('teamsIds', $teamsIdList);
|
||||
|
||||
if (!empty($userIdList)) {
|
||||
$email->set('usersIds', $userIdList);
|
||||
}
|
||||
|
||||
$fromArr = $this->getAddressListFromMessage($message, 'from');
|
||||
if (isset($message->from)) {
|
||||
@@ -82,28 +104,49 @@ class Importer
|
||||
|
||||
$toArr = $this->getAddressListFromMessage($message, 'to');
|
||||
$ccArr = $this->getAddressListFromMessage($message, 'cc');
|
||||
$replyToArr = $this->getAddressListFromMessage($message, 'replyTo');
|
||||
|
||||
$email->set('from', $fromArr[0]);
|
||||
$email->set('to', implode(';', $toArr));
|
||||
$email->set('cc', implode(';', $ccArr));
|
||||
$email->set('replyTo', implode(';', $replyToArr));
|
||||
|
||||
if ($this->getFiltersMatcher()->match($email, $filterList)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (isset($message->messageId) && !empty($message->messageId)) {
|
||||
$email->set('messageId', $message->messageId);
|
||||
if (isset($message->deliveredTo)) {
|
||||
$email->set('messageIdInternal', $message->messageId . '-' . $message->deliveredTo);
|
||||
}
|
||||
if (stripos($message->messageId, '@espo-system') !== false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($duplicate = $this->findDuplicate($email)) {
|
||||
$duplicate->loadLinkMultipleField('users');
|
||||
$usersIds = $duplicate->get('usersIds');
|
||||
$usersIds[] = $userId;
|
||||
if ($userId) {
|
||||
if (!in_array($userId, $usersIds)) {
|
||||
$usersIds[] = $userId;
|
||||
}
|
||||
}
|
||||
if (!empty($userIdList)) {
|
||||
foreach ($userIdList as $additionalUserId) {
|
||||
if (!in_array($additionalUserId, $usersIds)) {
|
||||
$usersIds[] = $additionalUserId;
|
||||
}
|
||||
}
|
||||
}
|
||||
$duplicate->set('usersIds', $usersIds);
|
||||
|
||||
$this->getEntityManager()->saveEntity($duplicate);
|
||||
|
||||
if (!empty($teamsIds)) {
|
||||
foreach ($teamsIds as $teamId) {
|
||||
if (!empty($teamsIdList)) {
|
||||
foreach ($teamsIdList as $teamId) {
|
||||
$this->getEntityManager()->getRepository('Email')->relate($duplicate, 'teams', $teamId);
|
||||
}
|
||||
}
|
||||
@@ -149,15 +192,54 @@ class Importer
|
||||
$email->set('body', $body);
|
||||
}
|
||||
|
||||
if ($this->getFiltersMatcher()->matchBody($email, $filterList)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$parentFound = false;
|
||||
|
||||
if (isset($message->inReplyTo) && !empty($message->inReplyTo)) {
|
||||
$arr = explode(' ', $message->inReplyTo);
|
||||
$inReplyTo = $arr[0];
|
||||
$replied = $this->getEntityManager()->getRepository('Email')->where(array(
|
||||
'messageId' => $inReplyTo
|
||||
))->findOne();
|
||||
if ($replied) {
|
||||
$email->set('repliedId', $replied->id);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($message->references) && !empty($message->references)) {
|
||||
$reference = str_replace(array('/', '@'), " ", trim($message->references, '<>'));
|
||||
$arr = explode(' ', $message->references);
|
||||
$reference = $arr[0];
|
||||
$reference = str_replace(array('/', '@'), " ", trim($reference, '<>'));
|
||||
$parentType = $parentId = null;
|
||||
$emailSent = PHP_INT_MAX;
|
||||
$n = sscanf($reference, '%s %s %d %d espo', $parentType, $parentId, $emailSent, $number);
|
||||
if ($n == 4 && $emailSent < time()) {
|
||||
if (!empty($parentType) && !empty($parentId)) {
|
||||
if ($parentType == 'Lead') {
|
||||
$parent = $this->getEntityManager()->getEntity('Lead', $parentId);
|
||||
if ($parent && $parent->get('status') == 'Converted') {
|
||||
if ($parent->get('createdAccountId')) {
|
||||
$account = $this->getEntityManager()->getEntity('Account', $parent->get('createdAccountId'));
|
||||
if ($account) {
|
||||
$parentType = 'Account';
|
||||
$parentId = $account->id;
|
||||
}
|
||||
} else {
|
||||
if ($this->getConfig()->get('b2cMode')) {
|
||||
if ($parent->get('createdContactId')) {
|
||||
$contact = $this->getEntityManager()->getEntity('Contact', $parent->get('createdContactId'));
|
||||
if ($contact) {
|
||||
$parentType = 'Contact';
|
||||
$parentId = $contact->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$email->set('parentType', $parentType);
|
||||
$email->set('parentId', $parentId);
|
||||
$parentFound = true;
|
||||
@@ -170,10 +252,15 @@ class Importer
|
||||
if ($from) {
|
||||
$parentFound = $this->findParent($email, $from);
|
||||
}
|
||||
if (!$parentFound) {
|
||||
if (!empty($toArr)) {
|
||||
$parentFound = $this->findParent($email, $toArr[0]);
|
||||
}
|
||||
}
|
||||
if (!$parentFound) {
|
||||
if (!empty($replyToArr)) {
|
||||
$parentFound = $this->findParent($email, $replyToArr[0]);
|
||||
}
|
||||
}
|
||||
if (!$parentFound) {
|
||||
if (!empty($toArr)) {
|
||||
$parentFound = $this->findParent($email, $toArr[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,12 +321,20 @@ class Importer
|
||||
}
|
||||
}
|
||||
|
||||
protected function normilizeHeader($header)
|
||||
{
|
||||
if (is_a($header, 'ArrayIterator')) {
|
||||
return $header->current();
|
||||
} else {
|
||||
return $header;
|
||||
}
|
||||
}
|
||||
|
||||
protected function getAddressListFromMessage($message, $type)
|
||||
{
|
||||
$addressList = array();
|
||||
if (isset($message->$type)) {
|
||||
|
||||
$list = $message->getHeader($type)->getAddressList();
|
||||
$list = $this->normilizeHeader($message->getHeader($type))->getAddressList();
|
||||
foreach ($list as $address) {
|
||||
$addressList[] = $address->getEmail();
|
||||
}
|
||||
@@ -276,7 +371,7 @@ class Importer
|
||||
$encoding = null;
|
||||
$isAttachment = true;
|
||||
if ($type == 'text/plain' || $type == 'text/html') {
|
||||
if ($contentDisposition !== 'inline' && $contentDisposition !== 'attachment') {
|
||||
if ($contentDisposition !== 'attachment') {
|
||||
$isAttachment = false;
|
||||
$content = $this->getContentFromPart($part);
|
||||
if ($type == 'text/plain') {
|
||||
@@ -306,9 +401,10 @@ class Importer
|
||||
$contentId = null;
|
||||
|
||||
if ($contentDisposition) {
|
||||
|
||||
if ($contentDisposition === 'attachment') {
|
||||
if (preg_match('/filename="?([^"]+)"?/i', $part->ContentDisposition, $m)) {
|
||||
$fileName = $m[1];
|
||||
$fileName = $this->fetchFileNameFromContentDisposition($part->ContentDisposition);
|
||||
if ($fileName) {
|
||||
$disposition = 'attachment';
|
||||
}
|
||||
} else if ($contentDisposition === 'inline') {
|
||||
@@ -317,10 +413,10 @@ class Importer
|
||||
$fileName = $contentId;
|
||||
$disposition = 'inline';
|
||||
} else {
|
||||
// hack for iOS not proper attachments
|
||||
// for iOS attachments
|
||||
if (empty($fileName)) {
|
||||
if (preg_match('/filename="?([^"]+)"?/i', $part->ContentDisposition, $m)) {
|
||||
$fileName = $m[1];
|
||||
$fileName = $this->fetchFileNameFromContentDisposition($part->ContentDisposition);
|
||||
if ($fileName) {
|
||||
$disposition = 'attachment';
|
||||
}
|
||||
}
|
||||
@@ -329,7 +425,7 @@ class Importer
|
||||
}
|
||||
|
||||
if (isset($part->contentTransferEncoding)) {
|
||||
$encoding = strtolower($part->getHeader('Content-Transfer-Encoding')->getTransferEncoding());
|
||||
$encoding = strtolower($this->normilizeHeader($part->getHeader('Content-Transfer-Encoding'))->getTransferEncoding());
|
||||
}
|
||||
|
||||
$attachment = $this->getEntityManager()->getEntity('Attachment');
|
||||
@@ -364,6 +460,26 @@ class Importer
|
||||
} catch (\Exception $e) {}
|
||||
}
|
||||
|
||||
protected function fetchFileNameFromContentDisposition($contentDisposition)
|
||||
{
|
||||
$m = array();
|
||||
if (preg_match('/filename="?([^"]+)"?/i', $contentDisposition, $m)) {
|
||||
$fileName = $m[1];
|
||||
return $fileName;
|
||||
} else if (preg_match('/filename\*="?([^"]+)"?/i', $contentDisposition, $m)) {
|
||||
$fileName = $m[1];
|
||||
if ($fileName && stripos($fileName, "''") !== false) {
|
||||
list($encoding, $fileName) = explode("''", $fileName);
|
||||
$fileName = rawurldecode($fileName);
|
||||
if (strtoupper($encoding) !== 'UTF-8') {
|
||||
$fileName = mb_convert_encoding($fileName, 'UTF-8', $encoding);
|
||||
}
|
||||
return $fileName;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getContentFromPart($part)
|
||||
{
|
||||
if ($part instanceof \Zend\Mime\Part) {
|
||||
@@ -377,7 +493,7 @@ class Importer
|
||||
$encoding = null;
|
||||
|
||||
if (isset($part->contentTransferEncoding)) {
|
||||
$cteHeader = $part->getHeader('Content-Transfer-Encoding');
|
||||
$cteHeader = $this->normilizeHeader($part->getHeader('Content-Transfer-Encoding'));
|
||||
$encoding = strtolower($cteHeader->getTransferEncoding());
|
||||
}
|
||||
|
||||
@@ -388,7 +504,7 @@ class Importer
|
||||
$charset = 'UTF-8';
|
||||
|
||||
if (isset($part->contentType)) {
|
||||
$ctHeader = $part->getHeader('Content-Type');
|
||||
$ctHeader = $this->normilizeHeader($part->getHeader('Content-Type'));
|
||||
$charsetParamValue = $ctHeader->getParameter('charset');
|
||||
if (!empty($charsetParamValue)) {
|
||||
$charset = strtoupper($charsetParamValue);
|
||||
@@ -396,7 +512,7 @@ class Importer
|
||||
}
|
||||
|
||||
if (isset($part->contentTransferEncoding)) {
|
||||
$cteHeader = $part->getHeader('Content-Transfer-Encoding');
|
||||
$cteHeader = $this->normilizeHeader($part->getHeader('Content-Transfer-Encoding'));
|
||||
if ($cteHeader->getTransferEncoding() == 'quoted-printable') {
|
||||
$content = quoted_printable_decode($content);
|
||||
}
|
||||
|
||||
102
application/Espo/Core/Mail/Mail/Header/XQueueItemId.php
Normal file
102
application/Espo/Core/Mail/Mail/Header/XQueueItemId.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Espo\Core\Mail\Mail\Header;
|
||||
|
||||
use \Zend\Mail\Header;
|
||||
use Zend\Mime\Mime;
|
||||
|
||||
class XQueueItemId implements Header\HeaderInterface
|
||||
{
|
||||
protected $fieldName = 'X-QueueItemId';
|
||||
|
||||
protected $id = null;
|
||||
|
||||
public static function fromString($headerLine)
|
||||
{
|
||||
list($name, $value) = Header\GenericHeader::splitHeaderLine($headerLine);
|
||||
$value = Header\HeaderWrap::mimeDecodeValue($value);
|
||||
|
||||
if (strtolower($name) !== 'x-queue-item-id') {
|
||||
throw new Header\Exception\InvalidArgumentException('Invalid header line for Message-ID string');
|
||||
}
|
||||
|
||||
$header = new static();
|
||||
$header->setId($value);
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
public function getFieldName()
|
||||
{
|
||||
return $this->fieldName;
|
||||
}
|
||||
|
||||
public function setFieldName($value)
|
||||
{
|
||||
}
|
||||
|
||||
public function setEncoding($encoding)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getEncoding()
|
||||
{
|
||||
return 'ASCII';
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return $this->fieldName . ': ' . $this->getFieldValue();
|
||||
}
|
||||
|
||||
public function getFieldValue($format = Header\HeaderInterface::FORMAT_RAW)
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,38 @@
|
||||
<?php
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Mail\Mail;
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Mail\Mail\Storage;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Mail\Mail\Storage;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Mail;
|
||||
@@ -131,9 +138,11 @@ class Sender
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function send(Email $email, $params = array(), &$message = null)
|
||||
public function send(Email $email, $params = array(), &$message = null, $attachmetList = [])
|
||||
{
|
||||
$message = new Message();
|
||||
if (!$message) {
|
||||
$message = new Message();
|
||||
}
|
||||
$config = $this->config;
|
||||
$params = $this->params + $params;
|
||||
|
||||
@@ -206,10 +215,24 @@ class Sender
|
||||
}
|
||||
}
|
||||
|
||||
$value = $email->get('replyTo');
|
||||
if ($value) {
|
||||
$arr = explode(';', $value);
|
||||
if (is_array($arr)) {
|
||||
foreach ($arr as $address) {
|
||||
$message->addReplyTo(trim($address));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$attachmentPartList = array();
|
||||
$attachmentCollection = $email->get('attachments');
|
||||
$attachmentInlineCollection = $email->getInlineAttachments();
|
||||
|
||||
foreach ($attachmetList as $attachment) {
|
||||
$attachmentCollection[] = $attachment;
|
||||
}
|
||||
|
||||
if (!empty($attachmentCollection)) {
|
||||
foreach ($attachmentCollection as $a) {
|
||||
$fileName = 'data/upload/' . $a->id;
|
||||
@@ -311,6 +334,9 @@ class Sender
|
||||
} else {
|
||||
$messageId = '' . md5($email->get('name')) . '/' . time() . '/' . $rand . '@espo';
|
||||
}
|
||||
if ($email->get('isSystem')) {
|
||||
$messageId .= '-system';
|
||||
}
|
||||
|
||||
$messageIdHeader = new \Zend\Mail\Header\MessageId();
|
||||
$messageIdHeader->setId($messageId);
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Notificators;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ORM;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ORM;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ORM\Repositories;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ORM;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\ORM;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Pdf;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Repositories;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\SelectManagers;
|
||||
@@ -65,6 +72,11 @@ class Base
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
protected function getAcl()
|
||||
{
|
||||
return $this->acl;
|
||||
}
|
||||
|
||||
public function setEntityType($entityType)
|
||||
{
|
||||
$this->entityType = $entityType;
|
||||
@@ -75,20 +87,20 @@ class Base
|
||||
return $this->entityType;
|
||||
}
|
||||
|
||||
protected function limit($params, &$result)
|
||||
protected function limit($offset = null, $maxSize = null, &$result)
|
||||
{
|
||||
if (isset($params['offset']) && !is_null($params['offset'])) {
|
||||
$result['offset'] = $params['offset'];
|
||||
if (!is_null($offset)) {
|
||||
$result['offset'] = $offset;
|
||||
}
|
||||
if (isset($params['maxSize']) && !is_null($params['maxSize'])) {
|
||||
$result['limit'] = $params['maxSize'];
|
||||
if (!is_null($maxSize)) {
|
||||
$result['limit'] = $maxSize;
|
||||
}
|
||||
}
|
||||
|
||||
protected function order($params, &$result)
|
||||
protected function order($sortBy, $asc, &$result)
|
||||
{
|
||||
if (!empty($params['sortBy'])) {
|
||||
$result['orderBy'] = $params['sortBy'];
|
||||
if (!empty($sortBy)) {
|
||||
$result['orderBy'] = $sortBy;
|
||||
$type = $this->metadata->get("entityDefs.{$this->entityType}.fields." . $result['orderBy'] . ".type");
|
||||
if ($type == 'link') {
|
||||
$result['orderBy'] .= 'Name';
|
||||
@@ -96,12 +108,10 @@ class Base
|
||||
$result['orderBy'] .= 'Type';
|
||||
}
|
||||
}
|
||||
if (isset($params['asc'])) {
|
||||
if ($params['asc']) {
|
||||
$result['order'] = 'ASC';
|
||||
} else {
|
||||
$result['order'] = 'DESC';
|
||||
}
|
||||
if ($asc) {
|
||||
$result['order'] = 'ASC';
|
||||
} else {
|
||||
$result['order'] = 'DESC';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,78 +128,61 @@ class Base
|
||||
return $this->seed;
|
||||
}
|
||||
|
||||
protected function textFilter($value, &$result)
|
||||
public function applyWhere($where, &$result)
|
||||
{
|
||||
$fieldDefs = $this->getSeed()->getFields();
|
||||
$fieldList = $this->getTextFilterFields();
|
||||
$d = array();
|
||||
|
||||
foreach ($fieldList as $field) {
|
||||
if (
|
||||
strlen($item['value']) >= self::MIN_LENGTH_FOR_CONTENT_SEARCH
|
||||
&&
|
||||
!empty($fieldDefs[$field]['type']) && $fieldDefs[$field]['type'] == 'text'
|
||||
) {
|
||||
$d[$field . '*'] = '%' . $value . '%';
|
||||
} else {
|
||||
$d[$field . '*'] = $value . '%';
|
||||
}
|
||||
}
|
||||
$result['whereClause'][] = array(
|
||||
'OR' => $d
|
||||
);
|
||||
$this->prepareResult($result);
|
||||
$this->where($where, $result);
|
||||
}
|
||||
|
||||
protected function where($params, &$result)
|
||||
protected function where($where, &$result)
|
||||
{
|
||||
if (!empty($params['where']) && is_array($params['where'])) {
|
||||
$where = array();
|
||||
$this->prepareResult($result);
|
||||
|
||||
foreach ($params['where'] as $item) {
|
||||
if ($item['type'] == 'bool' && !empty($item['value']) && is_array($item['value'])) {
|
||||
foreach ($item['value'] as $filter) {
|
||||
$p = $this->getBoolFilterWhere($filter);
|
||||
if (!empty($p)) {
|
||||
$params['where'][] = $p;
|
||||
}
|
||||
$this->boolFilter($filter, $result);
|
||||
$whereClause = array();
|
||||
foreach ($where as $item) {
|
||||
if ($item['type'] == 'bool' && !empty($item['value']) && is_array($item['value'])) {
|
||||
foreach ($item['value'] as $filter) {
|
||||
$p = $this->getBoolFilterWhere($filter);
|
||||
if (!empty($p)) {
|
||||
$where[] = $p;
|
||||
}
|
||||
} else if ($item['type'] == 'textFilter' && !empty($item['value'])) {
|
||||
if (!empty($item['value'])) {
|
||||
$this->textFilter($item['value'], $result);
|
||||
}
|
||||
} else if ($item['type'] == 'primary' && !empty($item['value'])) {
|
||||
$this->primaryFilter($item['value'], $result);
|
||||
$this->applyBoolFilter($filter, $result);
|
||||
}
|
||||
} else if ($item['type'] == 'textFilter' && !empty($item['value'])) {
|
||||
if (!empty($item['value'])) {
|
||||
$this->textFilter($item['value'], $result);
|
||||
}
|
||||
} else if ($item['type'] == 'primary' && !empty($item['value'])) {
|
||||
$this->applyPrimaryFilter($item['value'], $result);
|
||||
}
|
||||
}
|
||||
|
||||
$linkedWith = array();
|
||||
$inCategory = array();
|
||||
|
||||
$ignoreList = ['linkedWith', 'inCategory', 'bool', 'primary'];
|
||||
foreach ($where as $item) {
|
||||
if (!in_array($item['type'], $ignoreList)) {
|
||||
$part = $this->getWherePart($item);
|
||||
if (!empty($part)) {
|
||||
$whereClause[] = $part;
|
||||
}
|
||||
} else {
|
||||
if ($item['type'] == 'linkedWith' && !empty($item['value'])) {
|
||||
$linkedWith[$item['field']] = $item['value'];
|
||||
} else if ($item['type'] == 'inCategory' && !empty($item['value'])) {
|
||||
$inCategory[$item['field']] = $item['value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$linkedWith = array();
|
||||
$inCategory = array();
|
||||
$result['whereClause'] = array_merge($result['whereClause'], $whereClause);
|
||||
|
||||
$ignoreList = ['linkedWith', 'inCategory', 'bool', 'primary'];
|
||||
foreach ($params['where'] as $item) {
|
||||
if (!in_array($item['type'], $ignoreList)) {
|
||||
$part = $this->getWherePart($item);
|
||||
if (!empty($part)) {
|
||||
$where[] = $part;
|
||||
}
|
||||
} else {
|
||||
if ($item['type'] == 'linkedWith' && !empty($item['value'])) {
|
||||
$linkedWith[$item['field']] = $item['value'];
|
||||
} else if ($item['type'] == 'inCategory' && !empty($item['value'])) {
|
||||
$inCategory[$item['field']] = $item['value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result['whereClause'] = array_merge($result['whereClause'], $where);
|
||||
|
||||
if (!empty($linkedWith)) {
|
||||
$this->handleLinkedWith($linkedWith, $result);
|
||||
}
|
||||
if (!empty($inCategory)) {
|
||||
$this->handleInCategory($inCategory, $result);
|
||||
}
|
||||
if (!empty($linkedWith)) {
|
||||
$this->handleLinkedWith($linkedWith, $result);
|
||||
}
|
||||
if (!empty($inCategory)) {
|
||||
$this->handleInCategory($inCategory, $result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,15 +249,15 @@ class Base
|
||||
|
||||
if ($defs['type'] == 'manyMany') {
|
||||
|
||||
if (!empty($defs['relationName']) && !empty($defs['midKeys'])) {
|
||||
if (!empty($defs['midKeys'])) {
|
||||
$result['distinct'] = true;
|
||||
$result['joins'][] = $link;
|
||||
$key = $defs['midKeys'][1];
|
||||
|
||||
$relationName = lcfirst($defs['relationName']);
|
||||
$middleName = $link . 'Middle';
|
||||
|
||||
$result['customJoin'] .= "
|
||||
JOIN " . $query->toDb($pathName) . " AS `{$pathName}` ON {$pathName}.descendor_id = ".$query->sanitize($relationName) . "." . $query->toDb($key) . "
|
||||
JOIN " . $query->toDb($pathName) . " AS `{$pathName}` ON {$pathName}.descendor_id = ".$query->sanitize($middleName) . "." . $query->toDb($key) . "
|
||||
";
|
||||
$part[$pathName . '.ascendorId'] = $val;
|
||||
}
|
||||
@@ -290,51 +283,23 @@ class Base
|
||||
protected function q($params, &$result)
|
||||
{
|
||||
if (!empty($params['q'])) {
|
||||
$fieldDefs = $this->getSeed()->getFields();
|
||||
|
||||
$value = $params['q'];
|
||||
|
||||
$fieldList = $this->getTextFilterFields();
|
||||
$d = array();
|
||||
foreach ($fieldList as $field) {
|
||||
if (
|
||||
strlen($value) >= self::MIN_LENGTH_FOR_CONTENT_SEARCH
|
||||
&&
|
||||
!empty($fieldDefs[$field]['type']) && $fieldDefs[$field]['type'] == 'text'
|
||||
) {
|
||||
$d[$field . '*'] = '%' . $value . '%';
|
||||
} else {
|
||||
$d[$field . '*'] = $value . '%';
|
||||
}
|
||||
}
|
||||
|
||||
$result['whereClause'][] = array(
|
||||
'OR' => $d
|
||||
);
|
||||
$this->textFilter($params['q'], $result);
|
||||
}
|
||||
}
|
||||
|
||||
public function manageAccess(&$result)
|
||||
{
|
||||
if (empty($result)) {
|
||||
$result = array();
|
||||
}
|
||||
if (empty($result['joins'])) {
|
||||
$result['joins'] = [];
|
||||
}
|
||||
if (empty($result['leftJoins'])) {
|
||||
$result['leftJoins'] = [];
|
||||
}
|
||||
if (empty($result['whereClause'])) {
|
||||
$result['whereClause'] = array();
|
||||
}
|
||||
if (empty($result['customJoin'])) {
|
||||
$result['customJoin'] = [];
|
||||
}
|
||||
$this->access($result);
|
||||
$this->prepareResult($result);
|
||||
$this->applyAccess($result);
|
||||
}
|
||||
|
||||
public function manageTextFilter($textFilter, &$result)
|
||||
{
|
||||
$this->prepareResult($result);
|
||||
$this->q(array('q' => $textFilter), $result);
|
||||
}
|
||||
|
||||
protected function prepareResult(&$result)
|
||||
{
|
||||
if (empty($result)) {
|
||||
$result = array();
|
||||
@@ -349,29 +314,42 @@ class Base
|
||||
$result['whereClause'] = array();
|
||||
}
|
||||
if (empty($result['customJoin'])) {
|
||||
$result['customJoin'] = [];
|
||||
$result['customJoin'] = '';
|
||||
}
|
||||
if (empty($result['additionalSelectColumns'])) {
|
||||
$result['additionalSelectColumns'] = array();
|
||||
}
|
||||
if (empty($result['joinConditions'])) {
|
||||
$result['joinConditions'] = array();
|
||||
}
|
||||
$this->q(array('q' => $textFilter), $result);
|
||||
}
|
||||
|
||||
protected function access(&$result)
|
||||
{
|
||||
if ($this->acl->checkReadOnlyOwn($this->entityType)) {
|
||||
$this->accessOnlyOwn($result);
|
||||
}
|
||||
if (!$this->user->isAdmin() && $this->acl->checkReadOnlyTeam($this->entityType)) {
|
||||
$this->accessOnlyTeam($result);
|
||||
} else {
|
||||
if (!$this->user->isAdmin() && $this->acl->checkReadOnlyTeam($this->entityType)) {
|
||||
$this->accessOnlyTeam($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function accessOnlyOwn(&$result)
|
||||
{
|
||||
if (!$this->getSeed()->hasField('assignedUserId')) {
|
||||
if ($this->getSeed()->hasField('assignedUserId')) {
|
||||
$result['whereClause'][] = array(
|
||||
'assignedUserId' => $this->getUser()->id
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->getSeed()->hasField('createdById')) {
|
||||
$result['whereClause'][] = array(
|
||||
'createdById' => $this->getUser()->id
|
||||
);
|
||||
return;
|
||||
}
|
||||
$result['whereClause'][] = array(
|
||||
'assignedUserId' => $this->getUser()->id
|
||||
);
|
||||
}
|
||||
|
||||
protected function accessOnlyTeam(&$result)
|
||||
@@ -379,10 +357,8 @@ class Base
|
||||
if (!$this->getSeed()->hasField('teamsIds')) {
|
||||
return;
|
||||
}
|
||||
$result['distinct'] = true;
|
||||
if (!in_array('teams', $result['joins'])) {
|
||||
$result['leftJoins'][] = 'teams';
|
||||
}
|
||||
$this->setDistinct(true, $result);
|
||||
$this->addLeftJoin('teams', $result);
|
||||
$result['whereClause'][] = array(
|
||||
'OR' => array(
|
||||
'teams.id' => $this->user->get('teamsIds'),
|
||||
@@ -394,22 +370,48 @@ class Base
|
||||
public function getAclParams()
|
||||
{
|
||||
$result = array();
|
||||
$this->access($result);
|
||||
$this->applyAccess($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getSelectParams(array $params, $withAcl = false)
|
||||
{
|
||||
$result = array(
|
||||
'joins' => [],
|
||||
'leftJoins' => [],
|
||||
'whereClause' => [],
|
||||
'customJoin' => ''
|
||||
);
|
||||
$result = array();
|
||||
$this->prepareResult($result);
|
||||
|
||||
if (!empty($params['sortBy'])) {
|
||||
if (!array_key_exists('asc', $params)) {
|
||||
$params['asc'] = true;
|
||||
}
|
||||
$this->order($params['sortBy'], $params['asc'], $result);
|
||||
}
|
||||
|
||||
if (!isset($params['offset'])) {
|
||||
$params['offset'] = null;
|
||||
}
|
||||
if (!isset($params['maxSize'])) {
|
||||
$params['maxSize'] = null;
|
||||
}
|
||||
$this->limit($params['offset'], $params['maxSize'], $result);
|
||||
|
||||
if (!empty($params['primaryFilter'])) {
|
||||
$this->applyPrimaryFilter($params['primaryFilter'], $result);
|
||||
}
|
||||
|
||||
if (!empty($params['boolFilterList']) && is_array($params['boolFilterList'])) {
|
||||
foreach ($params['boolFilterList'] as $filterName) {
|
||||
$this->applyBoolFilter($filterName, $result);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params['where']) && is_array($params['where'])) {
|
||||
$this->where($params['where'], $result);
|
||||
}
|
||||
|
||||
if (!empty($params['textFilter'])) {
|
||||
$this->textFilter($params['textFilter'], $result);
|
||||
}
|
||||
|
||||
$this->order($params, $result);
|
||||
$this->limit($params, $result);
|
||||
$this->where($params, $result);
|
||||
$this->q($params, $result);
|
||||
|
||||
if ($withAcl) {
|
||||
@@ -498,6 +500,42 @@ class Base
|
||||
|
||||
$where['value'] = [$from, $to];
|
||||
|
||||
break;
|
||||
case 'lastXDays':
|
||||
$where['type'] = 'between';
|
||||
|
||||
$dtFrom = clone $dt;
|
||||
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$to = $dt->format($format);
|
||||
|
||||
$number = strval(intval($item['value']));
|
||||
$dtFrom->modify('-'.$number.' day');
|
||||
$dtFrom->setTime(0, 0, 0);
|
||||
$dtFrom->setTimezone(new \DateTimeZone('UTC'));
|
||||
|
||||
$from = $dtFrom->format($format);
|
||||
|
||||
$where['value'] = [$from, $to];
|
||||
|
||||
break;
|
||||
case 'nextXDays':
|
||||
$where['type'] = 'between';
|
||||
|
||||
$dtTo = clone $dt;
|
||||
|
||||
$dt->setTimezone(new \DateTimeZone('UTC'));
|
||||
$from = $dt->format($format);
|
||||
|
||||
$number = strval(intval($item['value']));
|
||||
$dtTo->modify('+'.$number.' day');
|
||||
$dtTo->setTime(24, 59, 59);
|
||||
$dtTo->setTimezone(new \DateTimeZone('UTC'));
|
||||
|
||||
$to = $dtTo->format($format);
|
||||
|
||||
$where['value'] = [$from, $to];
|
||||
|
||||
break;
|
||||
case 'on':
|
||||
$where['type'] = 'between';
|
||||
@@ -561,7 +599,7 @@ class Base
|
||||
foreach ($item['value'] as $i) {
|
||||
$a = $this->getWherePart($i);
|
||||
foreach ($a as $left => $right) {
|
||||
if (!empty($right)) {
|
||||
if (!empty($right) || is_null($right) || $right === '') {
|
||||
$arr[] = array($left => $right);
|
||||
}
|
||||
}
|
||||
@@ -636,6 +674,27 @@ class Base
|
||||
$item['field'] . '<=' => $dt1->format('Y-m-d'),
|
||||
);
|
||||
break;
|
||||
case 'lastXDays':
|
||||
$dt1 = new \DateTime();
|
||||
$dt2 = clone $dt1;
|
||||
$number = strval(intval($item['value']));
|
||||
|
||||
$dt2->modify('-'.$number.' days');
|
||||
$part['AND'] = array(
|
||||
$item['field'] . '>=' => $dt2->format('Y-m-d'),
|
||||
$item['field'] . '<=' => $dt1->format('Y-m-d'),
|
||||
);
|
||||
break;
|
||||
case 'nextXDays':
|
||||
$dt1 = new \DateTime();
|
||||
$dt2 = clone $dt1;
|
||||
$number = strval(intval($item['value']));
|
||||
$dt2->modify('+'.$number.' days');
|
||||
$part['AND'] = array(
|
||||
$item['field'] . '>=' => $dt1->format('Y-m-d'),
|
||||
$item['field'] . '<=' => $dt2->format('Y-m-d'),
|
||||
);
|
||||
break;
|
||||
case 'currentMonth':
|
||||
$dt = new \DateTime();
|
||||
$part['AND'] = array(
|
||||
@@ -701,19 +760,105 @@ class Base
|
||||
return $part;
|
||||
}
|
||||
|
||||
protected function boolFilter($filterName, &$result)
|
||||
public function applyOrder($sortBy, $asc, &$result)
|
||||
{
|
||||
$this->prepareResult($result);
|
||||
$this->order($sortBy, $asc, $result);
|
||||
}
|
||||
|
||||
public function applyLimit($offset, $maxSize, &$result)
|
||||
{
|
||||
$this->prepareResult($result);
|
||||
$this->limit($offset, $maxSize, $result);
|
||||
}
|
||||
|
||||
public function applyPrimaryFilter($filterName, &$result)
|
||||
{
|
||||
$this->prepareResult($result);
|
||||
|
||||
$method = 'filter' . ucfirst($filterName);
|
||||
if (method_exists($this, $method)) {
|
||||
$this->$method($result);
|
||||
}
|
||||
}
|
||||
|
||||
public function applyBoolFilter($filterName, &$result)
|
||||
{
|
||||
$this->prepareResult($result);
|
||||
|
||||
$method = 'boolFilter' . ucfirst($filterName);
|
||||
if (method_exists($this, $method)) {
|
||||
$this->$method($result);
|
||||
}
|
||||
}
|
||||
|
||||
protected function primaryFilter($filterName, &$result)
|
||||
public function applyTextFilter($textFilter, &$result)
|
||||
{
|
||||
$method = 'filter' . ucfirst($filterName);
|
||||
if (method_exists($this, $method)) {
|
||||
$this->$method($result);
|
||||
$this->prepareResult($result);
|
||||
$this->textFilter($textFilter, $result);
|
||||
}
|
||||
|
||||
public function addJoin($join, &$result)
|
||||
{
|
||||
if (empty($result['joins'])) {
|
||||
$result['joins'] = [];
|
||||
}
|
||||
|
||||
if (!in_array($join, $result['joins'])) {
|
||||
$result['joins'][] = $join;
|
||||
}
|
||||
}
|
||||
|
||||
public function addLeftJoin($leftJoin, &$result)
|
||||
{
|
||||
if (empty($result['leftJoins'])) {
|
||||
$result['leftJoins'] = [];
|
||||
}
|
||||
|
||||
if (!in_array($leftJoin, $result['leftJoins'])) {
|
||||
$result['leftJoins'][] = $leftJoin;
|
||||
}
|
||||
}
|
||||
|
||||
public function setDistinct($distinct, &$result)
|
||||
{
|
||||
$result['distinct'] = (bool) $distinct;
|
||||
}
|
||||
|
||||
protected function textFilter($textFilter, &$result)
|
||||
{
|
||||
$fieldDefs = $this->getSeed()->getFields();
|
||||
$fieldList = $this->getTextFilterFields();
|
||||
$d = array();
|
||||
|
||||
foreach ($fieldList as $field) {
|
||||
if (
|
||||
strlen($textFilter) >= self::MIN_LENGTH_FOR_CONTENT_SEARCH
|
||||
&&
|
||||
!empty($fieldDefs[$field]['type']) && $fieldDefs[$field]['type'] == 'text'
|
||||
) {
|
||||
$d[$field . '*'] = '%' . $textFilter . '%';
|
||||
} else {
|
||||
$d[$field . '*'] = $textFilter . '%';
|
||||
}
|
||||
}
|
||||
$result['whereClause'][] = array(
|
||||
'OR' => $d
|
||||
);
|
||||
}
|
||||
|
||||
public function applyAccess(&$result)
|
||||
{
|
||||
$this->prepareResult($result);
|
||||
$this->access($result);
|
||||
}
|
||||
|
||||
protected function boolFilters($params, &$result)
|
||||
{
|
||||
if (!empty($params['boolFilterList']) && is_array($params['boolFilterList'])) {
|
||||
foreach ($params['boolFilterList'] as $filterName) {
|
||||
$this->applyBoolFilter($filterName, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
|
||||
use \Espo\Core\Utils\Util;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Services;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Templates\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Templates\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Templates\Controllers;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Templates\Entities;
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Templates\Entities;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user