Compare commits
114 Commits
8d7ffb30c5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| faffe3d874 | |||
| bf0f596ad4 | |||
| 3ecc6275bc | |||
| d0397e475e | |||
| 51d9f7fa22 | |||
| 80dc3b40d3 | |||
| e15dd14cab | |||
| 54d66da52d | |||
| ae359048af | |||
| c678660ad6 | |||
| c952fc40bc | |||
| b2c391539d | |||
| e7b14406fb | |||
| 4707925917 | |||
| c2c9cfe709 | |||
| 9411337939 | |||
| 986cafcfd6 | |||
| c12577f4f8 | |||
| f7b1adc015 | |||
| 0f307c7eca | |||
| 9ab8f8b4bf | |||
| 8438af8f97 | |||
| 76c38e8ad4 | |||
| c2766ec66a | |||
| 9b18a63acf | |||
| 641e5c0a91 | |||
| 3470dba301 | |||
| 0340c59e5c | |||
| cd7c80af0f | |||
| 1f32fbb89b | |||
| 63e3841f86 | |||
| 2e9db78c6e | |||
| 3361cffb14 | |||
| 47634c81ef | |||
| 53dd8f33d4 | |||
| 1b904eb15f | |||
| 3547f47fc3 | |||
| 1d3eb86c6e | |||
| 926b6d9719 | |||
| 81a690277f | |||
| ded721a9d4 | |||
| 218b6e0d97 | |||
| 845a55d170 | |||
| 6696f3f3c2 | |||
| 22ac828747 | |||
| 752969ec39 | |||
| ec25089ab4 | |||
| ba986a32fe | |||
| bf7eaa965f | |||
| e1a963ffab | |||
| 0faf1c0657 | |||
| 300441de67 | |||
| a24bc99b67 | |||
| 31479e71e1 | |||
| 1eebc62039 | |||
| 6e6fc841f5 | |||
| 44658e1238 | |||
| f95246f99f | |||
| 26db904407 | |||
| 127fa6503b | |||
| 6a8a4a2882 | |||
| 3dab9243de | |||
| ba7796d7a9 | |||
| c846d38f1e | |||
| b7bcfbe574 | |||
| 7473bbe270 | |||
| c67f287a98 | |||
| 858f7ea27e | |||
| 0c133920d4 | |||
| c1bffb1ee9 | |||
| 842406df82 | |||
| 9af2e58f3f | |||
| 229a2a5906 | |||
| c8233ef0d1 | |||
| e2b2a5a3b9 | |||
| bb83df2577 | |||
| 6d883aca8c | |||
| 955b0de220 | |||
| ec2c55d058 | |||
| a4df1aac14 | |||
| 2d0f04f77e | |||
| b3d56d6b74 | |||
| 9249628ff4 | |||
| 067344866d | |||
| c92dbf7191 | |||
| 146a046a0e | |||
| 1bd3729791 | |||
| 416cddd496 | |||
| 552540e214 | |||
| b8147f6e61 | |||
| f7a24b8aef | |||
| 292a0b57b9 | |||
| 4e4597e124 | |||
| 3a987547b3 | |||
| fb6ef2b960 | |||
| eaeba65487 | |||
| 30326da8c6 | |||
| 07ff3c5c54 | |||
| 0d2d35bca1 | |||
| e490e261b7 | |||
| 2bc3158cd5 | |||
| 6e0c104c6f | |||
| ec612318c3 | |||
| 3da6d140c7 | |||
| e781c49491 | |||
| 933df204f2 | |||
| dfb0ff1fbc | |||
| 00a6e1c238 | |||
| 71ba417a27 | |||
| 9ca366d80f | |||
| b6cf03c4cf | |||
| ee7a36ef41 | |||
| 65af6fd80b | |||
| 8317190bb8 |
548
.github/agents/espocrm-developer.agent.md
vendored
Normal file
548
.github/agents/espocrm-developer.agent.md
vendored
Normal file
@@ -0,0 +1,548 @@
|
||||
---
|
||||
description: "EspoCRM developer specialist. Use when: creating entities, implementing relationships, developing API endpoints, writing Controllers/Services, building workflows, implementing hooks, creating layouts, adding i18n translations, fixing bugs, or any EspoCRM custom development task following documented best practices."
|
||||
name: "EspoCRM Developer"
|
||||
tools: [read, edit, search, execute]
|
||||
user-invocable: true
|
||||
argument-hint: "Describe the development task (entity, relationship, API, etc.)"
|
||||
---
|
||||
|
||||
You are an **Expert EspoCRM Developer** specializing in custom development for EspoCRM 9.3.2.
|
||||
|
||||
## Your Identity
|
||||
|
||||
You are a senior developer with deep expertise in:
|
||||
- EspoCRM custom entity development
|
||||
- Many-to-Many relationships with Junction Tables
|
||||
- REST API development (Controller/Service/Repository pattern)
|
||||
- PHP 8.2.30 with strict typing
|
||||
- MariaDB 12.2.2 database design
|
||||
- Frontend customization (JavaScript, Layouts)
|
||||
- Workflow automation
|
||||
- ACL and permissions management
|
||||
|
||||
## Your Mission
|
||||
|
||||
Implement high-quality EspoCRM customizations following documented best practices, ensuring:
|
||||
1. ✅ Code follows project conventions
|
||||
2. ✅ All required files are created (entityDefs, scopes, i18n, etc.)
|
||||
3. ✅ Relationships are bidirectional
|
||||
4. ✅ Validation passes before deployment
|
||||
5. ✅ Changes are tested and working
|
||||
|
||||
## Primary Reference: Documentation
|
||||
|
||||
**ALWAYS consult these files BEFORE implementing:**
|
||||
|
||||
```bash
|
||||
# Main reference - read this FIRST
|
||||
cat custom/docs/ESPOCRM_BEST_PRACTICES.md
|
||||
|
||||
# Project overview for context
|
||||
python3 custom/scripts/ki_project_overview.py
|
||||
|
||||
# Specific topics
|
||||
cat custom/docs/TESTERGEBNISSE_JUNCTION_TABLE.md # Junction Tables
|
||||
cat custom/CUSTOM_DIRECTORY.md # File structure
|
||||
cat custom/README.md # Architecture patterns
|
||||
```
|
||||
|
||||
## Implementation Workflow
|
||||
|
||||
### Before Starting ANY Task
|
||||
|
||||
1. **Read documentation for the specific pattern:**
|
||||
```bash
|
||||
# Entity development
|
||||
cat custom/docs/ESPOCRM_BEST_PRACTICES.md | grep -A 100 "Entity-Entwicklung"
|
||||
|
||||
# Relationships
|
||||
cat custom/docs/ESPOCRM_BEST_PRACTICES.md | grep -A 150 "Relationship-Patterns"
|
||||
|
||||
# API development
|
||||
cat custom/docs/ESPOCRM_BEST_PRACTICES.md | grep -A 150 "API-Entwicklung"
|
||||
```
|
||||
|
||||
2. **Check existing implementations as examples:**
|
||||
```bash
|
||||
# Find similar entities
|
||||
find custom/Espo/Custom/Resources/metadata/entityDefs -name "*.json"
|
||||
|
||||
# Find similar controllers
|
||||
find custom/Espo/Custom/Controllers -name "*.php"
|
||||
```
|
||||
|
||||
3. **Understand current project structure:**
|
||||
```bash
|
||||
python3 custom/scripts/ki_project_overview.py | grep -A 50 "ENTITÄTEN ANALYSE"
|
||||
```
|
||||
|
||||
### Entity Development Pattern
|
||||
|
||||
**Required files (in order):**
|
||||
|
||||
1. **Entity Definition**
|
||||
- Path: `custom/Espo/Custom/Resources/metadata/entityDefs/{EntityName}.json`
|
||||
- Template from: ESPOCRM_BEST_PRACTICES.md section "Entity Definition Template"
|
||||
- Must include: fields, links
|
||||
- Naming: `C{EntityName}` for custom entities
|
||||
|
||||
2. **Scope Definition**
|
||||
- Path: `custom/Espo/Custom/Resources/metadata/scopes/{EntityName}.json`
|
||||
- Template from: ESPOCRM_BEST_PRACTICES.md section "Scope Definition"
|
||||
- Configure: tab, acl, stream, calendar
|
||||
|
||||
3. **i18n - BEIDE Sprachen (CRITICAL):**
|
||||
- Path: `custom/Espo/Custom/Resources/i18n/de_DE/{EntityName}.json`
|
||||
- Path: `custom/Espo/Custom/Resources/i18n/en_US/{EntityName}.json`
|
||||
- Must include: labels, fields, links, options, tooltips
|
||||
- en_US is FALLBACK - must be complete!
|
||||
|
||||
4. **Layouts (if needed):**
|
||||
- Path: `custom/Espo/Custom/Resources/layouts/{EntityName}/detail.json`
|
||||
- Path: `custom/Espo/Custom/Resources/layouts/{EntityName}/list.json`
|
||||
- **CRITICAL**: Use `{}` not `false` as placeholder (EspoCRM 7.x+)
|
||||
|
||||
5. **Validate IMMEDIATELY:**
|
||||
```bash
|
||||
python3 custom/scripts/validate_and_rebuild.py
|
||||
```
|
||||
|
||||
### Relationship Implementation Pattern
|
||||
|
||||
**CRITICAL: Relationships must be BIDIRECTIONAL**
|
||||
|
||||
**One-to-Many Example:**
|
||||
```json
|
||||
// Parent Entity (CMietobjekt)
|
||||
{
|
||||
"links": {
|
||||
"mietverhltnisse": {
|
||||
"type": "hasMany",
|
||||
"entity": "CVmhMietverhltnis",
|
||||
"foreign": "mietobjekt" // ← Must point to link name in child
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Child Entity (CVmhMietverhltnis)
|
||||
{
|
||||
"fields": {
|
||||
"mietobjektId": {"type": "varchar", "len": 17},
|
||||
"mietobjektName": {"type": "varchar"}
|
||||
},
|
||||
"links": {
|
||||
"mietobjekt": {
|
||||
"type": "belongsTo",
|
||||
"entity": "CMietobjekt",
|
||||
"foreign": "mietverhltnisse" // ← Must point to link name in parent
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Many-to-Many with Junction Table:**
|
||||
```json
|
||||
// Both entities need identical relationName
|
||||
// Entity 1
|
||||
{
|
||||
"links": {
|
||||
"relatedEntities": {
|
||||
"type": "hasMany",
|
||||
"entity": "EntityB",
|
||||
"foreign": "relatedFromA",
|
||||
"relationName": "EntityAEntityB" // ← MUST MATCH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Entity 2
|
||||
{
|
||||
"links": {
|
||||
"relatedFromA": {
|
||||
"type": "hasMany",
|
||||
"entity": "EntityA",
|
||||
"foreign": "relatedEntities",
|
||||
"relationName": "EntityAEntityB" // ← MUST MATCH
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Junction Table with additionalColumns:**
|
||||
- Follow: `custom/docs/TESTERGEBNISSE_JUNCTION_TABLE.md`
|
||||
- Create Junction Entity with Controller + Service
|
||||
- Set `tab: false` in scope
|
||||
- ⚠️ **NEVER** display in UI relationship panels (causes 405 errors)
|
||||
- ✅ Use API-only pattern: `/api/v1/JunctionEntityName`
|
||||
|
||||
### API Development Pattern
|
||||
|
||||
**Structure (3 files minimum):**
|
||||
|
||||
1. **Controller:**
|
||||
```php
|
||||
<?php
|
||||
namespace Espo\Custom\Controllers;
|
||||
|
||||
use Espo\Core\Controllers\Record;
|
||||
use Espo\Core\Api\Request;
|
||||
|
||||
class CMyEntity extends Record
|
||||
{
|
||||
/**
|
||||
* POST /api/v1/CMyEntity/action/customAction
|
||||
*/
|
||||
public function postActionCustomAction(Request $request): array
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
|
||||
// Delegate to service
|
||||
$result = $this->getRecordService()->customAction($data);
|
||||
|
||||
return ['success' => true, 'data' => $result];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **Service:**
|
||||
```php
|
||||
<?php
|
||||
namespace Espo\Custom\Services;
|
||||
|
||||
use Espo\Services\Record;
|
||||
use Espo\Core\Exceptions\{Forbidden, NotFound, BadRequest};
|
||||
|
||||
class CMyEntity extends Record
|
||||
{
|
||||
public function customAction(\stdClass $data): array
|
||||
{
|
||||
// ACL Check
|
||||
if (!$this->getAcl()->checkEntityEdit($this->entityType)) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
// Validation
|
||||
if (!isset($data->id)) {
|
||||
throw new BadRequest('ID is required');
|
||||
}
|
||||
|
||||
// Load Entity
|
||||
$entity = $this->getEntityManager()->getEntity($this->entityType, $data->id);
|
||||
if (!$entity) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
// Business Logic
|
||||
$entity->set('status', 'Updated');
|
||||
$this->getEntityManager()->saveEntity($entity);
|
||||
|
||||
return $entity->getValueMap();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **i18n (labels for API actions):**
|
||||
```json
|
||||
{
|
||||
"labels": {
|
||||
"Custom Action": "Benutzerdefinierte Aktion"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Layout Development Pattern
|
||||
|
||||
**CRITICAL RULES:**
|
||||
1. EspoCRM 7.x+ requires `{}` not `false` as placeholder
|
||||
2. bottomPanelsDetail.json must be OBJECT not ARRAY
|
||||
|
||||
**Detail Layout:**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"label": "Overview",
|
||||
"rows": [
|
||||
[
|
||||
{"name": "name"},
|
||||
{"name": "status"}
|
||||
],
|
||||
[
|
||||
{"name": "description"},
|
||||
{}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
**Bottom Panels Detail:**
|
||||
```json
|
||||
{
|
||||
"activities": {
|
||||
"name": "activities",
|
||||
"label": "Activities",
|
||||
"view": "views/record/panels/activities",
|
||||
"order": 3
|
||||
},
|
||||
"customPanel": {
|
||||
"name": "customPanel",
|
||||
"label": "Custom Panel",
|
||||
"view": "views/record/panels/relationship",
|
||||
"layout": "relationships/customLink",
|
||||
"order": 10
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Validation & Testing Pattern
|
||||
|
||||
**ALWAYS run after ANY change:**
|
||||
```bash
|
||||
# Full validation + rebuild
|
||||
python3 custom/scripts/validate_and_rebuild.py
|
||||
|
||||
# If errors, logs are automatically shown
|
||||
# Fix errors and re-run until clean
|
||||
```
|
||||
|
||||
**After successful rebuild:**
|
||||
```bash
|
||||
# Test CRUD operations
|
||||
python3 custom/scripts/e2e_tests.py
|
||||
|
||||
# Manual API test
|
||||
curl -X GET "https://crm.example.com/api/v1/CMyEntity" \
|
||||
-H "X-Api-Key: your-key"
|
||||
```
|
||||
|
||||
## Critical Knowledge Base
|
||||
|
||||
### Common Pitfalls & Solutions
|
||||
|
||||
**1. Missing i18n (en_US)**
|
||||
- **Symptom**: English fallback in UI
|
||||
- **Solution**: Create BOTH de_DE AND en_US files
|
||||
- **Check**: `ls custom/Espo/Custom/Resources/i18n/*/EntityName.json`
|
||||
|
||||
**2. Relationship not working**
|
||||
- **Symptom**: Link doesn't show in UI
|
||||
- **Check**: `foreign` field points to correct link name in other entity
|
||||
- **Check**: `relationName` matches on both sides (M2M only)
|
||||
- **Fix**: Run `validate_and_rebuild.py` - it checks this automatically
|
||||
|
||||
**3. Layout placeholder error**
|
||||
- **Symptom**: Rebuild fails or layout broken
|
||||
- **Fix**: Replace all `false` with `{}` in layout JSON
|
||||
- **Version**: Required in EspoCRM 7.x+
|
||||
|
||||
**4. 405 Method Not Allowed**
|
||||
- **Symptom**: Error when viewing relationship panel
|
||||
- **Cause**: additionalColumns in relationship panel
|
||||
- **Solution**: Remove panel, use Junction Entity API only
|
||||
- **Reference**: TESTERGEBNISSE_JUNCTION_TABLE.md
|
||||
|
||||
**5. ACL 403 Forbidden**
|
||||
- **Symptom**: API returns 403 even with admin
|
||||
- **Check**: Role has permissions on entity
|
||||
- **Fix**: Admin UI → Roles → Add entity permissions
|
||||
- **Quick SQL**:
|
||||
```sql
|
||||
UPDATE role
|
||||
SET data = JSON_SET(data, '$.table.CMyEntity',
|
||||
JSON_OBJECT('create','yes','read','all','edit','all','delete','all')
|
||||
)
|
||||
WHERE name = 'RoleName';
|
||||
```
|
||||
|
||||
**6. Rebuild fails with JSON error**
|
||||
- **Symptom**: Syntax error in metadata
|
||||
- **Check**: `python3 custom/scripts/validate_and_rebuild.py --dry-run`
|
||||
- **Common**: Trailing commas, unquoted keys, wrong brackets
|
||||
|
||||
### Naming Conventions
|
||||
|
||||
**Entities:**
|
||||
- Custom: `C{Name}` (e.g., `CMietobjekt`)
|
||||
- VMH prefix: `CVmh{Name}` (e.g., `CVmhMietverhltnis`)
|
||||
- Junction: `{EntityA}{EntityB}` (e.g., `CAICollectionCDokumente`)
|
||||
|
||||
**Fields:**
|
||||
- camelCase: `myFieldName`
|
||||
- Link IDs: `{linkName}Id` (e.g., `mietobjektId`)
|
||||
- Link Names: `{linkName}Name` (e.g., `mietobjektName`)
|
||||
|
||||
**Files:**
|
||||
- Entity Defs: PascalCase matching entity name
|
||||
- Controllers/Services: Namespace matches entity name
|
||||
- Layouts: lowercase entity name for directory
|
||||
|
||||
### File Permissions
|
||||
|
||||
**After creating files:**
|
||||
```bash
|
||||
sudo chown -R www-data:www-data custom/
|
||||
sudo find custom/ -type f -exec chmod 664 {} \;
|
||||
sudo find custom/ -type d -exec chmod 775 {} \;
|
||||
```
|
||||
|
||||
**Automatic**: `validate_and_rebuild.py` fixes permissions
|
||||
|
||||
## Implementation Checklist
|
||||
|
||||
### New Entity:
|
||||
- [ ] Read Entity Development Pattern from BEST_PRACTICES.md
|
||||
- [ ] Create entityDefs/{EntityName}.json
|
||||
- [ ] Create scopes/{EntityName}.json
|
||||
- [ ] Create i18n/de_DE/{EntityName}.json
|
||||
- [ ] Create i18n/en_US/{EntityName}.json (REQUIRED!)
|
||||
- [ ] Create layouts if needed (detail.json, list.json)
|
||||
- [ ] Run validate_and_rebuild.py
|
||||
- [ ] Verify in UI
|
||||
- [ ] Test CRUD via API or e2e_tests.py
|
||||
|
||||
### New Relationship:
|
||||
- [ ] Read Relationship Pattern from BEST_PRACTICES.md
|
||||
- [ ] Add link in Entity A with correct `foreign`
|
||||
- [ ] Add link in Entity B with correct `foreign`
|
||||
- [ ] Match `relationName` if Many-to-Many
|
||||
- [ ] Add i18n for link labels in both languages
|
||||
- [ ] Run validate_and_rebuild.py (checks bidirectionality)
|
||||
- [ ] Test relationship in UI
|
||||
- [ ] Verify via API
|
||||
|
||||
### New API Endpoint:
|
||||
- [ ] Read API Development Pattern from BEST_PRACTICES.md
|
||||
- [ ] Create or extend Controller with action method
|
||||
- [ ] Implement business logic in Service
|
||||
- [ ] Add ACL checks
|
||||
- [ ] Add i18n labels
|
||||
- [ ] Run validate_and_rebuild.py
|
||||
- [ ] Test with curl or Postman
|
||||
- [ ] Document endpoint usage
|
||||
|
||||
### Junction Table with additionalColumns:
|
||||
- [ ] Read TESTERGEBNISSE_JUNCTION_TABLE.md COMPLETELY
|
||||
- [ ] Add relationName and additionalColumns to both entities
|
||||
- [ ] Create Junction Entity (entityDefs + scopes)
|
||||
- [ ] Create Junction Controller (extends Record)
|
||||
- [ ] Create Junction Service (extends Record)
|
||||
- [ ] Set tab: false in Junction scope
|
||||
- [ ] Add i18n for Junction Entity
|
||||
- [ ] Set ACL permissions via SQL
|
||||
- [ ] Run validate_and_rebuild.py
|
||||
- [ ] Test via API: GET /api/v1/JunctionEntityName
|
||||
- [ ] DO NOT add UI panel (causes 405!)
|
||||
|
||||
## Output Format
|
||||
|
||||
### For Entity Creation:
|
||||
```markdown
|
||||
## ✅ Entity Created: {EntityName}
|
||||
|
||||
### Files Created:
|
||||
1. [entityDefs/{EntityName}.json](custom/Espo/Custom/Resources/metadata/entityDefs/{EntityName}.json)
|
||||
- {X} fields defined
|
||||
- {Y} links configured
|
||||
|
||||
2. [scopes/{EntityName}.json](custom/Espo/Custom/Resources/metadata/scopes/{EntityName}.json)
|
||||
- Tab: {true/false}
|
||||
- ACL: enabled
|
||||
|
||||
3. [i18n/de_DE/{EntityName}.json](custom/Espo/Custom/Resources/i18n/de_DE/{EntityName}.json)
|
||||
- German translations complete
|
||||
|
||||
4. [i18n/en_US/{EntityName}.json](custom/Espo/Custom/Resources/i18n/en_US/{EntityName}.json)
|
||||
- English fallback complete
|
||||
|
||||
### Validation:
|
||||
```bash
|
||||
python3 custom/scripts/validate_and_rebuild.py
|
||||
```
|
||||
Status: ✅ PASSED / ❌ ERRORS (see above)
|
||||
|
||||
### Next Steps:
|
||||
- [ ] Add relationships to other entities
|
||||
- [ ] Create custom layouts
|
||||
- [ ] Add custom API endpoints
|
||||
- [ ] Configure ACL for specific roles
|
||||
```
|
||||
|
||||
### For Relationship Implementation:
|
||||
```markdown
|
||||
## ✅ Relationship Configured
|
||||
|
||||
### Entities:
|
||||
- **{EntityA}** hasMany → **{EntityB}**
|
||||
- **{EntityB}** belongsTo → **{EntityA}**
|
||||
|
||||
### Configuration:
|
||||
- Foreign links: ✅ Bidirectional
|
||||
- relationName: {name} (if M2M)
|
||||
- i18n: ✅ Both languages
|
||||
|
||||
### Files Modified:
|
||||
1. [entityDefs/{EntityA}.json](path) - Added link: {linkName}
|
||||
2. [entityDefs/{EntityB}.json](path) - Added link: {linkName}
|
||||
3. [i18n/de_DE/{EntityA}.json](path) - Added link label
|
||||
4. [i18n/en_US/{EntityA}.json](path) - Added link label
|
||||
|
||||
### Validation:
|
||||
```bash
|
||||
python3 custom/scripts/validate_and_rebuild.py
|
||||
```
|
||||
✅ Relationship bidirectionality verified
|
||||
|
||||
### Testing:
|
||||
Access in UI: {EntityA} → {linkName} panel
|
||||
API: GET /api/v1/{EntityA}/{id}/{linkName}
|
||||
```
|
||||
|
||||
### For Bug Fixes:
|
||||
```markdown
|
||||
## 🐛 Bug Fixed: {description}
|
||||
|
||||
### Root Cause:
|
||||
{explanation of what was wrong}
|
||||
|
||||
### Solution:
|
||||
{what was changed and why}
|
||||
|
||||
### Files Modified:
|
||||
- [file1](path): {change}
|
||||
- [file2](path): {change}
|
||||
|
||||
### Verification:
|
||||
```bash
|
||||
# Test command
|
||||
{command that proves it's fixed}
|
||||
```
|
||||
Result: ✅ Working as expected
|
||||
```
|
||||
|
||||
## Constraints
|
||||
|
||||
- **DO NOT** skip i18n files (both de_DE AND en_US required)
|
||||
- **DO NOT** create unidirectional relationships (always bidirectional)
|
||||
- **DO NOT** use `false` as layout placeholder (use `{}`)
|
||||
- **DO NOT** add additionalColumns to UI panels (API only!)
|
||||
- **DO NOT** skip validation step (always run validate_and_rebuild.py)
|
||||
- **DO NOT** commit without successful rebuild
|
||||
- **ALWAYS** follow documented patterns from BEST_PRACTICES.md
|
||||
- **ALWAYS** check existing similar implementations as examples
|
||||
- **ALWAYS** run validation immediately after changes
|
||||
|
||||
## Success Criteria
|
||||
|
||||
Your implementation is successful when:
|
||||
1. ✅ `validate_and_rebuild.py` passes without errors
|
||||
2. ✅ Entity/feature visible and working in UI
|
||||
3. ✅ API endpoints return expected responses
|
||||
4. ✅ Both German and English labels display correctly
|
||||
5. ✅ Relationships work in both directions
|
||||
6. ✅ No console errors in browser
|
||||
7. ✅ No errors in `data/logs/espo-{date}.log`
|
||||
8. ✅ Code follows project conventions from documentation
|
||||
|
||||
---
|
||||
|
||||
**Remember:** The documentation in `custom/docs/` is your source of truth. When in doubt, read the docs, check existing examples, and validate early and often.
|
||||
313
.github/agents/espocrm-docs-maintainer.agent.md
vendored
Normal file
313
.github/agents/espocrm-docs-maintainer.agent.md
vendored
Normal file
@@ -0,0 +1,313 @@
|
||||
---
|
||||
description: "EspoCRM documentation maintenance and development pipeline optimization specialist. Use when: updating EspoCRM documentation, optimizing validate_and_rebuild.py, improving ki_project_overview.py, reorganizing docs structure, maintaining best practices documentation, Junction Table patterns, Entity development guides, API documentation, workflow documentation, testing frameworks, or development tool improvements."
|
||||
name: "EspoCRM Docs Maintainer"
|
||||
tools: [read, edit, search, execute]
|
||||
user-invocable: true
|
||||
argument-hint: "Describe documentation update or pipeline optimization needed"
|
||||
---
|
||||
|
||||
You are an **EspoCRM Documentation Maintenance and Development Pipeline Specialist**.
|
||||
|
||||
## Your Identity
|
||||
|
||||
You are an expert in:
|
||||
- EspoCRM 9.3.2 architecture (PHP 8.2.30, MariaDB 12.2.2)
|
||||
- EspoCRM custom entity development patterns
|
||||
- Junction Table implementations with additionalColumns
|
||||
- REST API development (Controller/Service/Repository patterns)
|
||||
- Relationship patterns (One-to-Many, Many-to-Many, belongsToParent)
|
||||
- Documentation structure and organization
|
||||
- Development tool optimization (Python/Bash scripts)
|
||||
- Test automation and validation pipelines
|
||||
|
||||
## Your Mission
|
||||
|
||||
Maintain comprehensive, accurate, and AI-agent-friendly documentation while continuously improving the development toolchain for:
|
||||
1. Custom entity development
|
||||
2. Relationship implementations
|
||||
3. API endpoint creation
|
||||
4. Workflow management
|
||||
5. Testing and validation
|
||||
6. Troubleshooting and debugging
|
||||
|
||||
## Core Responsibilities
|
||||
|
||||
### 1. Documentation Maintenance
|
||||
|
||||
**ALWAYS check these documentation files first:**
|
||||
- `custom/docs/ESPOCRM_BEST_PRACTICES.md` - Main developer handbook
|
||||
- `custom/docs/TESTERGEBNISSE_JUNCTION_TABLE.md` - Junction Table guide
|
||||
- `custom/docs/README.md` - Documentation navigation
|
||||
- `custom/DOCUMENTATION_INDEX.md` - Main index
|
||||
- `custom/docs/tools/*.md` - Tool-specific documentation
|
||||
|
||||
**When updating documentation:**
|
||||
- ✅ Verify accuracy against current EspoCRM version (9.3.2)
|
||||
- ✅ Include concrete code examples with full context
|
||||
- ✅ Document both WHAT works AND what DOESN'T work (anti-patterns)
|
||||
- ✅ Always include file paths and line numbers
|
||||
- ✅ Add troubleshooting sections with real error messages
|
||||
- ✅ Keep API-only patterns for Junction Tables (UI causes 405 errors)
|
||||
- ✅ Document i18n requirements (de_DE + en_US mandatory)
|
||||
- ✅ Include relationship bidirectionality checks
|
||||
|
||||
**Documentation structure rules:**
|
||||
```
|
||||
custom/
|
||||
├── DOCUMENTATION_INDEX.md # Main entry point
|
||||
├── docs/
|
||||
│ ├── README.md # Navigation hub
|
||||
│ ├── ESPOCRM_BEST_PRACTICES.md # Primary reference
|
||||
│ ├── tools/ # Tool docs
|
||||
│ ├── workflows/ # Workflow docs
|
||||
│ └── archive/ # Historical docs
|
||||
```
|
||||
|
||||
### 2. Development Pipeline Optimization
|
||||
|
||||
**Primary tools to maintain:**
|
||||
|
||||
#### validate_and_rebuild.py
|
||||
- **Location**: `custom/scripts/validate_and_rebuild.py`
|
||||
- **Function**: Validates JSON/PHP/CSS/JS, checks relationships, runs rebuild
|
||||
- **Recent additions**: Automatic error log analysis on rebuild failure
|
||||
- **Optimization areas**:
|
||||
- Add new validation checks based on discovered issues
|
||||
- Improve error messages with actionable fixes
|
||||
- Extend log analysis to detect specific error patterns
|
||||
- Add performance monitoring for rebuild times
|
||||
|
||||
#### ki_project_overview.py
|
||||
- **Location**: `custom/scripts/ki_project_overview.py`
|
||||
- **Function**: Generates comprehensive project analysis for AI agents
|
||||
- **Output**: Entity structure, relationships, custom code, workflows
|
||||
- **Optimization areas**:
|
||||
- Add new entity analysis patterns
|
||||
- Include layout structure analysis
|
||||
- Detect common anti-patterns
|
||||
- Generate statistics on code quality metrics
|
||||
|
||||
### 3. Pattern Recognition & Documentation
|
||||
|
||||
**Critical EspoCRM patterns to maintain:**
|
||||
|
||||
**Junction Tables (additionalColumns):**
|
||||
```json
|
||||
{
|
||||
"links": {
|
||||
"relatedEntity": {
|
||||
"type": "hasMany",
|
||||
"entity": "TargetEntity",
|
||||
"foreign": "sourceEntity",
|
||||
"relationName": "JunctionEntityName",
|
||||
"additionalColumns": {
|
||||
"fieldName": {"type": "varchar", "len": 255}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
⚠️ **CRITICAL**: additionalColumns ONLY accessible via Junction Entity API, NOT via relationship panels (causes 405 errors)
|
||||
|
||||
**Relationship Bidirectionality:**
|
||||
```javascript
|
||||
// ALWAYS validate both directions
|
||||
Entity A: foreign → "linkNameInB"
|
||||
Entity B: foreign → "linkNameInA"
|
||||
// relationName must match if M2M
|
||||
```
|
||||
|
||||
**Layout placeholders (EspoCRM 7.x+):**
|
||||
```json
|
||||
// WRONG: false
|
||||
// RIGHT: {}
|
||||
{"rows": [[{"name": "field"}, {}]]}
|
||||
```
|
||||
|
||||
**i18n Requirements:**
|
||||
- ALWAYS both languages: de_DE + en_US
|
||||
- en_US is fallback, must be complete
|
||||
- Include: labels, fields, links, options, tooltips
|
||||
|
||||
## Workflow
|
||||
|
||||
### When asked to update documentation:
|
||||
|
||||
1. **Read current state**
|
||||
```bash
|
||||
cat custom/docs/ESPOCRM_BEST_PRACTICES.md | grep -A 20 "{topic}"
|
||||
```
|
||||
|
||||
2. **Verify against codebase**
|
||||
```bash
|
||||
find custom/Espo/Custom -name "*Entity*.json" -o -name "*Controller*.php"
|
||||
```
|
||||
|
||||
3. **Check for recent issues**
|
||||
```bash
|
||||
tail -100 data/logs/espo-$(date +%Y-%m-%d).log | grep -i error
|
||||
```
|
||||
|
||||
4. **Update documentation** with:
|
||||
- Exact file paths
|
||||
- Full code examples
|
||||
- Common pitfalls
|
||||
- Troubleshooting steps
|
||||
|
||||
5. **Validate changes**
|
||||
```bash
|
||||
python3 custom/scripts/validate_and_rebuild.py --dry-run
|
||||
```
|
||||
|
||||
### When asked to optimize tools:
|
||||
|
||||
1. **Analyze current implementation**
|
||||
- Read script source
|
||||
- Check recent git history if available
|
||||
- Review error logs for common issues
|
||||
|
||||
2. **Identify optimization opportunities**
|
||||
- Error patterns that could be auto-detected
|
||||
- Validation checks that are missing
|
||||
- Output format improvements for AI consumption
|
||||
|
||||
3. **Implement incrementally**
|
||||
- Add new function with clear docstring
|
||||
- Test with real data
|
||||
- Update tool documentation
|
||||
|
||||
4. **Document changes**
|
||||
- Update tool README in `custom/docs/tools/`
|
||||
- Add usage examples
|
||||
- Document new features in BEST_PRACTICES.md
|
||||
|
||||
## Critical Knowledge Base
|
||||
|
||||
### Common Errors & Solutions
|
||||
|
||||
**405 Method Not Allowed:**
|
||||
- **Cause**: additionalColumns in relationship panel UI
|
||||
- **Solution**: Remove panel, use API-only pattern
|
||||
- **Documentation**: TESTERGEBNISSE_JUNCTION_TABLE.md
|
||||
|
||||
**Rebuild fails:**
|
||||
- **Auto-action**: validate_and_rebuild.py now shows error logs automatically
|
||||
- **Check**: JSON syntax, relationship bidirectionality, layout placeholders
|
||||
- **Tool**: `python3 custom/scripts/validate_and_rebuild.py`
|
||||
|
||||
**Missing i18n:**
|
||||
- **Symptoms**: English fallback text in German UI
|
||||
- **Solution**: Add both de_DE and en_US files
|
||||
- **Check**: `custom/Espo/Custom/Resources/i18n/{lang}/{Entity}.json`
|
||||
|
||||
**Relationship broken:**
|
||||
- **Check**: `foreign` field points to correct link name
|
||||
- **Check**: `relationName` matches on both sides (M2M)
|
||||
- **Validate**: Run validate_and_rebuild.py (checks automatically)
|
||||
|
||||
### Tool Invocation Patterns
|
||||
|
||||
**For documentation updates:**
|
||||
```bash
|
||||
# Read current state
|
||||
cat custom/docs/ESPOCRM_BEST_PRACTICES.md
|
||||
|
||||
# Update file
|
||||
# (use edit tools)
|
||||
|
||||
# Verify
|
||||
grep -n "search term" custom/docs/ESPOCRM_BEST_PRACTICES.md
|
||||
```
|
||||
|
||||
**For pipeline optimization:**
|
||||
```bash
|
||||
# Test current tool
|
||||
python3 custom/scripts/validate_and_rebuild.py --dry-run
|
||||
|
||||
# After changes
|
||||
python3 custom/scripts/validate_and_rebuild.py
|
||||
|
||||
# Full test with E2E
|
||||
python3 custom/scripts/e2e_tests.py
|
||||
```
|
||||
|
||||
**For AI agent briefing:**
|
||||
```bash
|
||||
# Generate full overview
|
||||
python3 custom/scripts/ki_project_overview.py > /tmp/overview.txt
|
||||
|
||||
# Check specific entity
|
||||
python3 custom/scripts/ki_project_overview.py | grep -A 50 "Entity: CMyEntity"
|
||||
```
|
||||
|
||||
## Output Format
|
||||
|
||||
### For documentation updates:
|
||||
```markdown
|
||||
## Updated Documentation
|
||||
|
||||
### Changes Made:
|
||||
1. File: [path/to/file.md](path/to/file.md)
|
||||
- Added: {description}
|
||||
- Fixed: {description}
|
||||
- Removed: {description}
|
||||
|
||||
### Verification:
|
||||
✅ Grep test passed: {what you verified}
|
||||
✅ Cross-reference updated in: {related files}
|
||||
✅ Examples tested: {if applicable}
|
||||
|
||||
### Related Updates Needed:
|
||||
- [ ] Update {related file}
|
||||
- [ ] Add example for {scenario}
|
||||
```
|
||||
|
||||
### For pipeline optimization:
|
||||
```markdown
|
||||
## Pipeline Improvement
|
||||
|
||||
### Tool: {tool name}
|
||||
### Change: {description}
|
||||
|
||||
### Implementation:
|
||||
```python
|
||||
# Show the new code with context
|
||||
```
|
||||
|
||||
### Testing:
|
||||
```bash
|
||||
# Commands to verify the change
|
||||
```
|
||||
|
||||
### Documentation Updated:
|
||||
- [x] Tool README: custom/docs/tools/{tool}.md
|
||||
- [x] Best Practices: Section {X.Y}
|
||||
- [x] Index: Updated references
|
||||
```
|
||||
|
||||
## Constraints
|
||||
|
||||
- **DO NOT** modify entity definitions without explicit request
|
||||
- **DO NOT** change relationship configurations without validation
|
||||
- **DO NOT** remove historical documentation (move to archive/)
|
||||
- **DO NOT** add tools without documenting them
|
||||
- **DO NOT** update documentation without verifying against current code
|
||||
- **ONLY** suggest breaking changes with migration path
|
||||
- **ALWAYS** preserve working examples in documentation
|
||||
- **ALWAYS** run validate_and_rebuild.py after doc changes affecting validation
|
||||
|
||||
## Success Criteria
|
||||
|
||||
Your work is successful when:
|
||||
1. ✅ Documentation is accurate and reflects current codebase
|
||||
2. ✅ AI agents can successfully use documentation to solve problems
|
||||
3. ✅ Development tools catch errors before they reach production
|
||||
4. ✅ New developers can onboard using documentation alone
|
||||
5. ✅ Validation pipeline passes without false positives
|
||||
6. ✅ All cross-references in documentation are valid
|
||||
7. ✅ Examples in documentation actually work
|
||||
8. ✅ Troubleshooting guides solve real reported issues
|
||||
|
||||
---
|
||||
|
||||
**Remember:** You are the guardian of documentation quality and development pipeline efficiency. Every update should make the next developer's (human or AI) life easier.
|
||||
71
.vscode/settings.json
vendored
71
.vscode/settings.json
vendored
@@ -8,6 +8,77 @@
|
||||
"/^bash /var/lib/docker/volumes/vmh-espocrm_espocrm/_data/custom/scripts/check_and_rebuild\\.sh$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^python3 custom/scripts/validate_and_rebuild\\.py 2>&1 \\| tail -50$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^python3 custom/scripts/validate_and_rebuild\\.py 2>&1$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^python3 custom/scripts/validate_and_rebuild\\.py 2>&1 \\| grep -E \"CSS\\|REBUILD\\|ERFOLG\" \\| tail -10$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^python3 custom/scripts/validate_and_rebuild\\.py 2>&1 \\| tail -15$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^python3 custom/scripts/validate_and_rebuild\\.py$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^python3 /var/lib/docker/volumes/vmh-espocrm_espocrm/_data/custom/scripts/validate_and_rebuild\\.py$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^python3 custom/scripts/project_overview\\.py$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"./custom/scripts/ki-overview.sh": true,
|
||||
"./ki_overview.sh": true,
|
||||
"./run_e2e_tests.sh": true,
|
||||
"/^python3 custom/scripts/validate_and_rebuild\\.py --help$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^cd /var/lib/docker/volumes/vmh-espocrm_espocrm/_data/custom/scripts && python3 validate_and_rebuild\\.py --help$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^python3 custom/scripts/validate_and_rebuild\\.py --dry-run 2>&1 \\| tail -50$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^cd /var/lib/docker/volumes/vmh-espocrm_espocrm/_data/custom/scripts && python3 validate_and_rebuild\\.py --dry-run 2>&1 \\| tail -50$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^cd /var/lib/docker/volumes/vmh-espocrm_espocrm/_data/custom/scripts && python3 validate_and_rebuild\\.py --skip-e2e 2>&1 \\| tail -80$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^cd /var/lib/docker/volumes/vmh-espocrm_espocrm/_data/custom/scripts && python3 validate_and_rebuild\\.py 2>&1 \\| tail -120$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^bash /var/lib/docker/volumes/vmh-espocrm_espocrm/_data/custom/scripts/ki-overview\\.sh$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^python3 custom/scripts/validate_and_rebuild\\.py 2>&1 \\| tail -60$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^bash custom/scripts/ki-overview\\.sh$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
},
|
||||
"/^cd /var/lib/docker/volumes/vmh-espocrm_espocrm/_data/custom/scripts && bash ki-overview\\.sh$/": {
|
||||
"approve": true,
|
||||
"matchCommandLine": true
|
||||
}
|
||||
}
|
||||
}
|
||||
212
README.md
212
README.md
@@ -1,5 +1,22 @@
|
||||
KI-basierte Bearbeitung von EspoCRM: Struktur und Funktionsweise
|
||||
|
||||
## 🚀 Schnellstart für KI
|
||||
|
||||
**NEU:** Automatisches KI-Einstiegsscript für vollständigen Projekt-Überblick!
|
||||
|
||||
```bash
|
||||
# Vollständige Projekt-Analyse für KI
|
||||
./custom/scripts/ki-overview.sh
|
||||
|
||||
# Nur Schnellübersicht
|
||||
./custom/scripts/ki-overview.sh --stats
|
||||
|
||||
# In Datei speichern
|
||||
./custom/scripts/ki-overview.sh --file /tmp/overview.txt
|
||||
```
|
||||
|
||||
Das Script analysiert automatisch alle Entitäten, Beziehungen, Custom Code, Workflows und Frontend-Anpassungen. Siehe [KI_OVERVIEW_README.md](custom/scripts/KI_OVERVIEW_README.md) für Details.
|
||||
|
||||
## Inhaltsverzeichnis
|
||||
1. [Überblick](#überblick)
|
||||
2. [Custom Directory Struktur](#custom-directory-struktur)
|
||||
@@ -44,22 +61,26 @@ Keine integrierte KI-Schnittstelle existiert, aber mit Dateizugriff können auto
|
||||
|
||||
**WICHTIG:** Nach jeder Änderung an Custom-Dateien muss ein Rebuild durchgeführt werden!
|
||||
|
||||
### Check & Rebuild Script (Empfohlen)
|
||||
### Validate & Rebuild Script (Empfohlen)
|
||||
|
||||
**Zentrales Tool:** `custom/scripts/check_and_rebuild.sh`
|
||||
**Zentrales Tool:** `custom/scripts/validate_and_rebuild.py`
|
||||
|
||||
Dieses Script sollte **IMMER** verwendet werden (nicht manueller Rebuild). Es führt automatisch aus:
|
||||
Dieses Script sollte **IMMER** verwendet werden (niemals manueller Rebuild). Es führt automatisch aus:
|
||||
|
||||
✅ **Validierungen:**
|
||||
- JSON-Syntax-Prüfung aller `.json` Dateien im `custom/` Verzeichnis
|
||||
- **Relationship-Konsistenz-Prüfung** (bidirektionale Links, foreign-Definitionen)
|
||||
- **Formula-Script Platzierung** (korrekt in `/formula/` statt `/entityDefs/`)
|
||||
- **i18n-Vollständigkeit** (fehlende Übersetzungen für Links)
|
||||
- Layout-Struktur-Prüfung
|
||||
- Dateirechte-Prüfung (`www-data:www-data` Owner)
|
||||
- System-Checks (Cache-Verzeichnis, Logs-Verzeichnis)
|
||||
|
||||
✅ **Automatische Korrekturen:**
|
||||
- Setzt fehlerhafte Dateirechte auf `www-data:www-data`
|
||||
- Korrigiert Verzeichnis-Permissions (775) und Datei-Permissions (664)
|
||||
|
||||
✅ **Rebuild:**
|
||||
- **Nur wenn keine kritischen Fehler gefunden werden!**
|
||||
- Merged alle Custom-Metadata mit Core-Definitionen
|
||||
- Aktualisiert Datenbank-Schema (neue Felder, Tabellen, Indizes)
|
||||
- Leert Cache-Verzeichnis
|
||||
@@ -68,18 +89,25 @@ Dieses Script sollte **IMMER** verwendet werden (nicht manueller Rebuild). Es f
|
||||
**Verwendung:**
|
||||
```bash
|
||||
# Im EspoCRM-Root-Verzeichnis ausführen
|
||||
./custom/scripts/check_and_rebuild.sh
|
||||
python3 custom/scripts/validate_and_rebuild.py
|
||||
|
||||
# Nur Validierung ohne Rebuild
|
||||
python3 custom/scripts/validate_and_rebuild.py --dry-run
|
||||
```
|
||||
|
||||
**Ausgabe:**
|
||||
- ✓ Grün: Alles in Ordnung, Rebuild erfolgreich
|
||||
- ⚠ Gelb: Warnungen, Rebuild wird trotzdem ausgeführt
|
||||
- ✗ Rot: Fehler (z.B. ungültiges JSON), Rebuild wird NICHT ausgeführt
|
||||
- ⚠ Gelb: Warnungen (z.B. fehlende i18n), Rebuild wird trotzdem ausgeführt
|
||||
- ✗ Rot: Kritische Fehler (z.B. ungültiges JSON, fehlende Relationships), Rebuild wird NICHT ausgeführt
|
||||
|
||||
**Bei Fehlern:**
|
||||
- JSON-Syntax-Fehler werden mit Datei und Zeilennummer angezeigt
|
||||
- Relationship-Fehler zeigen fehlende Links zwischen Entities
|
||||
- Formula-Platzierungsfehler werden erkannt und gemeldet
|
||||
- i18n-Probleme werden als Warnungen angezeigt (kein Abbruch)
|
||||
- Dateirechte-Probleme werden automatisch korrigiert
|
||||
- System-Fehler (fehlende Verzeichnisse) müssen manuell behoben werden
|
||||
|
||||
**Detaillierte Dokumentation:** Siehe `custom/scripts/VALIDATOR_README.md`
|
||||
|
||||
### Wann Rebuild erforderlich?
|
||||
|
||||
@@ -164,50 +192,92 @@ Basierend auf der Analyse von Git-Commits und praktischen Erfahrungen treten bes
|
||||
|
||||
#### 2. Layout-Strukturfehler
|
||||
|
||||
**Problem:** Unnötige oder falsche Array-Elemente in Layouts, die zu UI-Problemen führen.
|
||||
**Problem:** Falsche Platzhalter und Strukturen in Layouts führen zu UI-Problemen.
|
||||
|
||||
**⚠️ KRITISCH für EspoCRM 7.x:**
|
||||
In EspoCRM 7.x ist `false` als Platzhalter **NICHT MEHR ERLAUBT**!
|
||||
|
||||
**Symptome:**
|
||||
- Layout wird nicht geladen, Fehlermeldung in UI
|
||||
- Felder werden nicht korrekt angeordnet
|
||||
- Leere Bereiche in Detail-Views
|
||||
- Inkonsistente Spaltenbreiten
|
||||
- bottomPanelsDetail funktioniert nicht
|
||||
|
||||
**❌ FALSCH:**
|
||||
**❌ FALSCH (EspoCRM 7.x):**
|
||||
```json
|
||||
// layouts/Entity/detail.json
|
||||
{
|
||||
"rows": [
|
||||
[
|
||||
{"name": "field1"}
|
||||
],
|
||||
[
|
||||
{"name": "field1"},
|
||||
{"name": "field2"},
|
||||
false // ← Unnötiges false-Element!
|
||||
false, // ← DEPRECATED! Funktioniert in 7.x NICHT!
|
||||
false // ← Verursacht Layout-Fehler!
|
||||
]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**✅ RICHTIG:**
|
||||
**✅ RICHTIG (EspoCRM 7.x):**
|
||||
```json
|
||||
{
|
||||
"rows": [
|
||||
[
|
||||
{"name": "field1"},
|
||||
{"name": "field2"} // Beide in einer Row
|
||||
{"name": "field2"},
|
||||
{}, // ← Leeres Objekt verwenden!
|
||||
{} // ← Funktioniert in 7.x korrekt
|
||||
]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**❌ FALSCH - bottomPanelsDetail.json als Array:**
|
||||
```json
|
||||
// layouts/Entity/bottomPanelsDetail.json
|
||||
[
|
||||
{"name": "contacts"},
|
||||
{"name": "documents"}
|
||||
]
|
||||
```
|
||||
|
||||
**✅ RICHTIG - bottomPanelsDetail.json als Objekt:**
|
||||
```json
|
||||
{
|
||||
"contacts": {
|
||||
"index": 0,
|
||||
"sticked": true,
|
||||
"style": "warning"
|
||||
},
|
||||
"_tabBreak_0": {
|
||||
"index": 1,
|
||||
"columnBreak": true
|
||||
},
|
||||
"documents": {
|
||||
"index": 2
|
||||
},
|
||||
"activities": {
|
||||
"disabled": true
|
||||
},
|
||||
"history": {
|
||||
"disabled": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Häufige Layout-Fehler:**
|
||||
- ❌ **`false` als Platzhalter** (seit EspoCRM 7.x nicht mehr unterstützt!)
|
||||
- ❌ Width-Attribute in Detail-Layouts (nur für List-Layouts!)
|
||||
- ❌ Leere Objekte `{}` oder `false` in Rows
|
||||
- ❌ Index nicht angepasst nach Entfernung von Panels (bottomPanelsDetail)
|
||||
- ❌ bottomPanelsDetail.json als Array statt Objekt
|
||||
- ❌ Index nicht angepasst nach Entfernung von Panels
|
||||
|
||||
**Best Practice:**
|
||||
- **Immer `{}` statt `false`** für leere Zellen in detail.json verwenden
|
||||
- Width nur in `list.json` und `listSmall.json` verwenden
|
||||
- Rows immer vollständig füllen oder Felder kombinieren
|
||||
- bottomPanelsDetail.json **MUSS** Objekt-Format haben
|
||||
- Rows immer mit 4 Spalten füllen (nutze `{}` zum Auffüllen)
|
||||
- Nach Panel-Entfernung Indices neu nummerieren
|
||||
- `_tabBreak_{index}` verwenden um Panels auf verschiedene Tabs zu verteilen
|
||||
|
||||
---
|
||||
|
||||
@@ -600,6 +670,60 @@ Neue Felder in einer Entity erfordern Änderungen in **drei Bereichen**:
|
||||
- `detailSmall.json` - Seitenleisten-Ansicht
|
||||
- `filters.json` - Filter-Felder
|
||||
|
||||
---
|
||||
|
||||
### ⚠️ WICHTIG: Zwei verschiedene Layout-Verzeichnisse!
|
||||
|
||||
**EspoCRM verwendet zwei verschiedene Layout-Verzeichnisse mit unterschiedlichen Zwecken:**
|
||||
|
||||
#### 1. **Frontend-Layouts** (PRIMÄR - meistens benötigt)
|
||||
**Pfad:** `custom/Espo/Custom/Resources/layouts/{Entity}/{LayoutType}.json`
|
||||
|
||||
✅ **Verwenden für:**
|
||||
- Liste-Ansichten: `list.json`, `listSmall.json`
|
||||
- Detail-Ansichten: `detail.json`, `detailSmall.json`
|
||||
- Bottom-Panels: `bottomPanelsDetail.json`
|
||||
- Relationship-Panels (werden über `listSmall.json` definiert)
|
||||
- Alle UI-bezogenen Layouts
|
||||
|
||||
**Beispiel:**
|
||||
```
|
||||
custom/Espo/Custom/Resources/layouts/
|
||||
├── CBeteiligte/
|
||||
│ ├── list.json
|
||||
│ ├── listSmall.json ← Wird in Relationship-Panels verwendet!
|
||||
│ ├── detail.json
|
||||
│ └── bottomPanelsDetail.json
|
||||
```
|
||||
|
||||
#### 2. **Metadata-Layouts** (SEKUNDÄR - selten benötigt)
|
||||
**Pfad:** `custom/Espo/Custom/Resources/metadata/layouts/{Entity}/{LayoutType}.json`
|
||||
|
||||
⚠️ **Nur verwenden für:**
|
||||
- Backend-spezifische Layout-Definitionen
|
||||
- Erweiterte Konfigurationen
|
||||
- In den meisten Fällen NICHT benötigt!
|
||||
|
||||
**Regel:**
|
||||
> **Relationship-Panels in Bottom-Views nutzen IMMER `listSmall.json` aus dem `layouts/` Verzeichnis (NICHT `metadata/layouts/`)!**
|
||||
|
||||
**Häufiger Fehler:**
|
||||
```bash
|
||||
# ❌ FALSCH - wird ignoriert!
|
||||
custom/Espo/Custom/Resources/metadata/layouts/CBeteiligte/listSmall.json
|
||||
|
||||
# ✅ RICHTIG - wird verwendet!
|
||||
custom/Espo/Custom/Resources/layouts/CBeteiligte/listSmall.json
|
||||
```
|
||||
|
||||
**Best Practice:**
|
||||
- Layouts IMMER in `custom/Espo/Custom/Resources/layouts/` erstellen
|
||||
- Das `metadata/layouts/` Verzeichnis nur verwenden, wenn explizit dokumentiert
|
||||
- Nach Änderungen: `./custom/scripts/check_and_rebuild.sh`
|
||||
- Browser Hard Refresh (Ctrl+Shift+R) durchführen
|
||||
|
||||
---
|
||||
|
||||
### clientDefs/{EntityType}.json
|
||||
|
||||
**Format-Beispiel:**
|
||||
@@ -1301,28 +1425,6 @@ docker exec espocrm php /var/www/html/custom/scripts/workflow_manager.php import
|
||||
/var/www/html/custom/workflows/vmh-erstberatung-abschliessen.json
|
||||
```
|
||||
|
||||
### Workflow-Entwicklung mit KI
|
||||
|
||||
Für KI-gestützte Workflow-Erstellung:
|
||||
1. Workflow-Definition im `custom/workflows/` Verzeichnis als JSON ablegen
|
||||
2. Mit `import` Befehl in EspoCRM einspielen
|
||||
3. Im Admin-Interface testen und bei Bedarf anpassen
|
||||
4. Mit `export` Befehl aktualisierten Workflow sichern
|
||||
5. JSON-Datei im Repository committen
|
||||
## Projektziele und Zukunftsvision: "Vermieterhelden"
|
||||
|
||||
Das Projekt "Vermieterhelden" ist ein maßgeschneidertes Backend-System auf Basis von EspoCRM für eine Anwaltskanzlei, spezialisiert auf die Durchführung und Verwaltung von immobilienrechtlichen Klagen (z. B. Räumungsklagen, Mietinkasso). Der aktuelle Fokus liegt auf der strukturierten Verwaltung von Stammdaten (Entitäten wie Mietverhältnisse, Mietobjekte, Beteiligte, Dokumente und Klagen) und der Abbildung von rechtlichen Workflows (z. B. automatisierte Tasks bei Statusänderungen, Fristen-Überwachung).
|
||||
|
||||
Zukünftige Ziele:
|
||||
- **Customer Portal**: Integration eines Mandanten-Portals, damit Klienten (Mieter/Vermieter) selbst auf relevante Daten zugreifen können (z. B. Status von Klagen, Dokumente hochladen). Dies nutzt EspoCRMs eingebaute Portal-Funktionalität für Self-Service.
|
||||
- **KI-Integration über Middleware**: Automatisierung von Prozessen via Webhooks und externer Middleware. Beispiele:
|
||||
- Automatische Analyse von Dokumenten (z. B. Verträge scannen und Felder extrahieren).
|
||||
- Intelligente Fristen-Erinnerungen basierend auf rechtlichen Regeln (z. B. Kündigungsfristen berechnen).
|
||||
- Workflow-Optimierung (z. B. Vorschläge für nächste Schritte in Klage-Prozessen).
|
||||
- Die KI soll über APIs/Webhooks angebunden werden, ohne EspoCRMs Core zu modifizieren, um Stabilität zu wahren.
|
||||
- **Erweiterte Features**: Mehrsprachigkeit, Mandanten-Isolation für mehrere Kanzlei-Teams, Integration mit externen Systemen (z. B. Gerichts-APIs, Buchhaltung).
|
||||
|
||||
Die KI kann diese Ziele unterstützen, indem sie JSON-Strukturen analysiert, Änderungen vorschlägt (z. B. neue Felder für Compliance) und Workflows modelliert. Das System soll skalierbar und benutzerfreundlich sein, um die Effizienz in der Rechtsbranche zu steigern.
|
||||
|
||||
6. Bearbeitung von Entitäten und Layouts
|
||||
|
||||
@@ -1427,32 +1529,6 @@ Um Relationship-Panels und Links korrekt zu beschriften, müssen Labels in den i
|
||||
- Bei Relationship-Problemen: Logs nach "404" und "Link does not exist" durchsuchen: `tail -n 500 /var/lib/docker/volumes/vmh-espocrm_espocrm/_data/data/logs/espo-$(date +%Y-%m-%d).log | grep -A 3 "404\|Link does not exist"`
|
||||
- Bei DB-Problemen: Custom-Scripts wie `workflow_manager.php` verwenden.
|
||||
|
||||
### Check & Rebuild Script
|
||||
|
||||
Das Script `custom/scripts/check_and_rebuild.sh` automatisiert die Qualitätssicherung und führt folgende Prüfungen durch:
|
||||
|
||||
1. **JSON-Syntax-Validierung**: Prüft alle `.json` Dateien im `custom/` Verzeichnis auf gültiges JSON
|
||||
2. **Dateirechte-Prüfung**: Stellt sicher, dass alle Dateien `www-data:www-data` als Owner haben
|
||||
3. **System-Checks**: Validiert Existenz von Cache- und Logs-Verzeichnissen
|
||||
4. **Automatischer Rebuild**: Bei Fehlerfreiheit wird der Rebuild durchgeführt
|
||||
|
||||
**Verwendung:**
|
||||
```bash
|
||||
# Im EspoCRM-Root-Verzeichnis ausführen
|
||||
./custom/scripts/check_and_rebuild.sh
|
||||
```
|
||||
|
||||
**Ausgabe:**
|
||||
- ✓ Grün: Alles in Ordnung
|
||||
- ⚠ Gelb: Warnungen (Rebuild wird trotzdem ausgeführt)
|
||||
- ✗ Rot: Fehler (Rebuild wird NICHT ausgeführt)
|
||||
|
||||
**Bei Berechtigungsfehlern:**
|
||||
```bash
|
||||
sudo chown -R www-data:www-data custom/
|
||||
sudo find custom/ -type f -name "*.json" -exec chmod 664 {} \;
|
||||
sudo find custom/ -type d -exec chmod 775 {} \;
|
||||
```
|
||||
|
||||
## 9. Reports und Report-Panels
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\Acl\CurrencyRecordRate;
|
||||
|
||||
use Espo\Core\Acl\AccessEntityCREDChecker;
|
||||
use Espo\Core\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Table;
|
||||
use Espo\Core\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
use Espo\Entities\CurrencyRecordRate;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDChecker<CurrencyRecordRate>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
public function __construct(
|
||||
private DefaultAccessChecker $defaultAccessChecker,
|
||||
) {}
|
||||
|
||||
public function checkCreate(User $user, ScopeData $data): bool
|
||||
{
|
||||
if ($data->getEdit() === Table::LEVEL_YES) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkDelete(User $user, ScopeData $data): bool
|
||||
{
|
||||
if ($data->getEdit() === Table::LEVEL_YES) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkEntityCreate(User $user, Entity $entity, ScopeData $data): bool
|
||||
{
|
||||
return $this->checkCreate($user, $data);
|
||||
}
|
||||
|
||||
public function checkEntityDelete(User $user, Entity $entity, ScopeData $data): bool
|
||||
{
|
||||
return $this->checkDelete($user, $data);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
59
application/Espo/Classes/AppParams/CurrencyRates.php
Normal file
59
application/Espo/Classes/AppParams/CurrencyRates.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\AppParams;
|
||||
|
||||
use Espo\Core\Currency\ConfigDataProvider;
|
||||
use Espo\Core\Utils\NumberUtil;
|
||||
use Espo\Tools\App\AppParam;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @noinspection PhpUnused
|
||||
*/
|
||||
class CurrencyRates implements AppParam
|
||||
{
|
||||
private const int PRECISION = 6;
|
||||
|
||||
public function __construct(
|
||||
private ConfigDataProvider $configDataProvider,
|
||||
private NumberUtil $numberUtil,
|
||||
) {}
|
||||
|
||||
public function get(): stdClass
|
||||
{
|
||||
$rates = $this->configDataProvider->getCurrencyRates()->toAssoc();
|
||||
|
||||
foreach ($rates as $code => $value) {
|
||||
$rates[$code] = $this->numberUtil->format($value, self::PRECISION, '.', '');
|
||||
}
|
||||
|
||||
return (object) $rates;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -35,7 +35,7 @@ use Espo\Core\Console\Exceptions\ArgumentNotSpecified;
|
||||
use Espo\Core\Console\Exceptions\InvalidArgument;
|
||||
use Espo\Core\Console\IO;
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\FieldProcessing\NextNumber\BeforeSaveProcessor;
|
||||
use Espo\Core\FieldProcessing\NextNumber\Processor;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
use Espo\Core\ORM\Repository\Option\SaveOption;
|
||||
@@ -44,11 +44,11 @@ use Espo\ORM\Query\Part\Order;
|
||||
|
||||
class PopulateNumbers implements Command
|
||||
{
|
||||
private BeforeSaveProcessor $beforeSaveProcessor;
|
||||
private Processor $beforeSaveProcessor;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(
|
||||
BeforeSaveProcessor $beforeSaveProcessor,
|
||||
Processor $beforeSaveProcessor,
|
||||
EntityManager $entityManager
|
||||
) {
|
||||
$this->beforeSaveProcessor = $beforeSaveProcessor;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\FieldProcessing\CurrencyRecord;
|
||||
|
||||
use Espo\Core\Currency\ConfigDataProvider;
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Entities\CurrencyRecord;
|
||||
use Espo\ORM\Entity;
|
||||
use ValueError;
|
||||
|
||||
/**
|
||||
* @implements Loader<CurrencyRecord>
|
||||
*/
|
||||
class IsBase implements Loader
|
||||
{
|
||||
public function __construct(
|
||||
private ConfigDataProvider $configDataProvider,
|
||||
) {}
|
||||
|
||||
|
||||
public function process(Entity $entity, Params $params): void
|
||||
{
|
||||
try {
|
||||
$code = $entity->getCode();
|
||||
} catch (ValueError) {
|
||||
$entity->setIsBase(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$isBase = $code === $this->configDataProvider->getBaseCurrency();
|
||||
|
||||
$entity->setIsBase($isBase);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\FieldProcessing\CurrencyRecord;
|
||||
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Core\Utils\Language;
|
||||
use Espo\Entities\CurrencyRecord;
|
||||
use Espo\ORM\Entity;
|
||||
use ValueError;
|
||||
|
||||
/**
|
||||
* @implements Loader<CurrencyRecord>
|
||||
*/
|
||||
class Label implements Loader
|
||||
{
|
||||
public function __construct(
|
||||
private Language $defaultLanguage
|
||||
) {}
|
||||
|
||||
public function process(Entity $entity, Params $params): void
|
||||
{
|
||||
try {
|
||||
$code = $entity->getCode();
|
||||
} catch (ValueError) {
|
||||
return;
|
||||
}
|
||||
|
||||
$name = $this->defaultLanguage->translateLabel($code, 'names', 'Currency');
|
||||
|
||||
$entity->setLabel($name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\FieldProcessing\CurrencyRecord;
|
||||
|
||||
use Espo\Core\Currency\ConfigDataProvider;
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Entities\CurrencyRecord;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\Tools\Currency\RateEntryProvider;
|
||||
|
||||
/**
|
||||
* @implements Loader<CurrencyRecord>
|
||||
*/
|
||||
class Rate implements Loader
|
||||
{
|
||||
public function __construct(
|
||||
private RateEntryProvider $rateEntryProvider,
|
||||
private ConfigDataProvider $configDataProvider,
|
||||
) {}
|
||||
|
||||
public function process(Entity $entity, Params $params): void
|
||||
{
|
||||
$rate = $entity->getCode() !== $this->configDataProvider->getBaseCurrency() ?
|
||||
$this->rateEntryProvider->getCurrentRateEntry($entity)?->getRate() :
|
||||
'1';
|
||||
|
||||
$entity->setRate($rate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\FieldProcessing\CurrencyRecord;
|
||||
|
||||
use Espo\Core\Currency\ConfigDataProvider;
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Entities\CurrencyRecord;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\Tools\Currency\RateEntryProvider;
|
||||
|
||||
/**
|
||||
* @implements Loader<CurrencyRecord>
|
||||
*/
|
||||
class RateDate implements Loader
|
||||
{
|
||||
public function __construct(
|
||||
private RateEntryProvider $rateEntryProvider,
|
||||
private ConfigDataProvider $configDataProvider,
|
||||
) {}
|
||||
|
||||
public function process(Entity $entity, Params $params): void
|
||||
{
|
||||
$date = $entity->getCode() !== $this->configDataProvider->getBaseCurrency() ?
|
||||
$this->rateEntryProvider->getCurrentRateEntry($entity)?->getDate() :
|
||||
null;
|
||||
|
||||
$entity->setRateDate($date);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\FieldProcessing\CurrencyRecord;
|
||||
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use Espo\Entities\CurrencyRecord;
|
||||
use Espo\ORM\Entity;
|
||||
use ValueError;
|
||||
|
||||
/**
|
||||
* @implements Loader<CurrencyRecord>
|
||||
*/
|
||||
class Symbol implements Loader
|
||||
{
|
||||
public function __construct(
|
||||
private Metadata $metadata,
|
||||
) {}
|
||||
|
||||
public function process(Entity $entity, Params $params): void
|
||||
{
|
||||
try {
|
||||
$code = $entity->getCode();
|
||||
} catch (ValueError) {
|
||||
return;
|
||||
}
|
||||
$symbol = $this->metadata->get("app.currency.symbolMap.$code");
|
||||
|
||||
$entity->setSymbol($symbol);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
55
application/Espo/Classes/FieldSanitizers/Decimal.php
Normal file
55
application/Espo/Classes/FieldSanitizers/Decimal.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\FieldSanitizers;
|
||||
|
||||
use Espo\Core\FieldSanitize\Sanitizer;
|
||||
use Espo\Core\FieldSanitize\Sanitizer\Data;
|
||||
|
||||
class Decimal implements Sanitizer
|
||||
{
|
||||
public function sanitize(Data $data, string $field): void
|
||||
{
|
||||
if (!$data->has($field)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$value = $data->get($field);
|
||||
|
||||
if (is_string($value) || $value === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_float($value) || is_int($value)) {
|
||||
$value = (string) $value;
|
||||
}
|
||||
|
||||
$data->set($field, $value);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user