attachments fixes

This commit is contained in:
yuri
2018-08-15 12:45:57 +03:00
parent 036e10cbf7
commit cf0a9fd808
7 changed files with 18 additions and 12 deletions
+1 -2
View File
@@ -90,10 +90,9 @@ class Import extends \Espo\Core\Controllers\Record
$attachment->set('type', 'text/csv');
$attachment->set('role', 'Import File');
$attachment->set('name', 'import-file.csv');
$attachment->set('contents', $contents);
$this->getEntityManager()->saveEntity($attachment);
$this->getFileStorageManager()->putContents($attachment, $contents);
return array(
'attachmentId' => $attachment->id
);
@@ -6,7 +6,8 @@
"type": "Type",
"field": "Field",
"sourceId": "Source ID",
"storage": "Storage"
"storage": "Storage",
"size": "Size (bytes)"
},
"options": {
"role": {
@@ -10,6 +10,9 @@
[
{"name": "type"}, {"name": "field"}
],
[
{"name": "size"}, false
],
[
{"name": "storage"}, {"name": "sourceId"}
]
@@ -10,6 +10,9 @@
[
{"name": "type"}, {"name": "field"}
],
[
{"name": "size"}, false
],
[
{"name": "storage"}, {"name": "sourceId"}
]
@@ -2,7 +2,9 @@
"role",
"parent",
"related",
"size",
"field",
"type",
"createdBy",
"createdAt"
]
@@ -1,7 +1,8 @@
[
{"name":"name", "link": true},
{"name": "role", "width": 14},
{"name": "parent", "width": 20},
{"name": "related", "width": 20},
{"name": "createdAt", "width": 11}
{"name": "role", "width": 13},
{"name": "parent", "width": 18},
{"name": "related", "width": 18},
{"name": "createdAt", "width": 11},
{"name": "size", "width": 11, "align": "right"}
]
+2 -5
View File
@@ -1811,14 +1811,11 @@ class Record extends \Espo\Core\Services\Base
$attachment->set('name', $fileName);
$attachment->set('role', 'Export File');
$attachment->set('type', $mimeType);
$attachment->set('contents', $contents);
$this->getEntityManager()->saveEntity($attachment);
if (!empty($attachment->id)) {
$this->getInjection('fileStorageManager')->putContents($attachment, $contents);
return $attachment->id;
}
throw new Error();
return $attachment->id;
}
protected function getAttributeFromEntityForExport(Entity $entity, $attribute)