Commit 0704eccb authored by Maria Sorica's avatar Maria Sorica Committed by Robert Lyon
Browse files

Bug 1722861: On file edit, display the tag prefix

Change-Id: I665d03d083e217647e00e64ab5573e263534276c
parent 057900f9
......@@ -694,7 +694,17 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
}
}
$tagwhere = "'" . join("','", array_keys($filedata)) . "'";
$tags = get_records_sql_array("SELECT tag, resourceid FROM {tag} WHERE resourcetype = 'artefact' AND resourceid IN (" . $tagwhere . ")");
$typecast = is_postgres() ? '::varchar' : '';
$tags = get_records_sql_array("
SELECT
(CASE
WHEN t.tag LIKE 'tagid_%' THEN CONCAT(i.displayname, ': ', t2.tag)
ELSE t.tag
END) AS tag, t.resourceid
FROM {tag} t
LEFT JOIN {tag} t2 ON t2.id" . $typecast . " = SUBSTRING(t.tag, 7)
LEFT JOIN {institution} i ON i.name = t2.ownerid
WHERE t.resourcetype = 'artefact' AND t.resourceid IN (" . $tagwhere . ")");
if ($tags) {
foreach ($tags as $t) {
$filedata[$t->resourceid]->tags[] = $t->tag;
......
......@@ -39,6 +39,13 @@ Scenario: Creating institution tags
And I follow "Display page"
Then I should see "Institution One: One tag"
Given I choose "Files" in "Content" from main menu
And I attach the file "Image2.png" to "files_filebrowser_userfile"
And I click on "Edit" in "Image2.png" row
And I fill in select2 input "files_filebrowser_edit_tags" with "One tag" and select "Institution One: One tag (1)"
And I fill in select2 input "files_filebrowser_edit_tags" with "Image" and select "Image"
And I press "Save changes"
Given I choose "Pages and collections" in "Portfolio" from main menu
And I follow "Tags"
And I follow "Edit tags"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment