Compare commits

...

15 Commits
6.0.4 ... 6.0.6

Author SHA1 Message Date
Yuri Kuznetsov
fb9ff0b8c0 fix deprecated 2020-11-18 13:16:24 +02:00
Yuri Kuznetsov
d1a62baa12 fix deprecated 2020-11-18 12:53:17 +02:00
Yuri Kuznetsov
cdec7ccfe8 v 2020-11-18 11:34:14 +02:00
Yuri Kuznetsov
25bc3a40f7 fix export currency 2020-11-18 09:41:54 +02:00
Yuri Kuznetsov
02e5c1fc44 v 2020-11-16 13:40:49 +02:00
Yuri Kuznetsov
844e9dd8e3 Merge branch 'hotfix/6.0.5' of github.com:espocrm/espocrm into hotfix/6.0.5 2020-11-16 13:38:16 +02:00
Yuri Kuznetsov
39f2ec83d5 fix duplicate attachments multiple 2020-11-16 13:35:53 +02:00
Taras Machyshyn
e4d2af03a5 Fixed PHP binary path 2020-11-16 13:34:24 +02:00
Taras Machyshyn
37616d69bf Merge branch 'hotfix/6.0.5' of https://github.com/espocrm/espocrm into hotfix/6.0.5 2020-11-16 13:28:03 +02:00
Taras Machyshyn
4e36f71dd8 Fixed PHP binary path 2020-11-16 13:27:16 +02:00
Yuri Kuznetsov
b5877ac32a fix person name 2020-11-16 13:03:56 +02:00
Yuri Kuznetsov
92de588a6e update npm packages 2020-11-16 11:07:12 +02:00
Yuri Kuznetsov
700f4b5b10 fix export 2020-11-14 10:24:22 +02:00
Yuri Kuznetsov
9c0a7b6778 app service changes 2020-11-13 12:39:27 +02:00
Yuri Kuznetsov
9a54c66f68 preferences fixes 2020-11-13 12:32:13 +02:00
15 changed files with 1614 additions and 819 deletions

View File

@@ -155,9 +155,11 @@ class InjectableFactory
$dependencyClass = null;
if ($param->getType()) {
$type = $param->getType();
if ($type && !$type->isBuiltin()) {
try {
$dependencyClass = $param->getClass();
$dependencyClass = new ReflectionClass($type->getName());
}
catch (Throwable $e) {
$badClassName = $param->getType()->getName();
@@ -241,15 +243,26 @@ class InjectableFactory
}
$params = $class->getMethod($methodName)->getParameters();
if (!$params || !count($params)) {
return false;
}
if ($skipInstanceCheck) {
return true;
}
$injection = $this->container->get($name);
$paramClass = $params[0]->getClass();
$paramClass = null;
if ($skipInstanceCheck || $paramClass && $paramClass->isInstance($injection)) {
$type = $params[0]->getType();
if ($type && !$type->isBuiltin()) {
$paramClass = new ReflectionClass($type->getName());
}
if ($paramClass && $paramClass->isInstance($injection)) {
return true;
}

View File

@@ -96,7 +96,7 @@ class PersonName extends Base
$whereItems[] = "CONCAT:({$firstName}, ' ', {$middleName}, ' ', {$lastName})";
} else
if ($format === 'lastFirstMiddle') {
$whereItems[] = "CONCAT:({$lastName}, ' ', {$firstColumn}, ' ', {$middleName})";
$whereItems[] = "CONCAT:({$lastName}, ' ', {$firstName}, ' ', {$middleName})";
}
$selectExpression = $this->getSelect($fullList);

View File

@@ -53,10 +53,10 @@ class ScheduledJob
protected $checkingCronPeriod = '25 hours';
protected $cronSetup = [
'linux' => '* * * * * cd {DOCUMENT_ROOT}; {PHP-BIN-DIR} -f {CRON-FILE} > /dev/null 2>&1',
'linux' => '* * * * * cd {DOCUMENT_ROOT}; {PHP-BINARY} -f {CRON-FILE} > /dev/null 2>&1',
'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',
'mac' => '* * * * * cd {DOCUMENT_ROOT}; {PHP-BINARY} -f {CRON-FILE} > /dev/null 2>&1',
'default' => '* * * * * cd {DOCUMENT_ROOT}; {PHP-BINARY} -f {CRON-FILE} > /dev/null 2>&1',
];
protected $classFinder;
@@ -105,7 +105,6 @@ class ScheduledJob
$desc = $language->translate('cronSetup', 'options', 'ScheduledJob');
$data = array(
'PHP-BIN-DIR' => $this->getSystemUtil()->getPhpBin(),
'PHP-BINARY' => $this->getSystemUtil()->getPhpBinary(),
'CRON-FILE' => $this->cronFile,
'DOCUMENT_ROOT' => $this->getSystemUtil()->getRootDir(),

View File

@@ -29,6 +29,8 @@
namespace Espo\Core\Utils;
use Symfony\Component\Process\PhpExecutableFinder;
class System
{
/**
@@ -100,22 +102,11 @@ class System
}
/**
* Get path to PHP
*
* @return string
* Deprecated. Use getPhpBinary()
*/
public function getPhpBin()
{
if (isset($_SERVER['PHP_PATH']) && !empty($_SERVER['PHP_PATH'])) {
return $_SERVER['PHP_PATH'];
}
$phpBin = @exec('which php');
if (!empty($phpBin)) {
return $phpBin;
}
return defined("PHP_BINDIR") ? PHP_BINDIR . DIRECTORY_SEPARATOR . 'php' : 'php';
return $this->getPhpBinary();
}
/**
@@ -125,7 +116,7 @@ class System
*/
public function getPhpBinary()
{
return defined("PHP_BINARY") ? PHP_BINARY : 'php';
return (new PhpExecutableFinder)->find();
}
/**

View File

@@ -2,7 +2,7 @@
"fields": {
"timeZone": {
"type": "enum",
"detault": "",
"default": "",
"view": "views/preferences/fields/time-zone"
},
"dateFormat": {
@@ -124,7 +124,8 @@
"assignmentNotificationsIgnoreEntityTypeList": {
"type": "checklist",
"translation": "Global.scopeNamesPlural",
"view": "views/preferences/fields/assignment-notifications-ignore-entity-type-list"
"view": "views/preferences/fields/assignment-notifications-ignore-entity-type-list",
"default": []
},
"assignmentEmailNotificationsIgnoreEntityTypeList": {
"type": "checklist",
@@ -140,14 +141,17 @@
},
"signature": {
"type": "wysiwyg",
"view": "views/preferences/fields/signature"
"view": "views/preferences/fields/signature",
"default": ""
},
"defaultReminders": {
"type": "jsonArray",
"view": "crm:views/meeting/fields/reminders"
"view": "crm:views/meeting/fields/reminders",
"default": []
},
"theme": {
"type": "enum",
"default": "",
"view": "views/preferences/fields/theme",
"translation": "Global.themes"
},
@@ -173,7 +177,8 @@
},
"doNotFillAssignedUserIfNotRequired": {
"type": "bool",
"tooltip": true
"tooltip": true,
"default": false
},
"followEntityOnStreamPost": {
"type": "bool",
@@ -187,16 +192,20 @@
"type": "multiEnum",
"view": "views/preferences/fields/auto-follow-entity-type-list",
"translation": "Global.scopeNamesPlural",
"default": [],
"tooltip": true
},
"emailUseExternalClient": {
"type": "bool"
"type": "bool",
"default": false
},
"scopeColorsDisabled": {
"type": "bool"
"type": "bool",
"default": false
},
"tabColorsDisabled": {
"type": "bool"
"type": "bool",
"default": false
}
},
"noDeletedAttribute": true

View File

@@ -46,6 +46,7 @@ use Espo\Core\{
Utils\Config,
Utils\Util,
Utils\Language,
Utils\FieldUtil,
};
use Espo\Entities\User;
@@ -57,8 +58,24 @@ use Espo\ORM\{
Entity,
};
use StdClass;
use Throwable;
class App
{
protected $config;
protected $entityManager;
protected $metadata;
protected $acl;
protected $aclManager;
protected $dataManager;
protected $selectManagerFactory;
protected $injectableFactory;
protected $serviceFactory;
protected $user;
protected $preferences;
protected $fieldUtil;
public function __construct(
Config $config,
EntityManager $entityManager,
@@ -70,7 +87,8 @@ class App
InjectableFactory $injectableFactory,
ServiceFactory $serviceFactory,
User $user,
Preferences $preferences
Preferences $preferences,
FieldUtil $fieldUtil
) {
$this->config = $config;
$this->entityManager = $entityManager;
@@ -83,12 +101,14 @@ class App
$this->serviceFactory = $serviceFactory;
$this->user = $user;
$this->preferences = $preferences;
$this->fieldUtil = $fieldUtil;
}
public function getUserData()
{
$preferencesData = $this->preferences->getValueMap();
unset($preferencesData->smtpPassword);
$this->filterPreferencesData($preferencesData);
$settingsService = $this->serviceFactory->create('Settings');
@@ -134,11 +154,16 @@ class App
foreach (($this->metadata->get(['app', 'appParams']) ?? []) as $paramKey => $item) {
$className = $item['className'] ?? null;
if (!$className) continue;
if (!$className) {
continue;
}
try {
$itemParams = $this->injectableFactory->create($className)->get();
} catch (\Throwable $e) {
} catch (Throwable $e) {
$GLOBALS['log']->error("appParam {$paramKey}: " . $e->getMessage());
continue;
}
$appParams[$paramKey] = $itemParams;
@@ -452,19 +477,41 @@ class App
$entityTypeList = ['Contact', 'Lead'];
foreach ($entityTypeList as $entityType) {
$entityList = $this->entityManager->getRepository($entityType)->where([
'doNotCall' => true,
'phoneNumber!=' => null,
])->select(['id', 'phoneNumber'])->find();
$entityList = $this->entityManager
->getRepository($entityType)
->where([
'doNotCall' => true,
'phoneNumber!=' => null,
])
->select(['id', 'phoneNumber'])
->find();
foreach ($entityList as $entity) {
$phoneNumber = $entity->get('phoneNumber');
if (!$phoneNumber) continue;
$phoneNumberEntity = $this->entityManager->getRepository('PhoneNumber')->getByNumber($phoneNumber);
if (!$phoneNumberEntity) continue;
$phoneNumberEntity->set('optOut', true);
$this->entityManager->saveEntity($phoneNumberEntity);
if (!$phoneNumber) {
continue;
}
$phoneNumberEntity = $this->entityManager->getRepository('PhoneNumber')->getByNumber($phoneNumber);
if (!$phoneNumberEntity) {
continue;
}
$phoneNumberEntity->set('optOut', true);
$this->entityManager->saveEntity($phoneNumberEntity);
}
}
}
protected function filterPreferencesData(StdClass $data)
{
$passwordFieldList = $this->fieldUtil->getFieldByTypeList('Preferences', 'password');
foreach ($passwordFieldList as $field) {
unset($data->$field);
}
}
}

View File

@@ -2550,6 +2550,10 @@ class Record implements Crud,
->getRepository('Attachment')
->getCopiedAttachment($attachment);
$attachment->set('field', $field);
$this->getEntityManager()->saveEntity($attachment);
if ($attachment) {
$idList[] = $attachment->id;
$nameHash->{$attachment->id} = $attachment->get('name');

View File

@@ -351,7 +351,7 @@ class Xlsx
if (array_key_exists($name.'Currency', $row) && array_key_exists($name, $row)) {
$sheet->setCellValue("$col$rowNumber", $row[$name] ? $row[$name] : '');
$currency = $row[$name . 'Currency'];
$currency = $row[$name . 'Currency'] ?? $this->getConfig()->get('defaultCurrency');
$sheet->getStyle("$col$rowNumber")
->getNumberFormat()

View File

@@ -44,6 +44,8 @@ define('views/fields/enum', ['views/fields/base', 'lib!Selectize'], function (De
translatedOptions: null,
fetchEmptyValueAsNull: false,
searchTypeList: ['anyOf', 'noneOf', 'isEmpty', 'isNotEmpty'],
data: function () {

View File

@@ -44,6 +44,8 @@ define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], function
seeMoreDisabled: true,
fetchEmptyValueAsNull: false,
setup: function () {
Dep.prototype.setup.call(this);
@@ -532,6 +534,12 @@ define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], function
data[this.name] = code;
} else {
data[this.name] = this.$element.val();
if (this.fetchEmptyValueAsNull) {
if (!data[this.name]) {
data[this.name] = null;
}
}
}
if (this.model.has('isHtml') && this.hasBodyPlainField) {

View File

@@ -30,6 +30,8 @@ define('views/preferences/fields/signature', 'views/fields/wysiwyg', function (D
return Dep.extend({
fetchEmptyValueAsNull: true,
toolbar: [
["style", ["bold", "italic", "underline", "clear"]],
["color", ["color"]],

View File

@@ -998,7 +998,7 @@ define('views/record/list', 'view', function (Dep) {
}, this);
if (
this.getConfig().get('exportDisabled') && !this.getUser().get('isAdmin')
this.getConfig().get('exportDisabled') && !this.getUser().isAdmin()
||
this.getAcl().get('exportPermission') === 'no'
||

2248
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "espocrm",
"version": "6.0.4",
"version": "6.0.6",
"description": "",
"main": "index.php",
"repository": {
@@ -12,21 +12,21 @@
"devDependencies": {
"archiver": "^3.1.1",
"fstream": ">=1.0.12",
"grunt": "^1.0.4",
"grunt": "^1.3.0",
"grunt-chmod": "~1.1.0",
"grunt-contrib-clean": "~2.0.0",
"grunt-contrib-concat": "~1.0.1",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-cssmin": "~3.0.0",
"grunt-contrib-less": "~2.0.0",
"grunt-contrib-less": "^2.0.0",
"grunt-contrib-uglify": "~4.0.0",
"grunt-mkdir": "~1.0.0",
"grunt-replace": "~1.0.1",
"js-yaml": "^3.13.1",
"lodash": "^4.17.19",
"lodash": "^4.17.20",
"minimist": ">=1.2.2",
"pofile": "~1.0.11",
"tar": "^4.4.8"
"tar": "^6.0.5"
},
"dependencies": {}
}

View File

@@ -86,12 +86,12 @@ class SystemTest extends \PHPUnit\Framework\TestCase
$this->assertEquals($rootDir, $this->object->getRootDir());
}
public function testGetPhpBin()
public function testGetPhpBinary()
{
$phpBin = @exec('which php');
$phpBinary = (new \Symfony\Component\Process\PhpExecutableFinder)->find();
if (isset($phpBin)) {
$this->assertEquals($phpBin, $this->object->getPhpBin());
if (isset($phpBinary)) {
$this->assertEquals($phpBinary, $this->object->getPhpBinary());
}
}