Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Commit

Permalink
Closes #133/#134 - Set status when creating ticket, set correct langu…
Browse files Browse the repository at this point in the history
…age for ticket's user
  • Loading branch information
mike-koch committed Feb 20, 2015
1 parent 1b5d468 commit 50df476
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions inc/posting_functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ function hesk_newTicket($ticket)

// If language is not set or default, set it to NULL.
if (!isset($ticket['language']) || empty($ticket['language'])) {
$language = (!$hesk_settings['can_sel_lang'] || $hesklang['LANGUAGE'] == HESK_DEFAULT_LANGUAGE) ? "NULL" : "'" . hesk_dbEscape($hesklang['LANGUAGE']) . "'";
$language = (!$hesk_settings['can_sel_lang']) ? HESK_DEFAULT_LANGUAGE : "'" . hesk_dbEscape($hesklang['LANGUAGE']) . "'";
} else {
$language = $ticket['language'];
}

// Get the default ticket status for new tickets and set it accordingly
$defaultNewTicketRs = hesk_dbQuery("SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `IsNewTicketStatus` = 1");
$defaultNewTicket = hesk_dbFetchAssoc($defaultNewTicketRs);
$ticket['status'] = $defaultNewTicket['ID'];

// Insert ticket into database
hesk_dbQuery("
INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets`
Expand Down Expand Up @@ -88,7 +93,8 @@ function hesk_newTicket($ticket)
`custom17`,
`custom18`,
`custom19`,
`custom20`
`custom20`,
`status`
)
VALUES
(
Expand Down Expand Up @@ -128,7 +134,8 @@ function hesk_newTicket($ticket)
'".hesk_dbEscape($ticket['custom17'])."',
'".hesk_dbEscape($ticket['custom18'])."',
'".hesk_dbEscape($ticket['custom19'])."',
'".hesk_dbEscape($ticket['custom20'])."'
'".hesk_dbEscape($ticket['custom20'])."',
'".intval($ticket['status'])."'
)
");

Expand All @@ -139,7 +146,7 @@ function hesk_newTicket($ticket)
'priority' => $ticket['priority'],
'owner' => $ticket['owner'],
'trackid' => $ticket['trackid'],
'status' => 0,
'status' => $ticket['status'],
'name' => $ticket['name'],
'lastreplier' => $ticket['name'],
'subject' => $ticket['subject'],
Expand Down

0 comments on commit 50df476

Please sign in to comment.