From d1f5d1efa0c2d9269a3edcc596e2e62a937a7364 Mon Sep 17 00:00:00 2001 From: Michael <Chefkeks@users.noreply.github.com> Date: Fri, 3 Jun 2016 09:25:45 +0200 Subject: [PATCH] Internal error occurred #3 (with a lot more internal error occurred related changes) This commit updates a bunch of files and changes a lot of phrases. Basically it extracts "Internal error occurred" from existing phrases. I've re-ordered the phrases so "Internal error occurred" is always at the end after the actual informative error message. Example comparison before and after this commit: Before: 1 Phrase: "Internal error: Unable to print to PDF" After: 2 Phrases: "Unable to print to PDF." + "Internal error occurred" --- account.php | 3 ++- include/ajax.search.php | 2 +- include/ajax.thread.php | 2 +- include/class.collaborator.php | 3 ++- include/class.dept.php | 3 ++- include/class.email.php | 3 ++- pwreset.php | 3 ++- scp/orgs.php | 6 ++++-- scp/profile.php | 3 ++- scp/tasks.php | 6 ++++-- scp/tickets.php | 6 ++++-- scp/users.php | 6 ++++-- tickets.php | 3 ++- 13 files changed, 32 insertions(+), 17 deletions(-) diff --git a/account.php b/account.php index f57eefbf1..947a4c36f 100644 --- a/account.php +++ b/account.php @@ -88,7 +88,8 @@ elseif ($_POST) { $errors['err'] = __('Unable to register account. See messages below'); else { if (!($acct = ClientAccount::createForUser($user))) - $errors['err'] = __('Internal error. Unable to create new account'); + $errors['err'] = __('Unable to create new account.') + .' '.__('Internal error occurred'); elseif (!$acct->update($_POST, $errors)) $errors['err'] = __('Errors configuring your profile. See messages below'); } diff --git a/include/ajax.search.php b/include/ajax.search.php index 3342ac46d..7e22a8790 100644 --- a/include/ajax.search.php +++ b/include/ajax.search.php @@ -140,7 +140,7 @@ class SearchAjaxAPI extends AjaxController { elseif ($search->__new__) Http::response(400, 'A name is required'); if (!$search->save()) { - Http::response(500, 'Internal error. Unable to update search'); + Http::response(500, 'Unable to update search. Internal error occurred'); } Http::response(201, $this->encode(array( 'id' => $search->id, diff --git a/include/ajax.thread.php b/include/ajax.thread.php index 470f9276e..f53a55182 100644 --- a/include/ajax.thread.php +++ b/include/ajax.thread.php @@ -123,7 +123,7 @@ class ThreadAjaxAPI extends AjaxController { if($errors && $errors['err']) { $info +=array('error' => $errors['err']); } else { - $info +=array('error' =>__('Unable to add collaborator. Internal error')); + $info +=array('error' =>__('Unable to add collaborator.').' '.__('Internal error occurred')); } return self::_addcollaborator($thread, $user, $form, $info); diff --git a/include/class.collaborator.php b/include/class.collaborator.php index 2d73efbfd..0de95b6e4 100644 --- a/include/class.collaborator.php +++ b/include/class.collaborator.php @@ -147,7 +147,8 @@ implements EmailContact, ITicketUser { if ($collab->save(true)) return $collab; - $errors['err'] = __('Unable to add collaborator. Internal error'); + $errors['err'] = __('Unable to add collaborator.') + .' '.__('Internal error occurred'); return false; } diff --git a/include/class.dept.php b/include/class.dept.php index 93f92d754..ba15038c2 100644 --- a/include/class.dept.php +++ b/include/class.dept.php @@ -613,7 +613,8 @@ implements TemplateVariable { $id = $this->id; if ($id && $id != $vars['id']) - $errors['err']=__('Missing or invalid Dept ID (internal error).'); + $errors['err']=__('Missing or invalid Dept ID.') + .' '.__('Internal error occurred'); if (!$vars['name']) { $errors['name']=__('Name required'); diff --git a/include/class.email.php b/include/class.email.php index 2b5f5e033..2cd7fe3ef 100644 --- a/include/class.email.php +++ b/include/class.email.php @@ -248,7 +248,8 @@ class Email extends VerySimpleModel { $id = isset($this->email_id) ? $this->getId() : 0; if($id && $id!=$vars['id']) - $errors['err']=__('Internal error. Get technical help.'); + $errors['err']=__('Get technical help.') + .' '.__('Internal error occurred'); if(!$vars['email'] || !Validator::is_email($vars['email'])) { $errors['email']=__('Valid email required'); diff --git a/pwreset.php b/pwreset.php index e083d3956..2461ec3cf 100644 --- a/pwreset.php +++ b/pwreset.php @@ -23,7 +23,8 @@ if($_POST) { $inc = 'pwreset.sent.php'; } else - $banner = __('Unable to send reset email. Internal error'); + $banner = __('Unable to send reset email.') + .' '.__('Internal error occurred'); } else $banner = sprintf(__('Unable to verify username %s'), diff --git a/scp/orgs.php b/scp/orgs.php index a58e985b5..d08400fc9 100644 --- a/scp/orgs.php +++ b/scp/orgs.php @@ -101,7 +101,8 @@ if ($_POST) { if (!($query=$_SESSION[':Q:orgs'])) $errors['err'] = __('Query token not found'); elseif (!Export::saveOrganizations($query, __('organizations')."-$ts.csv", 'csv')) - $errors['err'] = __('Internal error: Unable to export results'); + $errors['err'] = __('Unable to export results.') + .' '.__('Internal error occurred'); } $page = 'orgs.inc.php'; @@ -118,7 +119,8 @@ if ($org) { $filename = sprintf('%s-tickets-%s.csv', $org->getName(), strftime('%Y%m%d')); if (!Export::saveTickets($query, $filename, 'csv')) - $errors['err'] = __('Internal error: Unable to dump query results'); + $errors['err'] = __('Unable to dump query results.') + .' '.__('Internal error occurred'); } break; } diff --git a/scp/profile.php b/scp/profile.php index cf77b05f0..0a46875e7 100644 --- a/scp/profile.php +++ b/scp/profile.php @@ -20,7 +20,8 @@ require_once(INCLUDE_DIR.'class.export.php'); // For paper sizes $msg=''; $staff=Staff::lookup($thisstaff->getId()); if($_POST && $_POST['id']!=$thisstaff->getId()) { //Check dummy ID used on the form. - $errors['err']=__('Internal Error. Action Denied'); + $errors['err']=__('Action Denied.') + .' '.__('Internal error occurred'); } elseif(!$errors && $_POST) { //Handle post if(!$staff) diff --git a/scp/tasks.php b/scp/tasks.php index a45635ea0..327de9a26 100644 --- a/scp/tasks.php +++ b/scp/tasks.php @@ -225,7 +225,8 @@ if($task) { // Auto add new fields to the entries foreach ($forms as $f) $f->addMissingFields(); } elseif($_REQUEST['a'] == 'print' && !$task->pdfExport($_REQUEST['psize'])) - $errors['err'] = __('Internal error: Unable to print to PDF'); + $errors['err'] = __('Unable to print to PDF.') + .' '.__('Internal error occurred'); } else { $inc = 'tasks.inc.php'; if ($_REQUEST['a']=='open' && @@ -236,7 +237,8 @@ if($task) { if (!($query=$_SESSION[':Q:tasks'])) $errors['err'] = __('Query token not found'); elseif (!Export::saveTasks($query, "tasks-$ts.csv", 'csv')) - $errors['err'] = __('Internal error: Unable to dump query results'); + $errors['err'] = __('Unable to dump query results.') + .' '.__('Internal error occurred'); } //Clear active submenu on search with no status diff --git a/scp/tickets.php b/scp/tickets.php index 0ad162b29..8aeb537f5 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -463,7 +463,8 @@ if($ticket) { $f->addMissingFields(); } } elseif($_REQUEST['a'] == 'print' && !$ticket->pdfExport($_REQUEST['psize'], $_REQUEST['notes'])) - $errors['err'] = __('Internal error: Unable to export the ticket to PDF for print.'); + $errors['err'] = __('Unable to export the ticket to PDF for print.') + .' '.__('Internal error occurred'); } else { $inc = 'tickets.inc.php'; if ($_REQUEST['a']=='open' && @@ -474,7 +475,8 @@ if($ticket) { if (!($query=$_SESSION[':Q:tickets'])) $errors['err'] = __('Query token not found'); elseif (!Export::saveTickets($query, "tickets-$ts.csv", 'csv')) - $errors['err'] = __('Internal error: Unable to dump query results'); + $errors['err'] = __('Unable to dump query results.') + .' '.__('Internal error occurred'); } //Clear active submenu on search with no status diff --git a/scp/users.php b/scp/users.php index c3525c4d1..e4bee2dc8 100644 --- a/scp/users.php +++ b/scp/users.php @@ -167,7 +167,8 @@ if ($_POST) { if (!($query=$_SESSION[':Q:users'])) $errors['err'] = __('Query token not found'); elseif (!Export::saveUsers($query, __("users")."-$ts.csv", 'csv')) - $errors['err'] = __('Internal error: Unable to dump query results'); + $errors['err'] = __('Unable to dump query results.') + .' '.__('Internal error occurred'); } $page = 'users.inc.php'; @@ -184,7 +185,8 @@ if ($user ) { $filename = sprintf('%s-tickets-%s.csv', $user->getName(), strftime('%Y%m%d')); if (!Export::saveTickets($query, $filename, 'csv')) - $errors['err'] = __('Internal error: Unable to dump query results'); + $errors['err'] = __('Unable to dump query results.') + .' '.__('Internal error occurred'); } break; } diff --git a/tickets.php b/tickets.php index 5d2a07ffb..5795925f4 100644 --- a/tickets.php +++ b/tickets.php @@ -112,7 +112,8 @@ elseif (is_object($ticket) && $ticket->getId()) { switch(strtolower($_REQUEST['a'])) { case 'print': if (!$ticket || !$ticket->pdfExport($_REQUEST['psize'])) - $errors['err'] = __('Internal error: Unable to print to PDF'); + $errors['err'] = __('Unable to print to PDF.') + .' '.__('Internal error occurred'); break; } } -- GitLab