Commit e7bba98a695e6d65e17e1890cefc0e813b0eb4bb

Authored by michael
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
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentBL.php
... ... @@ -49,6 +49,7 @@ if (checkSession()) {
49 49 //create the document transaction record
50 50 $oDocumentTransaction = & new DocumentTransaction($oDocument->getID(), "Document created", CREATE);
51 51 $oDocumentTransaction->create();
  52 + $default->log->info("addDocumentBL.php successfully added document " . $oDocument->getFileName() . " to folder " . Folder::getFolderPath($fFolderID) . " id=$fFolderID");
52 53  
53 54 // fire subscription alerts for the new document
54 55 $count = SubscriptionEngine::fireSubscription($fFolderID, SubscriptionConstants::subscriptionAlertType("AddDocument"),
... ... @@ -60,6 +61,7 @@ if (checkSession()) {
60 61 //redirect to the document view page
61 62 redirect("$default->rootUrl/control.php?action=modifyDocument&fDocumentID=" . $oDocument->getID(). "&fFirstEdit=1");
62 63 } else {
  64 + // couldn't store document in db
63 65 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
64 66 $oDocument->delete();
65 67 $oPatternCustom = & new PatternCustom();
... ... @@ -68,9 +70,11 @@ if (checkSession()) {
68 70 $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1");
69 71 $main->setFormEncType("multipart/form-data");
70 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 74 $main->render();
72 75 }
73 76 } else {
  77 + // couldn't store document on fs
74 78 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
75 79 $oPatternCustom = & new PatternCustom();
76 80 $oPatternCustom->setHtml(getBrowseAddPage($fFolderID));
... ... @@ -78,9 +82,11 @@ if (checkSession()) {
78 82 $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1");
79 83 $main->setFormEncType("multipart/form-data");
80 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 86 $main->render();
82 87 }
83 88 } else {
  89 + // document already exists in folder
84 90 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
85 91 $oPatternCustom = & new PatternCustom();
86 92 $oPatternCustom->setHtml(getBrowseAddPage($fFolderID));
... ... @@ -88,6 +94,7 @@ if (checkSession()) {
88 94 $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1");
89 95 $main->setFormEncType("multipart/form-data");
90 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 98 $main->render();
92 99 }
93 100 } else {
... ...