Merge branch 'fix'

This commit is contained in:
Yuri Kuznetsov
2025-02-01 12:47:20 +02:00
4 changed files with 89 additions and 18 deletions
@@ -30,7 +30,6 @@
namespace Espo\ORM\Repository\Deprecation;
use Espo\ORM\Entity;
use Espo\ORM\Mapper\BaseMapper;
/**
* @internal
@@ -38,21 +37,6 @@ use Espo\ORM\Mapper\BaseMapper;
*/
trait RDBRepositoryDeprecationTrait
{
/**
* @deprecated Use QueryBuilder instead.
* @todo Rewrite usages.
*/
public function deleteFromDb(string $id, bool $onlyDeleted = false): void
{
$mapper = $this->getMapper();
if (!$mapper instanceof BaseMapper) {
throw new \RuntimeException("Not supported 'deleteFromDb'.");
}
$mapper->deleteFromDb($this->entityType, $id, $onlyDeleted);
}
/**
* Get an entity. If ID is NULL, a new entity is returned.
*
@@ -33,7 +33,6 @@ use Espo\ORM\Defs\RelationDefs;
use Espo\ORM\EntityCollection;
use Espo\ORM\EntityManager;
use Espo\ORM\EntityFactory;
use Espo\ORM\Collection;
use Espo\ORM\Name\Attribute;
use Espo\ORM\Relation\Relations;
use Espo\ORM\Relation\RelationsMap;
@@ -756,4 +755,15 @@ class RDBRepository implements Repository
$this->getRelation($entity, $name)->relate($related);
}
public function deleteFromDb(string $id, bool $onlyDeleted = false): void
{
$mapper = $this->getMapper();
if (!$mapper instanceof BaseMapper) {
throw new RuntimeException("Not supported 'deleteFromDb'.");
}
$mapper->deleteFromDb($this->entityType, $id, $onlyDeleted);
}
}
@@ -6,7 +6,7 @@
"align": "Align",
"panelName": "Panel Name",
"style": "Style",
"sticked": "Sticked",
"sticked": "Stick to top",
"isMuted": "Muted color",
"isLarge": "Large font size",
"hidden": "Hidden",
+77
View File
@@ -136,6 +136,8 @@ export default class LeadCaptureFormView extends View {
});
this.assignView('record', this.recordView, '.record');
this.whenReady().then(() => this.initAutocomplete());
}
afterRender() {
@@ -199,4 +201,79 @@ export default class LeadCaptureFormView extends View {
});
})
}
/**
* @private
*/
initAutocomplete() {
const emailAddressView = this.recordView.getFieldView('emailAddress');
if (emailAddressView) {
this.listenTo(emailAddressView, 'after:render', () => {
/** @type {HTMLInputElement} */
const element = emailAddressView.element.querySelector('input');
if (element) {
element.autocomplete = 'email';
}
});
}
const phoneNumberView = this.recordView.getFieldView('phoneNumber');
if (phoneNumberView) {
this.listenTo(phoneNumberView, 'after:render', () => {
/** @type {HTMLInputElement} */
const element = phoneNumberView.element.querySelector('input');
if (element) {
element.autocomplete = 'tel';
}
});
}
const nameView = this.recordView.getFieldView('name');
this.listenTo(nameView, 'after:render', () => {
/** @type {HTMLInputElement} */
const elementFirst = nameView.element.querySelector('input[data-name="firstName"]');
if (elementFirst) {
elementFirst.autocomplete = 'given-name';
}
/** @type {HTMLInputElement} */
const elementLast = nameView.element.querySelector('input[data-name="lastName"]');
if (elementLast) {
elementLast.autocomplete = 'family-name';
}
});
const firstName = this.recordView.getFieldView('firstName');
if (firstName) {
this.listenTo(firstName, 'after:render', () => {
/** @type {HTMLInputElement} */
const element = firstName.element.querySelector('input');
if (element) {
element.autocomplete = 'given-name';
}
});
}
const lastName = this.recordView.getFieldView('lastName');
if (lastName) {
this.listenTo(lastName, 'after:render', () => {
/** @type {HTMLInputElement} */
const element = lastName.element.querySelector('input');
if (element) {
element.autocomplete = 'family-name';
}
});
}
}
}