Skip to content

Commit 7fafd0c

Browse files
committed
Some refactoring
1 parent 0513bd3 commit 7fafd0c

8 files changed

Lines changed: 17 additions & 18 deletions

File tree

WEB-INF/templates/header.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ With 101% height we essentially force the scrollbar to always appear. -->
160160
<!-- End of page title and user details -->
161161

162162
<!-- Output errors -->
163-
{if $errors->yes()}
163+
{if $err->yes()}
164164
<table cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
165165
<tr>
166166
<td class="error">
167-
{foreach $errors->getErrors() as $error}
167+
{foreach $err->getErrors() as $error}
168168
{$error.message}<br> {* No need to escape as they are not coming from user and may contain a link. *}
169169
{/foreach}
170170
</td>
@@ -174,11 +174,11 @@ With 101% height we essentially force the scrollbar to always appear. -->
174174
<!-- End of output errors -->
175175

176176
<!-- Output messages -->
177-
{if $messages->yes()}
177+
{if $msg->yes()}
178178
<table cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
179179
<tr>
180180
<td class="info_message">
181-
{foreach $messages->getErrors() as $message}
181+
{foreach $msg->getErrors() as $message}
182182
{$message.message}<br> {* No need to escape. *}
183183
{/foreach}
184184
</td>

WEB-INF/templates/mobile/header.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
<!-- End of top image -->
5656

5757
<!-- Output errors -->
58-
{if $errors->yes()}
58+
{if $err->yes()}
5959
<table cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
6060
<tr>
6161
<td class="error">
62-
{foreach $errors->getErrors() as $error}
62+
{foreach $err->getErrors() as $error}
6363
{$error.message}<br> {* No need to escape as they are not coming from user and may contain a link. *}
6464
{/foreach}
6565
</td>
@@ -69,11 +69,11 @@
6969
<!-- End of output errors -->
7070

7171
<!-- Output messages -->
72-
{if $messages->yes()}
72+
{if $msg->yes()}
7373
<table cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
7474
<tr>
7575
<td class="info_message">
76-
{foreach $messages->getErrors() as $message}
76+
{foreach $msg->getErrors() as $message}
7777
{$message.message}<br> {* No need to escape. *}
7878
{/foreach}
7979
</td>

import.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
4545

4646
$import = new ttImportHelper($err);
4747
$import->importXml();
48-
if ($err->no())
49-
$messages->add($i18n->getKey('form.import.success'));
48+
if ($err->no()) $msg->add($i18n->getKey('form.import.success'));
5049
} // isPost
5150

5251
$smarty->assign('forms', array($form->getName()=>$form->toArray()) );

initialize.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@
152152
$request = new ttHttpRequest();
153153

154154
import('form.ActionErrors');
155-
$err = new ActionErrors();
156-
$messages = new ActionErrors();
155+
$err = new ActionErrors(); // Error messages for user.
156+
$msg = new ActionErrors(); // Notification messages (not errrors) for user.
157157

158158
// Create an instance of ttUser class. This gets us most of user details.
159159
import('ttUser');
@@ -193,8 +193,8 @@
193193

194194
// Assign things for smarty to use in template files.
195195
$smarty->assign('i18n', $i18n->keys);
196-
$smarty->assign('errors', $err);
197-
$smarty->assign('messages', $messages);
196+
$smarty->assign('err', $err);
197+
$smarty->assign('msg', $msg);
198198

199199
// TODO: move this code out of here to the files that use it.
200200

invoice_send.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
$mailer->setReceiverCC($cl_cc);
8989
$mailer->setSendType(MAIL_MODE);
9090
if ($mailer->send($cl_subject, $body))
91-
$messages->add($i18n->getKey('form.mail.invoice_sent'));
91+
$msg->add($i18n->getKey('form.mail.invoice_sent'));
9292
else
9393
$err->add($i18n->getKey('error.mail_send'));
9494
}

mobile/time_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
if (($cl_start == $cl_finish) && ($cl_duration == '0:00')) {
9999
$cl_finish = '';
100100
$cl_duration = '';
101-
$messages->add($i18n->getKey('form.time_edit.uncompleted'));
101+
$msg->add($i18n->getKey('form.time_edit.uncompleted'));
102102
}
103103
}
104104

report_send.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
$mailer->setReceiverCC($cl_cc);
8686
$mailer->setSendType(MAIL_MODE);
8787
if ($mailer->send($cl_subject, $body))
88-
$messages->add($i18n->getKey('form.mail.report_sent'));
88+
$msg->add($i18n->getKey('form.mail.report_sent'));
8989
else
9090
$err->add($i18n->getKey('error.mail_send'));
9191
}

time_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
if (($cl_start == $cl_finish) && ($cl_duration == '0:00')) {
9999
$cl_finish = '';
100100
$cl_duration = '';
101-
$messages->add($i18n->getKey('form.time_edit.uncompleted'));
101+
$msg->add($i18n->getKey('form.time_edit.uncompleted'));
102102
}
103103
}
104104

0 commit comments

Comments
 (0)