Commit 102a642a authored by Arnold Hendriks's avatar Arnold Hendriks

Fix db error when renaming site to already existing name

parent 7c302e7f
......@@ -2117,17 +2117,27 @@ PUBLIC STATIC OBJECTTYPE ObjectProps EXTEND TolliumScreenBase
}
}
// check for site conflict - do this first as even moving the site won't fix it
IF(ObjectExists(this->sourceitem) AND this->sourceitem->parentsite = this->sourceitem->id)
{
OBJECT othersite := OpenSiteByName(name);
IF(ObjectExists(othersite) AND othersite->id != this->sourceitem->id)
{
work->AddError(GetTid("publisher:commondialogs.errors.objectprops.sitealreadyexists", name));
RETURN work->Finish();
}
}
// Test for an object with the same name at the target location
OBJECT otherobject := this->parentfolder->OpenByName(name);
IF (ObjectExists(otherobject) AND otherobject->id != this->itemid)
{
BOOLEAN hiddenforme := IsObjectHiddenForMe(GetEffectiveUser(), otherobject->id);
OBJECT subwork := this->BeginFeedback();
IF(hiddenforme)
subwork->AddError(GetTid("publisher:common.errors.hiddenfolderexists", name, this->parentfolder->name));
work->AddError(GetTid("publisher:common.errors.hiddenfolderexists", name, this->parentfolder->name));
ELSE
subwork->AddError(GetTid("publisher:common.errors.fileorfolderexists", name, this->parentfolder->name));
RETURN subwork->Finish();
work->AddError(GetTid("publisher:common.errors.fileorfolderexists", name, this->parentfolder->name));
RETURN work->Finish();
}
RECORD indexactions;
......
......@@ -1485,7 +1485,7 @@ PUBLIC STATIC OBJECTTYPE App EXTEND TolliumScreenBase
}
IF(ObjectExists(OpenSiteByName(obj.name)))
{
this->RunMessageBox(".sitealreadyexists", obj.name);
this->RunSimpleScreen("error", GetTid("publisher:commondialogs.errors.objectprops.sitealreadyexists", obj.name));
RETURN;
}
OBJECT confirm := this->LoadScreen(".converttositedialog", [ site := obj.name ]);
......
......@@ -72,8 +72,22 @@ ASYNC MACRO ObjectProps()
AWAIT ExpectScreenChange(-1, PTR TTescape);
}
ASYNC MACRO TestRenameSiteConflict()
{
AWAIT ExpectScreenChange(+1, PTR TTLaunchApp("publisher:app", [ calltype := "direct", params := STRING[ OpenTestsuiteSite()->rootobject->whfspath ] ]));
topscreen->frame->focused := TT("foldertree");
AWAIT ExpectScreenChange(+1, PTR TTClick("props"));
TestEq(OpenTestsuiteSite()->rootobject->name, TT(":Name")->value);
TT(":Name")->value := "WebHare Backend";
AWAIT ExpectAndAnswerMessageBox("ok", PTR TTClick(":Ok"), [ messagemask := "*site*WebHare Backend*exists*" ]);
AWAIT ExpectScreenChange(-1, PTR TTEscape);
AWAIT ExpectScreenChange(-1, PTR TTescape);
}
RunTestframework([ PTR ObjectProps
, PTR TestRenameSiteConflict
], [ testusers := [[ login := "sysop", grantrights := ["system:sysop"] ]
,[ login := "lisa" ]
]]);
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