From 6cc5b5da7a407054b6f9075e25d72c3ec7aa21e0 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 31 Jul 2003 10:59:54 +0000 Subject: [PATCH] (#2763) added document transaction logging --- presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/editDocCheckoutBL.php | 38 ++++++++++++++++++++++++-------------- presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php | 8 ++++++++ presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php | 15 +++++++++++++++ 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/editDocCheckoutBL.php b/presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/editDocCheckoutBL.php index 3fdc16e..ff444f1 100644 --- a/presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/editDocCheckoutBL.php +++ b/presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/editDocCheckoutBL.php @@ -15,6 +15,7 @@ if (checkSession()) { require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); require_once("editDocCheckoutUI.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); + require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); require_once("$default->fileSystemRoot/lib/security/permission.inc"); require_once("$default->fileSystemRoot/lib/links/link.inc"); require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); @@ -27,31 +28,40 @@ if (checkSession()) { $oPatternCustom = & new PatternCustom(); $oPatternCustom->addHtml(renderHeading("Edit Document Checkout")); - - if (isset($fUpdate)){ - if (isset($fDocID)){ - $oDoc = Document::get($fDocID); + + if (isset($fDocID)){ + if (isset($fUpdate)) { + $oDocument = Document::get($fDocID); - if (($oDoc->getIsCheckedOut() > 0 && $fDocCheckout=="on" ) || - ($oDoc->getIsCheckedOut() == 0 && $fDocCheckout=="" )){ + if (($oDocument->getIsCheckedOut() > 0 && $fDocCheckout=="on" ) || + ($oDocument->getIsCheckedOut() == 0 && $fDocCheckout=="" )){ $main->setErrorMessage("No changes were made to the document checkout."); } else { if ($fDocCheckout=="on"){ - $oDoc->setIsCheckedOut(1); - }else { - $oDoc->setIsCheckedOut(0); - $oDoc->setCheckedOutUserID(-1); + $oDocument->setIsCheckedOut(1); + } else { + $oDocument->setIsCheckedOut(0); + $oDocument->setCheckedOutUserID(-1); } - if ($oDoc->update()){ + if ($oDocument->update()){ + // checkout cancelled transaction + $oDocumentTransaction = & new DocumentTransaction($oDocument->getID(), "Document checked out cancelled", FORCE_CHECKIN); + if ($oDocumentTransaction->create()) { + $default->log->debug("editDocCheckoutBL.php created forced checkin document transaction for document ID=" . $oDocument->getID()); + } else { + $default->log->error("editDocCheckoutBL.php couldn't create create document transaction for document ID=" . $oDocument->getID()); + } $oPatternCustom->addHtml(getEditCheckoutSuccessPage()); } else { $main->setErrorMessage("Error while trying to update the document checkout."); } } + } else { + $oPatternCustom->addHtml($fDocCheckout . getEditCheckoutPage($fDocID)); + $main->setFormAction($_SERVER["PHP_SELF"] . "?fUpdate=1&fDocID=$fDocID"); } - } else if (isset($fDocID)){ - $oPatternCustom->addHtml($fDocCheckout . getEditCheckoutPage($fDocID)); - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUpdate=1&fDocID=$fDocID"); + } else { + // no document selected } //render the page $main->setCentralPayload($oPatternCustom); diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php index b16550c..ca32fcf 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php @@ -55,6 +55,14 @@ if (checkSession()) { $oEmail = new Email(); $oEmail->send($fToEmail, $sTitle, $sMessage); + // emailed link transaction + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document link emailed to $fToEmail", EMAIL_LINK); + if ($oDocumentTransaction->create()) { + $default->log->debug("emailBL.php created email link document transaction for document ID=$fDocumentID"); + } else { + $default->log->error("emailBL.php couldn't create email link document transaction for document ID=$fDocumentID"); + } + //go back to the document view page redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=$fDocumentID"); } else { diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php index ceae1c4..5343d68 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php @@ -129,12 +129,27 @@ if (checkSession()) { $oEmail = & new Email(); $oEmail->send($oUser->getEmail(), "Document collaboration complete", $sBody); + // collaboration accepted transaction + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document collaboration step accepted", COLLAB_ACCEPT); + if ($oDocumentTransaction->create()) { + $default->log->debug("viewBL.php created collaboration accepted document transaction for document ID=$fDocumentID"); + } else { + $default->log->error("viewBL.php couldn't create collaboration accepted document transaction for document ID=$fDocumentID"); + } + //possibly set the document up for web publishing???? $sStatusMessage = "Document collaboration complete. The document initiator has been notified"; $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); } else { //start the next steps if all criteria are met DocumentCollaboration::beginNextStepInCollaborationProcess($fDocumentID, $_SESSION["userID"]); + // collaboration accepted transaction + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document collaboration step accepted", COLLAB_ACCEPT); + if ($oDocumentTransaction->create()) { + $default->log->debug("viewBL.php created collaboration accepted document transaction for document ID=$fDocumentID"); + } else { + $default->log->error("viewBL.php couldn't create collaboration accepted document transaction for document ID=$fDocumentID"); + } $sStatusMessage = "The next steps in the collaboration process have been started"; $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); } -- libgit2 0.21.4