mirror of
https://github.com/itflow-org/itflow
synced 2026-11-23 12:57:24 +00:00
Tickets: Quick ticket, a + in the top bar, takes the client, contact found by name email or phone, and the issue, lists the contact's open tickets with Work on this one, raises it through add_ticket and opens it with its timer running, with what it starts with set in Admin Settings Tickets; a stopwatch in the top bar lists the ticket timers in this browser to open, pause, resume or throw away; database 3.7.6 adds the Quick tickets settings; 26.11.9 changelog entries
This commit is contained in:
48
admin/database_updates/3.7.6.php
Normal file
48
admin/database_updates/3.7.6.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* ITFlow - Database update to version 3.7.6 (from 3.7.5)
|
||||
* Included by admin/database_updates.php - do not access directly
|
||||
*
|
||||
* Quick ticket (functions/quick_ticket.php) - what a ticket raised from the top
|
||||
* bar's + starts with, set in Admin > Settings > Tickets, Quick tickets:
|
||||
* config_quick_ticket_on the button shows, for those who can make tickets
|
||||
* config_quick_ticket_assign 'me' (the agent making it), 'nobody', or an agent's id
|
||||
* config_quick_ticket_status 0 (New, or Open once someone has it), or a status an agent can pick
|
||||
* config_quick_ticket_priority Low, Medium, High or Urgent
|
||||
* config_quick_ticket_category 0, or a ticket category
|
||||
* config_quick_ticket_billable -1 as a new ticket starts (config_ticket_default_billable), else 1 or 0
|
||||
* config_quick_ticket_timer make, open or off - when its timer counts from
|
||||
* config_quick_ticket_primary the contact starts on the client's primary contact
|
||||
* config_quick_ticket_open_tickets the window shows the contact's open tickets
|
||||
* config_quick_ticket_email_client the contact gets the "ticket created" email (with client emails on)
|
||||
*
|
||||
* Re-runnable: each column is added only where it isn't there yet.
|
||||
*/
|
||||
|
||||
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
||||
|
||||
$itflow_column = function ($table, $column) use ($mysqli) {
|
||||
$result = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '$table' AND COLUMN_NAME = '$column' LIMIT 1");
|
||||
return $result && mysqli_num_rows($result) > 0;
|
||||
};
|
||||
|
||||
$itflow_after = 'config_ticket_no_response_message';
|
||||
foreach ([
|
||||
'config_quick_ticket_on' => "tinyint(1) NOT NULL DEFAULT 1",
|
||||
'config_quick_ticket_assign' => "varchar(10) NOT NULL DEFAULT 'me'",
|
||||
'config_quick_ticket_status' => "int(11) NOT NULL DEFAULT 0",
|
||||
'config_quick_ticket_priority' => "varchar(10) NOT NULL DEFAULT 'Medium'",
|
||||
'config_quick_ticket_category' => "int(11) NOT NULL DEFAULT 0",
|
||||
'config_quick_ticket_billable' => "tinyint(1) NOT NULL DEFAULT -1",
|
||||
'config_quick_ticket_timer' => "varchar(10) NOT NULL DEFAULT 'make'",
|
||||
'config_quick_ticket_primary' => "tinyint(1) NOT NULL DEFAULT 1",
|
||||
'config_quick_ticket_open_tickets' => "tinyint(1) NOT NULL DEFAULT 1",
|
||||
'config_quick_ticket_email_client' => "tinyint(1) NOT NULL DEFAULT 1",
|
||||
] as $itflow_name => $itflow_type) {
|
||||
if (!$itflow_column('settings', $itflow_name)) {
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `$itflow_name` $itflow_type AFTER `$itflow_after`");
|
||||
}
|
||||
$itflow_after = $itflow_name;
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* Admin > Settings > Tickets (admin/settings_ticket.php):
|
||||
* edit_ticket_settings saves the numbering, email and text to ticket, who hears of a
|
||||
* new ticket and whether AI triages it, the timer and billing, the messages to
|
||||
* clients, closing and the tickets page. A next
|
||||
* new ticket and whether AI triages it, what a quick ticket starts with, the timer
|
||||
* and billing, the messages to clients, closing and the tickets page. A next
|
||||
* number already in use, an email address that isn't one or a closing time
|
||||
* out of range comes back to the page saying so - nothing is saved. Billable
|
||||
* by default is only on the page with accounting on, so is kept as it is
|
||||
@@ -22,7 +22,9 @@ if (isset($_POST['edit_ticket_settings'])) {
|
||||
'config_ticket_new_ticket_notification_email', 'config_ticket_timer_autostart', 'config_ticket_default_billable', 'config_ticket_autoclose_hours',
|
||||
'config_ticket_default_view', 'config_ticket_ordering', 'config_ticket_moving_columns'], aiTriageReady() ? ['config_ticket_ai_triage'] : [],
|
||||
settingsColumnExists($mysqli, 'config_ticket_sms_parse') ? ['config_ticket_sms_parse', 'config_ticket_sms_unknown_senders', 'config_ticket_sms_acknowledge'] : [],
|
||||
ticketStatusReplyReady() ? ['config_ticket_assigned_message'] : [], ticketNoResponseReady() ? ['config_ticket_no_response_message'] : []));
|
||||
ticketStatusReplyReady() ? ['config_ticket_assigned_message'] : [], ticketNoResponseReady() ? ['config_ticket_no_response_message'] : [],
|
||||
quickTicketReady() ? ['config_quick_ticket_on', 'config_quick_ticket_assign', 'config_quick_ticket_status', 'config_quick_ticket_priority', 'config_quick_ticket_category',
|
||||
'config_quick_ticket_billable', 'config_quick_ticket_timer', 'config_quick_ticket_primary', 'config_quick_ticket_open_tickets', 'config_quick_ticket_email_client'] : []));
|
||||
|
||||
// What was sent, and what is saved for anything that wasn't - a switch not sent is off
|
||||
$in = $_POST + array_map(function ($value) { return (string) $value; }, $before);
|
||||
@@ -56,6 +58,37 @@ if (isset($_POST['edit_ticket_settings'])) {
|
||||
}
|
||||
}
|
||||
|
||||
// Quick tickets - once the database has them. Billable is only on the page with accounting on
|
||||
if (array_key_exists('config_quick_ticket_on', $before)) {
|
||||
foreach (['config_quick_ticket_on', 'config_quick_ticket_primary', 'config_quick_ticket_open_tickets', 'config_quick_ticket_email_client'] as $switch) {
|
||||
$after[$switch] = empty($_POST[$switch]) ? 0 : 1;
|
||||
}
|
||||
$quick_assign = (string) $in['config_quick_ticket_assign'];
|
||||
$after['config_quick_ticket_assign'] = in_array($quick_assign, ['me', 'nobody'], true) ? $quick_assign : (string) ticketAgentId(intval($quick_assign));
|
||||
if ($after['config_quick_ticket_assign'] === '0') {
|
||||
$errors['config_quick_ticket_assign'] = 'Pick who it goes to from the list.';
|
||||
}
|
||||
$after['config_quick_ticket_status'] = intval($in['config_quick_ticket_status']);
|
||||
if ($after['config_quick_ticket_status'] && !isset(ticketPickableStatuses()[$after['config_quick_ticket_status']])) {
|
||||
$errors['config_quick_ticket_status'] = 'Pick the status from the list.';
|
||||
}
|
||||
$after['config_quick_ticket_priority'] = (string) $in['config_quick_ticket_priority'];
|
||||
if (!in_array($after['config_quick_ticket_priority'], ['Low', 'Medium', 'High', 'Urgent'], true)) {
|
||||
$errors['config_quick_ticket_priority'] = 'Pick the priority from the list.';
|
||||
}
|
||||
$after['config_quick_ticket_category'] = ticketCategoryId($in['config_quick_ticket_category']);
|
||||
if ($config_module_enable_accounting) {
|
||||
$after['config_quick_ticket_billable'] = intval($in['config_quick_ticket_billable']);
|
||||
if (!isset(QUICK_TICKET_BILLABLE[$after['config_quick_ticket_billable']])) {
|
||||
$errors['config_quick_ticket_billable'] = 'Pick whether it bills from the list.';
|
||||
}
|
||||
}
|
||||
$after['config_quick_ticket_timer'] = (string) $in['config_quick_ticket_timer'];
|
||||
if (!isset(QUICK_TICKET_TIMER[$after['config_quick_ticket_timer']])) {
|
||||
$errors['config_quick_ticket_timer'] = 'Pick when its timer starts from the list.';
|
||||
}
|
||||
}
|
||||
|
||||
if ($problem = settingsEmailProblem($after['config_ticket_new_ticket_notification_email'])) {
|
||||
$errors['config_ticket_new_ticket_notification_email'] = $problem;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,31 @@ echo settingsPageStart('ticket');
|
||||
<?php } ?>
|
||||
<?= settingsSectionEnd() ?>
|
||||
|
||||
<?php if (quickTicketReady()) {
|
||||
$quick = quickTicketSettings(); ?>
|
||||
<?= settingsSectionStart('quick', 'Quick tickets', 'The <i class="fas fa-plus-circle"></i> in the top bar - the client, the contact and the issue, for a call or a walk-up. It shows the contact\'s tickets still open first, so the same problem isn\'t raised twice. These are what a quick ticket starts with.', 'quick') ?>
|
||||
<?= settingsSwitch('config_quick_ticket_on', $quick['on'] ? 1 : 0, ['help' => 'For everyone who can make tickets.']) ?>
|
||||
<div data-settings-depends-on="config_quick_ticket_on">
|
||||
<?= settingsSelect('config_quick_ticket_assign', $quick['assign'], quickTicketAssignChoices(), ['icon' => 'fa-user-check', 'search' => true,
|
||||
'help' => 'The window has an "Assign it to ..." switch, to change it for one ticket.']) ?>
|
||||
<?= settingsSelect('config_quick_ticket_status', $quick['status'], quickTicketStatusChoices(), ['icon' => 'fa-info-circle']) ?>
|
||||
<?= settingsSelect('config_quick_ticket_priority', $quick['priority'], ['Low' => 'Low', 'Medium' => 'Medium', 'High' => 'High', 'Urgent' => 'Urgent'], ['icon' => 'fa-thermometer-half',
|
||||
'help' => 'The window can change it for one ticket. Its SLA follows the priority, as any ticket\'s does.']) ?>
|
||||
<?= settingsSelect('config_quick_ticket_category', $quick['category'], [], ['icon' => 'fa-layer-group', 'search' => true,
|
||||
'options_html' => '<option value="0"' . ($quick['category'] ? '' : ' selected') . '>- Not Categorized -</option>' . categoryOptionsHtml('Ticket', $quick['category'] ?: null)]) ?>
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<?= settingsSelect('config_quick_ticket_billable', $quick['billable'], QUICK_TICKET_BILLABLE, ['icon' => 'fa-dollar-sign']) ?>
|
||||
<?php } ?>
|
||||
<?= settingsSelect('config_quick_ticket_timer', $quick['timer'], QUICK_TICKET_TIMER, ['icon' => 'fa-stopwatch',
|
||||
'help' => 'It runs on the ticket page, as a ticket\'s timer does, until the time goes on a reply.']) ?>
|
||||
<?= settingsSwitch('config_quick_ticket_primary', $quick['primary'] ? 1 : 0, ['help' => 'Off, the contact starts empty, to be picked.']) ?>
|
||||
<?= settingsSwitch('config_quick_ticket_open_tickets', $quick['open_tickets'] ? 1 : 0, ['help' => 'Not resolved or closed - with Work on this one, to go to one instead.']) ?>
|
||||
<?= settingsSwitch('config_quick_ticket_email_client', $quick['email_client'] ? 1 : 0, ['help' => 'The "ticket created" email, as New Ticket sends it.'
|
||||
. (intval($config_ticket_client_general_notifications) === 1 ? '' : ' Emails to clients are off in <a href="settings_notification.php">Notifications</a>, so none goes either way.')]) ?>
|
||||
</div>
|
||||
<?= settingsSectionEnd() ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (ticketStatusReplyReady()) {
|
||||
// The statuses that send it now (Admin > Ticket Statuses)
|
||||
$assigned_sent_by = array_column(array_filter(ticketStatusesAll(), function ($status) {
|
||||
|
||||
Reference in New Issue
Block a user