Skip to content
Snippets Groups Projects
Commit 40e061a1 authored by Peter Rotich's avatar Peter Rotich
Browse files

Maintain user input on error

Make the error message clear
parent bf4416af
Branches
Tags
No related merge requests found
...@@ -901,9 +901,9 @@ class TicketsAjaxAPI extends AjaxController { ...@@ -901,9 +901,9 @@ class TicketsAjaxAPI extends AjaxController {
} }
} }
$count = count($_REQUEST['tids']);
if (!$errors) { if (!$errors) {
$i = 0; $i = 0;
$count = count($_REQUEST['tids']);
$comments = $_REQUEST['comments']; $comments = $_REQUEST['comments'];
foreach ($_REQUEST['tids'] as $tid) { foreach ($_REQUEST['tids'] as $tid) {
if (($ticket=Ticket::lookup($tid)) if (($ticket=Ticket::lookup($tid))
...@@ -914,8 +914,8 @@ class TicketsAjaxAPI extends AjaxController { ...@@ -914,8 +914,8 @@ class TicketsAjaxAPI extends AjaxController {
} }
if (!$i) if (!$i)
$errors['err'] = sprintf(__('Unable to set status for %s'), $errors['err'] = sprintf(__('Unable to change status for %s'),
_N('selected ticket', 'selected tickets', $count)); _N('the selected ticket', 'any of the selected tickets', $count));
else { else {
// Assume success // Assume success
if ($i==$count) { if ($i==$count) {
...@@ -936,6 +936,17 @@ class TicketsAjaxAPI extends AjaxController { ...@@ -936,6 +936,17 @@ class TicketsAjaxAPI extends AjaxController {
} }
} }
$info['title'] = sprintf('%s %s',
TicketStateField::getVerb($state),
__('Tickets'));
if ($count)
$info['title'] .= sprintf(' — %d %s',
$count, __('selected'));
$info['status_id'] = $_REQUEST['status_id'];
$info['comments'] = Format::htmlchars($_REQUEST['comments']);
$info['errors'] = $errors; $info['errors'] = $errors;
return self::_setStatus($state, $info); return self::_setStatus($state, $info);
} }
......
...@@ -86,7 +86,7 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); ...@@ -86,7 +86,7 @@ $action = $info['action'] ?: ('#tickets/status/'. $state);
cols="50" rows="3" wrap="soft" style="width:100%" cols="50" rows="3" wrap="soft" style="width:100%"
class="richtext ifhtml no-bar" class="richtext ifhtml no-bar"
placeholder="<?php echo $placeholder; ?>"><?php placeholder="<?php echo $placeholder; ?>"><?php
echo $info['notes']; ?></textarea> echo $info['comments']; ?></textarea>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment