示例#1
0
function merge_workorders($wo1, $wo2)
{
    $loc = rmabs(__FILE__ . ".merge_workorders");
    $wid1 = $wo1["WID"];
    $wid2 = $wo2["WID"];
    $wo1["Description"] .= "\n\n" . $wo2["Description"];
    UpdateWorkOrder($wid1, $wo1);
    $data = GetAppendedData($wid2);
    $nd = 0;
    foreach ($data as $d) {
        if ($d["UserID"] == 0) {
            continue;
        }
        // Skip sys generated msg.
        if ($d["Removed"]) {
            continue;
        }
        // Skip deleted data.
        AppendWorkOrderData($wid1, $d["UserID"], $d["TextInfo"], $d["PicID"], false);
        $nd++;
    }
    $workers = GetAssignedWorkers($wid2);
    $nw = 0;
    foreach ($workers as $w) {
        MakeAssignment($wid1, $w["UserID"]);
        RemoveAssignment($wid2, $w["UserID"]);
        $nw++;
    }
    $userid = GetUserID();
    $userinfo = GetUserInfo($userid);
    $username = MakeFullName($userinfo);
    if (!$wo2["Closed"]) {
        ChangeWOStatus($wid2, $username, "Closed", true);
    }
    $newwostr = WIDStr($wid1, $wo1["Revision"], $wo1["IsApproved"]);
    AttachSystemNote($wid2, "This WO Merged into " . $newwostr . " by " . $username . '.');
    $oldwostr = WIDStr($wid2, $wo2["Revision"], $wo2["IsApproved"]);
    AttachSystemNote($wid1, "Data from " . $oldwostr . " merged into this one by " . $username . '.');
    $msg = 'Workorder ' . $oldwostr . ' merged into ' . $newwostr . '.  ';
    $msg .= 'Number Items Copied=' . $nd . '. ';
    $msg .= 'Number of Workers Reassigned=' . $nw . '. ';
    log_msg($loc, array($msg, "By " . $username));
    return $msg;
}
示例#2
0
    $textinfo = $_POST["TextInfo"];
    $primary = $_POST["MainPic"];
    $picid = 0;
    if (isset($_FILES["PicFile"])) {
        $fileinfo = $_FILES["PicFile"];
        if (CheckFileInput($fileinfo)) {
            $picid = PicFileUpload($_FILES["PicFile"]);
            if (!$picid) {
                $error_msg = "Uploaded File does not seem to be a picture.";
                goto GenerateHtml;
            }
        }
    }
    if ($_POST["IncRevision"]) {
        $userinfo = GetUserInfo($userid);
        $username = MakeFullName($userinfo);
        //MakeAbbrivatedName($userinfo);
        IncrementRevision($wid, $username);
    }
    AppendWorkOrderData($wid, $userid, $textinfo, $picid, $primary);
    $success_msg = "Data Added!";
    $wo = GetWO($wid);
    $doform = false;
    goto GenerateHtml;
}
GenerateHtml:
$stylesheet = array("../css/global.css", "../css/nav.css", "../css/wo_head.css", "../css/wo_add_data.css");
include "forms/header.php";
include "forms/nav_form.php";
include "forms/wo_display_menubar.php";
include "forms/wo_add_data_form.php";
示例#3
0
function GetAssignedWorkers($wid)
{
    $loc = rmabs(__FILE__ . "GetAssignedWorkers");
    $sql = 'SELECT * FROM AssignedUsersView WHERE WID=' . intval($wid);
    $result = SqlQuery($loc, $sql);
    $d = array();
    while ($row = $result->fetch_assoc()) {
        $row["AbbrivatedName"] = MakeAbbrivatedName($row);
        $row["FullName"] = MakeFullName($row);
        $d[] = $row;
    }
    return $d;
}