If found it quiet easy to change the default behavior of the "Post Reply" form to autoselect 'Feedback'. This is a HTML only change and does not affect the rest of the app logic.
diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php
index 47e7728e..eabb599e 100644
--- a/include/staff/ticket-view.inc.php
+++ b/include/staff/ticket-view.inc.php
@@ -1106,12 +1106,13 @@ if ($errors['err'] && isset($_POST['a'])) {
foreach (TicketStatusList::getStatuses(
array('states' => $states)) as $s) {
if (!$s->isEnabled()) continue;
- $selected = $statusId == $s->getId();
+ $current = ($statusId == $s->getId());
+ $selected = ($s->getName() == 'Feedback');
echo sprintf('<option value="%d" %s>%s%s</option>',
$s->getId(),
$selected ? 'selected="selected"' : '',
__($s->getName()),
- $selected ? (' ('.__('current').')') : ''
+ $current ? (' ('.__('current').')') : ''
);
}
?>
Then I tried to edit also class.ticket.php
to change back the ticket status to 'InProgress' when a user replies,
but this didn't work. It looks like the onMessage
handler is not called in this case, so I still lack some understanding of the code. The code is pretty easy to read, actually, but here I have need to investigate further. Maybe you have a tip.
diff --git a/include/class.ticket.php b/include/class.ticket.php
index 593df7d8..aba3b4fa 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -228,6 +228,10 @@ implements RestrictedAccess, Threadable, Searchable {
return $this->hasState('closed');
}
+ function isFeedback() {
+ return $this->hasState('Feedback');
+ }
+
function isCloseable() {
global $cfg;
@@ -1445,6 +1449,13 @@ implements RestrictedAccess, Threadable, Searchable {
return $status ? $this->setStatus($status) : false;
}
+ function changeToInProgress() {
+ if (!$this->isFeedback())
+ return false;
+
+ return $this->setStatus('In Progress');
+ }
+
function onNewTicket($message, $autorespond=true, $alertstaff=true) {
global $cfg;
@@ -1694,6 +1705,12 @@ implements RestrictedAccess, Threadable, Searchable {
$this->save();
+ if ($this->isFeedback()) {
+ $this->changeToInProgress();
+ $this->save();
+ return;
+ }
+
// Reopen if closed AND reopenable
// We're also checking autorespond flag because we don't want to
// reopen closed tickets on auto-reply from end user. This is not to
--