fixes with assignment in mass update and autopopulate
This commit is contained in:
@@ -299,27 +299,7 @@ class Base
|
||||
protected function q($params, &$result)
|
||||
{
|
||||
if (!empty($params['q'])) {
|
||||
$fieldDefs = $this->getSeed()->getFields();
|
||||
|
||||
$value = $params['q'];
|
||||
|
||||
$fieldList = $this->getTextFilterFields();
|
||||
$d = array();
|
||||
foreach ($fieldList as $field) {
|
||||
if (
|
||||
strlen($value) >= self::MIN_LENGTH_FOR_CONTENT_SEARCH
|
||||
&&
|
||||
!empty($fieldDefs[$field]['type']) && $fieldDefs[$field]['type'] == 'text'
|
||||
) {
|
||||
$d[$field . '*'] = '%' . $value . '%';
|
||||
} else {
|
||||
$d[$field . '*'] = $value . '%';
|
||||
}
|
||||
}
|
||||
|
||||
$result['whereClause'][] = array(
|
||||
'OR' => $d
|
||||
);
|
||||
$this->textFilter($params['q'], $result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -793,9 +793,11 @@ class Record extends \Espo\Core\Services\Base
|
||||
$entity = $this->getEntity($id);
|
||||
if ($this->getAcl()->check($entity, 'edit')) {
|
||||
$entity->set(get_object_vars($attributes));
|
||||
if ($repository->save($entity)) {
|
||||
$idsUpdated[] = $id;
|
||||
$count++;
|
||||
if ($this->checkAssignment($entity)) {
|
||||
if ($repository->save($entity)) {
|
||||
$idsUpdated[] = $id;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -812,9 +814,11 @@ class Record extends \Espo\Core\Services\Base
|
||||
foreach ($collection as $entity) {
|
||||
if ($this->getAcl()->check($entity, 'edit')) {
|
||||
$entity->set(get_object_vars($attributes));
|
||||
if ($repository->save($entity)) {
|
||||
$idsUpdated[] = $id;
|
||||
$count++;
|
||||
if ($this->checkAssignment($entity)) {
|
||||
if ($repository->save($entity)) {
|
||||
$idsUpdated[] = $id;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -822,7 +826,6 @@ class Record extends \Espo\Core\Services\Base
|
||||
return array(
|
||||
'count' => $count
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return array(
|
||||
|
||||
@@ -129,14 +129,22 @@ Espo.define('Views.Fields.LinkMultiple', 'Views.Fields.Base', function (Dep) {
|
||||
getAutocompleteUrl: function () {
|
||||
var url = this.foreignScope + '?sortBy=name&maxCount=' + this.AUTOCOMPLETE_RESULT_MAX_COUNT;
|
||||
var boolList = this.getSelectBoolFilterList();
|
||||
var where = [];
|
||||
if (boolList) {
|
||||
boolList.forEach(function(item) {
|
||||
url += '&where%5B0%5D%5Btype%5D=bool&where%5B0%5D%5Bvalue%5D%5B%5D=' + item;
|
||||
}, this);
|
||||
where.push({
|
||||
type: 'bool',
|
||||
value: boolList
|
||||
});
|
||||
}
|
||||
var primary = this.getSelectPrimaryFilterName();
|
||||
if (primary) {
|
||||
url += '&where%5B0%5D%5Btype%5D=primary&where%5B0%5D%5Bvalue%5D=' + primary;
|
||||
where.push({
|
||||
type: 'primary',
|
||||
value: primary
|
||||
});
|
||||
}
|
||||
if (where.length) {
|
||||
url += '&' + $.param({'where': where});
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
@@ -132,14 +132,22 @@ Espo.define('Views.Fields.LinkParent', 'Views.Fields.Base', function (Dep) {
|
||||
getAutocompleteUrl: function () {
|
||||
var url = this.foreignScope + '?sortBy=name&maxCount=' + this.AUTOCOMPLETE_RESULT_MAX_COUNT;
|
||||
var boolList = this.getSelectBoolFilterList();
|
||||
var where = [];
|
||||
if (boolList) {
|
||||
boolList.forEach(function(item) {
|
||||
url += '&where%5B0%5D%5Btype%5D=bool&where%5B0%5D%5Bvalue%5D%5B%5D=' + item;
|
||||
}, this);
|
||||
where.push({
|
||||
type: 'bool',
|
||||
value: boolList
|
||||
});
|
||||
}
|
||||
var primary = this.getSelectPrimaryFilterName();
|
||||
if (primary) {
|
||||
url += '&where%5B0%5D%5Btype%5D=primary&where%5B0%5D%5Bvalue%5D=' + primary;
|
||||
where.push({
|
||||
type: 'primary',
|
||||
value: primary
|
||||
});
|
||||
}
|
||||
if (where.length) {
|
||||
url += '&' + $.param({'where': where});
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
@@ -25,13 +25,13 @@ Espo.define('Views.Fields.Link', 'Views.Fields.Base', function (Dep) {
|
||||
|
||||
type: 'link',
|
||||
|
||||
listTemplate: 'fields.link.list',
|
||||
listTemplate: 'fields/link/list',
|
||||
|
||||
detailTemplate: 'fields.link.detail',
|
||||
detailTemplate: 'fields/link/detail',
|
||||
|
||||
editTemplate: 'fields.link.edit',
|
||||
editTemplate: 'fields/link/edit',
|
||||
|
||||
searchTemplate: 'fields.link.search',
|
||||
searchTemplate: 'fields/link/search',
|
||||
|
||||
nameName: null,
|
||||
|
||||
@@ -41,7 +41,7 @@ Espo.define('Views.Fields.Link', 'Views.Fields.Base', function (Dep) {
|
||||
|
||||
AUTOCOMPLETE_RESULT_MAX_COUNT: 7,
|
||||
|
||||
selectRecordsViewName: 'Modals.SelectRecords',
|
||||
selectRecordsViewName: 'views/modals/select-records',
|
||||
|
||||
autocompleteDisabled: false,
|
||||
|
||||
@@ -134,14 +134,22 @@ Espo.define('Views.Fields.Link', 'Views.Fields.Base', function (Dep) {
|
||||
getAutocompleteUrl: function () {
|
||||
var url = this.foreignScope + '?sortBy=name&maxCount=' + this.AUTOCOMPLETE_RESULT_MAX_COUNT;
|
||||
var boolList = this.getSelectBoolFilterList();
|
||||
var where = [];
|
||||
if (boolList) {
|
||||
boolList.forEach(function(item) {
|
||||
url += '&where%5B0%5D%5Btype%5D=bool&where%5B0%5D%5Bvalue%5D%5B%5D=' + item;
|
||||
}, this);
|
||||
where.push({
|
||||
type: 'bool',
|
||||
value: boolList
|
||||
});
|
||||
}
|
||||
var primary = this.getSelectPrimaryFilterName();
|
||||
if (primary) {
|
||||
url += '&where%5B0%5D%5Btype%5D=primary&where%5B0%5D%5Bvalue%5D=' + primary;
|
||||
where.push({
|
||||
type: 'primary',
|
||||
value: primary
|
||||
});
|
||||
}
|
||||
if (where.length) {
|
||||
url += '&' + $.param({'where': where});
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user