本文整理汇总了PHP中Ticket::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::update方法的具体用法?PHP Ticket::update怎么用?PHP Ticket::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doLevelForTicket
/**
* Do a specific SLAlevel for a ticket
*
* @param $data array data of an entry of slalevels_tickets
*
* @return nothing
**/
static function doLevelForTicket(array $data)
{
$ticket = new Ticket();
$slalevelticket = new self();
// existing ticket and not deleted
if ($ticket->getFromDB($data['tickets_id']) && !$ticket->isDeleted()) {
$slalevel = new SlaLevel();
$sla = new SLA();
// Check if sla datas are OK
if ($ticket->fields['slas_id'] > 0 && $ticket->fields['slalevels_id'] == $data['slalevels_id']) {
if ($ticket->fields['status'] == CommonITILObject::CLOSED) {
// Drop line when status is closed
$slalevelticket->delete(array('id' => $data['id']));
} else {
if ($ticket->fields['status'] != CommonITILObject::SOLVED) {
// If status = solved : keep the line in case of solution not validated
$input['id'] = $ticket->getID();
$input['_auto_update'] = true;
if ($slalevel->getRuleWithCriteriasAndActions($data['slalevels_id'], 1, 1) && $sla->getFromDB($ticket->fields['slas_id'])) {
$doit = true;
if (count($slalevel->criterias)) {
$doit = $slalevel->checkCriterias($ticket->fields);
}
// Process rules
if ($doit) {
$input = $slalevel->executeActions($input, array());
}
}
// Put next level in todo list
$next = $slalevel->getNextSlaLevel($ticket->fields['slas_id'], $ticket->fields['slalevels_id']);
$input['slalevels_id'] = $next;
$ticket->update($input);
$sla->addLevelToDo($ticket);
// Action done : drop the line
$slalevelticket->delete(array('id' => $data['id']));
}
}
} else {
// Drop line
$slalevelticket->delete(array('id' => $data['id']));
}
} else {
// Drop line
$slalevelticket->delete(array('id' => $data['id']));
}
}
示例2: Ticket
function post_addItem()
{
if ($this->fields['itemtype'] == 'Ticket') {
$ticket = new Ticket();
$ticket->update(array('id' => $this->fields['items_id'], 'date_mod' => $_SESSION["glpi_currenttime"], '_forcenotif' => true, '_donotadddocs' => true));
}
parent::post_addItem();
}
示例3: Ticket
function post_purgeItem()
{
$ticket = new Ticket();
$input = array('id' => $this->fields['tickets_id'], 'date_mod' => $_SESSION["glpi_currenttime"], '_donotadddocs' => true);
if (!isset($this->input['_do_notif']) || $this->input['_do_notif']) {
$input['_forcenotif'] = true;
}
$ticket->update($input);
parent::post_purgeItem();
}
示例4: Ticket
function post_deleteFromDB()
{
global $CFG_GLPI;
$donotif = $CFG_GLPI["use_mailing"];
if (isset($this->input["_no_notif"]) && $this->input["_no_notif"]) {
$donotif = false;
}
$t = new Ticket();
if ($t->getFromDB($this->fields['tickets_id'])) {
if ($t->fields["suppliers_id_assign"] == 0 && $t->countUsers(Ticket::ASSIGN) == 0 && $t->countGroups(Ticket::ASSIGN) == 0) {
$t->update(array('id' => $this->fields['tickets_id'], 'status' => 'new'));
} else {
$t->updateDateMod($this->fields['tickets_id']);
if ($donotif) {
NotificationEvent::raiseEvent("update", $t);
}
}
}
parent::post_deleteFromDB();
}
示例5: TicketTask
$ttask = new TicketTask();
if (isset($_POST["add"])) {
$ttask->check(-1, 'w', $_POST);
$ttask->add($_POST);
Event::log($ttask->getField('tickets_id'), "ticket", 4, "tracking", sprintf(__('%s adds a task'), $_SESSION["glpiname"]));
}
}
//add document
if (isset($_REQUEST['filename']) && !empty($_REQUEST['filename'])) {
$doc = new Document();
if (isset($_POST["add"])) {
$doc->check(-1, 'w', $_POST);
if ($newID = $doc->add($_POST)) {
Event::log($newID, "documents", 4, "login", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $doc->fields["name"]));
}
}
}
//change ticket status
if (isset($_REQUEST['status']) && !empty($_REQUEST['status'])) {
$ticket = new Ticket();
$ticket->update(array('id' => intval($_REQUEST['tickets_id']), 'status' => intval($_REQUEST['status'])));
}
//delete document
if (isset($_REQUEST['delete_document'])) {
$document_item = new Document_Item();
$found_document_items = $document_item->find("itemtype = 'Ticket' " . " AND items_id = " . intval($_REQUEST['tickets_id']) . " AND documents_id = " . intval($_REQUEST['documents_id']));
foreach ($found_document_items as $item) {
$document_item->delete($item, true);
}
}
Html::back();
示例6: deleteTicketAssignation
/**
* Delete all tickets for an itemtype
* @param the itemtype
* @return nothing
*/
public static function deleteTicketAssignation($itemtype)
{
global $DB;
$ticket = new Ticket();
foreach ($ticket->find("`itemtype`='{$itemtype}'") as $data) {
$data['itemtype'] = '';
$data['items_id'] = 0;
$ticket->update($data);
}
}
示例7: updateTicketStatusAndPriority
/**
* updates the ticket's status & priority.
* A log entry about this will be created only if the newStatus is different from the current status and also when the newPriority is different from the current priority.
* @todo break this function up into a updateStatus (already exists) and updatePriority function and perhaps write a wrapper function for the combo.
* @param $ticket_id the id of the ticket of which we want to change the status & priority
* @param $newStatus the new status value (integer)
* @param $newPriority the new priority value (integer)
* @param $author the user (id) that performed the update
*/
public static function updateTicketStatusAndPriority($ticket_id, $newStatus, $newPriority, $author)
{
$ticket = new Ticket();
$ticket->load_With_TId($ticket_id);
if ($ticket->getStatus() != $newStatus) {
$ticket->setStatus($newStatus);
Ticket_Log::createLogEntry($ticket_id, $author, 5, $newStatus);
}
if ($ticket->getPriority() != $newPriority) {
$ticket->setPriority($newPriority);
Ticket_Log::createLogEntry($ticket_id, $author, 6, $newPriority);
}
$ticket->update();
}
示例8: UpdateTicket
/**
*
* Update Ticket into Database
* @param array $aryTicket Ticket object
*/
private function UpdateTicket($aryTicket)
{
global $db, $conf;
$function = "UpdateTicket";
$idTicket = -1;
$data = $aryTicket['data'];
$lines = $data['lines'];
$idTicket = $data['id'];
$statut = 0;
if (!$data['customerId']) {
$cash = new Cash($db);
$terminal = $_SESSION['TERMINAL_ID'];
$cash->fetch($terminal);
$socid = $cash->fk_soc;
} else {
$socid = $data['customerId'];
}
if (!$data['employeeId']) {
$employee = $_SESSION['uid'];
} else {
$employee = $data['employeeId'];
}
$object = new Ticket($db);
$object->fetch($idTicket);
$object->type = $data['type'];
$object->socid = $socid;
$object->statut = $data['state'];
$object->fk_cash = $_SESSION['TERMINAL_ID'];
$object->remise_percent = $data['discount_percent'];
$object->remise_absolut = $data['discount_qty'];
$object->mode_reglement_id = $data['payment_type'];
$object->fk_place = $data['id_place'];
$object->note = $data['note'];
$cash = new Cash($db);
$cash->fetch($_SESSION['TERMINAL_ID']);
if ($data['payment_type'] != $cash->fk_modepaycash) {
if ($data['points'] > 0) {
$object->customer_pay = $data['total_with_points'];
} else {
$object->customer_pay = $data['total'];
}
} else {
$object->customer_pay = $data['customerpay'];
}
$data['customerpay'] = $object->customer_pay;
$object->diff_payment = $data['difpayment'];
$object->id_source = $data['idsource'];
$userstatic = new User($db);
$userstatic->fetch($employee);
$db->begin;
$res = $object->update($userstatic->id);
$data['ref'] = $object->ref;
if ($res < 0) {
$db->rollback();
return -5;
} else {
//Adding lines
$idLines = self::addTicketLines($lines, $idTicket);
if ($idLines < 0) {
$db->rollback();
return -2;
} else {
$place = new Place($db);
$place->fetch($object->fk_place);
if ($object->statut != 0) {
//Adding Payments
$payment = self::addPayment($data);
if (!$payment) {
$db->rollback();
return -3;
} else {
if ($object->diff_payment <= 0) {
$object->set_paid($user);
}
}
//Decrease stock
$stock = self::quitSotck($lines);
if ($stock) {
$db->rollback();
return -4;
}
// liberar puesto
$place->free_place();
} else {
// usar puesto
$place->set_place($idTicket);
}
}
}
$db->commit;
return $idTicket;
}
示例9: Ticket
function post_addItem()
{
global $LANG, $CFG_GLPI;
$job = new Ticket();
$mailsend = false;
if ($job->getFromDB($this->fields["tickets_id"])) {
// Set global validation to waiting
if ($job->fields['global_validation'] == 'accepted' || $job->fields['global_validation'] == 'none') {
$input['id'] = $this->fields["tickets_id"];
$input['global_validation'] = 'waiting';
// to fix lastupdater
if (isset($this->input['_auto_update'])) {
$input['_auto_update'] = $this->input['_auto_update'];
}
$job->update($input);
}
if ($CFG_GLPI["use_mailing"]) {
$options = array('validation_id' => $this->fields["id"], 'validation_status' => $this->fields["status"]);
$mailsend = NotificationEvent::raiseEvent('validation', $job, $options);
}
if ($mailsend) {
$user = new User();
$user->getFromDB($this->fields["users_id_validate"]);
if (!empty($user->fields["email"])) {
addMessageAfterRedirect($LANG['validation'][13] . " " . $user->getName());
} else {
addMessageAfterRedirect($LANG['validation'][23], false, ERROR);
}
}
// Add log entry in the ticket
$changes[0] = 0;
$changes[1] = '';
$changes[2] = addslashes($LANG['validation'][13] . " " . getUserName($this->fields["users_id_validate"]));
Log::history($this->getField('tickets_id'), 'Ticket', $changes, $this->getType(), HISTORY_LOG_SIMPLE_MESSAGE);
}
}
示例10: changeTicketDetails
public static function changeTicketDetails($id, $title, $text, $location, $solution, $reference, $handle_id)
{
$ticket = new Ticket(array('id' => $id, 'title' => $title, 'text' => $text, 'location' => $location, 'solution' => $solution, 'reference' => $reference, 'handle_id' => $handle_id));
$ticket->update();
}
示例11: dater
if ($th->status_from != $th->status_to) {
$changed = true;
}
if ($th->milestone_from_id != $th->milestone_to_id) {
$changed = true;
}
if (strlen($th->comment) > 0) {
$changed = true;
}
if ($changed) {
$ticket->assigned_to = $th->user_to;
$ticket->milestone_id = $th->milestone_to_id;
$ticket->status = $th->status_to;
$ticket->dt_last_state = dater();
$th->insert();
$ticket->update();
redirect('/ticket/' . $ticket->id . '/');
}
} else {
$tags = '';
}
include 'inc/header.inc.php';
?>
<div id="bd">
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<div class="block tabs spaces">
<div class="hd">
<h2><?php
示例12: post_receive
public function post_receive()
{
if (empty($_POST['payload'])) {
exit("Empty payload.");
}
$json = json_decode($_POST['payload']);
# Handle special keywords that stand for models.
$targets = array("milestone" => array("Milestone", "name"), "owner" => array("User", "login"), "user" => array("User", "login"));
foreach ($json->commits as $commit) {
if (!preg_match("/\\[#[0-9]+(\\s[^\\]]+)?\\]/", $commit->message)) {
continue;
}
$user = new User(array("email" => $commit->author->email));
$message = "Updated in commit [" . substr($commit->id, 0, 8) . "](" . $commit->url . "):\n\n" . $commit->message;
preg_match_all("/\\[#([0-9]+)\\s?([^\\]]*)\\]/", $commit->message, $updates, PREG_SET_ORDER);
foreach ($updates as $update) {
$ticket = new Ticket($update[1], array("filter" => false));
if ($ticket->no_results) {
continue;
}
preg_match_all("/([a-zA-Z]+):(\"([^\"]+)\"|([^ ]+))/", $update[2], $changes, PREG_SET_ORDER);
$revchanges = array();
foreach ($changes as $change) {
$attribute = $change[1];
$value = oneof($change[3], $change[4]);
if (!in_array($attribute, array("title", "description", "state", "milestone", "owner", "user"))) {
continue;
}
foreach ($targets as $name => $target) {
if ($attribute == $name) {
$model = $target[0];
if (is_numeric($value)) {
$value = new $model($value);
} else {
$value = new $model(array($target[1] => $value));
}
}
}
$revchanges[$attribute] = $value;
}
$fromto = array();
foreach ($revchanges as $attr => $val) {
$old = @$ticket->{$attr};
$new = $val;
foreach ($targets as $name => $target) {
if ($attr == $name) {
$old = $ticket->{$name}->{$target}[1];
$new = $val->{$target}[1];
}
}
$fromto[$attr] = array("from" => $old, "to" => $new);
}
$ticket->update(@$revchanges["title"], @$revchanges["description"], @$revchanges["state"], @$revchanges["milestone"], @$revchanges["owner"], @$revchanges["user"]);
Revision::add($message, $fromto, $ticket, $user);
}
}
}
示例13: cleanRelationData
/**
* Clean data in the tables which have linked the deleted item
* Clear 1/N Relation
*
* @return nothing
**/
function cleanRelationData()
{
global $DB, $CFG_GLPI;
$RELATION = getDbRelations();
if (isset($RELATION[$this->getTable()])) {
$newval = isset($this->input['_replace_by']) ? $this->input['_replace_by'] : 0;
foreach ($RELATION[$this->getTable()] as $tablename => $field) {
if ($tablename[0] != '_') {
$itemtype = getItemTypeForTable($tablename);
// Code factorization : we transform the singleton to an array
if (!is_array($field)) {
$field = array($field);
}
foreach ($field as $f) {
foreach ($DB->request($tablename, array($f => $this->getID())) as $data) {
// Be carefull : we must use getIndexName because self::update rely on that !
if ($object = getItemForItemtype($itemtype)) {
$idName = $object->getIndexName();
// And we must ensure that the index name is not the same as the field
// we try to modify. Otherwise we will loose this element because all
// will be set to $newval ...
if ($idName != $f) {
$object->update(array($idName => $data[$idName], $f => $newval, '_disablenotif' => true));
// Disable notifs
}
}
}
}
}
}
}
// Clean ticket open against the item
if (in_array($this->getType(), $CFG_GLPI["ticket_types"])) {
$job = new Ticket();
$query = "SELECT *\n FROM `glpi_tickets`\n WHERE `items_id` = '" . $this->fields['id'] . "'\n AND `itemtype`='" . $this->getType() . "'";
$result = $DB->query($query);
if ($DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
if ($CFG_GLPI["keep_tickets_on_delete"] == 1) {
$input = array();
$input['id'] = $data["id"];
$input['items_id'] = 0;
$input['itemtype'] = '';
if ($data['status'] == 'closed') {
$input['_disablenotif'] = true;
}
$job->update($input);
} else {
$job->delete(array("id" => $data["id"]));
}
}
}
}
}
示例14: manageLinkedTicketsOnSolved
/**
* Affect the same solution for duplicates tickets
*
* @param $ID ID of the ticket id
*
* @return nothing do the change
**/
static function manageLinkedTicketsOnSolved($ID)
{
$ticket = new Ticket();
if ($ticket->getfromDB($ID)) {
$input['solution'] = addslashes($ticket->fields['solution']);
$input['ticketsolutiontypes_id'] = addslashes($ticket->fields['ticketsolutiontypes_id']);
$tickets = self::getLinkedTicketsTo($ID);
if (count($tickets)) {
foreach ($tickets as $data) {
$input['id'] = $data['tickets_id'];
if ($ticket->can($input['id'], 'w') && $data['link'] == self::DUPLICATE_WITH && $ticket->fields['status'] != 'solved' && $ticket->fields['status'] != 'closed') {
$ticket->update($input);
}
}
}
}
}
示例15: manageLinkedTicketsOnSolved
/**
* Affect the same solution for duplicates tickets
*
* @param $ID ID of the ticket id
*
* @return nothing do the change
**/
static function manageLinkedTicketsOnSolved($ID)
{
$ticket = new Ticket();
if ($ticket->getfromDB($ID)) {
$input['solution'] = addslashes($ticket->fields['solution']);
$input['solutiontypes_id'] = addslashes($ticket->fields['solutiontypes_id']);
$tickets = self::getLinkedTicketsTo($ID);
if (count($tickets)) {
foreach ($tickets as $data) {
$input['id'] = $data['tickets_id'];
if ($ticket->can($input['id'], UPDATE) && $data['link'] == self::DUPLICATE_WITH && $ticket->fields['status'] != CommonITILObject::SOLVED && $ticket->fields['status'] != CommonITILObject::CLOSED) {
$ticket->update($input);
}
}
}
}
}