use the checkout space of the logged in user not the substituted user

This commit is contained in:
Uwe Steinmann 2015-12-01 18:06:41 +01:00
parent eee4e2f0eb
commit f7b2d5b6d6
2 changed files with 14 additions and 3 deletions

View File

@ -53,7 +53,12 @@ if ($document->isCheckedOut()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("document_already_checkedout"));
}
$checkoutpath = sprintf($settings->_checkOutDir.'/', preg_replace('/[^A-Za-z0-9_-]/', '', $user->getLogin()));
if($session->getSu()) {
$origuser = $dms->getUser($session->getUser());
$checkoutpath = sprintf($settings->_checkOutDir.'/', preg_replace('/[^A-Za-z0-9_-]/', '', $origuser->getLogin()));
} else {
$checkoutpath = sprintf($settings->_checkOutDir.'/', preg_replace('/[^A-Za-z0-9_-]/', '', $user->getLogin()));
}
if(!file_exists($checkoutpath) && $settings->_createCheckOutDir) {
SeedDMS_Core_File::makeDir($checkoutpath);
}

View File

@ -232,8 +232,14 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$this->contentHeading(getMLText("document_infos"));
if($info = $document->getCheckOutInfo()) {
echo "<div class=\"alert alert-info\">";
$checkoutpath = sprintf($checkoutdir, preg_replace('/[^A-Za-z0-9_-]/', '', $user->getLogin()));
echo "<a href=\"file://".$info['filename']."\">".getMLText('copied_to_checkout_as', array('filename'=>substr($info['filename'], strlen($checkoutpath)+1)))."</a>";
$session = $this->params['session'];
if($session->getSu()) {
$origuser = $dms->getUser($session->getUser());
$checkoutpath = sprintf($checkoutdir, preg_replace('/[^A-Za-z0-9_-]/', '', $origuser->getLogin()));
} else {
$checkoutpath = sprintf($checkoutdir, preg_replace('/[^A-Za-z0-9_-]/', '', $user->getLogin()));
}
echo "<a href=\"file://".$info['filename']."\">".getMLText('copied_to_checkout_as', array('date'=>$info['date'], 'filename'=>substr($info['filename'], strlen($checkoutpath)+1)))."</a>";
echo "</div>";
}
$this->contentContainerStart();