Commit cd6d12fe6a94a17dbca112d63288a552c4e1fc14
1 parent
f7e94832
Added checks for failed document linking
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2020 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
19 additions
and
1 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentBL.php
| ... | ... | @@ -61,6 +61,24 @@ if (checkSession()) { |
| 61 | 61 | if ($oDocumentLink->create()) { |
| 62 | 62 | //no longer a dependant document, but a linked document |
| 63 | 63 | $oDependantDocument->delete(); |
| 64 | + } else { | |
| 65 | + //an error occured whilst trying to link the two documents automatically. Email the parent document | |
| 66 | + //original to inform him/her that the two documents must be linked manually | |
| 67 | + $oParentDocument = Document::get($oDependantDocument->getParentDocumentID()); | |
| 68 | + $oUserDocCreator = User::get($oParentDocument->getCreatorID()); | |
| 69 | + | |
| 70 | + $sBody = $oUserDocCreator->getName() . ", an error occured whilst attempting to automatically link the document, '" . | |
| 71 | + $oDocument->getName() . "' to the document, '" . $oParentDocument->getName() . "'. These two documents " . | |
| 72 | + " are meant to be linked for collaboration purposes. As creator of the document, ' " . $oParentDocument->getName() . "', you are requested to " . | |
| 73 | + "please link them manually by browsing to the parent document, " . | |
| 74 | + generateControllerLink("viewDocument","fDocumentID=" . $oParentDocument->getID(), $oParentDocument->getName()) . | |
| 75 | + " and selecting the link button. " . $oDocument->getName() . " can be found at " . $oDocument->generateFullFolderPath($oDocument->getFolderID()); | |
| 76 | + | |
| 77 | + $oEmail = & new Email(); | |
| 78 | + $oEmail->send($oUserDocCreator->getEmail(), "Automatic document linking failed", $sBody); | |
| 79 | + | |
| 80 | + //document no longer dependant document, but must be linked manually | |
| 81 | + $oDependantDocument->delete(); | |
| 64 | 82 | } |
| 65 | 83 | } |
| 66 | 84 | |
| ... | ... | @@ -147,7 +165,7 @@ if (checkSession()) { |
| 147 | 165 | //so don't display add button |
| 148 | 166 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 149 | 167 | $oPatternCustom = & new PatternCustom(); |
| 150 | - $oPatternCustom->setHtml(getBrowsePage($fFolderID)); | |
| 168 | + $oPatternCustom->setHtml(getBrowsePage($fFolderID, $fDependantDocumentID)); | |
| 151 | 169 | $main->setCentralPayload($oPatternCustom); |
| 152 | 170 | $main->setErrorMessage("You do not have permission to add a document to this folder</td><td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"></a>"); |
| 153 | 171 | $main->render(); | ... | ... |