introducing junction table extension
This commit is contained in:
10
custom/Espo/Custom/Controllers/CAICollectionCDokumente.php
Normal file
10
custom/Espo/Custom/Controllers/CAICollectionCDokumente.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Espo\Custom\Controllers;
|
||||
|
||||
use Espo\Core\Controllers\Record;
|
||||
|
||||
class CAICollectionCDokumente extends Record
|
||||
{
|
||||
// Keine zusätzliche Logik nötig - erbt alle CRUD-Operationen
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"labels": {
|
||||
"CAICollectionCDokumente": "AI Collection - Dokument Verknüpfung",
|
||||
"Create CAICollectionCDokumente": "Verknüpfung erstellen",
|
||||
"Edit Link Data": "Verknüpfungsdaten bearbeiten"
|
||||
},
|
||||
"fields": {
|
||||
"cAICollections": "AI Collection",
|
||||
"cAICollectionsId": "AI Collection ID",
|
||||
"cAICollectionsName": "AI Collection Name",
|
||||
"cDokumente": "Dokument",
|
||||
"cDokumenteId": "Dokument ID",
|
||||
"cDokumenteName": "Dokument Name",
|
||||
"syncId": "Sync ID"
|
||||
},
|
||||
"links": {
|
||||
"cAICollections": "AI Collection",
|
||||
"cDokumente": "Dokument"
|
||||
},
|
||||
"messages": {
|
||||
"linkDataSaved": "Verknüpfungsdaten gespeichert"
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
"xaiCollections": "x.AI Collections",
|
||||
"xaiSyncStatus": "Sync-Status",
|
||||
"fileStatus": "Datei-Status",
|
||||
"cAICollections": "AI Collections",
|
||||
"contactsvmhdokumente": "Freigegebene Nutzer",
|
||||
"vmhMietverhltnisesDokumente": "Mietverhältnisse",
|
||||
"vmhErstgespraechsdokumente": "Erstgespräche",
|
||||
@@ -23,6 +24,7 @@
|
||||
"kndigungensdokumente": "Kündigungen"
|
||||
},
|
||||
"links": {
|
||||
"cAICollections": "AI Collections",
|
||||
"contactsvmhdokumente": "Freigegebene Nutzer",
|
||||
"vmhMietverhltnisesDokumente": "Mietverhältnisse",
|
||||
"vmhErstgespraechsdokumente": "Erstgespräche",
|
||||
|
||||
@@ -1 +1,8 @@
|
||||
{}
|
||||
{
|
||||
"fields": {
|
||||
"cAICollections": "AI Collections"
|
||||
},
|
||||
"links": {
|
||||
"cAICollections": "AI Collections"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"labels": {
|
||||
"CAICollectionCDokumente": "AI Collection - Document Link",
|
||||
"Create CAICollectionCDokumente": "Create Link",
|
||||
"Edit Link Data": "Edit Link Data"
|
||||
},
|
||||
"fields": {
|
||||
"cAICollections": "AI Collection",
|
||||
"cAICollectionsId": "AI Collection ID",
|
||||
"cAICollectionsName": "AI Collection Name",
|
||||
"cDokumente": "Document",
|
||||
"cDokumenteId": "Document ID",
|
||||
"cDokumenteName": "Document Name",
|
||||
"syncId": "Sync ID"
|
||||
},
|
||||
"links": {
|
||||
"cAICollections": "AI Collection",
|
||||
"cDokumente": "Document"
|
||||
},
|
||||
"messages": {
|
||||
"linkDataSaved": "Link data saved"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"rows": [
|
||||
[
|
||||
{
|
||||
"name": "syncId"
|
||||
},
|
||||
{}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"rows": [
|
||||
[
|
||||
{
|
||||
"name": "cAICollections",
|
||||
"fullWidth": true
|
||||
},
|
||||
{}
|
||||
],
|
||||
[
|
||||
{
|
||||
"name": "cDokumente",
|
||||
"fullWidth": true
|
||||
},
|
||||
{}
|
||||
],
|
||||
[
|
||||
{
|
||||
"name": "syncId",
|
||||
"fullWidth": true
|
||||
},
|
||||
{}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -47,6 +47,6 @@
|
||||
},
|
||||
"stream": {
|
||||
"sticked": false,
|
||||
"index": 12
|
||||
"index": 11
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"name": "name",
|
||||
"link": true,
|
||||
"width": 50
|
||||
},
|
||||
{
|
||||
"name": "createdAt",
|
||||
"width": 30
|
||||
}
|
||||
]
|
||||
@@ -46,6 +46,10 @@
|
||||
"mietobjekt2dokumente": {
|
||||
"layout": null,
|
||||
"selectPrimaryFilterName": null
|
||||
},
|
||||
"cAICollections": {
|
||||
"layout": "relationships/cAICollections",
|
||||
"selectPrimaryFilterName": null
|
||||
}
|
||||
},
|
||||
"kanbanViewMode": false,
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "id",
|
||||
"dbType": "bigint",
|
||||
"autoincrement": true,
|
||||
"notStorable": false
|
||||
},
|
||||
"cAICollections": {
|
||||
"type": "link"
|
||||
},
|
||||
"cAICollectionsId": {
|
||||
"type": "varchar",
|
||||
"len": 17,
|
||||
"index": true
|
||||
},
|
||||
"cAICollectionsName": {
|
||||
"type": "varchar",
|
||||
"notStorable": true,
|
||||
"relation": "cAICollections",
|
||||
"isLinkStub": true
|
||||
},
|
||||
"cDokumente": {
|
||||
"type": "link"
|
||||
},
|
||||
"cDokumenteId": {
|
||||
"type": "varchar",
|
||||
"len": 17,
|
||||
"index": true
|
||||
},
|
||||
"cDokumenteName": {
|
||||
"type": "varchar",
|
||||
"notStorable": true,
|
||||
"relation": "cDokumente",
|
||||
"isLinkStub": true
|
||||
},
|
||||
"syncId": {
|
||||
"type": "varchar",
|
||||
"len": 255,
|
||||
"isCustom": true
|
||||
},
|
||||
"deleted": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"cAICollections": {
|
||||
"type": "belongsTo",
|
||||
"entity": "CAICollections",
|
||||
"key": "cAICollectionsId",
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"cDokumente": {
|
||||
"type": "belongsTo",
|
||||
"entity": "CDokumente",
|
||||
"key": "cDokumenteId",
|
||||
"foreignKey": "id"
|
||||
}
|
||||
},
|
||||
"collection": {
|
||||
"orderBy": "id",
|
||||
"order": "desc"
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,14 @@
|
||||
"entity": "Email",
|
||||
"foreign": "parent",
|
||||
"layoutRelationshipsDisabled": true
|
||||
},
|
||||
"cDokumente": {
|
||||
"type": "hasMany",
|
||||
"entity": "CDokumente",
|
||||
"foreign": "cAICollections",
|
||||
"relationName": "cAICollectionCDokumente",
|
||||
"audited": false,
|
||||
"isCustom": true
|
||||
}
|
||||
},
|
||||
"collection": {
|
||||
|
||||
@@ -263,6 +263,20 @@
|
||||
"entity": "CMietobjekt",
|
||||
"audited": false,
|
||||
"isCustom": true
|
||||
},
|
||||
"cAICollections": {
|
||||
"type": "hasMany",
|
||||
"entity": "CAICollections",
|
||||
"foreign": "cDokumente",
|
||||
"relationName": "cAICollectionCDokumente",
|
||||
"additionalColumns": {
|
||||
"syncId": {
|
||||
"type": "varchar",
|
||||
"len": 255
|
||||
}
|
||||
},
|
||||
"audited": false,
|
||||
"isCustom": true
|
||||
}
|
||||
},
|
||||
"collection": {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"entity": true,
|
||||
"type": "Base",
|
||||
"module": "Custom",
|
||||
"object": true,
|
||||
"isCustom": true,
|
||||
"tab": false,
|
||||
"acl": true,
|
||||
"aclPortal": false,
|
||||
"disabled": false,
|
||||
"customizable": true,
|
||||
"importable": false,
|
||||
"notifications": false,
|
||||
"stream": false
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
define('custom:views/c-dokumente/record/panels/c-a-i-collections',
|
||||
['views/record/panels/relationship'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
},
|
||||
|
||||
getRowActionList: function (model, acl) {
|
||||
var list = Dep.prototype.getRowActionList.call(this, model, acl);
|
||||
|
||||
if (acl.edit) {
|
||||
list.unshift({
|
||||
action: 'editLinkData',
|
||||
label: 'Edit Link Data',
|
||||
data: {
|
||||
id: model.id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
},
|
||||
|
||||
actionEditLinkData: function (data) {
|
||||
var id = data.id;
|
||||
|
||||
this.notify('Loading...');
|
||||
|
||||
var url = 'CAICollectionCDokumente?where[0][type]=and&where[0][value][0][type]=equals&where[0][value][0][attribute]=cDokumenteId&where[0][value][0][value]=' + this.model.id + '&where[0][value][1][type]=equals&where[0][value][1][attribute]=cAICollectionsId&where[0][value][1][value]=' + id + '&maxSize=1';
|
||||
|
||||
Espo.Ajax.getRequest(url).then(function (response) {
|
||||
this.notify(false);
|
||||
|
||||
if (response.list && response.list.length > 0) {
|
||||
var junctionRecord = response.list[0];
|
||||
|
||||
this.createView('dialog', 'views/modals/edit', {
|
||||
scope: 'CAICollectionCDokumente',
|
||||
id: junctionRecord.id
|
||||
}, function (view) {
|
||||
view.render();
|
||||
|
||||
this.listenToOnce(view, 'after:save', function () {
|
||||
this.clearView('dialog');
|
||||
this.actionRefresh();
|
||||
}, this);
|
||||
}.bind(this));
|
||||
} else {
|
||||
this.notify('Junction record not found', 'error');
|
||||
}
|
||||
}.bind(this)).catch(function () {
|
||||
this.notify('Error loading link data', 'error');
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
10
custom/Espo/Custom/Services/CAICollectionCDokumente.php
Normal file
10
custom/Espo/Custom/Services/CAICollectionCDokumente.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Espo\Custom\Services;
|
||||
|
||||
use Espo\Services\Record;
|
||||
|
||||
class CAICollectionCDokumente extends Record
|
||||
{
|
||||
// Keine zusätzliche Logik nötig
|
||||
}
|
||||
Reference in New Issue
Block a user