Merge branch 'hotfix/4.8.5'

This commit is contained in:
yuri
2017-11-13 15:33:46 +02:00
6 changed files with 55 additions and 9 deletions

View File

@@ -25,12 +25,25 @@
*
* 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\Entities;
class Lead extends \Espo\Core\Entities\Person
{
protected function _getName()
{
if (!array_key_exists('name', $this->valuesContainer) || !$this->valuesContainer['name']) {
if ($this->get('accountName')) {
return $this->get('accountName');
} else if ($this->get('emailAddress')) {
return $this->get('emailAddress');
} else if ($this->get('phoneNumber')) {
return $this->get('phoneNumber');
}
}
return $this->valuesContainer['name'];
}
}

View File

@@ -122,5 +122,27 @@
"style": "success"
}
],
"boolFilterList": ["onlyMy"]
"boolFilterList": ["onlyMy"],
"dynamicLogic": {
"fields": {
"name": {
"required": {
"conditionGroup": [
{
"type": "isEmpty",
"attribute": "accountName"
},
{
"type": "isEmpty",
"attribute": "emailAddress"
},
{
"type": "isEmpty",
"attribute": "phoneNumber"
}
]
}
}
}
}
}

View File

@@ -15,7 +15,6 @@
"lastName": {
"type": "varchar",
"maxLength": 100,
"required": true,
"default":""
},
"title": {

View File

@@ -98,6 +98,14 @@
"view": "views/admin/dynamic-logic/conditions/field-types/base",
"typeList": ["equals", "notEquals", "isEmpty", "isNotEmpty"]
},
"email": {
"view": "views/admin/dynamic-logic/conditions/field-types/base",
"typeList": ["isEmpty", "isNotEmpty"]
},
"phone": {
"view": "views/admin/dynamic-logic/conditions/field-types/base",
"typeList": ["isEmpty", "isNotEmpty"]
},
"text": {
"view": "views/admin/dynamic-logic/conditions/field-types/base",
"typeList": ["isEmpty", "isNotEmpty"]

View File

@@ -262,13 +262,13 @@ Espo.define('views/fields/base', 'view', function (Dep) {
this.on('after:render', function () {
if (this.mode === 'edit') {
if (this.isRequired()) {
if (this.hasRequiredMarker()) {
this.showRequiredSign();
} else {
this.hideRequiredSign();
}
} else {
if (this.isRequired()) {
if (!this.hasRequiredMarker()) {
this.hideRequiredSign();
}
}
@@ -580,6 +580,10 @@ Espo.define('views/fields/base', 'view', function (Dep) {
}
},
hasRequiredMarker: function () {
return this.isRequired();
},
fetchToModel: function () {
this.model.set(this.fetch(), {silent: true});
},

View File

@@ -82,7 +82,7 @@ Espo.define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
},
validateRequired: function () {
var isRequired = this.model.getFieldParam(this.name, 'required');
var isRequired = this.isRequired();
var validate = function (name) {
if (this.model.isRequired(name)) {
@@ -109,11 +109,11 @@ Espo.define('views/fields/person-name', 'views/fields/varchar', function (Dep) {
return result;
},
isRequired: function () {
hasRequiredMarker: function () {
if (this.isRequired()) return true;
return this.model.getFieldParam(this.salutationField, 'required') ||
this.model.getFieldParam(this.firstField, 'required') ||
this.model.getFieldParam(this.lastField, 'required') ||
this.model.getFieldParam(this.name, 'required');
this.model.getFieldParam(this.lastField, 'required');
},
fetch: function (form) {