Commit e7bba98a695e6d65e17e1890cefc0e813b0eb4bb
1 parent
4f550fed
added comments and error logging
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1763 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
7 additions
and
0 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentBL.php
| @@ -49,6 +49,7 @@ if (checkSession()) { | @@ -49,6 +49,7 @@ if (checkSession()) { | ||
| 49 | //create the document transaction record | 49 | //create the document transaction record |
| 50 | $oDocumentTransaction = & new DocumentTransaction($oDocument->getID(), "Document created", CREATE); | 50 | $oDocumentTransaction = & new DocumentTransaction($oDocument->getID(), "Document created", CREATE); |
| 51 | $oDocumentTransaction->create(); | 51 | $oDocumentTransaction->create(); |
| 52 | + $default->log->info("addDocumentBL.php successfully added document " . $oDocument->getFileName() . " to folder " . Folder::getFolderPath($fFolderID) . " id=$fFolderID"); | ||
| 52 | 53 | ||
| 53 | // fire subscription alerts for the new document | 54 | // fire subscription alerts for the new document |
| 54 | $count = SubscriptionEngine::fireSubscription($fFolderID, SubscriptionConstants::subscriptionAlertType("AddDocument"), | 55 | $count = SubscriptionEngine::fireSubscription($fFolderID, SubscriptionConstants::subscriptionAlertType("AddDocument"), |
| @@ -60,6 +61,7 @@ if (checkSession()) { | @@ -60,6 +61,7 @@ if (checkSession()) { | ||
| 60 | //redirect to the document view page | 61 | //redirect to the document view page |
| 61 | redirect("$default->rootUrl/control.php?action=modifyDocument&fDocumentID=" . $oDocument->getID(). "&fFirstEdit=1"); | 62 | redirect("$default->rootUrl/control.php?action=modifyDocument&fDocumentID=" . $oDocument->getID(). "&fFirstEdit=1"); |
| 62 | } else { | 63 | } else { |
| 64 | + // couldn't store document in db | ||
| 63 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 65 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 64 | $oDocument->delete(); | 66 | $oDocument->delete(); |
| 65 | $oPatternCustom = & new PatternCustom(); | 67 | $oPatternCustom = & new PatternCustom(); |
| @@ -68,9 +70,11 @@ if (checkSession()) { | @@ -68,9 +70,11 @@ if (checkSession()) { | ||
| 68 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1"); | 70 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1"); |
| 69 | $main->setFormEncType("multipart/form-data"); | 71 | $main->setFormEncType("multipart/form-data"); |
| 70 | $main->setErrorMessage("An error occured while storing the document on the file system"); | 72 | $main->setErrorMessage("An error occured while storing the document on the file system"); |
| 73 | + $default->log->error("addDocumentBL.php Filesystem error attempting to store document " . $oDocument->getFileName() . " in folder " . Folder::getFolderPath($fFolderID) . " id=$fFolderID"); | ||
| 71 | $main->render(); | 74 | $main->render(); |
| 72 | } | 75 | } |
| 73 | } else { | 76 | } else { |
| 77 | + // couldn't store document on fs | ||
| 74 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 78 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 75 | $oPatternCustom = & new PatternCustom(); | 79 | $oPatternCustom = & new PatternCustom(); |
| 76 | $oPatternCustom->setHtml(getBrowseAddPage($fFolderID)); | 80 | $oPatternCustom->setHtml(getBrowseAddPage($fFolderID)); |
| @@ -78,9 +82,11 @@ if (checkSession()) { | @@ -78,9 +82,11 @@ if (checkSession()) { | ||
| 78 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1"); | 82 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1"); |
| 79 | $main->setFormEncType("multipart/form-data"); | 83 | $main->setFormEncType("multipart/form-data"); |
| 80 | $main->setErrorMessage("An error occured while storing the document in the database"); | 84 | $main->setErrorMessage("An error occured while storing the document in the database"); |
| 85 | + $default->log->error("addDocumentBL.php DB error storing document in folder " . Folder::getFolderPath($fFolderID) . " id=$fFolderID"); | ||
| 81 | $main->render(); | 86 | $main->render(); |
| 82 | } | 87 | } |
| 83 | } else { | 88 | } else { |
| 89 | + // document already exists in folder | ||
| 84 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 90 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 85 | $oPatternCustom = & new PatternCustom(); | 91 | $oPatternCustom = & new PatternCustom(); |
| 86 | $oPatternCustom->setHtml(getBrowseAddPage($fFolderID)); | 92 | $oPatternCustom->setHtml(getBrowseAddPage($fFolderID)); |
| @@ -88,6 +94,7 @@ if (checkSession()) { | @@ -88,6 +94,7 @@ if (checkSession()) { | ||
| 88 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1"); | 94 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1"); |
| 89 | $main->setFormEncType("multipart/form-data"); | 95 | $main->setFormEncType("multipart/form-data"); |
| 90 | $main->setErrorMessage("A document with this file name already exists in this folder"); | 96 | $main->setErrorMessage("A document with this file name already exists in this folder"); |
| 97 | + $default->log->error("addDocumentBL.php Document exists with name " . $oDocument->getFileName() . " in folder " . Folder::getFolderPath($fFolderID) . " id=$fFolderID"); | ||
| 91 | $main->render(); | 98 | $main->render(); |
| 92 | } | 99 | } |
| 93 | } else { | 100 | } else { |