Commit e5a37436 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix edit file description bug

parent 8b6d75e2
......@@ -170,7 +170,7 @@ class ArtefactTypeFileBase extends ArtefactType {
. ($bloginstalled ? ('LEFT OUTER JOIN ' . $prefix .
'artefact_blog_blogpost_file b ON b.file = a.id') : '') . '
WHERE a.parent' . $foldersql . '
AND ' . ($adminfiles ? 'f.adminfile = 1' : ('a.owner = ' . $userid)) . '
AND ' . ($adminfiles ? 'f.adminfiles = 1' : ('a.owner = ' . $userid)) . '
AND a.artefacttype IN ' . $filetypesql . '
GROUP BY
1, 2, 3, 4, 5, 6;', '');
......
......@@ -36,15 +36,16 @@ $name = param_variable('name');
$description = param_variable('description');
$collideaction = param_variable('collideaction', 'fail');
if ($existingid = ArtefactTypeFileBase::exists_in_db($name, $USER->get('id'), $parentfolder)) {
log_debug($existingid);
if ($collideaction == 'replace') {
$copy = artefact_instance_from_id($existingid);
$copy->delete();
}
else {
json_reply('local', get_string('fileexists', 'artefact.file'));
if ($existingid != $id) {
if ($collideaction == 'replace') {
log_debug('deleting ' . $existingid);
$copy = artefact_instance_from_id($existingid);
$copy->delete();
}
else {
json_reply('local', get_string('fileexists', 'artefact.file'));
}
}
}
......
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