Commit 5dfa77d61f1bb80701b7effb336bfff111022999

Authored by Michael Joseph
1 parent db2af973

fixed error displaying and removed some debug logging


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1162 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php
... ... @@ -59,7 +59,6 @@ if (checkSession()) {
59 59 // clear the checked in user id
60 60 $oDocument->setCheckedOutUserID(-1);
61 61 // bump the version numbers
62   - $default->log->error("fCheckInType=$fCheckInType");
63 62 if ($fCheckInType == "major") {
64 63 // major version number rollover
65 64 $oDocument->setMajorVersionNumber($oDocument->getMajorVersionNumber()+1);
... ... @@ -68,11 +67,10 @@ if (checkSession()) {
68 67 } else if ($fCheckInType == "minor") {
69 68 $oDocument->setMinorVersionNumber($oDocument->getMinorVersionNumber()+1);
70 69 }
71   - $default->log->error("major=" . $oDocument->getMajorVersionNumber() . ";minor=" . $oDocument->getMinorVersionNumber());
72   -
  70 +
73 71 // update it
74 72 if ($oDocument->update()) {
75   -
  73 +
76 74 // create the document transaction record
77 75 $oDocumentTransaction = & new DocumentTransaction($oDocument->getID(), $fCheckInComment, CHECKIN);
78 76 // TODO: check transaction creation status?
... ... @@ -83,21 +81,22 @@ if (checkSession()) {
83 81 SubscriptionConstants::subscriptionType("DocumentSubscription"),
84 82 array( "modifiedDocumentName" => $oDocument->getName() ));
85 83 $default->log->info("checkInDocumentBL.php fired $count subscription alerts for checked out document " . $oDocument->getName());
86   -
  84 +
87 85 //redirect to the document view page
88 86 redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID());
89 87  
90 88 } else {
91 89 // document update failed
92   - $sErrorMessage = "An error occurred while storing this document in the database";
  90 + $oPatternCustom->setHtml(renderErrorPage("An error occurred while storing this document in the database"));
93 91 }
94 92 } else {
95 93 // reinstate the backup
96 94 copy($sBackupPath, $oDocument->getPath());
97   - $sErrorMessage = "An error occurred while storing the new file on the filesystem";
  95 + $oPatternCustom->setHtml(renderErrorPage("An error occurred while storing the new file on the filesystem"));
98 96 }
99 97 } else {
100   - $sErrorMessage = "Please select a document by first clicking on 'Browse'. Then click 'Check-In'";
  98 + $sErrorMessage = "Please select a document by first clicking on 'Browse'. Then click 'Check-In'";
  99 + $oPatternCustom->setHtml(renderCheckInPage($oDocument));
101 100 }
102 101 } else {
103 102 // prompt the user for a check in comment and the file
... ... @@ -105,19 +104,20 @@ if (checkSession()) {
105 104 }
106 105 } else {
107 106 // this document isn't checked out
108   - $oPatternCustom->setHtml("<p class=\"errorText\">You can't check in this document because its not checked out</p>\n");
  107 + $oPatternCustom->setHtml(renderErrorPage("You can't check in this document because its not checked out"));
  108 +
109 109 }
110 110 } else {
111 111 // no permission to checkout the document
112   - $oPatternCustom->setHtml("<p class=\"errorText\">Could not check in this document</p>\n");
  112 + $oPatternCustom->setHtml(renderErrorPage("You do not have permission to check in this document"));
113 113 }
114 114 } else {
115 115 // couldn't instantiate the document
116   - $oPatternCustom->setHtml("<p class=\"errorText\">Could not check in this document</p>\n");
  116 + $oPatternCustom->setHtml(renderErrorPage("Could not check in this document"));
117 117 }
118 118 } else {
119 119 // no document id was set when coming to this page,
120   - $oPatternCustom->setHtml("<p class=\"errorText\">No document is currently selected for check in</p>\n");
  120 + $oPatternCustom->setHtml(renderErrorPage("No document is currently selected for check in"));
121 121 }
122 122  
123 123 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
... ... @@ -127,7 +127,6 @@ if (checkSession()) {
127 127 if (isset($sErrorMessage)) {
128 128 $main->setErrorMessage($sErrorMessage);
129 129 }
130   - $oPatternCustom->setHtml(renderCheckInPage($oDocument));
131 130 $main->render();
132 131 }
133 132 ?>
... ...