예제 #1
0
function show_commentTemplate($template_name)
{
    global $TPL;
    // Run query and loop through the records
    $db = new db_alloc();
    $query = "SELECT * FROM commentTemplate ORDER BY commentTemplateType, commentTemplateName";
    $db->query($query);
    while ($db->next_record()) {
        $commentTemplate = new commentTemplate();
        $commentTemplate->read_db_record($db);
        $commentTemplate->set_values();
        $TPL["odd_even"] = $TPL["odd_even"] == "even" ? "odd" : "even";
        include_template($template_name);
    }
}
예제 #2
0
파일: config.php 프로젝트: cjbayliss/alloc
$currencyOptions = $m->get_assoc_array("currencyTypeID", "currencyTypeName");
$TPL["currencyOptions"] = page::select_options($currencyOptions, config::get_config_item("currency"));
$db = new db_alloc();
$display = array("", "username", ", ", "emailAddress");
$person = new person();
$people =& get_cached_table("person");
foreach ($people as $p) {
    $peeps[$p["personID"]] = $p["name"];
}
// get the default time sheet manager/admin options
$TPL["defaultTimeSheetManagerListText"] = get_person_list(config::get_config_item("defaultTimeSheetManagerList"));
$TPL["defaultTimeSheetAdminListText"] = get_person_list(config::get_config_item("defaultTimeSheetAdminList"));
$days = array("Sun" => "Sun", "Mon" => "Mon", "Tue" => "Tue", "Wed" => "Wed", "Thu" => "Thu", "Fri" => "Fri", "Sat" => "Sat");
$TPL["calendarFirstDayOptions"] = page::select_options($days, config::get_config_item("calendarFirstDay"));
$TPL["timeSheetPrintOptions"] = page::select_options($TPL["timeSheetPrintOptions"], $TPL["timeSheetPrint"]);
$commentTemplate = new commentTemplate();
$ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName");
$TPL["rssStatusFilterOptions"] = page::select_options(task::get_task_statii_array(true), config::get_config_item("rssStatusFilter"));
if (has("timeUnit")) {
    $timeUnit = new timeUnit();
    $rate_type_array = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelB");
}
$TPL["timesheetRate_options"] = page::select_options($rate_type_array, config::get_config_item("defaultTimeSheetUnit"));
$TPL["main_alloc_title"] = "Setup - " . APPLICATION_NAME;
include_template("templates/configM.tpl");
function get_person_list($personID_array)
{
    global $peeps;
    $people = array();
    foreach ($personID_array as $personID) {
        $people[] = $peeps[$personID];
예제 #3
0
파일: client.php 프로젝트: cjbayliss/alloc
function show_comments()
{
    global $clientID;
    global $TPL;
    global $client;
    $TPL["commentsR"] = comment::util_get_comments("client", $clientID);
    $TPL["commentsR"] and $TPL["class_new_comment"] = "hidden";
    $interestedPartyOptions = $client->get_all_parties();
    $interestedPartyOptions = interestedParty::get_interested_parties("client", $client->get_id(), $interestedPartyOptions);
    $TPL["allParties"] = $interestedPartyOptions or $TPL["allParties"] = array();
    $TPL["entity"] = "client";
    $TPL["entityID"] = $client->get_id();
    $TPL["clientID"] = $client->get_id();
    $commentTemplate = new commentTemplate();
    $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "client"));
    $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
    include_template("../comment/templates/commentM.tpl");
}
예제 #4
0
 function send_emails($selected_option, $email_receive = false, $hash = "", $is_a_reply_comment = false, $files = array())
 {
     $current_user =& singleton("current_user");
     $e = $this->get_parent_object();
     $type = $e->classname . "_comments";
     $body = $this->get_value("comment");
     if (is_object($email_receive)) {
         list($from_address, $from_name) = parse_email_address($email_receive->mail_headers["from"]);
     }
     if ($is_a_reply_comment) {
         $id = $this->get_value("commentLinkID");
     } else {
         $id = $this->get_id();
     }
     $recipients = comment::get_email_recipients($selected_option, "comment", $id);
     list($to_address, $bcc, $successful_recipients) = comment::get_email_recipient_headers($recipients, $from_address);
     if ($to_address || $bcc || $successful_recipients) {
         $email = new email_send();
         if ($email_receive) {
             list($email_receive_header, $email_receive_body) = $email_receive->get_raw_header_and_body();
             $email->set_headers($email_receive_header);
             $email->set_body($email_receive_body, $email_receive->mail_text);
             // Remove any existing To/Cc header, to prevent the email getting sent to the same recipients again.
             $email->del_header("To");
             $email->del_header("Cc");
             $subject = $email->get_header("subject");
             $subject = trim(preg_replace("/{Key:[^}]*}.*\$/i", "", $subject));
         } else {
             $email->set_body($body);
             if ($files) {
                 // (if we're bouncing a complete email body the attachments are already included, else do this...)
                 foreach ((array) $files as $file) {
                     $email->add_attachment($file["fullpath"]);
                 }
             } else {
                 $email->set_content_type();
             }
         }
         $bcc && $email->add_header("Bcc", $bcc);
         // nuke bounce headers - mail won't send properly otherwise
         $email->del_header("Resent-From");
         $email->del_header("Resent-Date");
         $email->del_header("Resent-Message-ID");
         $email->del_header("Resent-To");
         $email->add_header("X-Alloc-CommentID", $this->get_id());
         if (is_object($e) && method_exists($e, "get_name")) {
             $email->add_header("X-Alloc-" . ucwords($e->classname), $e->get_name());
             $email->add_header("X-Alloc-" . ucwords($e->key_field->get_name()), $e->get_id());
         }
         // Add project header too, if possible
         if (has("project") && $e->classname != "project" && isset($e->data_fields["projectID"])) {
             $p = $e->get_foreign_object("project");
             $email->add_header("X-Alloc-Project", $p->get_value("projectName"));
             $email->add_header("X-Alloc-ProjectID", $p->get_id());
         }
         $email->set_to_address($to_address);
         $messageid = $email->set_message_id($hash);
         $subject_extra = "{Key:" . $hash . "}";
         $email->set_date();
         if (!$subject) {
             $tpl = config::get_config_item("emailSubject_" . $e->classname . "Comment");
             $tpl and $subject = commentTemplate::populate_string($tpl, $e->classname, $e->get_id());
             $e->classname != "task" and $prefix = ucwords($e->classname) . " Comment: ";
             $subject or $subject = $prefix . $e->get_id() . " " . $e->get_name(DST_VARIABLE);
         }
         $email->set_subject($subject . " " . $subject_extra);
         $email->set_message_type($type);
         // If from name is empty, then use the email address instead
         // eg: From: jon@jonny.com -> From: "jon@jonny.com via allocPSA" <*****@*****.**>
         $from_name or $from_name = $from_address;
         is_object($current_user) && !$from_name and $from_name = $current_user->get_name();
         if (defined("ALLOC_DEFAULT_FROM_ADDRESS") && ALLOC_DEFAULT_FROM_ADDRESS) {
             if (config::for_cyber()) {
                 $email->set_reply_to('"All parties via allocPSA" ' . ALLOC_DEFAULT_FROM_ADDRESS);
                 $email->set_from('"' . str_replace('"', '', $from_name) . ' via allocPSA" ' . ALLOC_DEFAULT_FROM_ADDRESS);
             } else {
                 $email->set_reply_to('"All parties" ' . ALLOC_DEFAULT_FROM_ADDRESS);
                 $email->set_from('"' . str_replace('"', '', $from_name) . '" ' . ALLOC_DEFAULT_FROM_ADDRESS);
             }
         } else {
             if (is_object($current_user) && $current_user->get_from()) {
                 $f = $current_user->get_from();
             } else {
                 $f = config::get_config_item("allocEmailAdmin");
             }
             $email->set_reply_to($f);
             $email->set_from($f);
         }
         if ($email->send(false)) {
             return array($successful_recipients, $messageid);
         }
     }
 }
예제 #5
0
파일: task.php 프로젝트: cjbayliss/alloc
function show_comments()
{
    global $taskID;
    global $TPL;
    global $task;
    if ($_REQUEST["commentSummary"]) {
        $_REQUEST["showTaskHeader"] = true;
        $_REQUEST["clients"] = true;
        $TPL["commentsR"] = comment::get_list_summary($_REQUEST);
        $TPL["extra_page_links"] = '<a href="' . $TPL["url_alloc_task"] . 'taskID=' . $TPL["task_taskID"] . '&sbs_link=comments">Full</a>';
    } else {
        $TPL["commentsR"] = comment::util_get_comments("task", $taskID);
        $TPL["extra_page_links"] = '<a href="' . $TPL["url_alloc_task"] . 'taskID=' . $TPL["task_taskID"];
        $TPL["extra_page_links"] .= '&sbs_link=comments&commentSummary=true&maxCommentLength=50000000">Summary</a>';
    }
    $TPL["commentsR"] and $TPL["class_new_comment"] = "hidden";
    $TPL["allParties"] = $task->get_all_parties($task->get_value("projectID")) or $TPL["allParties"] = array();
    $TPL["entity"] = "task";
    $TPL["entityID"] = $task->get_id();
    if (has("project")) {
        $project = $task->get_foreign_object("project");
        $TPL["clientID"] = $project->get_value("clientID");
    }
    $commentTemplate = new commentTemplate();
    $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "task"));
    $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
    include_template("../comment/templates/commentM.tpl");
}
예제 #6
0
     $TPL["reminder_default_subject"] = $reminder->get_value('reminderSubject');
 } else {
     if ($parentType == "client") {
         $TPL["reminder_default_subject"] = commentTemplate::populate_string(config::get_config_item("emailSubject_reminderClient"), "client", $parentID);
         $TPL["reminder_default_content"] = config::get_config_item("allocURL") . "client/client.php?clientID=" . $parentID;
     } else {
         if ($parentType == "project") {
             $TPL["reminder_default_subject"] = commentTemplate::populate_string(config::get_config_item("emailSubject_reminderProject"), "project", $parentID);
             $TPL["reminder_default_content"] = config::get_config_item("allocURL") . "project/project.php?projectID=" . $parentID;
         } else {
             if ($parentType == "task") {
                 $TPL["reminder_default_subject"] = commentTemplate::populate_string(config::get_config_item("emailSubject_reminderTask"), "task", $parentID);
                 $TPL["reminder_default_content"] = config::get_config_item("allocURL") . "task/task.php?taskID=" . $parentID;
             } else {
                 if ($parentType == "general") {
                     $TPL["reminder_default_subject"] = commentTemplate::populate_string(config::get_config_item("emailSubject_reminderOther"), "");
                 }
             }
         }
     }
 }
 $TPL["reminder_default_content"] .= "\n" . $reminder->get_value('reminderContent');
 $TPL["parentType"] = $parentType;
 $TPL["parentID"] = $parentID;
 $TPL["reminderActive"] = $reminder->get_value("reminderActive");
 if (!is_object($reminder) || !$reminder->get_id()) {
     $TPL["reminderActive"] = true;
 }
 if ($reminder->get_value("reminderHash")) {
     $db = new db_alloc();
     $r = $db->qr("SELECT tokenAction\n                    FROM token \n               LEFT JOIN tokenAction ON token.tokenActionID = tokenAction.tokenActionID\n                   WHERE token.tokenHash = '%s'", $reminder->get_value("reminderHash"));
예제 #7
0
     }
 }
 // If not found, append the comment to the mailbox
 if (!$found) {
     e("Appending this comment: " . $row["comment"]);
     $people_cache =& get_cached_table("person");
     $name = $people_cache[$row["commentCreatedUser"]]["name"];
     $email = add_brackets($people_cache[$row["commentCreatedUser"]]["emailAddress"]);
     $eml = array();
     $eml[] = "From: " . $name . " " . $email;
     $eml[] = "Date: " . date('D M  j G:i:s Y', strtotime($row["commentCreatedTime"]));
     $e = new $entity();
     $e->set_id($entityID);
     $e->select();
     $tpl = config::get_config_item("emailSubject_" . $entity . "Comment");
     $tpl and $subject = commentTemplate::populate_string($tpl, $entity, $entityID);
     $entity != "task" and $prefix = ucwords($entity) . " Comment: ";
     $subject or $subject = $prefix . $entityID . " " . $e->get_name(DST_VARIABLE);
     $r = $db->qr("SELECT tokenHash FROM token WHERE tokenEntity = 'comment' AND tokenEntityID = %d", $row["commentID"]);
     $subject_header = "Subject: " . $subject . " {Key:" . $r["tokenHash"] . "}";
     $eml[] = $subject_header;
     $recipients = comment::get_email_recipients(array("interested"), $entity, $entityID);
     list($to_address, $bcc, $successful_recipients) = comment::get_email_recipient_headers($recipients, $people_cache[$row["commentCreatedUser"]]["emailAddress"]);
     $eml[] = "To: " . $to_address;
     $eml[] = "";
     $eml[] = $row["comment"];
     $eml = implode("\n", $eml);
     //$eml = str_replace("\n","<br>",htmlentities($eml)); //TODO: remove
     //echo("<br><b style='font-size:70%'>".$eml."</b>");
     $mail->mail_headers["subject"] = $subject_header;
     // hack
예제 #8
0
    function email_move_status_to_finished($direction, $info)
    {
        if ($direction == "forwards") {
            //requires INVOICE_TIMESHEETS
            if (!$this->have_perm(PERM_TIME_INVOICE_TIMESHEETS)) {
                //no permission, go away
                alloc_error("You do not have permission to change this timesheet.");
            }
            //transactions
            $q = prepare("SELECT DISTINCT transaction.transactionDate, transaction.product, transaction.status\n                      FROM transaction\n                      JOIN tf ON tf.tfID = transaction.tfID OR tf.tfID = transaction.fromTfID\n                RIGHT JOIN tfPerson ON tfPerson.personID = %d AND tfPerson.tfID = tf.tfID\n                     WHERE transaction.timeSheetID = %d\n                   ", $this->get_value('personID'), $this->get_id());
            $db = new db_alloc();
            $db->query($q);
            //the email itself
            $email = array();
            $email["type"] = "timesheet_finished";
            $email["to"] = $info["timeSheet_personID_email"];
            $email["subject"] = commentTemplate::populate_string(config::get_config_item("emailSubject_timeSheetCompleted"), "timeSheet", $this->get_id());
            $email["body"] = <<<EOD
         To: {$info["timeSheet_personID_name"]}
 Time Sheet: {$info["url"]}
For Project: {$info["projectName"]}

Your timesheet has been completed by {$info["current_user_name"]}.

EOD;
            if ($db->num_rows() > 0) {
                $email["body"] .= "Transaction summary:\n";
                $status_ops = array("pending" => "Pending", "approved" => "Approved", "rejected" => "Rejected");
                while ($db->next_record()) {
                    $email["body"] .= $db->f("transactionDate") . " for " . $db->f("product") . ": " . $status_ops[$db->f("status")] . "\n";
                }
            }
            $msg[] = $this->shootEmail($email);
            $this->set_value("status", "finished");
            return $msg;
        }
    }
예제 #9
0
function show_comments()
{
    global $timeSheetID;
    global $TPL;
    global $timeSheet;
    if ($timeSheetID) {
        $TPL["commentsR"] = comment::util_get_comments("timeSheet", $timeSheetID);
        $TPL["class_new_comment"] = "hidden";
        $TPL["allParties"] = $timeSheet->get_all_parties($timeSheet->get_value("projectID")) or $TPL["allParties"] = array();
        $TPL["entity"] = "timeSheet";
        $TPL["entityID"] = $timeSheet->get_id();
        $p = $timeSheet->get_foreign_object('project');
        $TPL["clientID"] = $p->get_value("clientID");
        $commentTemplate = new commentTemplate();
        $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "timeSheet"));
        $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
        $timeSheetPrintOptions = config::get_config_item("timeSheetPrintOptions");
        $timeSheetPrint = config::get_config_item("timeSheetPrint");
        $ops = array("" => "Format as...");
        foreach ($timeSheetPrint as $value) {
            $ops[$value] = $timeSheetPrintOptions[$value];
        }
        $TPL["attach_extra_files"] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $TPL["attach_extra_files"] .= "Attach Time Sheet ";
        $TPL["attach_extra_files"] .= '<select name="attach_timeSheet">' . page::select_options($ops) . '</select><br>';
        include_template("../comment/templates/commentM.tpl");
    }
}
예제 #10
0
 function get_populated_template($entity, $entityID = false)
 {
     // Gets a populated template for this->commentTemplateName
     $str = $this->get_value("commentTemplateText");
     return commentTemplate::populate_string($str, $entity, $entityID);
 }
예제 #11
0
파일: project.php 프로젝트: cjbayliss/alloc
function show_comments()
{
    global $projectID;
    global $TPL;
    global $project;
    $TPL["commentsR"] = comment::util_get_comments("project", $projectID);
    $TPL["commentsR"] and $TPL["class_new_comment"] = "hidden";
    $interestedPartyOptions = $project->get_all_parties();
    $interestedPartyOptions = interestedParty::get_interested_parties("project", $project->get_id(), $interestedPartyOptions);
    $TPL["allParties"] = $interestedPartyOptions or $TPL["allParties"] = array();
    $TPL["entity"] = "project";
    $TPL["entityID"] = $project->get_id();
    $TPL["clientID"] = $project->get_value("clientID");
    $commentTemplate = new commentTemplate();
    $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "project"));
    $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
    $ops = array("" => "Format as...", "pdf" => "PDF", "pdf_plus" => "PDF+", "html" => "HTML", "html_plus" => "HTML+");
    $TPL["attach_extra_files"] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $TPL["attach_extra_files"] .= "Attach Task Report ";
    $TPL["attach_extra_files"] .= '<select name="attach_tasks">' . page::select_options($ops) . '</select><br>';
    include_template("../comment/templates/commentM.tpl");
}
예제 #12
0
 * allocPSA is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "../alloc.php";
// Create an object to hold a commentTemplate
$commentTemplate = new commentTemplate();
// Load the commentTemplate from the database
$commentTemplateID = $_POST["commentTemplateID"] or $commentTemplateID = $_GET["commentTemplateID"];
if ($commentTemplateID) {
    $commentTemplate->set_id($commentTemplateID);
    $commentTemplate->select();
}
// Process submission of the form using the save button
if ($_POST["save"]) {
    $commentTemplate->read_globals();
    $commentTemplate->save();
    alloc_redirect($TPL["url_alloc_commentTemplateList"]);
    // Process submission of the form using the delete button
} else {
    if ($_POST["delete"]) {
        $commentTemplate->delete();
예제 #13
0
/*
 * Copyright (C) 2006-2011 Alex Lance, Clancy Malcolm, Cyber IT Solutions
 * Pty. Ltd.
 * 
 * This file is part of the allocPSA application <*****@*****.**>.
 * 
 * allocPSA is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
define("NO_REDIRECT", 1);
require_once "../alloc.php";
if ($_GET["commentTemplateID"] && $_GET["commentTemplateID"] != "undefined" && $_GET["entity"] && $_GET["entityID"]) {
    $commentTemplate = new commentTemplate();
    $commentTemplate->set_id($_GET["commentTemplateID"]);
    $commentTemplate->select();
    $val = $commentTemplate->get_populated_template($_GET["entity"], $_GET["entityID"]);
    echo page::textarea("comment", $val, array("height" => "medium", "width" => "100%"));
} else {
    echo page::textarea("comment", $val, array("height" => "medium", "width" => "100%"));
}
echo "<script>\$('textarea:not(.processed)').TextAreaResizer();</script>";
예제 #14
0
파일: invoice.php 프로젝트: cjbayliss/alloc
function show_comments()
{
    global $invoiceID;
    global $TPL;
    global $invoice;
    if ($invoiceID) {
        $TPL["commentsR"] = comment::util_get_comments("invoice", $invoiceID);
        $TPL["class_new_comment"] = "hidden";
        if ($invoice->get_value("projectID")) {
            $project = $invoice->get_foreign_object("project");
            $interestedPartyOptions = $project->get_all_parties($invoice->get_value("projectID"));
            $client = $project->get_foreign_object("client");
            $clientID = $client->get_id();
        } else {
            if ($invoice->get_value("clientID")) {
                $client = $invoice->get_foreign_object("client");
                $interestedPartyOptions = $client->get_all_parties($invoice->get_value("clientID"));
                $clientID = $client->get_id();
            }
        }
        $interestedPartyOptions = interestedParty::get_interested_parties("invoice", $invoice->get_id(), $interestedPartyOptions);
        $TPL["allParties"] = $interestedPartyOptions or $TPL["allParties"] = array();
        $TPL["entity"] = "invoice";
        $TPL["entityID"] = $invoice->get_id();
        $TPL["clientID"] = $clientID;
        $commentTemplate = new commentTemplate();
        $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "invoice"));
        $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
        $ops = array("" => "Format as...", "generate_pdf" => "PDF Invoice", "generate_pdf_verbose" => "PDF Invoice - verbose");
        $TPL["attach_extra_files"] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $TPL["attach_extra_files"] .= "Attach Invoice ";
        $TPL["attach_extra_files"] .= '<select name="attach_invoice">' . page::select_options($ops) . '</select><br>';
        include_template("../comment/templates/commentM.tpl");
    }
}
예제 #15
0
function show_comments()
{
    global $productSaleID;
    global $TPL;
    global $productSale;
    if ($productSaleID) {
        $TPL["commentsR"] = comment::util_get_comments("productSale", $productSaleID);
        $TPL["class_new_comment"] = "hidden";
        $TPL["entity"] = "productSale";
        $TPL["entityID"] = $productSale->get_id();
        $project = $productSale->get_foreign_object('project');
        $TPL["clientID"] = $project->get_value("clientID");
        $TPL["allParties"] = $productSale->get_all_parties($productSale->get_value("projectID")) or $TPL["allParties"] = array();
        $commentTemplate = new commentTemplate();
        $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "productSale"));
        $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
        include_template("../comment/templates/commentM.tpl");
    }
}
예제 #16
0
    $person = new person();
    $person->read_db_record($db);
    $person->set_id($db->f("personID"));
    $person->load_prefs();
    if (!$person->prefs["dailyTaskEmail"]) {
        continue;
    }
    $msg = "";
    $tasks = "";
    $to = "";
    if ($announcement["heading"]) {
        $msg .= $announcement["heading"];
        $msg .= "\n" . $announcement["body"] . "\n";
        $msg .= "\n- - - - - - - - - -\n";
    }
    if ($person->get_value("emailAddress")) {
        $tasks = $person->get_tasks_for_email();
        $msg .= $tasks;
        $subject = commentTemplate::populate_string(config::get_config_item("emailSubject_dailyDigest", ""));
        $to = $person->get_value("emailAddress");
        if ($person->get_value("firstName") && $person->get_value("surname") && $to) {
            $to = $person->get_value("firstName") . " " . $person->get_value("surname") . " <" . $to . ">";
        }
        if ($tasks && $to) {
            $email = new email_send($to, $subject, $msg, "daily_digest");
            if ($email->send()) {
                echo "\n<br>Sent email to: " . $to;
            }
        }
    }
}