Commit 5dfa77d61f1bb80701b7effb336bfff111022999
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
Showing
1 changed file
with
12 additions
and
13 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php
| @@ -59,7 +59,6 @@ if (checkSession()) { | @@ -59,7 +59,6 @@ if (checkSession()) { | ||
| 59 | // clear the checked in user id | 59 | // clear the checked in user id |
| 60 | $oDocument->setCheckedOutUserID(-1); | 60 | $oDocument->setCheckedOutUserID(-1); |
| 61 | // bump the version numbers | 61 | // bump the version numbers |
| 62 | - $default->log->error("fCheckInType=$fCheckInType"); | ||
| 63 | if ($fCheckInType == "major") { | 62 | if ($fCheckInType == "major") { |
| 64 | // major version number rollover | 63 | // major version number rollover |
| 65 | $oDocument->setMajorVersionNumber($oDocument->getMajorVersionNumber()+1); | 64 | $oDocument->setMajorVersionNumber($oDocument->getMajorVersionNumber()+1); |
| @@ -68,11 +67,10 @@ if (checkSession()) { | @@ -68,11 +67,10 @@ if (checkSession()) { | ||
| 68 | } else if ($fCheckInType == "minor") { | 67 | } else if ($fCheckInType == "minor") { |
| 69 | $oDocument->setMinorVersionNumber($oDocument->getMinorVersionNumber()+1); | 68 | $oDocument->setMinorVersionNumber($oDocument->getMinorVersionNumber()+1); |
| 70 | } | 69 | } |
| 71 | - $default->log->error("major=" . $oDocument->getMajorVersionNumber() . ";minor=" . $oDocument->getMinorVersionNumber()); | ||
| 72 | - | 70 | + |
| 73 | // update it | 71 | // update it |
| 74 | if ($oDocument->update()) { | 72 | if ($oDocument->update()) { |
| 75 | - | 73 | + |
| 76 | // create the document transaction record | 74 | // create the document transaction record |
| 77 | $oDocumentTransaction = & new DocumentTransaction($oDocument->getID(), $fCheckInComment, CHECKIN); | 75 | $oDocumentTransaction = & new DocumentTransaction($oDocument->getID(), $fCheckInComment, CHECKIN); |
| 78 | // TODO: check transaction creation status? | 76 | // TODO: check transaction creation status? |
| @@ -83,21 +81,22 @@ if (checkSession()) { | @@ -83,21 +81,22 @@ if (checkSession()) { | ||
| 83 | SubscriptionConstants::subscriptionType("DocumentSubscription"), | 81 | SubscriptionConstants::subscriptionType("DocumentSubscription"), |
| 84 | array( "modifiedDocumentName" => $oDocument->getName() )); | 82 | array( "modifiedDocumentName" => $oDocument->getName() )); |
| 85 | $default->log->info("checkInDocumentBL.php fired $count subscription alerts for checked out document " . $oDocument->getName()); | 83 | $default->log->info("checkInDocumentBL.php fired $count subscription alerts for checked out document " . $oDocument->getName()); |
| 86 | - | 84 | + |
| 87 | //redirect to the document view page | 85 | //redirect to the document view page |
| 88 | redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID()); | 86 | redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID()); |
| 89 | 87 | ||
| 90 | } else { | 88 | } else { |
| 91 | // document update failed | 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 | } else { | 92 | } else { |
| 95 | // reinstate the backup | 93 | // reinstate the backup |
| 96 | copy($sBackupPath, $oDocument->getPath()); | 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 | } else { | 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 | } else { | 101 | } else { |
| 103 | // prompt the user for a check in comment and the file | 102 | // prompt the user for a check in comment and the file |
| @@ -105,19 +104,20 @@ if (checkSession()) { | @@ -105,19 +104,20 @@ if (checkSession()) { | ||
| 105 | } | 104 | } |
| 106 | } else { | 105 | } else { |
| 107 | // this document isn't checked out | 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 | } else { | 110 | } else { |
| 111 | // no permission to checkout the document | 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 | } else { | 114 | } else { |
| 115 | // couldn't instantiate the document | 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 | } else { | 118 | } else { |
| 119 | // no document id was set when coming to this page, | 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 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 123 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| @@ -127,7 +127,6 @@ if (checkSession()) { | @@ -127,7 +127,6 @@ if (checkSession()) { | ||
| 127 | if (isset($sErrorMessage)) { | 127 | if (isset($sErrorMessage)) { |
| 128 | $main->setErrorMessage($sErrorMessage); | 128 | $main->setErrorMessage($sErrorMessage); |
| 129 | } | 129 | } |
| 130 | - $oPatternCustom->setHtml(renderCheckInPage($oDocument)); | ||
| 131 | $main->render(); | 130 | $main->render(); |
| 132 | } | 131 | } |
| 133 | ?> | 132 | ?> |