diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php
index b156bd4..a62f692 100644
--- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php
+++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php
@@ -27,7 +27,7 @@
require_once("../../../../config/dmsDefaults.php");
-KTUtil::extractGPC('fAttachDocument', 'fComment', 'fDocumentID', 'fSendEmail', 'groupNewRight', 'userNewRight');
+KTUtil::extractGPC('fAttachDocument', 'fComment', 'fDocumentID', 'fEmailAddresses', 'fSendEmail', 'groupNewRight', 'userNewRight');
require_once("$default->fileSystemRoot/lib/security/Permission.inc");
require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
@@ -103,6 +103,21 @@ function sendUserEmails($aUserIDs, $oDocument, $sComment = "", $bAttachDocument)
}
/**
+ * Sends emails to the manually entered email addresses
+ */
+function sendManualEmails($aEmailAddresses, $oDocument, $sComment = "", $bAttachDocument) {
+ global $default;
+
+ // loop through users
+ foreach ($aEmailAddresses as $sEmailAddress) {
+ $default->log->info("sendingEmail to address " . $sEmailAddress);
+ if (validateEmailAddress($sEmailAddress)) {
+ sendEmail($sEmailAddress, $sEmailAddress, $oDocument->getID(), $oDocument->getName(), $sComment, $bAttachDocument);
+ }
+ }
+}
+
+/**
* Constructs the email message text and sends the message
*/
function sendEmail($sDestEmailAddress, $sDestUserName, $iDocumentID, $sDocumentName, $sComment, $bAttachDocument = false) {
@@ -206,14 +221,17 @@ if (checkSession()) {
// explode group and user ids
$aGroupIDs = explode(",", $groupNewRight);
$aUserIDs = explode(",", $userNewRight);
- $default->log->info("Sending email to groups=$groupNewRight; users=$userNewRight");
+ $aEmailAddresses = explode(" ", $fEmailAddresses);
+ $default->log->info("Sending email to groups=$groupNewRight; users=$userNewRight; manual=$fEmailAddresses");
//if we're going to send a mail, first make there is someone to send it to
- if ((count($aGroupIDs) > 1) || (count($aUserIDs) > 1)) {
+ if ((count($aGroupIDs) > 1) || (count($aUserIDs) > 1) || (count($aEmailAddresses) != 0)) {
// send group emails
sendGroupEmails($aGroupIDs, $oDocument, $fComment, (boolean)$fAttachDocument);
// send user emails
sendUserEmails($aUserIDs, $oDocument, $fComment, (boolean)$fAttachDocument);
+ // send manual email addresses
+ sendManualEmails($aEmailAddresses, $oDocument, $fComment, (boolean)$fAttachDocument);
if (count($emailerrors)) {
$_SESSION['errorMessage'] = join("
\n", $emailerrors);
diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc
index 412bc05..d44d5fd 100644
--- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc
+++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc
@@ -92,6 +92,7 @@ function getDocumentEmailPage($oDocument) {
$sToRender .= "";
$sToRender .= "
|
\n";
@@ -111,8 +112,8 @@ function getDocumentEmailPage($oDocument) {
$sToRender .= "\n";
return $sToRender;