Пример #1
0
function createHistory($o, $h)
{
    if ($o instanceof Ticket) {
        $history = new TicketHistory();
        $history->setTicket($o);
    } else {
        $history = new IssueHistory();
        $history->setIssue($o);
    }
    if (!empty($h['enteredDate'])) {
        $d = DateTime::createFromFormat('U', $h['enteredDate']->sec);
        if ($d) {
            $history->setEnteredDate($d->format('Y-m-d H:i:s'));
        }
    }
    if (!empty($h['actionDate'])) {
        $d = DateTime::createFromFormat('U', $h['actionDate']->sec);
        if ($d) {
            $history->setActionDate($d->format('Y-m-d H:i:s'));
        }
    }
    if (!empty($h['enteredByPerson'])) {
        $id = getPersonIdFromCrosswalk($h['enteredByPerson']['_id']);
        if ($id) {
            $history->setEnteredByPerson_id($id);
        }
    }
    if (!empty($h['actionPerson'])) {
        $id = getPersonIdFromCrosswalk($h['actionPerson']['_id']);
        if ($id) {
            $history->setActionPerson_id($id);
        }
    }
    if (!empty($h['action'])) {
        try {
            $action = new Action($h['action']);
        } catch (Exception $e) {
            $action = new Action();
            $action->setName($h['action']);
            $action->setDescription($h['action']);
            $action->setType('system');
        }
        $history->setAction($action);
    }
    if (!empty($h['notes'])) {
        $history->setNotes($h['notes']);
    }
    $history->save();
}
Пример #2
0
<?php

require 'includes/master.inc.php';
$Auth->requireAdmin();
$db = Database::getDatabase();
$Nav = 'tickets';
$ticket = new Ticket($_GET['id']);
if (!$ticket->ok()) {
    redirect('/tickets/');
}
$app = new Application($ticket->app_id);
$user = new User($ticket->created_by);
$milestone = new Milestone($ticket->milestone_id);
if (isset($_POST['btnUpdate'])) {
    $th = new TicketHistory();
    $th->dt = dater();
    $th->ticket_id = $ticket->id;
    $th->app_id = $ticket->app_id;
    $th->user_id = $Auth->id;
    $th->user_from = $ticket->assigned_to;
    $th->user_to = $_POST['assigned_to'];
    $th->status_from = $ticket->status;
    $th->status_to = $_POST['status'];
    $th->milestone_from_id = $ticket->milestone_id;
    $th->milestone_to_id = $_POST['milestone_id'];
    $th->comment = trim($_POST['comment']);
    $changed = false;
    if ($th->user_from != $th->user_to) {
        $changed = true;
    }
    if ($th->status_from != $th->status_to) {
Пример #3
0
 function postAdd()
 {
     $hist = new TicketHistory($this->__masterserver, $this->__readserver, $this->nname . "___" . '0');
     $rhis['text_reason'] = $this->descr_f;
     $rhis['state_from'] = "";
     $rhis['ddate'] = time();
     $rhis['parent_clname'] = $this->getClName();
     $rhis['state'] = "open";
     $rhis['made_by'] = $this->made_by;
     $hist->create($rhis);
     $this->addToList("tickethistory", $hist);
     $this->realpass = randomString(6);
     $this->password = crypt($this->realpass);
     $this->status = 'on';
     $this->cpstatus = 'on';
     $this->escalate = 'dull';
     list($sec, $usec) = explode(" ", microtime());
     $this->mail_messageid = "<{$sec}{$usec}.GA8614@lxlabs.com>";
     ticketHistory::getObjectsTosend($this, $rhis, "ticketadd");
 }
Пример #4
0
$pname = $matches[1];
if (cse($pname, ".vm")) {
    $pclass = "vps";
}
/*
if (!csa($matches[1], "-")) {
	$pclass = "client";
	$pname = $matches[1];
} else {
	$pp = explode("-", $matches[1]);
	$pclass = $pp[0];
	$pname = $pp[1];
}
*/
$pobject = new $pclass(null, null, $pname);
$pobject->get();
$tick = new Ticket(null, null, $ticketid);
$tick->get();
$param['state'] = 'open';
$param['text_reason'] = $message;
$param['pobject'] = $pobject;
$param['made_by'] = createClName($pclass, $pname);
$param['from_ad'] = $email->from;
$param = tickethistory::add($tick, 'tickethistory', $param);
$newob = new TicketHistory(null, null, $param['nname']);
$newob->ddate = time();
$tick->unread_flag = 'dull';
$newob->parent_clname = $tick->getClName();
$newob->create($param);
$newob->write();
$tick->write();