Commit 6cc5b5da7a407054b6f9075e25d72c3ec7aa21e0

Authored by michael
1 parent ede9f126

(#2763) added document transaction logging


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2467 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/editDocCheckoutBL.php
@@ -15,6 +15,7 @@ if (checkSession()) { @@ -15,6 +15,7 @@ if (checkSession()) {
15 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); 15 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc");
16 require_once("editDocCheckoutUI.inc"); 16 require_once("editDocCheckoutUI.inc");
17 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); 17 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
  18 + require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc");
18 require_once("$default->fileSystemRoot/lib/security/permission.inc"); 19 require_once("$default->fileSystemRoot/lib/security/permission.inc");
19 require_once("$default->fileSystemRoot/lib/links/link.inc"); 20 require_once("$default->fileSystemRoot/lib/links/link.inc");
20 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); 21 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
@@ -27,31 +28,40 @@ if (checkSession()) { @@ -27,31 +28,40 @@ if (checkSession()) {
27 $oPatternCustom = & new PatternCustom(); 28 $oPatternCustom = & new PatternCustom();
28 29
29 $oPatternCustom->addHtml(renderHeading("Edit Document Checkout")); 30 $oPatternCustom->addHtml(renderHeading("Edit Document Checkout"));
30 -  
31 - if (isset($fUpdate)){  
32 - if (isset($fDocID)){  
33 - $oDoc = Document::get($fDocID); 31 +
  32 + if (isset($fDocID)){
  33 + if (isset($fUpdate)) {
  34 + $oDocument = Document::get($fDocID);
34 35
35 - if (($oDoc->getIsCheckedOut() > 0 && $fDocCheckout=="on" ) ||  
36 - ($oDoc->getIsCheckedOut() == 0 && $fDocCheckout=="" )){ 36 + if (($oDocument->getIsCheckedOut() > 0 && $fDocCheckout=="on" ) ||
  37 + ($oDocument->getIsCheckedOut() == 0 && $fDocCheckout=="" )){
37 $main->setErrorMessage("No changes were made to the document checkout."); 38 $main->setErrorMessage("No changes were made to the document checkout.");
38 } else { 39 } else {
39 if ($fDocCheckout=="on"){ 40 if ($fDocCheckout=="on"){
40 - $oDoc->setIsCheckedOut(1);  
41 - }else {  
42 - $oDoc->setIsCheckedOut(0);  
43 - $oDoc->setCheckedOutUserID(-1); 41 + $oDocument->setIsCheckedOut(1);
  42 + } else {
  43 + $oDocument->setIsCheckedOut(0);
  44 + $oDocument->setCheckedOutUserID(-1);
44 } 45 }
45 - if ($oDoc->update()){ 46 + if ($oDocument->update()){
  47 + // checkout cancelled transaction
  48 + $oDocumentTransaction = & new DocumentTransaction($oDocument->getID(), "Document checked out cancelled", FORCE_CHECKIN);
  49 + if ($oDocumentTransaction->create()) {
  50 + $default->log->debug("editDocCheckoutBL.php created forced checkin document transaction for document ID=" . $oDocument->getID());
  51 + } else {
  52 + $default->log->error("editDocCheckoutBL.php couldn't create create document transaction for document ID=" . $oDocument->getID());
  53 + }
46 $oPatternCustom->addHtml(getEditCheckoutSuccessPage()); 54 $oPatternCustom->addHtml(getEditCheckoutSuccessPage());
47 } else { 55 } else {
48 $main->setErrorMessage("Error while trying to update the document checkout."); 56 $main->setErrorMessage("Error while trying to update the document checkout.");
49 } 57 }
50 } 58 }
  59 + } else {
  60 + $oPatternCustom->addHtml($fDocCheckout . getEditCheckoutPage($fDocID));
  61 + $main->setFormAction($_SERVER["PHP_SELF"] . "?fUpdate=1&fDocID=$fDocID");
51 } 62 }
52 - } else if (isset($fDocID)){  
53 - $oPatternCustom->addHtml($fDocCheckout . getEditCheckoutPage($fDocID));  
54 - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUpdate=1&fDocID=$fDocID"); 63 + } else {
  64 + // no document selected
55 } 65 }
56 //render the page 66 //render the page
57 $main->setCentralPayload($oPatternCustom); 67 $main->setCentralPayload($oPatternCustom);
presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php
@@ -55,6 +55,14 @@ if (checkSession()) { @@ -55,6 +55,14 @@ if (checkSession()) {
55 $oEmail = new Email(); 55 $oEmail = new Email();
56 $oEmail->send($fToEmail, $sTitle, $sMessage); 56 $oEmail->send($fToEmail, $sTitle, $sMessage);
57 57
  58 + // emailed link transaction
  59 + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document link emailed to $fToEmail", EMAIL_LINK);
  60 + if ($oDocumentTransaction->create()) {
  61 + $default->log->debug("emailBL.php created email link document transaction for document ID=$fDocumentID");
  62 + } else {
  63 + $default->log->error("emailBL.php couldn't create email link document transaction for document ID=$fDocumentID");
  64 + }
  65 +
58 //go back to the document view page 66 //go back to the document view page
59 redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=$fDocumentID"); 67 redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=$fDocumentID");
60 } else { 68 } else {
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php
@@ -129,12 +129,27 @@ if (checkSession()) { @@ -129,12 +129,27 @@ if (checkSession()) {
129 $oEmail = & new Email(); 129 $oEmail = & new Email();
130 $oEmail->send($oUser->getEmail(), "Document collaboration complete", $sBody); 130 $oEmail->send($oUser->getEmail(), "Document collaboration complete", $sBody);
131 131
  132 + // collaboration accepted transaction
  133 + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document collaboration step accepted", COLLAB_ACCEPT);
  134 + if ($oDocumentTransaction->create()) {
  135 + $default->log->debug("viewBL.php created collaboration accepted document transaction for document ID=$fDocumentID");
  136 + } else {
  137 + $default->log->error("viewBL.php couldn't create collaboration accepted document transaction for document ID=$fDocumentID");
  138 + }
  139 +
132 //possibly set the document up for web publishing???? 140 //possibly set the document up for web publishing????
133 $sStatusMessage = "Document collaboration complete. The document initiator has been notified"; 141 $sStatusMessage = "Document collaboration complete. The document initiator has been notified";
134 $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); 142 $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage));
135 } else { 143 } else {
136 //start the next steps if all criteria are met 144 //start the next steps if all criteria are met
137 DocumentCollaboration::beginNextStepInCollaborationProcess($fDocumentID, $_SESSION["userID"]); 145 DocumentCollaboration::beginNextStepInCollaborationProcess($fDocumentID, $_SESSION["userID"]);
  146 + // collaboration accepted transaction
  147 + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document collaboration step accepted", COLLAB_ACCEPT);
  148 + if ($oDocumentTransaction->create()) {
  149 + $default->log->debug("viewBL.php created collaboration accepted document transaction for document ID=$fDocumentID");
  150 + } else {
  151 + $default->log->error("viewBL.php couldn't create collaboration accepted document transaction for document ID=$fDocumentID");
  152 + }
138 $sStatusMessage = "The next steps in the collaboration process have been started"; 153 $sStatusMessage = "The next steps in the collaboration process have been started";
139 $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); 154 $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage));
140 } 155 }