feat(CPuls): Enhance CPuls entity with new fields, tooltips, and options; add localization for German and English

- Added new fields to CPuls entity including status, syncStatus, kiAnalyse, and others.
- Implemented localization for CPuls in German (de_DE) and English (en_US).
- Introduced new API actions for team activation and completion of CPuls.
- Created hooks to update team statistics and manage document counts.
- Added new entity definitions and metadata for CPulsTeamZuordnung and Team.
- Implemented validation logic in formulas to prevent completion of unclean Puls.
- Updated layouts for detail and list views of CPuls.
- Enhanced user entity with absence tracking fields.
- Added scopes for CPuls and CPulsTeamZuordnung.
This commit is contained in:
2026-02-13 10:09:19 +01:00
parent 0faf1c0657
commit e1a963ffab
22 changed files with 1073 additions and 374 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace Espo\Custom\Hooks\CPuls;
use Espo\ORM\Entity;
use Espo\Core\Hook\Hook\BeforeSave;
class UpdateTeamStats implements BeforeSave
{
public function __construct(
private \Espo\ORM\EntityManager $entityManager
) {}
public function beforeSave(Entity $entity, array $options): void
{
// Zähle Dokumente
if ($entity->isNew() || $entity->isAttributeChanged('id')) {
$dokumenteCount = $this->entityManager
->getRDBRepository('CDokumente')
->where(['pulsId' => $entity->getId()])
->count();
$entity->set('anzahlDokumente', $dokumenteCount);
}
// Zähle Team-Zuordnungen
$zuordnungen = $this->entityManager
->getRDBRepository('CPulsTeamZuordnung')
->where(['pulsId' => $entity->getId()])
->find();
$aktiv = 0;
$abgeschlossen = 0;
foreach ($zuordnungen as $z) {
if ($z->get('aktiv')) {
$aktiv++;
if ($z->get('abgeschlossen')) {
$abgeschlossen++;
}
}
}
$entity->set('anzahlTeamsAktiv', $aktiv);
$entity->set('anzahlTeamsAbgeschlossen', $abgeschlossen);
}
}