Example #1
0
 function add_interested_parties($commentID, $ip = array(), $op = array())
 {
     // We send this email to the default from address, so that a copy of the
     // original email is kept. The receiveEmail.php script will see that this
     // email is *from* the same address, and will then skip over it, when going
     // through the new emails.
     if (defined("ALLOC_DEFAULT_FROM_ADDRESS") && ALLOC_DEFAULT_FROM_ADDRESS) {
         list($from_address, $from_name) = parse_email_address(ALLOC_DEFAULT_FROM_ADDRESS);
         $emailRecipients[] = $from_address;
     }
     interestedParty::make_interested_parties("comment", $commentID, $ip);
     $emailRecipients[] = "interested";
     // Other parties that are added on-the-fly
     foreach ((array) $op as $email => $info) {
         if ($email && in_str("@", $email)) {
             unset($lt, $gt);
             // used above
             $str = $info["name"];
             $str and $str .= " ";
             $str and $lt = "<";
             $str and $gt = ">";
             $str .= $lt . str_replace(array("<", ">"), "", $email) . $gt;
             $emailRecipients[] = $str;
             // Add a new client contact
             if ($info["addContact"] && $info["clientID"]) {
                 $q = prepare("SELECT * FROM clientContact WHERE clientID = %d AND clientContactEmail = '%s'", $info["clientID"], trim($email));
                 $db = new db_alloc();
                 if (!$db->qr($q)) {
                     $cc = new clientContact();
                     $cc->set_value("clientContactName", trim($info["name"]));
                     $cc->set_value("clientContactEmail", trim($email));
                     $cc->set_value("clientID", sprintf("%d", $info["clientID"]));
                     $cc->save();
                 }
             }
             // Add the person to the interested parties list
             if ($info["addIP"] && !interestedParty::exists("comment", $commentID, trim($email))) {
                 $interestedParty = new interestedParty();
                 $interestedParty->set_value("fullName", trim($info["name"]));
                 $interestedParty->set_value("emailAddress", trim($email));
                 $interestedParty->set_value("entityID", $commentID);
                 $interestedParty->set_value("entity", "comment");
                 $interestedParty->set_value("external", $info["internal"] ? "0" : "1");
                 $interestedParty->set_value("interestedPartyActive", "1");
                 if (is_object($cc) && $cc->get_id()) {
                     $interestedParty->set_value("clientContactID", $cc->get_id());
                 }
                 $interestedParty->save();
             }
         }
     }
     return $emailRecipients;
 }
Example #2
0
<?php

/*
 * 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";
interestedParty::make_interested_parties('comment', $_POST['commentID'], $_POST['comment_recipients']);
if (interestedParty::is_external('comment', $_POST['commentID'])) {
    echo 'external';
} else {
    echo 'internal';
}
Example #3
0
 }
 // enforced at the database, but show a friendlier error here if possible
 $query = prepare("SELECT COUNT(*) as count FROM project WHERE projectShortName = '%s'", $db->esc($project->get_value("projectShortName")));
 if (!$definitely_new_project) {
     $query .= prepare(" AND projectID != %d", $project->get_id());
 }
 $db->query($query);
 $db->next_record();
 if ($db->f('count') > 0) {
     alloc_error("A project with that nickname already exists.");
 }
 if (!$TPL["message"]) {
     $project->set_value("projectComments", rtrim($project->get_value("projectComments")));
     $project->save();
     $projectID = $project->get_id();
     interestedParty::make_interested_parties("project", $project->get_id(), $_POST["interestedParty"]);
     $client = new client();
     $client->set_id($project->get_value("clientID"));
     $client->select();
     if ($client->get_value("clientStatus") == 'Potential') {
         $client->set_value("clientStatus", "Current");
         $client->save();
     }
     if ($definitely_new_project) {
         $projectPerson = new projectPerson();
         $projectPerson->currency = $project->get_value("currencyTypeID");
         $projectPerson->set_value("projectID", $projectID);
         $projectPerson->set_value_role("isManager");
         $projectPerson->set_value("personID", $current_user->get_id());
         $projectPerson->save();
     }
Example #4
0
}
// If saving a record
if ($_POST["save"] || $_POST["save_and_back"] || $_POST["save_and_new"] || $_POST["save_and_summary"] || $_POST["timeSheet_save"] || $_POST["close_task"]) {
    $task->read_globals();
    if ($_POST["close_task"]) {
        $task->set_value("taskStatus", "closed_complete");
    }
    // If we're auto-nuking the pending tasks, we need to do that before the call to task->save()
    if ($task->get_id() && !$_POST["pendingTasksIDs"]) {
        $task->add_pending_tasks($_POST["pendingTasksIDs"]);
    }
    // Moved all validation over into task.inc.php save()
    $success = $task->save();
    count($msg) and $msg = "&message_good=" . urlencode(implode("<br>", $msg));
    if ($success) {
        interestedParty::make_interested_parties("task", $task->get_id(), $_POST["interestedParty"]);
        // A task can only have a pending task or pending reopen date - pending task is fixed up in JS, but check here too
        if ($task->get_value("taskStatus") != "pending_tasks") {
            $_POST['pendingTaskIDs'] = '';
        }
        $task->add_pending_tasks($_POST["pendingTasksIDs"]);
        $task->add_tags($_POST["tags"]);
        // This is only valid on pending_, but not on pending_task (because it has a different field)
        if (strpos($task->get_value("taskStatus"), "pending_") !== 0 || $task->get_value("taskStatus") == "pending_tasks") {
            $_POST['reopen_task'] = '';
        }
        $task->add_reopen_reminder($_POST["reopen_task"]);
        // Create reminders if necessary
        if ($_POST["createTaskReminder"] == true) {
            $task->create_task_reminder();
        }
Example #5
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/>.
*/
require_once "../alloc.php";
$current_user =& singleton("current_user");
$db = new db_alloc();
$invoiceRepeat = new invoiceRepeat($_REQUEST["invoiceRepeatID"]);
if ($_POST["save"]) {
    $invoiceRepeat->set_value("invoiceID", $_POST["invoiceID"]);
    $invoiceRepeat->set_value("message", $_POST["message"]);
    $invoiceRepeat->set_value("active", 1);
    $invoiceRepeat->set_value("personID", $current_user->get_id());
    $invoiceRepeat->save($_POST["frequency"]);
    interestedParty::make_interested_parties("invoiceRepeat", $invoiceRepeat->get_id(), $_POST["commentEmailRecipients"]);
}
alloc_redirect($TPL["url_alloc_invoice"] . "invoiceID=" . $_POST["invoiceID"]);