Compare commits

..

279 Commits

Author SHA1 Message Date
yuri f68bb4b491 tr_TR lang fix 2017-04-21 11:19:00 +03:00
yuri 473e1109b4 fix import 2017-04-20 15:23:20 +03:00
yuri c4b8b90ff5 fix css 2017-04-20 12:21:30 +03:00
yuri 70b4017353 tr_TR lang 2017-04-20 11:32:58 +03:00
yuri e6f7bf4d6c Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend 2017-04-19 16:28:22 +03:00
Taras Machyshyn 69385519d7 Metadata: delete related additional fields in entitiDefs 2017-04-19 16:24:44 +03:00
yuri 235ee7c383 Merge branch 'master' of github.com:espocrm/espocrm 2017-04-19 13:49:21 +03:00
yunga91 a6dba9f09a fix view name resolving for custom field types in merge action (#509) 2017-04-19 13:49:02 +03:00
yuri f1352430b9 close modal bigger icon 2017-04-18 17:45:08 +03:00
yuri b9b63a8a7c fix last viewed 2017-04-18 15:50:56 +03:00
yuri 5358bf4a43 fix last viewerd 2017-04-18 15:00:19 +03:00
yuri 1c7a7d8147 template placeholders labels 2017-04-18 14:58:23 +03:00
yuri ca055e8ca9 css fix 2017-04-18 14:22:33 +03:00
yuri 081c058229 languge field order fix 2017-04-18 13:20:39 +03:00
yuri a5c941b1b2 zh_CN lang 2017-04-18 13:14:26 +03:00
yuri d43e63b89e fix checbox css 2 2017-04-18 12:39:47 +03:00
yuri 102886e23d fix firefox checkbox style 2017-04-18 12:06:50 +03:00
yuri 3b8b9e392e fix auth 2017-04-18 12:06:38 +03:00
yuri 226152135d fix portal language 2017-04-18 11:11:18 +03:00
yuri 7f6a5b626e fix last viewed 2017-04-14 16:04:54 +03:00
yuri c5fa26ffcb portal kb acl published check 2017-04-14 15:12:29 +03:00
yuri 7b2bbcfd05 version 4.6.0 2017-04-13 15:40:10 +03:00
yuri e5b336d4f3 Merge branch 'master' of github.com:espocrm/espocrm 2017-04-13 15:03:18 +03:00
yuri 2d786d9660 noneOf filter 2017-04-13 15:01:23 +03:00
yuri a587efddde link multiple filters improvements 2017-04-13 12:56:32 +03:00
yuri 81dd2bc800 link filters changes 2017-04-12 17:20:06 +03:00
tanyalei b1273176a9 Hooks for afterOptOut, afterCancelOptOut for TargetList (#502)
* Process hooks for optOut, cancelOptOut

* process hook afterOptOut

* process hook afterCancelOptOut

* updateRelation
2017-04-12 16:26:21 +03:00
yuri 46beb8b6b7 uk_UA lang 2017-04-12 15:22:32 +03:00
yuri 264efa2e8d formula number\\round 2017-04-12 14:18:47 +03:00
yuri f538f05ec3 Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend 2017-04-12 12:16:31 +03:00
yuri 069a50c717 fix hooks 2017-04-12 12:16:19 +03:00
yuri 08f1329868 kb article aclPortal 2017-04-12 12:09:06 +03:00
yuri e48043c2e8 record list dashlet changes 2017-04-11 16:25:00 +03:00
yuri 024aeb6d01 fix dashlet expoanded layout field 2017-04-11 15:51:48 +03:00
yuri c79ef63c4d internal scheduled jobs 2017-04-11 15:41:03 +03:00
yuri 54798b94c9 acl: check entity create 2017-04-11 15:40:40 +03:00
yuri f70f22c503 css changes 2017-04-11 15:28:23 +03:00
yuri 33adc65dac records dashlet layout 2017-04-11 14:42:01 +03:00
yuri a6541f6f21 fix chart 2 2017-04-11 14:05:49 +03:00
yuri 0b44fee0e5 field manager: forbidden field list 2017-04-11 12:56:16 +03:00
yuri d03aec270e Merge branch 'master' of github.com:espocrm/espocrm 2017-04-11 12:33:45 +03:00
yuri 08bca7daf7 chart fix 2017-04-11 12:33:30 +03:00
yuri d5cb1f5c1b useCacheInDeveloperMode 2017-04-11 12:22:31 +03:00
Yuri Kuznetsov 68b16d3de9 Update CONTRIBUTING.md 2017-04-10 16:35:07 +03:00
Taras Machyshyn daffa60cd4 Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend 2017-04-10 15:56:24 +03:00
Taras Machyshyn 25cb6cdfb3 Installation: correct configuration for nginx server 2017-04-10 15:56:15 +03:00
yuri 7afecc4cdd afterMassRelate, afterUnlinkAll hooks 2017-04-10 12:49:24 +03:00
yuri 0e9373cf5e fix record/list 2017-04-10 12:42:37 +03:00
yuri 7992b78d4e fix naming 2017-04-10 12:19:12 +03:00
yuri fed5e6ded7 Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend 2017-04-10 12:15:24 +03:00
Taras Machyshyn 82ddd2e562 HookManager: add possibility to define custom hook methods 2017-04-10 12:15:10 +03:00
yuri 1470cea4ed kb article available only in specified portals 2017-04-10 12:01:49 +03:00
yuri 43e8929368 fix kb moveToTop/Bottom 2017-04-10 11:32:02 +03:00
yuri 6db3600a4b Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend 2017-04-10 11:18:09 +03:00
Taras Machyshyn 9b2324755b Fixed wrong php path for Scheduled job in Windows 2017-04-10 10:55:42 +03:00
Taras Machyshyn dc77b3c73e Added support 'unsetIgnore' 2017-04-10 10:47:10 +03:00
yuri 7627afb7d2 markdown changes 2017-04-07 16:01:42 +03:00
yuri e68ad81d57 Merge branch 'hotfix/4.5.2' 2017-04-07 14:43:48 +03:00
yuri 73b84d720a fix auth 2017-04-07 14:43:23 +03:00
yuri 0743582ef6 records dashlet fix 2017-04-06 15:54:17 +03:00
yuri f73d26fcf3 records dashlet sorting 2017-04-06 15:49:16 +03:00
yuri b1dd9f30fb records dashlet 2017-04-06 15:25:51 +03:00
yuri 27071695cb email: keep list after remove 2017-04-06 13:19:30 +03:00
yuri 1f551b6052 mass email: additional headers 2017-04-06 12:44:56 +03:00
yuri 947ebbb6f5 fix dashboard css 2017-04-05 15:56:18 +03:00
yuri 3a706cad86 cleanup auth tokens 2017-04-05 14:08:17 +03:00
yuri 8cb1709966 document acl portal fix 2017-04-05 13:06:26 +03:00
yuri 7533fc337e preferences changes 2017-04-04 16:56:02 +03:00
yuri 601f908992 action history dev 2017-04-04 13:04:56 +03:00
yuri ff72489f39 add contact to scope templates acl portal level list 2017-04-04 12:31:57 +03:00
yuri db442e0769 action history onlt for admin 2017-04-03 14:25:01 +03:00
yuri 189bbd784d last viwed modal click 2017-04-03 14:10:32 +03:00
yuri 2940de57b6 Merge branch 'stable' 2017-04-03 13:55:22 +03:00
yuri cceb9eccc3 fix license 2017-04-03 12:04:21 +03:00
yuri 410ba24bef Merge branch 'hotfix/4.5.1' 2017-04-03 12:03:15 +03:00
yuri 292e90e6b7 fix formula diff 2017-04-03 12:03:07 +03:00
yuri 3f9b229a9e Merge branch 'hotfix/4.5.1' 2017-04-03 11:30:13 +03:00
yuri 05c2270f36 fix relationship manager not storing has children audited 2017-04-03 11:28:24 +03:00
yuri f22fdd6724 Merge branch 'hotfix/4.5.1' 2017-04-03 11:14:06 +03:00
yuri 8059669a21 link fields select modal issue 2017-04-03 11:14:00 +03:00
yuri 28a8ad927a Merge branch 'hotfix/4.5.1' 2017-03-31 14:40:27 +03:00
yuri 6f7d27a5fd fix user removal 2017-03-31 14:40:16 +03:00
yuri d89a173a41 fix warning 2017-03-31 14:01:45 +03:00
yuri ba5fef320e fix user changePassword method 2017-03-31 13:53:48 +03:00
yuri a7982acc8f fix login page taborder 2017-03-31 13:30:41 +03:00
yuri 17742fccf1 fix array 2017-03-31 13:26:35 +03:00
yuri 7a2b563cd4 fix array field with empty options 2017-03-31 13:26:20 +03:00
yuri 549984d1ed fix xss 2017-03-31 13:13:27 +03:00
yuri d9256074fe about tpl change 2017-03-24 16:38:27 +02:00
yuri 97be52a0bc menu change 2017-03-24 16:34:50 +02:00
yuri 26a4d24492 about tpl change 2017-03-24 16:29:00 +02:00
yuri 03dad5a178 action history 2017-03-24 16:19:35 +02:00
yuri 4c0453d0e3 Merge branch 'hotfix/4.5.1' 2017-03-23 12:31:30 +02:00
yuri 1299853961 campaign: subscribe again removes optet out log record 2017-03-23 12:28:25 +02:00
yuri e6d792ef5a Merge branch 'hotfix/4.5.1' 2017-03-23 11:49:50 +02:00
yuri e8e8d0d7b2 target list: update count dynamicaly 2017-03-23 11:49:43 +02:00
yuri cec0c7b374 dynamic logic: multi-enum and array support 2017-03-22 13:22:58 +02:00
yuri fd73a0b8a5 lang 2017-03-22 11:52:06 +02:00
yuri 120ff8543e language list sorted 2017-03-22 11:12:47 +02:00
yuri 7b8fa73474 Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend 2017-03-22 11:04:35 +02:00
yuri 85164758ce zh_CN lang 2017-03-22 11:04:15 +02:00
yuri 8a38568617 zh_CN lang 2017-03-22 11:03:48 +02:00
Taras Machyshyn 0c9e795dfd Options for tables 2017-03-21 15:20:18 +02:00
yuri ee1a50aa16 Merge branch 'hotfix/4.5.1' 2017-03-16 12:47:40 +02:00
yuri a13b6af04a fix modal 2017-03-16 12:47:33 +02:00
yuri f847535aea small amendments 2017-03-16 12:43:34 +02:00
yuri b1b03c6dc1 naming fix 2017-03-16 12:26:46 +02:00
yuri eeb10c6bce fix router navigate back 2017-03-16 12:23:55 +02:00
yuri 05241cefa5 side modal in espo theme 2017-03-15 17:06:28 +02:00
yuri 1861e2cd87 cleanup 2017-03-15 15:20:06 +02:00
yuri 8a17cbe23c mark mandatory fields on edit 2017-03-15 15:18:54 +02:00
yuri 484458c2ba inbound email ui improvement 2 2017-03-15 14:40:56 +02:00
yuri c62cc15159 inbound email ui fix 2017-03-15 13:29:18 +02:00
yuri 17f8b09782 inbound email ui fix 2017-03-15 13:28:55 +02:00
yuri 9fd05672ae fix 2017-03-13 17:41:36 +02:00
yuri 69d96450da addition to about.tpl 2017-03-13 16:52:51 +02:00
tanyalei 7393040c12 Update datetime-optional.js (#457)
Does not work validating before and after type for field type datetimeOptional, if time wasn't set
2017-03-13 16:45:19 +02:00
yuri 9097e644d4 Merge branch 'master' of https://github.com/espocrm/espocrm 2017-03-13 16:44:12 +02:00
yuri 837b1691d1 showing email address name part 2017-03-13 16:44:00 +02:00
tanyalei 2cdec34062 Update datetime-optional.js (#457)
Does not work validating before and after type for field type datetimeOptional, if time wasn't set
2017-03-13 16:43:20 +02:00
yuri a33e10e92d mailmimeparser and email parsing imrovements 2017-03-13 16:22:42 +02:00
yuri 86631117a2 fix inline attachment issue 2017-03-13 12:50:50 +02:00
yuri 05dfcf7511 fix image warning 2017-03-13 12:39:38 +02:00
yuri 3e1582bd6b version 2017-03-10 16:49:07 +02:00
yuri 743f348fcf version 2017-03-10 16:19:53 +02:00
yuri 2b2ac2a76d Merge branch 'hotfix/4.5.1' 2017-03-10 15:49:00 +02:00
yuri a7d2d41b0f da_DK lang 2017-03-10 15:48:26 +02:00
yuri 6ef0081ace nb_NO fixes 2017-03-10 15:44:44 +02:00
yuri 4f3304d55f fix query 2017-03-10 14:24:47 +02:00
yuri 47b6093752 fix query 2017-03-10 14:22:36 +02:00
yuri ea8d930e56 email: addToPerson improvement 2017-03-10 13:13:05 +02:00
yuri 79f3d86384 contact parent to event 2017-03-10 13:03:36 +02:00
yuri fff201b7cd parent improvements 2017-03-10 13:02:30 +02:00
yuri 1ad454ce0b fix email address 2017-03-10 12:33:22 +02:00
yuri e090fe699b new actions for unknown email addresses 2017-03-10 12:32:14 +02:00
yuri f677b5614b tasks stream 2017-03-09 16:02:57 +02:00
yuri f7b240e6a9 fix send email not read 2017-03-09 13:04:24 +02:00
yuri ea3a60aaf7 email address tpl fix 2017-03-09 12:53:38 +02:00
yuri 6a7cfa58ae email import: inline attachment issue 2017-03-09 12:37:53 +02:00
yuri 482f0cc314 dashlet chart color 2017-03-07 11:06:59 +02:00
yuri 28ada61f3d internal post title 2017-03-07 10:58:04 +02:00
yuri 7057210e90 next number table locking 2017-03-06 17:32:54 +02:00
yuri 8c5bc59c45 fix lang 2017-03-06 15:35:53 +02:00
yuri b7370ff238 activities panel: check read access 2017-03-06 12:49:03 +02:00
yuri fb36f769d9 SelectManager: accessNo 2017-03-06 12:37:34 +02:00
yuri f07b728851 nb_NO lang 2017-03-06 11:01:28 +02:00
yuri 7d4ada7ec2 fix portal user creation 2017-03-02 16:28:05 +02:00
yuri 1c31a6689f fix event duration order 2017-03-02 12:41:21 +02:00
yuri a839144796 hide reminders from list view layout 2017-03-02 12:21:16 +02:00
yuri 87cbe603d2 fix lang 2017-03-02 12:00:53 +02:00
yuri ec96916013 Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend 2017-03-02 11:44:52 +02:00
yuri 2c811a4faa integration form fix 2017-03-02 11:43:11 +02:00
yuri 6e089c1e25 change stream post tpl 2017-03-02 11:03:30 +02:00
yuri 2e203341b7 dynamic logic: foreign fields 2017-03-02 10:30:21 +02:00
yuri 5bea143bf0 labels 2017-03-02 10:22:49 +02:00
yuri 732494e251 import: added time format with seconds 2017-03-01 16:57:18 +02:00
Taras Machyshyn 39e1303cbe Schema Converter improvements 2017-03-01 16:17:52 +02:00
yuri 62c3549004 label fix 2017-03-01 15:20:40 +02:00
yuri 9bcc942f0f change formula metadata 2017-03-01 13:04:28 +02:00
yuri e34ee34d7b fix formula function insertText 2017-03-01 12:25:42 +02:00
yuri dedef4b36f array: none if empty 2017-03-01 12:18:54 +02:00
yuri e6f6e0fcf1 email performance improvement 2017-03-01 12:07:52 +02:00
yuri 11a9e2ab9c mark notification read if email is read 2017-03-01 12:05:50 +02:00
yuri 9077542f61 fix email inbound 2017-03-01 12:03:31 +02:00
yuri cb6faaa769 fix email back 2017-02-28 15:55:28 +02:00
yuri a209d5aaaf link multiple if not set then show dots 2017-02-27 15:17:30 +02:00
yuri 767cdc75ee fix css 2017-02-27 14:03:44 +02:00
yuri 3eef0e088a fix modal backdrop 2017-02-27 11:59:36 +02:00
yuri 1e5ef6a070 fix text field 2017-02-27 11:56:43 +02:00
yuri a2edc3cf4e theme changes 2017-02-24 12:38:42 +02:00
yuri 9a5dc7b4d1 reduntancy fix 2017-02-24 12:17:19 +02:00
yuri 7b0fd40d3e fix modal 2017-02-24 12:11:25 +02:00
yuri 169df31cab css fix 2017-02-24 11:20:56 +02:00
yuri 44b0ba2f33 fix array field int issue 2017-02-23 16:15:34 +02:00
yuri 8d70956607 Merge branch 'master' of https://github.com/espocrm/espocrm 2017-02-23 15:59:12 +02:00
ayman-alkom 5ad20c8666 fix variable name (#426) 2017-02-23 15:58:48 +02:00
yuri 790d4a88b5 de_DE additions 2017-02-23 14:24:13 +02:00
yuri b72ac42068 fr_FR langauge 2017-02-23 13:30:38 +02:00
yuri 0a379be049 version 4.5.0 2017-02-23 12:33:22 +02:00
yuri e0e08a1c17 Merge branch 'hotfix/4.4.2' 2017-02-23 11:28:05 +02:00
yuri 0d825120bb notifications to portal users fix 2017-02-23 11:27:42 +02:00
yuri 7b81b66b76 formula: number abs 2017-02-22 15:38:50 +02:00
yuri d39f4e2533 forumle: datetime diff 2017-02-22 15:31:36 +02:00
yuri 598a2f9f05 fix 2017-02-22 13:09:07 +02:00
yuri ce9089b838 date time format 2017-02-22 13:06:10 +02:00
yuri 45b06fc154 stream: auto-follow after posting 2017-02-22 11:38:39 +02:00
yuri f44177a994 Merge branch 'hotfix/4.4.2' 2017-02-21 17:11:41 +02:00
yuri d91b13a7c1 Merge branch 'hotfix/4.4.2' of ssh://172.20.0.1/var/git/espo/backend into hotfix/4.4.2 2017-02-21 17:11:08 +02:00
Taras Machyshyn bd1894322c Slim: fixed a notice 2017-02-21 17:10:16 +02:00
yuri 90874535ea Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend 2017-02-21 17:06:23 +02:00
yuri 8c919dbca4 Merge branch 'hotfix/4.4.2' 2017-02-21 17:06:14 +02:00
yuri 05223c5272 Merge branch 'hotfix/4.4.2' of ssh://172.20.0.1/var/git/espo/backend into hotfix/4.4.2 2017-02-21 17:05:52 +02:00
yuri afee6d564b select manager textFilterUseContainsAttributeList 2017-02-21 17:04:47 +02:00
Taras Machyshyn b4e879a369 FieldManager: improved storing logic 2017-02-21 16:26:23 +02:00
yuri de4d96e260 event template set held action 2017-02-21 15:40:05 +02:00
yuri 89056f61c2 add consulting industry 2017-02-21 12:55:18 +02:00
yuri afac29151c account filter website 2017-02-21 12:44:35 +02:00
Taras Machyshyn e54430fb1b Merge branch 'hotfix/4.4.2' 2017-02-20 16:19:23 +02:00
tanyalei 7d8736b98c Creating Target List from Campaign Log not working in php7
creating a target list from the log bug fix(for mysql 5.7+)
2017-02-20 15:00:55 +02:00
tanyalei 216e9419d4 Creating Target List from Campaign Log not working in php7
creating a target list from the log bug fix(for mysql 5.7+)
2017-02-20 14:59:02 +02:00
yuri 359fdd4dab Merge branch 'hotfix/4.4.2' 2017-02-20 11:44:32 +02:00
yuri 2044a87630 fix last quarter filter 2017-02-20 11:44:24 +02:00
yuri 171feed28e global search mouseup fix 2017-02-20 11:10:58 +02:00
yuri 92dbbbd390 Merge branch 'master' of https://github.com/espocrm/espocrm 2017-02-17 16:24:04 +02:00
yuri 3166cb862e inbound email teams field 2017-02-17 12:41:04 +02:00
Taras Machyshyn b606cb2e04 Fixed warnings in Slim 2017-02-17 11:10:29 +02:00
tanyalei 724ef00d52 clientDefs view of entities for convert (#416) 2017-02-16 21:41:15 +02:00
yuri 0b7857b495 self assign 2017-02-16 16:22:13 +02:00
yuri a150eb7f0e fix email notification 2017-02-16 13:35:21 +02:00
yuri 4cb21a4fdb Merge branch 'hotfix/4.4.2' 2017-02-16 13:23:43 +02:00
yuri 46e13b0269 Merge branch 'hotfix/4.4.2' of ssh://172.20.0.1/var/git/espo/backend into hotfix/4.4.2 2017-02-16 13:23:32 +02:00
yuri d4d5138991 fix sorting alphabeetically 2017-02-16 13:23:17 +02:00
yuri 9fd00d9f0a inbound email: reply to not required 2017-02-16 13:16:23 +02:00
yuri 9361938285 Injectable factory && Case: notifications replyToAddress 2017-02-16 13:00:11 +02:00
yuri cb054b2f2b fix email email address 2017-02-16 12:41:58 +02:00
yuri f8ff6e6cf5 Merge branch 'hotfix/4.4.2' 2017-02-16 10:56:59 +02:00
yuri 918c1b2114 fix formula resize issue 2017-02-16 10:56:51 +02:00
Taras Machyshyn 2026bcb021 Fixed field manager notices 2017-02-16 10:46:47 +02:00
Taras Machyshyn ce5393155a Fixed merge method 2017-02-16 10:06:16 +02:00
Taras Machyshyn 6f4b752b10 Fixed merge method 2017-02-15 12:45:31 +02:00
yuri 2a5a453517 Merge branch 'hotfix/4.4.2' 2017-02-14 17:07:05 +02:00
yuri 191bba7afc fix notice 2017-02-14 17:06:54 +02:00
yuri f50d2ef9e3 fix notice 2017-02-14 16:59:38 +02:00
yuri 1ad744d151 fix source list 2017-02-14 16:49:40 +02:00
yuri ba0f86c8d4 attachment source list config check 2017-02-14 13:42:43 +02:00
yuri 372c84bfa3 file: sourceList 2017-02-14 12:33:28 +02:00
yuri 6ec18950e4 fix email user sent not added to users 2017-02-14 12:07:37 +02:00
yuri 6c3168a356 Merge branch 'hotfix/4.4.2' 2017-02-14 11:18:18 +02:00
yuri 109ee17a47 formula: parentName 2017-02-14 11:17:35 +02:00
yuri 21702b3c34 Merge branch 'hotfix/4.4.2' 2017-02-10 15:55:39 +02:00
yuri 159a2ee99d fix target list opted out count 2017-02-10 15:55:28 +02:00
yuri d6151d33b4 ditch document source 2017-02-10 15:36:01 +02:00
yuri 2217e03fa8 file storage: download url 2017-02-10 15:28:52 +02:00
yuri 794c7eb523 fix document download link 2017-02-10 15:27:38 +02:00
yuri 98f61c0c4b fix css 2017-02-10 14:54:59 +02:00
yuri 5f5a450d95 css fix 2017-02-10 13:21:25 +02:00
yuri 0ba9679a75 confirm additions 2017-02-10 13:10:23 +02:00
yuri 85e60d4e32 attachment storage additions 2017-02-10 12:59:49 +02:00
yuri a074b8a214 htmlizer fix 2017-02-09 16:01:04 +02:00
yuri ac593c1d3d fix email queue 2 2017-02-09 15:39:34 +02:00
yuri 170e62bc8b fix email queue 2 2017-02-09 15:39:17 +02:00
yuri 5d19ae42dc fix email queue 2017-02-09 15:24:34 +02:00
yuri 9f3fdd01bf fix email queue 2017-02-09 15:24:06 +02:00
yuri 65e94e237d metadata getAllForFrontend 2017-02-09 15:05:11 +02:00
yuri 7935bc59fe fix sysiwyg 2017-02-09 14:31:40 +02:00
yuri f49677b5c0 file storage manager 2017-02-09 14:29:28 +02:00
yuri b69f829a3e import: timezone 2017-02-08 14:42:20 +02:00
yuri 13dfc90a1b import tpl fix 2017-02-08 13:46:35 +02:00
yuri 6d49d39480 layout manager confirm 2017-02-08 13:35:32 +02:00
yuri f473ea9cea dashlet remove confirm 2017-02-08 13:34:06 +02:00
yuri db8536ac55 phone strikestrough 2017-02-08 12:37:13 +02:00
yuri e402745a86 change detailSmall layouts 2017-02-08 12:20:14 +02:00
yuri abcaaddc2f fix wysiwyg destroying 2017-02-08 12:00:53 +02:00
yuri 3ac375c95c confirm change 2017-02-08 11:32:25 +02:00
yuri 56f65e0fc0 ui dialog 2017-02-07 16:30:55 +02:00
yuri 471df0034e css changes 2017-02-07 12:50:40 +02:00
yuri a1b3be9ef3 Merge branch 'hotfix/4.4.2' 2017-02-07 11:32:36 +02:00
yuri c4f70482ac fix email folder navigate back 2017-02-07 11:31:53 +02:00
yuri 31a8fa387d fix autocomplete 2017-02-07 10:48:45 +02:00
yuri a0d6cb9be4 fix wysywyg modal 2017-02-07 10:34:53 +02:00
yuri 4586d26bd6 css fix 2017-02-06 17:41:52 +02:00
yuri 1609adc766 modal new style 2017-02-06 17:23:05 +02:00
yuri aa0a9cf708 Merge branch 'hotfix/4.4.2' 2017-02-06 11:44:04 +02:00
yuri d7dfe5fea4 email reply head text change 2017-02-06 11:43:47 +02:00
yuri 340ed5acec formula fix 2017-02-06 10:43:51 +02:00
yuri 7ec3e38e6d version 2017-02-03 15:53:53 +02:00
yuri 879bf13809 Merge branch 'stable' 2017-02-03 15:05:02 +02:00
yuri b44bbaffa2 Merge branch 'hotfix/4.4.1' 2017-02-02 12:44:12 +02:00
yuri 4c562cb603 Merge branch 'hotfix/4.4.1' 2017-02-02 11:59:19 +02:00
yuri 8eb2be46ca Merge branch 'hotfix/4.4.1' 2017-02-02 11:25:53 +02:00
yuri cd7571387c fix formula field 2017-02-01 15:55:15 +02:00
yuri 1b3496edd9 formula fix 2017-02-01 12:11:49 +02:00
yuri 356da4e70d Merge branch 'hotfix/4.4.1' 2017-02-01 12:06:06 +02:00
yuri f3deffb3f6 year 2017 2017-02-01 11:43:36 +02:00
yuri 8398cc4364 fix timeline 2017-02-01 11:14:18 +02:00
yuri 6ddda814c0 Merge branch 'hotfix/4.4.1' 2017-01-31 15:30:34 +02:00
yuri 76ffa2def9 duration sortable 2017-01-31 13:24:05 +02:00
yuri 2fdc0a3a93 Merge branch 'master' of https://github.com/espocrm/espocrm 2017-01-31 12:23:12 +02:00
Alasdair Campbell 0dcc8d08d1 Removed executable permission set on stub file data/.data (#386) 2017-01-30 13:15:32 +02:00
799 changed files with 27168 additions and 6557 deletions
+7 -1
View File
@@ -1,3 +1,9 @@
## Pull Requests
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.
[Code Style Guidelines](https://github.com/espocrm/espocrm/wiki/Code-Style-Guidelines).
[Code Style Guidelines](https://github.com/espocrm/espocrm/wiki/Code-Style-Guidelines).
## Issues
We don't provide developer help or any kind of support on github. Please use our [forum](http://forum.espocrm.com/) for this.
@@ -0,0 +1,42 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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 as EntityUser;
use \Espo\ORM\Entity;
class ActionHistoryRecord extends \Espo\Core\Acl\Base
{
public function checkIsOwner(EntityUser $user, Entity $entity)
{
return $entity->get('userId') === $user->id;
}
}
+61
View File
@@ -0,0 +1,61 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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 as EntityUser;
use \Espo\ORM\Entity;
class ScheduledJob extends \Espo\Core\Acl\Base
{
public function checkEntityRead(EntityUser $user, Entity $entity, $data)
{
if ($entity->get('isInternal')) return false;
return $this->checkEntity($user, $entity, $data, 'read');
}
public function checkEntityEdit(EntityUser $user, Entity $entity, $data)
{
if ($entity->get('isInternal')) return false;
return $this->checkEntity($user, $entity, $data, 'edit');
}
public function checkEntityDelete(EntityUser $user, Entity $entity, $data)
{
if ($entity->get('isInternal')) return false;
return $this->checkEntity($user, $entity, $data, 'delete');
}
public function checkEntityCreate(EntityUser $user, Entity $entity, $data)
{
if ($entity->get('isInternal')) return false;
return $this->checkEntity($user, $entity, $data, 'create');
}
}
@@ -0,0 +1,71 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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;
use \Espo\Core\Exceptions\Forbidden;
class ActionHistoryRecord extends \Espo\Core\Controllers\Record
{
public function actionUpdate($params, $data, $request)
{
throw new Forbidden();
}
public function actionCreate($params, $data, $request)
{
throw new Forbidden();
}
public function actionListLinked($params, $data, $request)
{
throw new Forbidden();
}
public function actionMassUpdate($params, $data, $request)
{
throw new Forbidden();
}
public function actionCreateLink($params, $data, $request)
{
throw new Forbidden();
}
public function actionRemoveLink($params, $data, $request)
{
throw new Forbidden();
}
public function actionMassDelete($params, $data, $request)
{
throw new Forbidden();
}
}
+3
View File
@@ -65,6 +65,9 @@ class App extends \Espo\Core\Controllers\Base
$settings->$item = $this->getConfig()->get($item);
}
unset($userData['authTokenId']);
unset($userData['password']);
return array(
'user' => $userData,
'acl' => $this->getAcl()->getMap(),
+1 -1
View File
@@ -54,7 +54,7 @@ class Attachment extends \Espo\Core\Controllers\Record
$attachment = $this->getEntityManager()->getEntity('Attachment');
$this->getEntityManager()->saveEntity($attachment);
$this->getContainer()->get('fileManager')->putContents('data/upload/' . $attachment->id, $contents);
$this->getContainer()->get('fileStorageManager')->putContents($attachment, $contents);
return array(
'attachmentId' => $attachment->id
+27 -10
View File
@@ -42,20 +42,37 @@ class AuthToken extends \Espo\Core\Controllers\Record
public function actionUpdate($params, $data, $request)
{
throw new Forbidden();
}
public function actionCreate($params, $data, $request)
{
throw new Forbidden();
}
public function actionListLinked($params, $data, $request)
{
if (
is_array($data) &&
array_key_exists('isActive', $data) &&
$data['isActive'] === false &&
count(array_keys($data)) === 1)
{
return parent::actionUpdate($params, $data, $request);
}
throw new Forbidden();
}
public function actionMassUpdate($params, $data, $request)
{
if (empty($data['attributes'])) {
throw new BadRequest();
}
$attributes = $data['attributes'];
if (
is_object($attributes) &&
isset($attributes->isActive) &&
$attributes->isActive === false &&
count(array_keys(get_object_vars($attributes))) === 1
) {
return parent::actionMassUpdate($params, $data, $request);
}
throw new Forbidden();
}
public function actionCreate($params, $data, $request)
{
throw new Forbidden();
}
+13 -13
View File
@@ -29,10 +29,10 @@
namespace Espo\Controllers;
use \Espo\Core\Exceptions\Error,
\Espo\Core\Exceptions\Forbidden,
\Espo\Core\Exceptions\NotFound,
\Espo\Core\Exceptions\BadRequest;
use Espo\Core\Exceptions\Error;
use Espo\Core\Exceptions\Forbidden;
use Espo\Core\Exceptions\NotFound;
use Espo\Core\Exceptions\BadRequest;
class FieldManager extends \Espo\Core\Controllers\Base
{
@@ -49,7 +49,7 @@ class FieldManager extends \Espo\Core\Controllers\Base
throw new BadRequest();
}
$data = $this->getContainer()->get('fieldManager')->read($params['name'], $params['scope']);
$data = $this->getContainer()->get('fieldManager')->read($params['scope'], $params['name']);
if (!isset($data)) {
throw new BadRequest();
@@ -65,16 +65,16 @@ class FieldManager extends \Espo\Core\Controllers\Base
}
$fieldManager = $this->getContainer()->get('fieldManager');
$fieldManager->create($data['name'], $data, $params['scope']);
$fieldManager->create($params['scope'], $data['name'], $data);
try {
$this->getContainer()->get('dataManager')->rebuild($params['scope']);
} catch (Error $e) {
$fieldManager->delete($data['name'], $params['scope']);
$fieldManager->delete($params['scope'], $data['name']);
throw new Error($e->getMessage());
}
return $fieldManager->read($data['name'], $params['scope']);
return $fieldManager->read($params['scope'], $data['name']);
}
public function putActionUpdate($params, $data)
@@ -84,7 +84,7 @@ class FieldManager extends \Espo\Core\Controllers\Base
}
$fieldManager = $this->getContainer()->get('fieldManager');
$fieldManager->update($params['name'], $data, $params['scope']);
$fieldManager->update($params['scope'], $params['name'], $data);
if ($fieldManager->isChanged()) {
$this->getContainer()->get('dataManager')->rebuild($params['scope']);
@@ -92,7 +92,7 @@ class FieldManager extends \Espo\Core\Controllers\Base
$this->getContainer()->get('dataManager')->clearCache();
}
return $fieldManager->read($params['name'], $params['scope']);
return $fieldManager->read($params['scope'], $params['name']);
}
public function deleteActionDelete($params, $data)
@@ -101,11 +101,11 @@ class FieldManager extends \Espo\Core\Controllers\Base
throw new BadRequest();
}
$res = $this->getContainer()->get('fieldManager')->delete($params['name'], $params['scope']);
$result = $this->getContainer()->get('fieldManager')->delete($params['scope'], $params['name']);
$this->getContainer()->get('dataManager')->rebuildMetadata();
return $res;
return $result;
}
public function postActionResetToDefault($params, $data)
@@ -114,7 +114,7 @@ class FieldManager extends \Espo\Core\Controllers\Base
throw new BadRequest();
}
$this->getContainer()->get('fieldManager')->resetToDefault($data['name'], $data['scope']);
$this->getContainer()->get('fieldManager')->resetToDefault($data['scope'], $data['name']);
$this->getContainer()->get('dataManager')->rebuildMetadata();
+9 -3
View File
@@ -68,9 +68,9 @@ class Import extends \Espo\Core\Controllers\Record
throw new BadRequest();
}
protected function getFileManager()
protected function getFileStorageManager()
{
return $this->getContainer()->get('fileManager');
return $this->getContainer()->get('fileStorageManager');
}
protected function getEntityManager()
@@ -92,7 +92,7 @@ class Import extends \Espo\Core\Controllers\Record
$attachment->set('name', 'import-file.csv');
$this->getEntityManager()->saveEntity($attachment);
$this->getFileManager()->putContents('data/upload/' . $attachment->id, $contents);
$this->getFileStorageManager()->putContents($attachment, $contents);
return array(
'attachmentId' => $attachment->id
@@ -167,12 +167,18 @@ class Import extends \Espo\Core\Controllers\Record
throw new BadRequest();
}
$timezone = 'UTC';
if (isset($data['timezone'])) {
$timezone = $data['timezone'];
}
$importParams = array(
'headerRow' => !empty($data['headerRow']),
'fieldDelimiter' => $data['fieldDelimiter'],
'textQualifier' => $data['textQualifier'],
'dateFormat' => $data['dateFormat'],
'timeFormat' => $data['timeFormat'],
'timezone' => $timezone,
'personNameFormat' => $data['personNameFormat'],
'decimalMark' => $data['decimalMark'],
'currency' => $data['currency'],
@@ -0,0 +1,46 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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;
use \Espo\Core\Exceptions\Forbidden;
class LastViewed extends \Espo\Core\Controllers\Base
{
public function getActionIndex($params, $data, $request)
{
$result = $this->getServiceFactory()->create('LastViewed')->get();
return [
'total' => $result['total'],
'list' => isset($result['collection']) ? $result['collection']->toArray() : $result['list']
];
}
}
+2 -3
View File
@@ -33,11 +33,10 @@ use \Espo\Core\Exceptions\Forbidden;
class Metadata extends \Espo\Core\Controllers\Base
{
public function actionRead($params, $data)
{
$data = $this->getMetadata()->getAll();
unset($data['formula']);
return $data;
return $this->getMetadata()->getAllForFrontend();
}
public function getActionGet($params, $data, $request)
+5
View File
@@ -69,6 +69,11 @@ class Acl
return $this->getAclManager()->get($this->getUser(), $permission);
}
public function checkReadNo($scope)
{
return $this->getAclManager()->checkReadNo($this->getUser(), $scope);
}
public function checkReadOnlyTeam($scope)
{
return $this->getAclManager()->checkReadOnlyTeam($this->getUser(), $scope);
+8
View File
@@ -106,6 +106,14 @@ class Base implements Injectable
return $data->read === 'team';
}
public function checkReadNo(User $user, $data)
{
if (empty($data) || !is_object($data) || !isset($data->read)) {
return false;
}
return $data->read === 'no';
}
public function checkReadOnlyOwn(User $user, $data)
{
if (empty($data) || !is_object($data) || !isset($data->read)) {
+9
View File
@@ -133,6 +133,15 @@ class AclManager
return $this->getTable($user)->get($permission);
}
public function checkReadNo(User $user, $scope)
{
if ($user->isAdmin()) {
return false;
}
$data = $this->getTable($user)->getScopeData($scope);
return $this->getImplementation($scope)->checkReadNo($user, $data);
}
public function checkReadOnlyTeam(User $user, $scope)
{
if ($user->isAdmin()) {
+15
View File
@@ -128,6 +128,14 @@ class Container
return new \Espo\Core\Utils\Api\Slim();
}
protected function loadFileStorageManager()
{
return new \Espo\Core\FileStorage\Manager(
$this->get('metadata')->get(['app', 'fileStorage', 'implementationClassNameMap']),
$this
);
}
protected function loadFileManager()
{
return new \Espo\Core\Utils\File\Manager(
@@ -343,6 +351,13 @@ class Container
);
}
protected function loadInjectableFactory()
{
return new \Espo\Core\InjectableFactory(
$this
);
}
public function setUser(\Espo\Entities\User $user)
{
$this->set('user', $user);
+1 -1
View File
@@ -67,7 +67,7 @@ class Record extends Base
public function actionRead($params, $data, $request)
{
$id = $params['id'];
$entity = $this->getRecordService()->getEntity($id);
$entity = $this->getRecordService()->readEntity($id);
if (empty($entity)) {
throw new NotFound();
@@ -0,0 +1,115 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\FileStorage;
use \Espo\Entities\Attachment;
use \Espo\Core\Exceptions\Error;
class Manager
{
private $implementations = array();
private $implementationClassNameMap = array();
private $container;
public function __construct(array $implementationClassNameMap, $container)
{
$this->implementationClassNameMap = $implementationClassNameMap;
$this->container = $container;
}
private function getImplementation($storage = null)
{
if (!$storage) {
$storage = 'EspoUploadDir';
}
if (array_key_exists($storage, $this->implementations)) {
return $this->implementations[$storage];
}
if (!array_key_exists($storage, $this->implementationClassNameMap)) {
throw new Error("FileStorageManager: Unknown storage '{$storage}'");
}
$className = $this->implementationClassNameMap[$storage];
$implementation = new $className();
foreach ($implementation->getDependencyList() as $dependencyName) {
$implementation->inject($dependencyName, $this->container->get($dependencyName));
}
$this->implementations[$storage] = $implementation;
return $implementation;
}
public function isFile(Attachment $attachment)
{
$implementation = $this->getImplementation($attachment->get('storage'));
return $implementation->isFile($attachment);
}
public function getContents(Attachment $attachment)
{
$implementation = $this->getImplementation($attachment->get('storage'));
return $implementation->getContents($attachment);
}
public function putContents(Attachment $attachment, $contents)
{
$implementation = $this->getImplementation($attachment->get('storage'));
return $implementation->putContents($attachment, $contents);
}
public function unlink(Attachment $attachment)
{
$implementation = $this->getImplementation($attachment->get('storage'));
return $implementation->unlink($attachment);
}
public function getLocalFilePath(Attachment $attachment)
{
$implementation = $this->getImplementation($attachment->get('storage'));
return $implementation->getLocalFilePath($attachment);
}
public function hasDownloadUrl(Attachment $attachment)
{
$implementation = $this->getImplementation($attachment->get('storage'));
return $implementation->hasDownloadUrl($attachment);
}
public function getDownloadUrl(Attachment $attachment)
{
$implementation = $this->getImplementation($attachment->get('storage'));
return $implementation->getDownloadUrl($attachment);
}
}
@@ -0,0 +1,89 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\FileStorage\Storages;
use \Espo\Core\Interfaces\Injectable;
abstract class Base implements Injectable
{
protected $dependencyList = [];
protected $injections = array();
public function inject($name, $object)
{
$this->injections[$name] = $object;
}
public function __construct()
{
$this->init();
}
protected function init()
{
}
protected function getInjection($name)
{
return $this->injections[$name];
}
protected function addDependency($name)
{
$this->dependencyList[] = $name;
}
protected function addDependencyList(array $list)
{
foreach ($list as $item) {
$this->addDependency($item);
}
}
public function getDependencyList()
{
return $this->dependencyList;
}
abstract public function hasDownloadUrl(\Espo\Entities\Attachment $attachment);
abstract public function getDownloadUrl(\Espo\Entities\Attachment $attachment);
abstract public function unlink(\Espo\Entities\Attachment $attachment);
abstract public function getContents(\Espo\Entities\Attachment $attachment);
abstract public function isFile(\Espo\Entities\Attachment $attachment);
abstract public function putContents(\Espo\Entities\Attachment $attachment, $contents);
abstract public function getLocalFilePath(\Espo\Entities\Attachment $attachment);
}
@@ -0,0 +1,85 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\FileStorage\Storages;
use \Espo\Entities\Attachment;
use \Espo\Core\Exceptions\Error;
class EspoUploadDir extends Base
{
protected $dependencyList = ['fileManager'];
protected function getFileManager()
{
return $this->getInjection('fileManager');
}
public function unlink(Attachment $attachment)
{
return $this->getFileManager()->unlink($this->getFilePath($attachment));
}
public function isFile(Attachment $attachment)
{
return $this->getFileManager()->isFile($this->getFilePath($attachment));
}
public function getContents(Attachment $attachment)
{
return $this->getFileManager()->getContents($this->getFilePath($attachment));
}
public function putContents(Attachment $attachment, $contents)
{
return $this->getFileManager()->putContents($this->getFilePath($attachment), $contents);
}
public function getLocalFilePath(Attachment $attachment)
{
return $this->getFilePath($attachment);
}
protected function getFilePath(Attachment $attachment)
{
$sourceId = $attachment->getSourceId();
return 'data/upload/' . $sourceId;
}
public function getDownloadUrl(Attachment $attachment)
{
throw new Error();
}
public function hasDownloadUrl(Attachment $attachment)
{
return false;
}
}
@@ -1,4 +1,4 @@
<?php
<?php
/************************************************************************
* This file is part of EspoCRM.
*
@@ -65,6 +65,13 @@ class AttributeFetcher
$methodName = 'getFetched';
}
if ($entity->getAttributeParam($attribute, 'isParentName') && $methodName == 'get') {
$relationName = $entity->getAttributeParam($attribute, 'relation');
if ($parent = $entity->get($relationName)) {
return $parent->get('name');
}
}
return $entity->$methodName($attribute);
}
@@ -0,0 +1,132 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\Formula\Functions\DatetimeGroup;
use \Espo\Core\Exceptions\Error;
class DiffType extends \Espo\Core\Formula\Functions\Base
{
protected function init()
{
$this->addDependency('dateTime');
}
protected $intevalTypePropertyMap = array(
'years' => 'y', 'months' => 'm', 'days' => 'd', 'hours' => 'h', 'minutes' => 'i', 'seconds' => 's'
);
public function process(\StdClass $item)
{
if (!property_exists($item, 'value')) {
throw new Error();
}
if (!is_array($item->value)) {
throw new Error();
}
if (count($item->value) < 2) {
throw new Error();
}
$dateTime1String = $this->evaluate($item->value[0]);
$dateTime2String = $this->evaluate($item->value[1]);
if (!$dateTime1String) {
return null;
}
if (!$dateTime2String) {
return null;
}
if (!is_string($dateTime1String)) {
throw new Error();
}
if (!is_string($dateTime2String)) {
throw new Error();
}
$intervalType = 'days';
if (count($item->value) > 2) {
$intervalType = $this->evaluate($item->value[2]);
}
if (!is_string($intervalType)) {
throw new Error();
}
if (!array_key_exists($intervalType, $this->intevalTypePropertyMap)) {
throw new Error('Not supported interval type' . $intervalType);
}
$isTime = false;
if (strlen($dateTime1String) > 10) {
$isTime = true;
}
try {
$dateTime1 = new \DateTime($dateTime1String);
$dateTime2 = new \DateTime($dateTime2String);
} catch (\Exception $e) {
return null;
}
$t1 = $dateTime1->getTimestamp();
$t2 = $dateTime2->getTimestamp();
$secondsDiff = $t1 - $t2;
if ($intervalType === 'seconds') {
$number = $secondsDiff;
} else if ($intervalType === 'minutes') {
$number = floor($secondsDiff / 60);
} else if ($intervalType === 'hours') {
$number = floor($secondsDiff / (60 * 60));
} else if ($intervalType === 'days') {
$number = floor($secondsDiff / (60 * 60 * 24));
} else {
$property = $this->intevalTypePropertyMap[$intervalType];
$interval = $dateTime2->diff($dateTime1);
$number = $interval->$property;
if ($interval->invert) {
$number *= -1;
}
if ($intervalType === 'months') {
$number += $interval->y * 12;
}
}
return $number;
}
}
@@ -1,4 +1,4 @@
<?php
<?php
/************************************************************************
* This file is part of EspoCRM.
*
@@ -58,10 +58,15 @@ class FormatType extends \Espo\Core\Formula\Functions\Base
}
$value = $this->evaluate($item->value[0]);
$format = null;
if (count($item->value) > 2) {
$format = $this->evaluate($item->value[2]);
}
if (strlen($value) > 11) {
return $this->getInjection('dateTime')->convertSystemDateTime($value, $timezone);
return $this->getInjection('dateTime')->convertSystemDateTime($value, $timezone, $format);
} else {
return $this->getInjection('dateTime')->convertSystemDate($value);
return $this->getInjection('dateTime')->convertSystemDate($value, $format);
}
}
}
@@ -0,0 +1,59 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\Formula\Functions\NumberGroup;
use \Espo\Core\Exceptions\Error;
class AbsType extends \Espo\Core\Formula\Functions\Base
{
public function process(\StdClass $item)
{
if (!property_exists($item, 'value')) {
return true;
}
if (!is_array($item->value)) {
throw new Error();
}
if (count($item->value) < 1) {
throw new Error();
}
$value = $this->evaluate($item->value[0]);
if (!is_numeric($value)) {
return null;
}
return abs($value);
}
}
@@ -0,0 +1,63 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\Formula\Functions\NumberGroup;
use \Espo\Core\Exceptions\Error;
class RoundType extends \Espo\Core\Formula\Functions\Base
{
public function process(\StdClass $item)
{
if (!property_exists($item, 'value')) {
return true;
}
if (!is_array($item->value)) {
throw new Error();
}
if (count($item->value) < 1) {
throw new Error();
}
$value = $this->evaluate($item->value[0]);
$precision = 0;
if (count($item->value) > 1) {
$precision = $this->evaluate($item->value[1]);
}
if (!is_numeric($value)) {
return null;
}
return round($value, $precision);
}
}
+5 -1
View File
@@ -229,7 +229,11 @@ class Parser
$possibleRightOperator = trim($operator . $expression[$index + 1]);
}
}
if ($possibleRightOperator && $possibleRightOperator != $operator && $this->operatorMap[$possibleRightOperator]) continue;
if (
$possibleRightOperator &&
$possibleRightOperator != $operator &&
!empty($this->operatorMap[$possibleRightOperator])
) continue;
$firstPart = substr($expression, 0, $index);
$secondPart = substr($expression, $index + strlen($operator));
+10 -10
View File
@@ -42,17 +42,14 @@ class HookManager
protected $cacheFile = 'data/cache/application/hooks.php';
/**
* List of defined hooks
* List of ignored hook methods
*
* @var array
*/
protected $hookList = array(
'beforeSave',
'afterSave',
'beforeRemove',
'afterRemove',
'afterRelate',
'afterUnrelate'
protected $ignoredMethodList = array(
'__construct',
'getDependencyList',
'inject'
);
protected $paths = array(
@@ -170,9 +167,12 @@ class HookManager
$hookFilePath = Util::concatPath($hookScopeDirPath, $hookFile);
$className = Util::getClassName($hookFilePath);
foreach($this->hookList as $hookName) {
$classMethods = get_class_methods($className);
$hookMethods = array_diff($classMethods, $this->ignoredMethodList);
foreach($hookMethods as $hookName) {
$entityHookData = isset($hookData[$scopeName][$hookName]) ? $hookData[$scopeName][$hookName] : array();
if (method_exists($className, $hookName) && !$this->isHookExists($className, $entityHookData)) {
if (!$this->isHookExists($className, $entityHookData)) {
$hookData[$normalizedScopeName][$hookName][$className::$order][] = $className;
}
}
+24 -3
View File
@@ -48,12 +48,15 @@ class Htmlizer
protected $acl;
public function __construct(FileManager $fileManager, DateTime $dateTime, NumberUtil $number, $acl = null)
protected $entityManager;
public function __construct(FileManager $fileManager, DateTime $dateTime, NumberUtil $number, $acl = null, $entityManager = null)
{
$this->fileManager = $fileManager;
$this->dateTime = $dateTime;
$this->number = $number;
$this->acl = $acl;
$this->entityManager = $entityManager;
}
protected function getAcl()
@@ -61,6 +64,11 @@ class Htmlizer
return $this->acl;
}
protected function getEntityManager()
{
return $this->entityManager;
}
protected function format($value)
{
if (is_float($value)) {
@@ -163,7 +171,8 @@ class Htmlizer
'helpers' => [
'file' => function ($context, $options) {
if (count($context) && $context[0]) {
return 'data/upload/'.$context[0];
$id = $context[0];
return "?entryPoint=attachment&id=" . $id;
}
}
]
@@ -192,8 +201,20 @@ class Htmlizer
$html = $renderer($data);
$html = str_replace('?entryPoint=attachment&amp;', '?entryPoint=attachment&', $html);
$html = preg_replace('/\?entryPoint=attachment\&id=(.*)/', 'data/upload/$1', $html);
if ($this->getEntityManager()) {
$html = preg_replace_callback('/\?entryPoint=attachment\&id=([A-Za-z0-9]*)/', function ($matches) {
$id = $matches[1];
$attachment = $this->getEntityManager()->getEntity('Attachment', $id);
if ($attachment) {
$filePath = $this->getEntityManager()->getRepository('Attachment')->getFilePath($attachment);
return $filePath;
}
}, $html);
}
return $html;
}
+74
View File
@@ -0,0 +1,74 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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;
abstract class Injectable implements \Espo\Core\Interfaces\Injectable
{
protected $dependencyList = array();
protected $injections = array();
public function inject($name, $object)
{
$this->injections[$name] = $object;
}
public function __construct()
{
$this->init();
}
protected function init()
{
}
protected function getInjection($name)
{
return $this->injections[$name];
}
protected function addDependency($name)
{
if (in_array($name, $this->dependencyList)) return;
$this->dependencyList[] = $name;
}
protected function addDependencyList(array $list)
{
foreach ($list as $item) {
$this->addDependency($item);
}
}
public function getDependencyList()
{
return $this->dependencyList;
}
}
@@ -0,0 +1,58 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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;
use \Espo\Core\Exceptions\Error;
class InjectableFactory
{
private $container;
public function __construct(Container $container)
{
$this->container = $container;
}
public function createByClassName($className)
{
if (class_exists($className)) {
$service = new $className();
if (!($service instanceof \Espo\Core\Interfaces\Injectable)) {
throw new Error("Class '$className' is not instance of Injectable interface");
}
$dependencyList = $service->getDependencyList();
foreach ($dependencyList as $name) {
$service->inject($name, $this->container->get($name));
}
return $service;
}
throw new Error("Class '$className' does not exist");
}
}
+11 -4
View File
@@ -104,12 +104,16 @@ class Importer
}
}
if ($parser->checkMessageAttribute($message, 'from')) {
$email->set('fromString', $parser->getMessageAttribute($message, 'from'));
$fromAddressData = $parser->getAddressDataFromMessage($message, 'from');
if ($fromAddressData) {
$fromString = ($fromAddressData['name'] ? ($fromAddressData['name'] . ' ') : '') . '<' . $fromAddressData['address'] .'>';
$email->set('fromString', $fromString);
}
if ($parser->checkMessageAttribute($message, 'reply-To')) {
$email->set('replyToString', $parser->getMessageAttribute($message, 'reply-To'));
$replyToData = $parser->getAddressDataFromMessage($message, 'reply-To');
if ($replyToData) {
$replyToString = ($replyToData['name'] ? ($replyToData['name'] . ' ') : '') . '<' . $replyToData['address'] .'>';
$email->set('replyToString', $replyToString);
}
$fromArr = $parser->getAddressListFromMessage($message, 'from');
@@ -124,6 +128,9 @@ class Importer
$email->set('cc', implode(';', $ccArr));
$email->set('replyTo', implode(';', $replyToArr));
$addressNameMap = $parser->getAddressNameMap($message);
$email->set('addressNameMap', $addressNameMap);
if ($folderData) {
foreach ($folderData as $uId => $folderId) {
$email->setLinkMultipleColumn('users', 'folderId', $uId, $folderId);
@@ -0,0 +1,222 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\Parsers;
class MailMimeParser
{
private $entityManager;
private $parser = array();
protected $messageHash = array();
public function __construct($entityManager)
{
$this->entityManager = $entityManager;
}
protected function getEntityManager()
{
return $this->entityManager;
}
protected function getParser()
{
if (!$this->parser) {
$this->parser = new \ZBateson\MailMimeParser\MailMimeParser();
}
return $this->parser;
}
protected function loadContent($message)
{
$raw = $message->getFullRawContent();
$key = spl_object_hash($message);
$this->messageHash[$key] = $this->getParser()->parse($raw);
}
protected function getMessage($message)
{
$key = spl_object_hash($message);
if (!array_key_exists($key, $this->messageHash)) {
$raw = $message->getRawHeader();
if (!$raw) {
$raw = $message->getFullRawContent();
}
$this->messageHash[$key] = $this->getParser()->parse($raw);
}
return $this->messageHash[$key];
}
public function checkMessageAttribute($message, $attribute)
{
return $this->getMessage($message)->getHeaderValue($attribute) !== null;
}
public function getMessageAttribute($message, $attribute)
{
if (!$this->checkMessageAttribute($message, $attribute)) return null;
return $this->getMessage($message)->getHeaderValue($attribute);
}
public function getMessageMessageId($message)
{
return $this->getMessageAttribute($message, 'Message-ID');
}
public function getAddressNameMap($message)
{
$map = (object) [];
foreach (['from', 'to', 'cc', 'reply-To'] as $type) {
$header = $this->getMessage($message)->getHeader($type);
if ($header) {
$list = $header->getAddresses();
foreach ($list as $item) {
$address = $item->getEmail();
$name = $item->getName();
if ($name && $address) {
$map->$address = $name;
}
}
}
}
return $map;
}
public function getAddressDataFromMessage($message, $type)
{
$addressList = [];
$header = $this->getMessage($message)->getHeader($type);
if ($header) {
foreach ($header->getAddresses() as $item) {
return [
'address' => $item->getEmail(),
'name' => $item->getName()
];
}
}
return null;
}
public function getAddressListFromMessage($message, $type)
{
$addressList = [];
$header = $this->getMessage($message)->getHeader($type);
if ($header) {
$list = $header->getAddresses();
foreach ($list as $address) {
$addressList[] = $address->getEmail();
}
}
return $addressList;
}
public function fetchContentParts(\Espo\Entities\Email $email, $message)
{
$this->loadContent($message);
$bodyPlain = $this->getMessage($message)->getTextContent();
$bodyHtml = $this->getMessage($message)->getHtmlContent();
if ($bodyHtml) {
$email->set('isHtml', true);
$email->set('body', $bodyHtml);
$email->set('bodyPlain', $bodyPlain);
} else {
$email->set('isHtml', false);
$email->set('body', $bodyPlain);
}
if (!$email->get('body') && $email->get('bodyPlain')) {
$email->set('body', $email->get('bodyPlain'));
}
$attachmentObjList = $this->getMessage($message)->getAllAttachmentParts();
$inlineIds = array();
foreach ($attachmentObjList as $attachmentObj) {
$attachment = $this->getEntityManager()->getEntity('Attachment');
$content = $attachmentObj->getContent();
$disposition = $attachmentObj->getHeaderValue('Content-Disposition');
$attachment = $this->getEntityManager()->getEntity('Attachment');
$attachment->set('name', $attachmentObj->getHeaderParameter('Content-Disposition', 'filename', 'unnamed'));
$attachment->set('type', $attachmentObj->getHeaderValue('Content-Type'));
$contentId = $attachmentObj->getHeaderValue('Content-ID');
if ($contentId) {
$contentId = trim($contentId, '<>');
}
if ($disposition == 'inline') {
$attachment->set('role', 'Inline Attachment');
} else {
$attachment->set('role', 'Attachment');
}
$attachment->set('contents', $content);
$this->getEntityManager()->saveEntity($attachment);
if ($disposition == 'attachment') {
$email->addLinkMultipleId('attachments', $attachment->id);
if ($contentId) {
$inlineIds[$contentId] = $attachment->id;
}
} else if ($disposition == 'inline') {
if ($contentId) {
$inlineIds[$contentId] = $attachment->id;
}
}
}
$body = $email->get('body');
if (!empty($body)) {
foreach ($inlineIds as $cid => $attachmentId) {
if (strpos($body, 'cid:' . $cid) !== false) {
$body = str_replace('cid:' . $cid, '?entryPoint=attachment&amp;id=' . $attachmentId, $body);
} else {
$email->addLinkMultipleId('attachments', $attachmentId);
}
}
$email->set('body', $body);
}
}
}
@@ -85,6 +85,42 @@ class PhpMimeMailParser
return $this->getMessageAttribute($message, 'Message-ID');
}
public function getAddressNameMap($message)
{
$map = (object) [];
foreach (['from', 'to', 'cc', 'reply-To'] as $type) {
if ($this->checkMessageAttribute($message, $type)) {
$list = $this->getParser($message)->getAddresses($type);
foreach ($list as $item) {
$name = $list[0]['display'];
$address = $list[0]['address'];
if ($name && $address && $name !== $address) {
$map->$address = $name;
}
}
}
}
return $map;
}
public function getAddressDataFromMessage($message, $type)
{
$addressList = [];
if ($this->checkMessageAttribute($message, $type)) {
$list = $this->getParser($message)->getAddresses($type);
if (count($list)) {
return [
'address' => $list[0]['address'],
'name' => $list[0]['display'],
];
}
}
return null;
}
public function getAddressListFromMessage($message, $type)
{
$addressList = [];
@@ -130,9 +166,10 @@ class PhpMimeMailParser
$attachment->set('name', $attachmentObj->getFileName());
$attachment->set('type', $attachmentObj->getContentType());
$contentId = $attachmentObj->getContentID();
if ($disposition == 'inline') {
$attachment->set('role', 'Inline Attachment');
$contentId = $attachmentObj->getContentID();
} else {
$attachment->set('role', 'Attachment');
}
@@ -142,11 +179,14 @@ class PhpMimeMailParser
$this->getEntityManager()->saveEntity($attachment);
if ($disposition == 'attachment') {
$attachmentsIds = $email->get('attachmentsIds');
$attachmentsIds[] = $attachment->id;
$email->set('attachmentsIds', $attachmentsIds);
$email->addLinkMultipleId('attachments', $attachment->id);
if ($contentId) {
$inlineIds[$contentId] = $attachment->id;
}
} else if ($disposition == 'inline') {
$inlineIds[$contentId] = $attachment->id;
if ($contentId) {
$inlineIds[$contentId] = $attachment->id;
}
}
}
@@ -57,7 +57,9 @@ class Parser extends \PhpMimeMailParser\Parser
&& substr($part['content-type'], 0, 10) !== 'multipart/'
) {
// if we cannot get it by getMessageBody(), we assume it is an attachment
$disposition = 'attachment';
if ($disposition !== 'inline') {
$disposition = 'attachment';
}
}
if (in_array($disposition, $dispositions) === true && isset($filename) === true) {
@@ -72,6 +72,45 @@ class ZendMail
return $messageId;
}
public function getAddressNameMap($message)
{
$map = (object) [];
$zendMessage = $message->getZendMessage();
foreach (['from', 'to', 'cc', 'reply-To'] as $type) {
if (isset($zendMessage->$type)) {
$list = $this->normilizeHeader($zendMessage->getHeader($type))->getAddressList();
foreach ($list as $item) {
$name = $item->getName();
$address = $item->getEmail();
if ($name && $address && $name !== $address) {
$map->$address = $name;
}
}
}
}
return $map;
}
public function getAddressDataFromMessage($message, $type)
{
$zendMessage = $message->getZendMessage();
$addressList = array();
if (isset($zendMessage->$type)) {
$list = $this->normilizeHeader($zendMessage->getHeader($type))->getAddressList();
foreach ($list as $address) {
return [
'address' => $address->getEmail(),
'name' => $address->getName()
];
}
}
return null;
}
public function getAddressListFromMessage($message, $type)
{
$zendMessage = $message->getZendMessage();
@@ -227,6 +266,13 @@ class ZendMail
$attachmentsIds = $email->get('attachmentsIds');
$attachmentsIds[] = $attachment->id;
$email->set('attachmentsIds', $attachmentsIds);
if (isset($part->contentID)) {
$contentId = trim($part->contentID, '<>');
if ($contentId) {
$inlineIds[$contentId] = $attachment->id;
}
}
} else if ($disposition == 'inline') {
$inlineIds[$contentId] = $attachment->id;
}
@@ -189,6 +189,16 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable
$this->getEntityManager()->getHookManager()->process($this->entityType, 'afterRemove', $entity, $options);
}
protected function afterMassRelate(Entity $entity, $relationName, array $params = array(), array $options = array())
{
$hookData = array(
'relationName' => $relationName,
'relationParams' => $params
);
$this->getEntityManager()->getHookManager()->process($this->entityType, 'afterMassRelate', $entity, $options, $hookData);
}
public function remove(Entity $entity, array $options = array())
{
$result = parent::remove($entity, $options);
@@ -178,6 +178,15 @@ class AclManager extends \Espo\Core\AclManager
return parent::checkReadOnlyTeam($user, $scope);
}
public function checkReadNo(User $user, $scope)
{
if ($this->checkUserIsNotPortal($user)) {
$data = $this->getTable($user)->getScopeData($scope);
return $this->getMainManager()->checkReadNo($user, $data);
}
return parent::checkReadNo($user, $scope);
}
public function checkReadOnlyOwn(User $user, $scope)
{
if ($this->checkUserIsNotPortal($user)) {
@@ -35,11 +35,6 @@ class Language extends \Espo\Core\Utils\Language
{
public function setPortal($portal)
{
if ($portal->get('language') !== '' && $portal->get('language')) {
if (!$this->getPreferences()->get('language')) {
$this->setLanguage($portal->get('language'));
}
}
}
}
+129 -11
View File
@@ -57,7 +57,9 @@ class Base
private $userTimeZone = null;
protected $additionalFilterTypeList = ['linkedWith', 'inCategory', 'isUserFromTeams'];
protected $additionalFilterTypeList = ['inCategory', 'isUserFromTeams'];
protected $textFilterUseContainsAttributeList = [];
const MIN_LENGTH_FOR_CONTENT_SEARCH = 4;
@@ -144,7 +146,7 @@ class Base
$list = $this->getMetadata()->get(['entityDefs', $this->getEntityType(), 'fields', $sortBy, 'options']);
if ($list && is_array($list) && count($list)) {
if ($this->getMetadata()->get(['entityDefs', $this->getEntityType(), 'fields', $sortBy, 'isSorted'])) {
$list = asort($list);
asort($list);
}
if ($desc) {
$list = array_reverse($list);
@@ -210,7 +212,7 @@ class Base
foreach ($where as $item) {
$type = $item['type'];
if (!in_array($type, $ignoreTypeList)) {
$part = $this->getWherePart($item);
$part = $this->getWherePart($item, $result);
if (!empty($part)) {
$whereClause[] = $part;
}
@@ -257,13 +259,18 @@ class Base
$defs = $relDefs[$link];
if ($relationType == 'manyMany') {
$this->addJoin([$link, $link . 'Filter'], $result);
$this->addLeftJoin([$link, $link . 'Filter'], $result);
$midKeys = $seed->getRelationParam($link, 'midKeys');
if (!empty($midKeys)) {
$key = $midKeys[1];
$part[$link . 'Filter' . 'Middle.' . $key] = $idsValue;
}
} else if ($relationType == 'hasMany') {
$alias = $link . 'Filter';
$this->addLeftJoin([$link, $alias], $result);
$part[$alias . '.id'] = $idsValue;
} else if ($relationType == 'belongsTo') {
$key = $seed->getRelationParam($link, 'key');
if (!empty($key)) {
@@ -428,6 +435,8 @@ class Base
if (!$this->getUser()->isAdmin()) {
if ($this->getAcl()->checkReadOnlyTeam($this->getEntityType())) {
$this->accessOnlyTeam($result);
} else if ($this->getAcl()->checkReadNo($this->getEntityType())) {
$this->accessNo($result);
}
}
}
@@ -440,12 +449,21 @@ class Base
} else {
if ($this->getAcl()->checkReadOnlyContact($this->getEntityType())) {
$this->accessPortalOnlyContact($result);
} else if ($this->getAcl()->checkReadNo($this->getEntityType())) {
$this->accessNo($result);
}
}
}
}
}
protected function accessNo(&$result)
{
$result['whereClause'][] = array(
'id' => null
);
}
protected function accessOnlyOwn(&$result)
{
if ($this->hasAssignedUsersField()) {
@@ -724,7 +742,7 @@ class Base
$attribute = $w['attribute'];
}
if ($attribute) {
if (isset($w['type']) && $w['type'] === 'linkedWith') {
if (isset($w['type']) && in_array($w['type'], ['isLinked', 'isNotLinked', 'linkedWith', 'notLinkedWith', 'isUserFromTeams'])) {
if (in_array($attribute, $this->getAcl()->getScopeForbiddenFieldList($this->getEntityType()))) {
throw new Forbidden();
}
@@ -928,7 +946,7 @@ class Base
return $result;
}
protected function getWherePart($item)
protected function getWherePart($item, &$result = null)
{
$part = array();
@@ -940,22 +958,29 @@ class Base
$attribute = $item['attribute'];
}
if (!is_null($attribute) && !is_string($attribute)) {
throw new Error('Bad attribute in where statement');
}
if (!empty($attribute) && !empty($item['type'])) {
$methodName = 'getWherePart' . ucfirst($attribute) . ucfirst($item['type']);
if (method_exists($this, $methodName)) {
$value = null;
if (!empty($item['value'])) {
if (array_key_exists('value', $item)) {
$value = $item['value'];
}
return $this->$methodName($value);
return $this->$methodName($value, $result);
}
}
if (!empty($item['dateTime'])) {
return $this->convertDateTimeWhere($item);
}
if (!array_key_exists('value', $item)) {
$item['value'] = null;
}
if (!empty($item['type'])) {
switch ($item['type']) {
case 'or':
@@ -963,7 +988,7 @@ class Base
if (is_array($item['value'])) {
$arr = array();
foreach ($item['value'] as $i) {
$a = $this->getWherePart($i);
$a = $this->getWherePart($i, $result);
foreach ($a as $left => $right) {
if (!empty($right) || is_null($right) || $right === '') {
$arr[] = array($left => $right);
@@ -1107,7 +1132,7 @@ class Base
$quarter--;
if ($quarter == 0) {
$quarter = 4;
$dt->sub('P1Y');
$dt->modify('-1 year');
}
$part['AND'] = array(
$attribute . '>=' => $dt->add(new \DateInterval('P'.(($quarter - 1) * 3).'M'))->format('Y-m-d'),
@@ -1136,6 +1161,96 @@ class Base
);
}
break;
case 'isNotLinked':
if (!$result) break;
$alias = $attribute . 'IsNotLinkedFilter' . strval(rand(10000, 99999));;
$part[$alias . '.id'] = null;
$this->setDistinct(true, $result);
$this->addLeftJoin([$attribute, $alias], $result);
break;
case 'isLinked':
if (!$result) break;
$alias = $attribute . 'IsLinkedFilter' . strval(rand(10000, 99999));;
$part[$alias . '.id!='] = null;
$this->setDistinct(true, $result);
$this->addLeftJoin([$attribute, $alias], $result);
break;
case 'linkedWith':
$seed = $this->getSeed();
$link = $attribute;
if (!$seed->hasRelation($link)) break;
$alias = $link . 'Filter' . strval(rand(10000, 99999));
$value = $item['value'];
if (is_null($value)) break;
$relationType = $seed->getRelationType($link);
if ($relationType == 'manyMany') {
$this->addLeftJoin([$link, $alias], $result);
$midKeys = $seed->getRelationParam($link, 'midKeys');
if (!empty($midKeys)) {
$key = $midKeys[1];
$part[$alias . 'Middle.' . $key] = $value;
}
} else if ($relationType == 'hasMany') {
$this->addLeftJoin([$link, $alias], $result);
$part[$alias . '.id'] = $value;
} else if ($relationType == 'belongsTo') {
$key = $seed->getRelationParam($link, 'key');
if (!empty($key)) {
$part[$key] = $value;
}
} else if ($relationType == 'hasOne') {
$this->addLeftJoin([$link, $alias], $result);
$part[$alias . '.id'] = $value;
} else {
break;;
}
$this->setDistinct(true, $result);
break;
case 'notLinkedWith':
$seed = $this->getSeed();
$link = $attribute;
if (!$seed->hasRelation($link)) break;
$value = $item['value'];
if (is_null($value)) break;
$relationType = $seed->getRelationType($link);
$alias = $link . 'NotLinkedFilter' . strval(rand(10000, 99999));
if ($relationType == 'manyMany') {
$this->addLeftJoin([$link, $alias], $result);
$midKeys = $seed->getRelationParam($link, 'midKeys');
if (!empty($midKeys)) {
$key = $midKeys[1];
$result['joinConditions'][$alias] = [$key => $value];
$part[$alias . 'Middle.' . $key] = null;
}
} else if ($relationType == 'hasMany') {
$this->addLeftJoin([$link, $alias], $result);
$result['joinConditions'][$alias] = ['id' => $value];
$part[$alias . '.id'] = null;
} else if ($relationType == 'belongsTo') {
$key = $seed->getRelationParam($link, 'key');
if (!empty($key)) {
$part[$key . '!='] = $value;
}
} else if ($relationType == 'hasOne') {
$this->addLeftJoin([$link, alias], $result);
$part[$alias . '.id!='] = $value;
} else {
break;
}
$this->setDistinct(true, $result);
}
}
@@ -1322,6 +1437,9 @@ class Base
(
!empty($fieldDefs[$field]['type']) && $fieldDefs[$field]['type'] == 'text'
||
!empty($this->textFilterUseContainsAttributeList[$field])
||
!empty($fieldDefs[$field]['type']) && $fieldDefs[$field]['type'] == 'varchar' &&
$this->getConfig()->get('textFilterUseContainsForVarchar')
)
) {
@@ -4,7 +4,7 @@
"tab": true,
"acl": true,
"aclPortal": true,
"aclPortalLevelList": ["all", "account", "own", "no"],
"aclPortalLevelList": ["all", "account", "contact", "own", "no"],
"customizable": true,
"importable": true,
"notifications": true
@@ -4,7 +4,7 @@
"tab": true,
"acl": true,
"aclPortal": true,
"aclPortalLevelList": ["all", "account", "own", "no"],
"aclPortalLevelList": ["all", "account", "contact", "own", "no"],
"customizable": true,
"importable": true,
"notifications": true
@@ -4,7 +4,7 @@
"tab": true,
"acl": true,
"aclPortal": true,
"aclPortalLevelList": ["all", "account", "own", "no"],
"aclPortalLevelList": ["all", "account", "contact", "own", "no"],
"customizable": true,
"importable": true,
"notifications": true
@@ -1,6 +1,9 @@
{
"controller": "controllers/record",
"boolFilterList": ["onlyMy"],
"recordViews": {
"detail": "views/templates/event/record/detail"
},
"activityDefs": {
"activitiesCreate": true,
"historyCreate": true
@@ -33,12 +33,12 @@
"options": [300, 600, 900, 1800, 2700, 3600, 7200],
"default": 300,
"notStorable": true,
"select": "TIMESTAMPDIFF(SECOND, date_start, date_end)",
"select": "TIMESTAMPDIFF(SECOND, {tableName}.date_start, {tableName}.date_end)",
"orderBy": "duration {direction}"
},
"parent": {
"type": "linkParent",
"entityList": ["Account", "Lead"]
"entityList": ["Account", "Lead", "Contact"]
},
"description": {
"type": "text"
@@ -46,7 +46,8 @@
"reminders": {
"type": "jsonArray",
"notStorable": true,
"view": "crm:views/meeting/fields/reminders"
"view": "crm:views/meeting/fields/reminders",
"layoutListDisabled": true
},
"createdAt": {
"type": "datetime",
@@ -4,7 +4,7 @@
"tab": true,
"acl": true,
"aclPortal": true,
"aclPortalLevelList": ["all", "account", "own", "no"],
"aclPortalLevelList": ["all", "account", "contact", "own", "no"],
"customizable": true,
"importable": true,
"notifications": true
@@ -0,0 +1,5 @@
{
"labels": {
"Create {entityType}": "Opret {entityTypeTranslated} "
}
}
@@ -0,0 +1,10 @@
{
"links": {
"meetings": "Møder",
"calls": "Opkald",
"tasks": "Opgaver"
},
"labels": {
"Create {entityType}": "Opret {entityTypeTranslated} "
}
}
@@ -0,0 +1,15 @@
{
"fields": {
"billingAddress": "Betalingsadresse",
"shippingAddress": "Leveringsadresse",
"website": "Website"
},
"links": {
"meetings": "Møder",
"calls": "Opkald",
"tasks": "Opgaver"
},
"labels": {
"Create {entityType}": "Opret {entityTypeTranslated} "
}
}
@@ -0,0 +1,36 @@
{
"fields": {
"parent": "Henviser til",
"dateStart": "Startdato",
"dateEnd": "Slutdato",
"duration": "Varighed",
"status": "Status",
"reminders": "Underretninger"
},
"links": {
"parent": "Henviser til"
},
"options": {
"status": {
"Planned": "Planlagt",
"Held": "Gennemført",
"Not Held": "Ikke Gennemført"
}
},
"labels": {
"Create {entityType}": "Opret {entityTypeTranslated}",
"Schedule {entityType}": "Planlæg {entityTypeTranslated}",
"Log {entityType}": "Log {entityTypeTranslated}",
"Set Held": "Marker som Gennemført",
"Set Not Held": "Marker som Ikke Gennemført"
},
"massActions": {
"setHeld": "Marker som Gennemført",
"setNotHeld": "Marker som Ikke Gennemført"
},
"presetFilters": {
"planned": "Planlagt",
"held": "Gennemført",
"todays": "Dagens"
}
}
@@ -0,0 +1,13 @@
{
"fields": {
"address": "Adresse"
},
"links": {
"meetings": "Møder",
"calls": "Opkald",
"tasks": "Opgaver"
},
"labels": {
"Create {entityType}": "Opret {entityTypeTranslated}"
}
}
@@ -4,7 +4,8 @@
"dateStart": "Startdatum",
"dateEnd": "Enddatum",
"duration": "Dauer",
"status": "Status"
"status": "Status",
"reminders": "Erinnerungen"
},
"links": {
"parent": "Bezieht sich auf"
@@ -0,0 +1,5 @@
{
"labels": {
"Create {entityType}": "Opprett {entityTypeTranslated}"
}
}
@@ -0,0 +1,10 @@
{
"links": {
"meetings": "Møter",
"calls": "Samtaler",
"tasks": "Oppgaver"
},
"labels": {
"Create {entityType}": "Opprett {entityTypeTranslated}"
}
}
@@ -0,0 +1,15 @@
{
"fields": {
"billingAddress": "Faktureringsadresse",
"shippingAddress": "Leveringsadresse",
"website": "Nettside"
},
"links": {
"meetings": "Møter",
"calls": "Samtaler",
"tasks": "Oppgaver"
},
"labels": {
"Create {entityType}": "Opprett {entityTypeTranslated}"
}
}
@@ -0,0 +1,36 @@
{
"fields": {
"parent": "Forelder",
"dateStart": "Startdato",
"dateEnd": "Sluttdato",
"duration": "Varighet",
"status": "Status",
"reminders": "Påminnelser"
},
"links": {
"parent": "Forelder"
},
"options": {
"status": {
"Planned": "Planlagt",
"Held": "Gjennomført",
"Not Held": "Ikke gjennomført"
}
},
"labels": {
"Create {entityType}": "Opprett {entityTypeTranslated}",
"Schedule {entityType}": "Planlegg {entityTypeTranslated}",
"Log {entityType}": "Logg {entityTypeTranslated}",
"Set Held": "Merk som gjennomført",
"Set Not Held": "Merk som ikke gjennomført"
},
"massActions": {
"setHeld": "Merk som gjennomført",
"setNotHeld": "Merk som ikke gjennomført"
},
"presetFilters": {
"planned": "Planlagt",
"held": "Gjennomført",
"todays": "Dagens"
}
}
@@ -0,0 +1,13 @@
{
"fields": {
"address": "Adresse"
},
"links": {
"meetings": "Møter",
"calls": "Samtaler",
"tasks": "Oppgaver"
},
"labels": {
"Create {entityType}": "Opprett {entityTypeTranslated}"
}
}
@@ -1,5 +1,5 @@
{
"labels": {
"Create {entityType}": "{entityTypeTranslated} Oluştur"
}
}
"labels": {
"Create {entityType}": "{entityTypeTranslated} oluştur"
}
}
@@ -1,5 +1,10 @@
{
"labels": {
"Create {entityType}": "{entityTypeTranslated} Oluştur"
}
}
"links": {
"meetings": "Toplantılar",
"calls": "(Seslenme)",
"tasks": "Görevler"
},
"labels": {
"Create {entityType}": "{entityTypeTranslated} oluştur"
}
}
@@ -1,5 +1,15 @@
{
"labels": {
"Create {entityType}": "{entityTypeTranslated} Oluştur"
}
}
"fields": {
"billingAddress": "Fatura Adresi",
"shippingAddress": "Teslimat Adresi",
"website": "Web sitesi "
},
"links": {
"meetings": "Toplantılar",
"calls": "(Seslenme)",
"tasks": "Görevler"
},
"labels": {
"Create {entityType}": "{entityTypeTranslated} oluştur"
}
}
@@ -1,5 +1,36 @@
{
"labels": {
"Create {entityType}": "{entityTypeTranslated} Oluştur"
"fields": {
"parent": "Üst",
"dateStart": "Başlangıç Tarihi",
"dateEnd": "Son Tarih",
"duration": "Süre ",
"status": "Durum ",
"reminders": "Hatırlatıcılar"
},
"links": {
"parent": "Üst"
},
"options": {
"status": {
"Planned": "Planlandı",
"Held": "Düzenlenen",
"Not Held": "Düzenlenmedi"
}
}
},
"labels": {
"Create {entityType}": "{entityTypeTranslated} oluştur",
"Schedule {entityType}": "Zamanlama {entityTypeTranslated}",
"Log {entityType}": "{entityTypeTranslated} günlüğünü kaydet",
"Set Held": "Düzenlendi",
"Set Not Held": "Düzenlenmedi olarak ayarla"
},
"massActions": {
"setHeld": "Düzenlendi",
"setNotHeld": "Düzenlenmedi olarak ayarla"
},
"presetFilters": {
"planned": "Planlandı",
"held": "Düzenlenen",
"todays": "Bugünün"
}
}
@@ -1,5 +1,13 @@
{
"labels": {
"Create {entityType}": "{entityTypeTranslated} Oluştur"
}
}
"fields": {
"address": "Adres "
},
"links": {
"meetings": "Toplantılar",
"calls": "(Seslenme)",
"tasks": "Görevler"
},
"labels": {
"Create {entityType}": "{entityTypeTranslated} oluştur"
}
}
@@ -1,5 +1,5 @@
{
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}"
}
}
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}"
}
}
@@ -1,5 +1,10 @@
{
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}"
}
}
"links": {
"meetings": "Зустрічі",
"calls": "Дзвінки",
"tasks": "Завдання"
},
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}"
}
}
@@ -1,5 +1,15 @@
{
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}"
}
}
"fields": {
"billingAddress": "Billing Address",
"shippingAddress": "Адреса доставки",
"website": "Вебсайт"
},
"links": {
"meetings": "Зустрічі",
"calls": "Дзвінки",
"tasks": "Завдання"
},
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}"
}
}
@@ -1,5 +1,36 @@
{
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}"
"fields": {
"parent": "Джерело",
"dateStart": "Дата початку",
"dateEnd": "Дата завершення",
"duration": "Тривалість",
"status": "Статус",
"reminders": "Нагадування"
},
"links": {
"parent": "Джерело"
},
"options": {
"status": {
"Planned": "Плановий",
"Held": "Вміщений",
"Not Held": "Не вміщений"
}
}
},
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}",
"Schedule {entityType}": "Розклад {entityTypeTranslated} ",
"Log {entityType}": "Log {entityTypeTranslated}",
"Set Held": "Set Held",
"Set Not Held": "Set Not Held"
},
"massActions": {
"setHeld": "Set Held",
"setNotHeld": "Set Not Held"
},
"presetFilters": {
"planned": "Планований",
"held": "Вміщений ",
"todays": "Сьогоднішні"
}
}
@@ -1,5 +1,13 @@
{
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}"
}
}
"fields": {
"address": "Адреса"
},
"links": {
"meetings": "Зустрічі",
"calls": "Дзвінки",
"tasks": "Завдання"
},
"labels": {
"Create {entityType}": "Створити {entityTypeTranslated}"
}
}
@@ -0,0 +1,5 @@
{
"labels": {
"Create {entityType}": "创建 {entityTypeTranslated}"
}
}
@@ -0,0 +1,10 @@
{
"links": {
"meetings": "会晤",
"calls": "通话",
"tasks": "任务"
},
"labels": {
"Create {entityType}": "创建 {entityTypeTranslated}"
}
}
@@ -0,0 +1,15 @@
{
"fields": {
"billingAddress": "账单地址",
"shippingAddress": "邮寄地址",
"website": "网站"
},
"links": {
"meetings": "会晤",
"calls": "通话",
"tasks": "任务"
},
"labels": {
"Create {entityType}": "创建 {entityTypeTranslated}"
}
}
@@ -0,0 +1,36 @@
{
"fields": {
"parent": "关联",
"dateStart": "开始日期",
"dateEnd": "结束日期",
"duration": "持续时间",
"status": "状态",
"reminders": "提醒"
},
"links": {
"parent": "关联"
},
"options": {
"status": {
"Planned": "已计划",
"Held": "已举行",
"Not Held": "未举行"
}
},
"labels": {
"Create {entityType}": "创建 {entityTypeTranslated}",
"Schedule {entityType}": "计划 {entityTypeTranslated}",
"Log {entityType}": "记录 {entityTypeTranslated} ",
"Set Held": "设为已举行",
"Set Not Held": "设为未举行"
},
"massActions": {
"setHeld": "设为已举行",
"setNotHeld": "设为未举行"
},
"presetFilters": {
"planned": "已计划",
"held": "已举行",
"todays": "今天的"
}
}
@@ -0,0 +1,13 @@
{
"fields": {
"address": "地址"
},
"links": {
"meetings": "会晤",
"calls": "通话",
"tasks": "任务"
},
"labels": {
"Create {entityType}": "创建 {entityTypeTranslated}"
}
}
+7
View File
@@ -61,6 +61,13 @@ class Auth extends \Slim\Middleware
list($authUsername, $authPassword) = explode(':', base64_decode($espoAuth));
}
if (!isset($authUsername)) {
if (!empty($_COOKIE['auth-username']) && !empty($_COOKIE['auth-token'])) {
$authUsername = $_COOKIE['auth-username'];
$authPassword = $_COOKIE['auth-token'];
}
}
$espoCgiAuth = $req->headers('HTTP_ESPO_CGI_AUTH');
if (empty($espoCgiAuth)) {
$espoCgiAuth = $req->headers('REDIRECT_HTTP_ESPO_CGI_AUTH');
+83
View File
@@ -31,6 +31,89 @@ namespace Espo\Core\Utils\Api;
class Slim extends \Slim\Slim
{
public function __construct(array $userSettings = array())
{
// Setup IoC container
$this->container = new \Slim\Helper\Set();
$this->container['settings'] = array_merge(static::getDefaultSettings(), $userSettings);
// Default environment
$this->container->singleton('environment', function ($c) {
/* ESPOCRM: change Environment class */
//return \Slim\Environment::getInstance();
return \Espo\Core\Utils\Api\Slim\Environment::getInstance();
/* ESPOCRM: end */
});
// Default request
$this->container->singleton('request', function ($c) {
return new \Slim\Http\Request($c['environment']);
});
// Default response
$this->container->singleton('response', function ($c) {
return new \Slim\Http\Response();
});
// Default router
$this->container->singleton('router', function ($c) {
return new \Slim\Router();
});
// Default view
$this->container->singleton('view', function ($c) {
$viewClass = $c['settings']['view'];
$templatesPath = $c['settings']['templates.path'];
$view = ($viewClass instanceOf \Slim\View) ? $viewClass : new $viewClass;
$view->setTemplatesDirectory($templatesPath);
return $view;
});
// Default log writer
$this->container->singleton('logWriter', function ($c) {
$logWriter = $c['settings']['log.writer'];
return is_object($logWriter) ? $logWriter : new \Slim\LogWriter($c['environment']['slim.errors']);
});
// Default log
$this->container->singleton('log', function ($c) {
$log = new \Slim\Log($c['logWriter']);
$log->setEnabled($c['settings']['log.enabled']);
$log->setLevel($c['settings']['log.level']);
$env = $c['environment'];
$env['slim.log'] = $log;
return $log;
});
// Default mode
$this->container['mode'] = function ($c) {
$mode = $c['settings']['mode'];
if (isset($_ENV['SLIM_MODE'])) {
$mode = $_ENV['SLIM_MODE'];
} else {
$envMode = getenv('SLIM_MODE');
if ($envMode !== false) {
$mode = $envMode;
}
}
return $mode;
};
// Define default middleware stack
$this->middleware = array($this);
$this->add(new \Slim\Middleware\Flash());
$this->add(new \Slim\Middleware\MethodOverride());
// Make default if first instance
if (is_null(static::getInstance())) {
$this->setName('default');
}
}
/**
* Redefine the run method
@@ -0,0 +1,60 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\Utils\Api\Slim;
class Environment extends \Slim\Environment
{
/**
* Define undefined $_SERVER variables
*/
private static function setUndefinedVariables()
{
$list = array(
'REQUEST_METHOD',
'REMOTE_ADDR',
'SERVER_NAME',
'SERVER_PORT',
'REQUEST_URI',
);
foreach ($list as $name) {
if (!array_key_exists($name, $_SERVER)) {
$_SERVER[$name] = '';
}
}
}
public static function getInstance($refresh = false)
{
static::setUndefinedVariables();
return parent::getInstance($refresh);
}
}
+10 -2
View File
@@ -109,6 +109,7 @@ class Auth
}
$user->set('isAdmin', $isAdmin);
$user->set('ipAddress', $_SERVER['REMOTE_ADDR']);
$entityManager->setUser($user);
$this->getContainer()->setUser($user);
@@ -116,7 +117,10 @@ class Auth
public function login($username, $password)
{
$authToken = $this->getEntityManager()->getRepository('AuthToken')->where(array('token' => $password))->findOne();
$authToken = $this->getEntityManager()->getRepository('AuthToken')->where(array(
'token' => $password,
'isActive' => true
))->findOne();
if ($authToken) {
if (!$this->allowAnyAccess) {
@@ -167,6 +171,8 @@ class Auth
$user->loadLinkMultipleField('teams');
}
$user->set('ipAddress', $_SERVER['REMOTE_ADDR']);
$this->getEntityManager()->setUser($user);
$this->getContainer()->setUser($user);
@@ -186,6 +192,7 @@ class Auth
$this->getEntityManager()->saveEntity($authToken);
$user->set('token', $authToken->get('token'));
$user->set('authTokenId', $authToken->id);
}
return true;
@@ -201,7 +208,8 @@ class Auth
{
$authToken = $this->getEntityManager()->getRepository('AuthToken')->where(array('token' => $token))->findOne();
if ($authToken) {
$this->getEntityManager()->removeEntity($authToken);
$authToken->set('isActive', false);
$this->getEntityManager()->saveEntity($authToken);
return true;
}
}
@@ -86,7 +86,9 @@ class ClientManager
$htmlFilePath = $this->mainHtmlFilePath;
}
if ($this->getConfig()->get('isDeveloperMode')) {
$isDeveloperMode = $this->getConfig()->get('isDeveloperMode');
if ($isDeveloperMode) {
if (file_exists('frontend/' . $htmlFilePath)) {
$htmlFilePath = 'frontend/' . $htmlFilePath;
}
@@ -102,6 +104,9 @@ class ClientManager
$html = str_replace('{{stylesheet}}', $this->getThemeManager()->getStylesheet(), $html);
$html = str_replace('{{runScript}}', $runScript , $html);
$html = str_replace('{{basePath}}', $this->basePath , $html);
if ($isDeveloperMode) {
$html = str_replace('{{useCacheInDeveloperMode}}', $this->getConfig()->get('useCacheInDeveloperMode') ? 'true' : 'false', $html);
}
echo $html;
exit;
@@ -48,6 +48,8 @@ class LinkParent extends Base
$fieldName.'Name' => array(
'type' => 'varchar',
'notStorable' => true,
'relation' => $fieldName,
'isParentName' => true
),
),
),
@@ -38,6 +38,18 @@ class BelongsTo extends Base
$foreignEntityName = $this->getForeignEntityName();
$foreignLinkName = $this->getForeignLinkName();
$noForeignName = false;
if (!empty($linkParams['noForeignName'])) {
$noForeignName = true;
} else {
if (!empty($linkParams['foreignName'])) {
$foreign = $linkParams['foreignName'];
} else {
$foreign = $this->getForeignField('name', $foreignEntityName);
}
}
if (!empty($linkParams['noJoin'])) {
$fieldNameDefs = array(
'type' => 'varchar',
@@ -49,15 +61,14 @@ class BelongsTo extends Base
$fieldNameDefs = array(
'type' => 'foreign',
'relation' => $linkName,
'foreign' => $this->getForeignField('name', $foreignEntityName),
'foreign' => $foreign,
'notStorable' => false
);
}
return array (
$data = array (
$entityName => array (
'fields' => array(
$linkName.'Name' => $fieldNameDefs,
$linkName.'Id' => array(
'type' => 'foreignId',
'index' => true
@@ -74,6 +85,12 @@ class BelongsTo extends Base
)
)
);
if (!$noForeignName) {
$data[$entityName]['fields'][$linkName.'Name'] = $fieldNameDefs;
}
return $data;
}
}
@@ -36,11 +36,18 @@ use Espo\Core\Utils\Util,
class Converter
{
private $dbalSchema;
private $fileManager;
private $metadata;
private $ormMeta = null;
private $customTablePath = 'application/Espo/Core/Utils/Database/Schema/tables';
protected $tablePaths = array(
'corePath' => 'application/Espo/Core/Utils/Database/Schema/tables',
'modulePath' => 'application/Espo/Modules/{*}/Core/Utils/Database/Schema/tables',
'customPath' => 'custom/Espo/Custom/Core/Utils/Database/Schema/tables',
);
protected $typeList;
@@ -69,13 +76,19 @@ class Converter
'foreign'
);
public function __construct(\Espo\Core\Utils\File\Manager $fileManager)
public function __construct(\Espo\Core\Utils\Metadata $metadata, \Espo\Core\Utils\File\Manager $fileManager)
{
$this->metadata = $metadata;
$this->fileManager = $fileManager;
$this->typeList = array_keys(\Doctrine\DBAL\Types\Type::getTypesMap());
}
protected function getMetadata()
{
return $this->metadata;
}
protected function getFileManager()
{
return $this->fileManager;
@@ -112,12 +125,24 @@ class Converter
//check if exist files in "Tables" directory and merge with ormMetadata
$ormMeta = Util::merge($ormMeta, $this->getCustomTables($ormMeta));
if (isset($ormMeta['unsetIgnore'])) {
$protectedOrmMeta = array();
foreach ($ormMeta['unsetIgnore'] as $protectedKey) {
$protectedOrmMeta = Util::merge( $protectedOrmMeta, Util::fillArrayKeys($protectedKey, Util::getValueByKey($ormMeta, $protectedKey)) );
}
unset($ormMeta['unsetIgnore']);
}
//unset some keys in orm
if (isset($ormMeta['unset'])) {
$ormMeta = Util::unsetInArray($ormMeta, $ormMeta['unset']);
unset($ormMeta['unset']);
} //END: unset some keys in orm
if (isset($protectedOrmMeta)) {
$ormMeta = Util::merge($ormMeta, $protectedOrmMeta);
}
if (isset($entityList)) {
$entityList = is_string($entityList) ? (array) $entityList : $entityList;
@@ -144,6 +169,12 @@ class Converter
$tables[$entityName] = $schema->createTable($tableName);
if (isset($entityParams['params']) && is_array($entityParams['params'])) {
foreach ($entityParams['params'] as $paramName => $paramValue) {
$tables[$entityName]->addOption($paramName, $paramValue);
}
}
$primaryColumns = array();
$uniqueColumns = array();
$indexList = array(); //list of indexes like array( array(comlumn1, column2), array(column3))
@@ -369,17 +400,22 @@ class Converter
*/
protected function getCustomTables(array $ormMeta)
{
$customTables = array();
$customTables = $this->loadData($this->tablePaths['corePath']);
$fileList = $this->getFileManager()->getFileList($this->customTablePath, false, '\.php$', true);
if (!empty($this->tablePaths['modulePath'])) {
$moduleDir = strstr($this->tablePaths['modulePath'], '{*}', true);
$moduleList = isset($this->metadata) ? $this->getMetadata()->getModuleList() : $this->getFileManager()->getFileList($moduleDir, false, '', false);
foreach($fileList as $fileName) {
$fileData = $this->getFileManager()->getPhpContents( array($this->customTablePath, $fileName) );
if (is_array($fileData)) {
$customTables = Util::merge($customTables, $fileData);
foreach ($moduleList as $moduleName) {
$modulePath = str_replace('{*}', $moduleName, $this->tablePaths['modulePath']);
$customTables = Util::merge($customTables, $this->loadData($modulePath));
}
}
if (!empty($this->tablePaths['customPath'])) {
$customTables = Util::merge($customTables, $this->loadData($this->tablePaths['customPath']));
}
//get custom tables from metdata 'additionalTables'
foreach ($ormMeta as $entityName => $entityParams) {
if (isset($entityParams['additionalTables']) && is_array($entityParams['additionalTables'])) {
@@ -437,4 +473,23 @@ class Converter
return implode('_', $names);
}
protected function loadData($path)
{
$tables = array();
if (!file_exists($path)) {
return $tables;
}
$fileList = $this->getFileManager()->getFileList($path, false, '\.php$', true);
foreach($fileList as $fileName) {
$fileData = $this->getFileManager()->getPhpContents( array($path, $fileName) );
if (is_array($fileData)) {
$tables = Util::merge($tables, $fileData);
}
}
return $tables;
}
}
@@ -94,7 +94,7 @@ class Schema
$this->converter = new \Espo\Core\Utils\Database\Converter($this->metadata, $this->fileManager);
$this->schemaConverter = new Converter($this->fileManager);
$this->schemaConverter = new Converter($this->metadata, $this->fileManager);
$this->ormMetadata = $ormMetadata;
}
@@ -0,0 +1,39 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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.
************************************************************************/
return array(
'ActionHistoryRecord' => array(
'params' => array(
'engine' => 'InnoDB'
)
)
);
@@ -25,13 +25,31 @@
*
* 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.
************************************************************************/
************************************************************************/
return array(
return array(
'unset' => array(
'Preferences',
'__APPEND__',
'Preferences'
),
'unsetIgnore' => [
'__APPEND__',
['Preferences', 'fields', 'id'],
['Preferences', 'fields', 'data']
],
'Preferences' => array(
'fields' => array(
'id' => array(
'dbType' => 'varchar',
'len' => 24,
'type' => 'id'
),
'data' => array(
'type' => 'text'
)
)
)
);
@@ -25,12 +25,13 @@
*
* 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.
************************************************************************/
************************************************************************/
return array(
return array(
'unset' => array(
'Settings',
'__APPEND__',
'Settings',
),
);
+53 -4
View File
@@ -55,6 +55,36 @@ class DateTime
'hh:mmA' => 'h:iA',
);
protected $formattingMap = array(
'MMMM' => 'F',
'MMM' => 'M',
'MM' => 'm',
'M' => 'n',
'DDDD' => 'z',
'DD' => 'd',
'D' => 'j',
'dddd' => 'l',
'ddd' => 'D',
'ww' => 'W',
'w' => 'W',
'e' => 'w',
'YYYY' => 'Y',
'YY' => 'y',
'HH' => 'H',
'H' => 'G',
'hh' => 'h',
'h' => 'g',
'mm' => 'i',
'm' => 'i',
'A' => 'A',
'a' => 'a',
'ss' => 's',
's' => 's',
'Z' => 'O',
'z' => 'O'
);
public function __construct($dateFormat = 'YYYY-MM-DD', $timeFormat = 'HH:mm', $timeZone = 'UTC')
{
$this->dateFormat = $dateFormat;
@@ -83,6 +113,11 @@ class DateTime
return $this->dateFormats[$this->dateFormat] . ' ' . $this->timeFormats[$this->timeFormat];
}
protected function convertFormatToPhp($format)
{
return strtr($format, $this->formattingMap);
}
public function convertSystemDateToGlobal($string)
{
return $this->convertSystemDate($string);
@@ -93,25 +128,39 @@ class DateTime
return $this->convertSystemDateTime($string);
}
public function convertSystemDate($string)
public function convertSystemDate($string, $format = null)
{
$dateTime = \DateTime::createFromFormat('Y-m-d', $string);
if ($dateTime) {
return $dateTime->format($this->getPhpDateFormat());
if ($format) {
$phpFormat = $this->convertFormatToPhp($format);
} else {
$phpFormat = $this->getPhpDateFormat();
}
return $dateTime->format($phpFormat);
}
return null;
}
public function convertSystemDateTime($string, $timezone = null)
public function convertSystemDateTime($string, $timezone = null, $format = null)
{
if (is_string($string) && strlen($string) === 16) {
$string .= ':00';
}
$dateTime = \DateTime::createFromFormat('Y-m-d H:i:s', $string);
if (empty($timezone)) {
$timezone = $this->timezone;
} else {
$timezone = new \DateTimeZone($timezone);
}
if ($dateTime) {
return $dateTime->setTimezone($timezone)->format($this->getPhpDateTimeFormat());
if ($format) {
$phpFormat = $this->convertFormatToPhp($format);
} else {
$phpFormat = $this->getPhpDateTimeFormat();
}
return $dateTime->setTimezone($timezone)->format($phpFormat);
}
return null;
}
+10 -2
View File
@@ -68,6 +68,13 @@ class EntityManager
return $this->metadata;
}
protected function getEntityManager()
{
if (!$this->container) return;
return $this->container->get('entityManager');
}
protected function getLanguage()
{
return $this->language;
@@ -210,6 +217,7 @@ class EntityManager
$filePath = "application/Espo/Core/Templates/Metadata/{$type}/entityDefs.json";
$entityDefsDataContents = $this->getFileManager()->getContents($filePath);
$entityDefsDataContents = str_replace('{entityType}', $name, $entityDefsDataContents);
$entityDefsDataContents = str_replace('{tableName}', $this->getEntityManager()->getQuery()->toDb($name), $entityDefsDataContents);
$entityDefsData = Json::decode($entityDefsDataContents, true);
$this->getMetadata()->set('entityDefs', $name, $entityDefsData);
@@ -655,7 +663,7 @@ class EntityManager
}
if (
$this->getMetadata()->get("entityDefs.{$entity}.links.{$link}.type") == 'hasMany'
in_array($this->getMetadata()->get("entityDefs.{$entity}.links.{$link}.type"), ['hasMany', 'hasChildren'])
) {
if (array_key_exists('audited', $params)) {
$audited = $params['audited'];
@@ -672,7 +680,7 @@ class EntityManager
}
if (
$this->getMetadata()->get("entityDefs.{$entityForeign}.links.{$linkForeign}.type") == 'hasMany'
in_array($this->getMetadata()->get("entityDefs.{$entityForeign}.links.{$linkForeign}.type"), ['hasMany', 'hasChildren'])
) {
if (array_key_exists('auditedForeign', $params)) {
$auditedForeign = $params['auditedForeign'];
+118 -63
View File
@@ -28,10 +28,10 @@
************************************************************************/
namespace Espo\Core\Utils;
use \Espo\Core\Exceptions\Error,
\Espo\Core\Exceptions\Conflict;
use \Espo\Core\Container;
use Espo\Core\Exceptions\Error;
use Espo\Core\Exceptions\Conflict;
use Espo\Core\Container;
class FieldManager
{
@@ -49,6 +49,8 @@ class FieldManager
protected $customOptionName = 'isCustom';
protected $forbiddenFieldNameList = ['id', 'deleted'];
public function __construct(Metadata $metadata, Language $language, Container $container = null)
{
$this->metadata = $metadata;
@@ -78,9 +80,9 @@ class FieldManager
return $this->container->get('defaultLanguage');
}
public function read($name, $scope)
public function read($scope, $name)
{
$fieldDefs = $this->getFieldDefs($name, $scope);
$fieldDefs = $this->getFieldDefs($scope, $name);
$fieldDefs['label'] = $this->getLanguage()->translate($name, 'fields', $scope);
@@ -91,30 +93,36 @@ class FieldManager
return $fieldDefs;
}
public function create($name, $fieldDefs, $scope)
public function create($scope, $name, $fieldDefs)
{
$existingField = $this->getFieldDefs($name, $scope);
$existingField = $this->getFieldDefs($scope, $name);
if (isset($existingField)) {
throw new Conflict('Field ['.$name.'] exists in '.$scope);
}
if (in_array($name, $this->forbiddenFieldNameList)) {
throw new Conflict('Field ['.$name.'] is not allowed');
}
return $this->update($name, $fieldDefs, $scope, true);
return $this->update($scope, $name, $fieldDefs, true);
}
public function update($name, $fieldDefs, $scope, $isNew = false)
public function update($scope, $name, $fieldDefs, $isNew = false)
{
$name = trim($name);
$this->isChanged = false;
/*Add option to metadata to identify the custom field*/
if (!$this->isCore($name, $scope)) {
if (!$this->isCore($scope, $name)) {
$fieldDefs[$this->customOptionName] = true;
}
$res = true;
$result = true;
$isLabelChanged = false;
if (isset($fieldDefs['label'])) {
$this->setLabel($name, $fieldDefs['label'], $scope);
$isLabelChanged |= $this->setLabel($scope, $name, $fieldDefs['label']);
}
if (isset($fieldDefs['tooltipText'])) {
$this->setTooltipText($name, $fieldDefs['tooltipText'], $scope);
$isLabelChanged |= $this->setTooltipText($scope, $name, $fieldDefs['tooltipText']);
}
$type = isset($fieldDefs['type']) ? $fieldDefs['type'] : $type = $this->getMetadata()->get(['entityDefs', $scope, 'fields', $name, 'type']);
@@ -127,16 +135,15 @@ class FieldManager
$translatedOptions = json_decode(json_encode($fieldDefs['translatedOptions']), true);
if (isset($translatedOptions['_empty_'])) {
$translatedOptions[''] = $translatedOptions['_empty_'];
unset($translatedOptions['_empty_']);
}
$this->setTranslatedOptions($name, $translatedOptions, $scope);
$isLabelChanged |= $this->setTranslatedOptions($scope, $name, $translatedOptions);
}
}
if (
isset($fieldDefs['label']) || isset($fieldDefs['translatedOptions']) || isset($fieldDefs['tooltipText'])
) {
$res &= $this->getLanguage()->save();
if ($isLabelChanged) {
$result &= $this->getLanguage()->save();
if (isset($fieldDefs['tooltipText'])) {
$this->getDefaultLanguage()->save();
@@ -223,19 +230,20 @@ class FieldManager
$this->getMetadata()->set('clientDefs', $scope, $clientDefs);
}
if ($this->isDefsChanged($name, $fieldDefs, $scope)) {
$entityDefs = $this->normalizeDefs($name, $fieldDefs, $scope);
$entityDefs = $this->normalizeDefs($scope, $name, $fieldDefs);
if (!empty($entityDefs)) {
$this->getMetadata()->set('entityDefs', $scope, $entityDefs);
$metadataToBeSaved = true;
$this->isChanged = true;
}
if ($metadataToBeSaved) {
$res &= $this->getMetadata()->save();
$result &= $this->getMetadata()->save();
$this->processHook('afterSave', $type, $scope, $name, $fieldDefs, array('isNew' => $isNew));
}
return (bool) $res;
return (bool) $result;
}
protected function prepareClientDefsFieldsDynamicLogic(&$clientDefs, $name)
@@ -264,9 +272,9 @@ class FieldManager
}
}
public function delete($name, $scope)
public function delete($scope, $name)
{
if ($this->isCore($name, $scope)) {
if ($this->isCore($scope, $name)) {
throw new Error('Cannot delete core field ['.$name.'] in '.$scope);
}
@@ -288,16 +296,16 @@ class FieldManager
$res = $this->getMetadata()->save();
$res &= $this->deleteLabel($name, $scope);
$res &= $this->deleteLabel($scope, $name);
$this->processHook('afterRemove', $type, $scope, $name);
return (bool) $res;
}
public function resetToDefault($name, $scope)
public function resetToDefault($scope, $name)
{
if (!$this->isCore($name, $scope)) {
if (!$this->isCore($scope, $name)) {
throw new Error('Cannot reset to default custom field ['.$name.'] in '.$scope);
}
@@ -321,28 +329,32 @@ class FieldManager
$this->getDefaultLanguage()->save();
}
protected function setEntityDefs($name, $fieldDefs, $scope)
protected function setTranslatedOptions($scope, $name, $value)
{
$fieldDefs = $this->normalizeDefs($name, $fieldDefs, $scope);
if (!$this->isLabelChanged($scope, 'options', $name, $value)) {
return false;
}
$this->getMetadata()->set('entityDefs', $scope, $fieldDefs);
$res = $this->getMetadata()->save();
return $res;
}
protected function setTranslatedOptions($name, $value, $scope)
{
$this->getLanguage()->set($scope, 'options', $name, $value);
return true;
}
protected function setLabel($name, $value, $scope)
protected function setLabel($scope, $name, $value)
{
return $this->getLanguage()->set($scope, 'fields', $name, $value);
if (!$this->isLabelChanged($scope, 'fields', $name, $value)) {
return false;
}
$this->getLanguage()->set($scope, 'fields', $name, $value);
return true;
}
protected function setTooltipText($name, $value, $scope)
protected function setTooltipText($scope, $name, $value)
{
if (!$this->isLabelChanged($scope, 'tooltips', $name, $value)) {
return false;
}
if ($value && $value !== '') {
$this->getLanguage()->set($scope, 'tooltips', $name, $value);
$this->getDefaultLanguage()->set($scope, 'tooltips', $name, $value);
@@ -350,9 +362,11 @@ class FieldManager
$this->getLanguage()->delete($scope, 'tooltips', $name);
$this->getDefaultLanguage()->delete($scope, 'tooltips', $name);
}
return true;
}
protected function deleteLabel($name, $scope)
protected function deleteLabel($scope, $name)
{
$this->getLanguage()->delete($scope, 'fields', $name);
$this->getLanguage()->delete($scope, 'tooltips', $name);
@@ -363,12 +377,12 @@ class FieldManager
$this->getDefaultLanguage()->save();
}
protected function getFieldDefs($name, $scope)
protected function getFieldDefs($scope, $name)
{
return $this->getMetadata()->get('entityDefs'.'.'.$scope.'.fields.'.$name);
}
protected function getLinkDefs($name, $scope)
protected function getLinkDefs($scope, $name)
{
return $this->getMetadata()->get('entityDefs'.'.'.$scope.'.links.'.$name);
}
@@ -381,12 +395,16 @@ class FieldManager
* @param string $scope
* @return array
*/
protected function prepareFieldDefs($name, $fieldDefs, $scope)
protected function prepareFieldDefs($scope, $name, $fieldDefs)
{
$unnecessaryFields = array(
'name',
'label',
'translatedOptions',
'dynamicLogicVisible',
'dynamicLogicReadOnly',
'dynamicLogicRequired',
'dynamicLogicOptions',
);
foreach ($unnecessaryFields as $fieldName) {
@@ -395,7 +413,7 @@ class FieldManager
}
}
$currentOptionList = array_keys((array) $this->getFieldDefs($name, $scope));
$currentOptionList = array_keys((array) $this->getFieldDefs($scope, $name));
foreach ($fieldDefs as $defName => $defValue) {
if ( (!isset($defValue) || $defValue === '') && !in_array($defName, $currentOptionList) ) {
unset($fieldDefs[$defName]);
@@ -408,14 +426,14 @@ class FieldManager
/**
* Add all needed block for a field defenition
*
* @param string $scope
* @param string $fieldName
* @param array $fieldDefs
* @param string $scope
* @return array
*/
protected function normalizeDefs($fieldName, array $fieldDefs, $scope)
protected function normalizeDefs($scope, $fieldName, array $fieldDefs)
{
$fieldDefs = $this->prepareFieldDefs($fieldName, $fieldDefs, $scope);
$fieldDefs = $this->prepareFieldDefs($scope, $fieldName, $fieldDefs);
$metaFieldDefs = $this->getMetadataHelper()->getFieldDefsInFieldMeta($fieldDefs);
if (isset($metaFieldDefs)) {
@@ -427,19 +445,29 @@ class FieldManager
unset($fieldDefs['linkDefs']);
}
$defs = array(
'fields' => array(
$fieldName => $fieldDefs,
),
);
$defs = array();
$currentFieldDefs = (array) $this->getFieldDefs($scope, $fieldName);
$normalizedFieldDefs = Util::arrayDiff($currentFieldDefs, $fieldDefs);
if (!empty($normalizedFieldDefs)) {
$defs['fields'] = array(
$fieldName => $normalizedFieldDefs,
);
}
/** Save links for a field. */
$metaLinkDefs = $this->getMetadataHelper()->getLinkDefsInFieldMeta($scope, $fieldDefs);
if (isset($linkDefs) || isset($metaLinkDefs)) {
$linkDefs = Util::merge((array) $metaLinkDefs, (array) $linkDefs);
$defs['links'] = array(
$fieldName => $linkDefs,
);
$metaLinkDefs = isset($metaLinkDefs) ? $metaLinkDefs : array();
$linkDefs = isset($linkDefs) ? $linkDefs : array();
$normalizedLinkdDefs = Util::merge($metaLinkDefs, $linkDefs);
if (!empty($normalizedLinkdDefs)) {
$defs['links'] = array(
$fieldName => $normalizedLinkdDefs,
);
}
}
return $defs;
@@ -448,18 +476,45 @@ class FieldManager
/**
* Check if changed metadata defenition for a field except 'label'
*
* @param string $scope
* @param string $name
* @param array $fieldDefs
*
* @return boolean
*/
protected function isDefsChanged($name, $fieldDefs, $scope)
protected function isDefsChanged($scope, $name, $fieldDefs)
{
$fieldDefs = $this->prepareFieldDefs($name, $fieldDefs, $scope);
$currentFieldDefs = $this->getFieldDefs($name, $scope);
$fieldDefs = $this->prepareFieldDefs($scope, $name, $fieldDefs);
$currentFieldDefs = $this->getFieldDefs($scope, $name);
$this->isChanged = Util::isEquals($fieldDefs, $currentFieldDefs) ? false : true;
$diffDefs = Util::arrayDiff($currentFieldDefs, $fieldDefs);
$this->isChanged = empty($diffDefs) ? false : true;
return $this->isChanged;
}
/**
* Check if label is changed
*
* @param string $scope
* @param string $category
* @param string $name
* @param mixed $newLabel
*
* @return boolean
*/
protected function isLabelChanged($scope, $category, $name, $newLabel)
{
$currentLabel = $this->getLanguage()->get([$scope, $category, $name]);
if ($newLabel != $currentLabel) {
return true;
}
return false;
}
/**
* Only for update method
*
@@ -477,9 +532,9 @@ class FieldManager
* @param string $scope
* @return boolean
*/
protected function isCore($name, $scope)
protected function isCore($scope, $name)
{
$existingField = $this->getFieldDefs($name, $scope);
$existingField = $this->getFieldDefs($scope, $name);
if (isset($existingField) && (!isset($existingField[$this->customOptionName]) || !$existingField[$this->customOptionName])) {
return true;
}
+56
View File
@@ -61,6 +61,12 @@ class Metadata
private $moduleList = null;
protected $frontendHiddenPathList = [
['app', 'formula', 'functionClassNameMap'],
['app', 'fileStorage', 'implementationClassNameMap'],
['app', 'emailNotifications', 'handlerClassNameMap']
];
/**
* Default module order
* @var integer
@@ -198,6 +204,36 @@ class Metadata
return $this->data;
}
public function getAllForFrontend()
{
$data = $this->getAll();
foreach ($this->frontendHiddenPathList as $row) {
$p =& $data;
$path = [&$p];
foreach ($row as $i => $item) {
if (!array_key_exists($item, $p)) break;
if ($i == count($row) - 1) {
unset($p[$item]);
$o =& $p;
for ($j = $i - 1; $j > 0; $j--) {
if (is_array($o) && empty($o)) {
$o =& $path[$j];
$k = $row[$j];
unset($o[$k]);
} else {
break;
}
}
} else {
$p =& $p[$item];
$path[] = &$p;
}
}
}
return $data;
}
/**
* todo: move to a separate file
* Add additional fields defined from metadata -> fields
@@ -290,6 +326,26 @@ class Metadata
$unsets = (array) $unsets;
}
switch ($key1) {
case 'entityDefs':
//unset related additional fields, e.g. a field with "address" type
$unsetList = $unsets;
foreach ($unsetList as $unsetItem) {
if (preg_match('/fields\.([^\.]+)/', $unsetItem, $matches) && isset($matches[1])) {
$fieldName = $matches[1];
$fieldPath = [$key1, $key2, 'fields', $fieldName];
$additionalFields = $this->getMetadataHelper()->getAdditionalFieldList($fieldName, $this->get($fieldPath));
if (is_array($additionalFields)) {
foreach ($additionalFields as $additionalFieldName => $additionalFieldParams) {
$unsets[] = 'fields.' . $additionalFieldName;
}
}
}
}
break;
}
$normalizedData = array(
'__APPEND__',
);
+2 -1
View File
@@ -55,7 +55,7 @@ class ScheduledJob
protected $cronSetup = array(
'linux' => '* * * * * cd {DOCUMENT_ROOT}; {PHP-BIN-DIR} -f {CRON-FILE} > /dev/null 2>&1',
'windows' => '{PHP-BIN-DIR}.exe -f {FULL-CRON-PATH}',
'windows' => '{PHP-BINARY} -f {FULL-CRON-PATH}',
'mac' => '* * * * * cd {DOCUMENT_ROOT}; {PHP-BIN-DIR} -f {CRON-FILE} > /dev/null 2>&1',
'default' => '* * * * * cd {DOCUMENT_ROOT}; {PHP-BIN-DIR} -f {CRON-FILE} > /dev/null 2>&1',
);
@@ -165,6 +165,7 @@ class ScheduledJob
$data = array(
'PHP-BIN-DIR' => $this->getSystemUtil()->getPhpBin(),
'PHP-BINARY' => $this->getSystemUtil()->getPhpBinary(),
'CRON-FILE' => $this->cronFile,
'DOCUMENT_ROOT' => $this->getSystemUtil()->getRootDir(),
'FULL-CRON-PATH' => Util::concatPath($this->getSystemUtil()->getRootDir(), $this->cronFile),
+12 -1
View File
@@ -28,6 +28,7 @@
************************************************************************/
namespace Espo\Core\Utils;
class System
{
/**
@@ -105,7 +106,17 @@ class System
*/
public function getPhpBin()
{
return (defined("PHP_BINDIR"))? PHP_BINDIR.DIRECTORY_SEPARATOR.'php' : 'php';
return defined("PHP_BINDIR") ? PHP_BINDIR . DIRECTORY_SEPARATOR . 'php' : 'php';
}
/**
* Get PHP binary
*
* @return string
*/
public function getPhpBinary()
{
return defined("PHP_BINARY") ? PHP_BINARY : 'php';
}
/**
+51 -6
View File
@@ -146,9 +146,9 @@ class Util
{
$mergeIdentifier = '__APPEND__';
if (is_array($currentArray) && (!is_array($newArray) || empty($newArray))) {
if (is_array($currentArray) && !is_array($newArray)) {
return $currentArray;
} else if ((!is_array($currentArray) || empty($currentArray)) && is_array($newArray)) {
} else if (!is_array($currentArray) && is_array($newArray)) {
return $newArray;
} else if ((!is_array($currentArray) || empty($currentArray)) && (!is_array($newArray) || empty($newArray))) {
return array();
@@ -156,10 +156,6 @@ class Util
foreach ($newArray as $newName => $newValue) {
if (is_array($newValue) && empty($newValue)) {
continue;
}
if (is_array($newValue) && array_key_exists($newName, $currentArray) && is_array($currentArray[$newName])) {
// check __APPEND__ identifier
@@ -557,5 +553,54 @@ class Util
return preg_replace("/([^\w\s\d\-_~,;:\[\]\(\).])/u", '_', $fileName);
}
/**
* Improved computing the difference of arrays
*
* @param array $array1
* @param array $array2
*
* @return array
*/
public static function arrayDiff(array $array1, array $array2)
{
$diff = array();
foreach ($array1 as $key1 => $value1) {
if (array_key_exists($key1, $array2)) {
if ($value1 !== $array2[$key1]) {
$diff[$key1] = $array2[$key1];
}
continue;
}
$diff[$key1] = $value1;
}
$diff = array_merge($diff, array_diff_key($array2, $array1));
return $diff;
}
/**
* Fill array with specified keys
*
* @param array|string $keys
* @param mixed $value
*
* @return array
*/
public static function fillArrayKeys($keys, $value)
{
$arrayKeys = is_array($keys) ? $keys : explode('.', $keys);
$array = array();
foreach (array_reverse($arrayKeys) as $i => $key) {
$array = array(
$key => ($i == 0) ? $value : $array,
);
}
return $array;
}
}
+14 -7
View File
@@ -65,11 +65,13 @@ return array (
'languageList' => [
'en_US',
'cs_CZ',
'da_DK',
'de_DE',
'es_ES',
'fr_FR',
'id_ID',
'it_IT',
'nb_NO',
'nl_NL',
'tr_TR',
'ro_RO',
@@ -77,7 +79,8 @@ return array (
'pl_PL',
'pt_BR',
'uk_UA',
'vi_VN'
'vi_VN',
'zh_CN'
],
'language' => 'en_US',
'logger' =>
@@ -95,8 +98,8 @@ return array (
'Lead',
'Opportunity',
),
"tabList" => ["Account", "Contact", "Lead", "Opportunity", "Case", "Email", "Calendar", "Meeting", "Call", "Task", "_delimiter_", "Document", "Campaign", "KnowledgeBaseArticle", "Stream", "User"],
"quickCreateList" => ["Account", "Contact", "Lead", "Opportunity", "Meeting", "Call", "Task", "Case", "Email"],
'tabList' => ["Account", "Contact", "Lead", "Opportunity", "Case", "Email", "Calendar", "Meeting", "Call", "Task", "_delimiter_", "Document", "Campaign", "KnowledgeBaseArticle", "Stream", "User"],
'quickCreateList' => ["Account", "Contact", "Lead", "Opportunity", "Meeting", "Call", "Task", "Case", "Email"],
'exportDisabled' => false,
'assignmentEmailNotifications' => false,
'assignmentEmailNotificationsEntityList' => ['Lead', 'Opportunity', 'Task', 'Case'],
@@ -150,9 +153,13 @@ return array (
]
]
],
"calendarEntityList" => ["Meeting", "Call", "Task"],
"activitiesEntityList" => ["Meeting", "Call"],
"historyEntityList" => ["Meeting", "Call", "Email"],
'isInstalled' => false,
'calendarEntityList' => ['Meeting', 'Call', 'Task'],
'activitiesEntityList' => ['Meeting', 'Call'],
'historyEntityList' => ['Meeting', 'Call', 'Email'],
'lastViewedCount' => 20,
'cleanupJobPeriod' => '1 month',
'cleanupActionHistoryPeriod' => '15 days',
'cleanupAuthTokenPeriod' => '1 month',
'isInstalled' => false
);
@@ -149,7 +149,9 @@ return array ( 'defaultPermissions' =>
'ldapUserDefaultTeamId',
'ldapUserDefaultTeamName',
'ldapUserTeamsIds',
'ldapUserTeamsNames'
'ldapUserTeamsNames',
'cleanupJobPeriod',
'cleanupActionHistoryPeriod'
),
'userItems' =>
array (
@@ -0,0 +1,36 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\Entities;
class ActionHistoryRecord extends \Espo\Core\ORM\Entity
{
}
@@ -67,6 +67,12 @@ class Download extends \Espo\Core\EntryPoints\Base
$sourceId = $attachment->getSourceId();
if ($this->getEntityManager()->getRepository('Attachment')->hasDownloadUrl($attachment)) {
$downloadUrl = $this->getEntityManager()->getRepository('Attachment')->getDownloadUrl($attachment);
header('Location: ' . $downloadUrl);
exit;
}
$fileName = $this->getEntityManager()->getRepository('Attachment')->getFilePath($attachment);
if (!file_exists($fileName)) {
+4
View File
@@ -149,6 +149,10 @@ class Image extends \Espo\Core\EntryPoints\Base
protected function getThumbImage($filePath, $fileType, $size)
{
if (!@is_array(getimagesize($filePath))) {
throw new Error();
}
list($originalWidth, $originalHeight) = getimagesize($filePath);
list($width, $height) = $this->imageSizes[$size];
+3 -18
View File
@@ -70,29 +70,13 @@ class NextNumber extends \Espo\Core\Hooks\Base
}
continue;
}
$this->getEntityManager()->getPdo()->query('LOCK TABLES `next_number` WRITE');
$nextNumber = $this->getEntityManager()->getRepository('NextNumber')->where(array(
'fieldName' => $fieldName,
'entityType' => $entity->getEntityType()
))->findOne();
if (!$nextNumber) continue;
$entity->set($fieldName, $this->composeNumberAttribute($nextNumber));
}
}
}
public function afterSave(Entity $entity, array $options = array())
{
if (!$entity->isNew()) return;
$fieldDefs = $this->getMetadata()->get(['entityDefs', $entity->getEntityType(), 'fields'], array());
foreach ($fieldDefs as $fieldName => $defs) {
if (isset($defs['type']) && $defs['type'] === 'number') {
$nextNumber = $this->getEntityManager()->getRepository('NextNumber')->where(array(
'fieldName' => $fieldName,
'entityType' => $entity->getEntityType()
))->findOne();
if (!$nextNumber) continue;
$value = $nextNumber->get('value');
if (!$value) {
@@ -102,10 +86,11 @@ class NextNumber extends \Espo\Core\Hooks\Base
$nextNumber->set('value', $value);
$this->getEntityManager()->saveEntity($nextNumber);
$this->getEntityManager()->getPdo()->query('UNLOCK TABLES');
}
}
}
}
+6 -3
View File
@@ -42,7 +42,9 @@ class AuthTokenControl extends \Espo\Core\Jobs\Base
return;
}
$whereClause = array();
$whereClause = array(
'isActive' => true
);
if ($authTokenLifetime) {
$dt = new \DateTime();
@@ -60,10 +62,11 @@ class AuthTokenControl extends \Espo\Core\Jobs\Base
$whereClause['lastAccess<'] = $authTokenMaxIdleTimeThreshold;
}
$tokenList = $this->getEntityManager()->getRepository('AuthToken')->where($whereClause)->limit(0, 100)->find();
$tokenList = $this->getEntityManager()->getRepository('AuthToken')->where($whereClause)->limit(0, 500)->find();
foreach ($tokenList as $token) {
$this->getEntityManager()->removeEntity($token);
$token->set('isActive', false);
$this->getEntityManager()->saveEntity($token);
}
}
}
+39 -8
View File
@@ -33,7 +33,11 @@ use \Espo\Core\Exceptions;
class Cleanup extends \Espo\Core\Jobs\Base
{
protected $period = '-1 month';
protected $cleanupJobPeriod = '1 month';
protected $cleanupActionHistoryPeriod = '15 days';
protected $cleanupAuthTokenPeriod = '1 month';
public function run()
{
@@ -43,11 +47,13 @@ class Cleanup extends \Espo\Core\Jobs\Base
$this->cleanupEmails();
$this->cleanupNotes();
$this->cleanupNotifications();
$this->cleanupActionHistory();
$this->cleanupAuthToken();
}
protected function cleanupJobs()
{
$query = "DELETE FROM `job` WHERE DATE(modified_at) < '".$this->getCleanupFromDate()."' AND status <> 'Pending'";
$query = "DELETE FROM `job` WHERE DATE(modified_at) < '".$this->getCleanupJobFromDate()."' AND status <> 'Pending'";
$pdo = $this->getEntityManager()->getPDO();
$sth = $pdo->prepare($query);
@@ -71,20 +77,45 @@ class Cleanup extends \Espo\Core\Jobs\Base
$delSql = "DELETE FROM `scheduled_job_log_record`
WHERE scheduled_job_id = '".$id."'
AND DATE(created_at) < '".$this->getCleanupFromDate()."'
AND DATE(created_at) < '".$this->getCleanupJobFromDate()."'
AND id NOT IN ('".implode("', '", $lastRowIds)."')
";
$pdo->query($delSql);
}
}
protected function getCleanupFromDate()
protected function cleanupActionHistory()
{
$format = 'Y-m-d';
$period = '-' . $this->getConfig()->get('cleanupActionHistoryPeriod', $this->cleanupActionHistoryPeriod);
$datetime = new \DateTime();
$datetime->modify($this->period);
return $datetime->format($format);
$datetime->modify($period);
$query = "DELETE FROM `action_history_record` WHERE DATE(created_at) < '" . $datetime->format('Y-m-d') . "'";
$pdo = $this->getEntityManager()->getPDO();
$sth = $pdo->prepare($query);
$sth->execute();
}
protected function cleanupAuthToken()
{
$period = '-' . $this->getConfig()->get('cleanupAuthTokenPeriod', $this->cleanupAuthTokenPeriod);
$datetime = new \DateTime();
$datetime->modify($period);
$query = "DELETE FROM `auth_token` WHERE DATE(modified_at) < '" . $datetime->format('Y-m-d') . "' AND is_active = 0";
$pdo = $this->getEntityManager()->getPDO();
$sth = $pdo->prepare($query);
$sth->execute();
}
protected function getCleanupJobFromDate()
{
$period = '-' . $this->getConfig()->get('cleanupJobPeriod', $this->cleanupJobPeriod);
$datetime = new \DateTime();
$datetime->modify($period);
return $datetime->format('Y-m-d');
}
protected function cleanupAttachments()
@@ -0,0 +1,55 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\Modules\Crm\AclPortal;
use \Espo\Entities\User as EntityUser;
use \Espo\ORM\Entity;
class KnowledgeBaseArticle extends \Espo\Core\AclPortal\Base
{
public function checkEntityRead(EntityUser $user, Entity $entity, $data)
{
if (!$this->checkEntity($user, $entity, $data, 'read')) {
return false;
}
if ($entity->get('status') !== 'Published') return false;
$portalIdList = $entity->getLinkMultipleIdList('portals');
if ($user->get('portalId') && !in_array($user->get('portalId'), $portalIdList)) {
return false;
}
return true;
}
}
@@ -0,0 +1,62 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2017 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\Modules\Crm\Business\EmailNotificationHandlers;
class CaseObj extends \Espo\Core\Injectable
{
protected $dependencyList = [
'entityManager'
];
protected $inboundEmailEntityHash = array();
public function getSmtpParams($type, $case, $user = null)
{
$inboundEmailId = $case->get('inboundEmailId');
if (!$inboundEmailId) return;
if (!array_key_exists($inboundEmailId, $this->inboundEmailEntityHash)) {
$this->inboundEmailEntityHash[$inboundEmailId] = $this->getInjection('entityManager')->getEntity('InboundEmail', $inboundEmailId);
}
$inboundEmail = $this->inboundEmailEntityHash[$inboundEmailId];
if (!$inboundEmail) return;
$emailAddress = $inboundEmail->get('emailAddress');
if (!$emailAddress) return;
return array(
'replyToAddress' => $emailAddress
);
}
}
@@ -40,6 +40,11 @@ class SubscribeAgain extends \Espo\Core\EntryPoints\Base
{
public static $authRequired = false;
private function getHookManager()
{
return $this->getContainer()->get('hookManager');
}
public function run()
{
if (empty($_GET['id'])) {
@@ -96,9 +101,17 @@ class SubscribeAgain extends \Espo\Core\EntryPoints\Base
$targetListList = $massEmail->get('targetLists');
foreach ($targetListList as $targetList) {
$this->getEntityManager()->getRepository('TargetList')->updateRelation($targetList, $link, $target->id, array(
$optedInResult = $this->getEntityManager()->getRepository('TargetList')->updateRelation($targetList, $link, $target->id, array(
'optedOut' => false
));
if ($optedInResult) {
$hookData = [
'link' => $link,
'targetId' => $targetId,
'targetType' => $targetType
];
$this->getHookManager()->process('TargetList', 'afterCancelOptOut', $targetList, [], $hookData);
}
}
echo $this->getLanguage()->translate('subscribedAgain', 'messages', 'Campaign');
echo '<br><br>';
@@ -108,6 +121,17 @@ class SubscribeAgain extends \Espo\Core\EntryPoints\Base
}
}
if ($campaign && $target) {
$logRecord = $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array(
'queueItemId' => $queueItemId,
'action' => 'Opted Out'
))->order('createdAt', true)->findOne();
if ($logRecord) {
$this->getEntityManager()->removeEntity($logRecord);
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More