diff --git a/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php b/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php
index cd1597b213..a29df18969 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php
@@ -103,7 +103,15 @@ public function indexAction(Request $request)
/** @var record_adapter $rec */
foreach ($records as $rec) {
- $databoxSubdefs = $rec->getDatabox()->get_subdef_structure()->getSubdefGroup($rec->getType());
+ $recordType = $rec->getType();
+
+ // if record type is unknown
+ // use the type 'document' setting
+ if ($recordType == 'unknown') {
+ $recordType = 'document';
+ }
+
+ $databoxSubdefs = $rec->getDatabox()->get_subdef_structure()->getSubdefGroup($recordType);
if ($databoxSubdefs !== null) {
foreach ($databoxSubdefs as $sub) {
if ($sub->isTobuild()) {
diff --git a/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php b/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php
index 2fd8f573da..c1fd3fd9fc 100644
--- a/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php
+++ b/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php
@@ -99,6 +99,9 @@ public function substituteSubdef(\record_adapter $record, $name, MediaInterface
}
$type = $record->isStory() ? 'image' : $record->getType();
+
+ $type = ($type == 'unknown') ? 'document' : $type;
+
$databox_subdef = $record->getDatabox()->get_subdef_structure()->get_subdef($type, $name);
if ($this->isOldSubdefPresent($record, $name)) {
diff --git a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php
index 2447a8211d..a7363ebf2a 100644
--- a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php
+++ b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php
@@ -323,6 +323,12 @@ public function getDoctypeIcon(RecordInterface $record)
$src = '/assets/common/images/icons/icon_flash.png';
$title = $this->app['translator']->trans('flash');
break;
+ case 'unknown':
+ if ($record->getMimeType() == 'application/zip') {
+ $src = '/assets/common/images/icons/substitution/application_zip.png';
+ $title = $this->app['translator']->trans('zip');
+ }
+ break;
}
return sprintf('', $src, $title);
diff --git a/lib/classes/ACL.php b/lib/classes/ACL.php
index 18f98f6b18..58d7415e5b 100644
--- a/lib/classes/ACL.php
+++ b/lib/classes/ACL.php
@@ -525,8 +525,14 @@ public function has_access_to_subdef(RecordInterface $record, $subdef_name)
$databox = $this->app->findDataboxById($record->getDataboxId());
try {
+ $recordType = $record->getType();
+
+ if ($recordType == 'unknown') {
+ $recordType = 'document';
+ }
+
$subdef_class = $databox->get_subdef_structure()
- ->get_subdef($record->getType(), $subdef_name)
+ ->get_subdef($recordType, $subdef_name)
->get_class();
} catch (\Exception $e) {
return false;
diff --git a/lib/classes/record/exportElement.php b/lib/classes/record/exportElement.php
index 7de7eefe69..7d9ba0d205 100644
--- a/lib/classes/record/exportElement.php
+++ b/lib/classes/record/exportElement.php
@@ -89,7 +89,7 @@ protected function get_actions($userOwner)
$subdefs = [];
foreach ($this->app->findDataboxById($sbas_id)->get_subdef_structure() as $subdef_type => $subdefs_obj) {
- if ($subdef_type == $this->getType()) {
+ if ($subdef_type == $this->getType() || ($this->getType() == 'unknown') && $subdef_type == 'document') {
$subdefs = $subdefs_obj;
break;
}
diff --git a/templates/web/prod/actions/Tools/index.html.twig b/templates/web/prod/actions/Tools/index.html.twig
index 9740756b84..cf8a9f144d 100644
--- a/templates/web/prod/actions/Tools/index.html.twig
+++ b/templates/web/prod/actions/Tools/index.html.twig
@@ -150,53 +150,47 @@
{% if substituables|length > 0 %} {# substituables is empty if multiple records #}
{% for record in records %}