function ActionErrors() {
}
- function isEmpty() {
- return (count($this->errors)>0 ? false : true);
- }
-
function exist() {
return (count($this->errors)>0 ? true : false);
}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.9.16.3430 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.9.16.3431 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
<!-- End of page title and user details -->
<!-- Output errors -->
-{if !$errors->isEmpty()}
+{if $errors->yes()}
<table cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
<tr>
<td class="error">
<!-- End of output errors -->
<!-- Output messages -->
-{if !$messages->isEmpty()}
+{if $messages->yes()}
<table cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
<tr>
<td class="info_message">
<!-- End of output errors -->
<!-- Output messages -->
-{if !$messages->isEmpty()}
+{if $messages->yes()}
<table cellspacing="4" cellpadding="7" width="{$tab_width}" border="0">
<tr>
<td class="info_message">
$errors->add($i18n->getKey('error.db'));
$form = new Form('optionAddForm');
-if ($errors->isEmpty()) {
+if ($errors->no()) {
$form->addInput(array('type'=>'hidden','name'=>'field_id','value'=>$cl_field_id));
$form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>''));
$form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->getKey('button.add')));
// Validate user input.
if (!ttValidString($cl_option_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$res = CustomFields::insertOption($cl_field_id, $cl_option_name);
if ($res) {
header("Location: cf_dropdown_options.php?field_id=$cl_field_id");
if (false === $option)
$errors->add($i18n->getKey('error.db'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete')));
$form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->getKey('button.cancel')));
$errors->add($i18n->getKey('error.db'));
$form = new Form('optionEditForm');
-if ($errors->isEmpty()) {
+if ($errors->no()) {
$form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$cl_name));
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
$form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save')));
// Validate user input.
if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$res = CustomFields::updateOption($cl_id, $cl_name);
if ($res) {
// Determine field id for redirect.
if (!ttValidString($cl_address, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.client_address'));
if (!ttValidFloat($cl_tax, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.tax'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (!ttClientHelper::getClientByName($cl_name)) {
if (ttClientHelper::insert(array(
'team_id' => $user->team_id,
if (!ttValidString($cl_address, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.client_address'));
if (!ttValidFloat($cl_tax, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.tax'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if ($request->getParameter('btn_save')) {
$client = ttClientHelper::getClientByName($cl_name);
if (($client && ($cl_id == $client['id'])) || !$client) {
$errors->add($i18n->getKey('error.period_locked'));
}
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Mark the record as deleted.
if (ttExpenseHelper::markDeleted($cl_id, $user->getActiveUser())) {
header('Location: expenses.php');
if($lockdate && $item_date->before($lockdate))
$errors->add($i18n->getKey('error.period_locked'));
// 2) Prohibit saving completed unlocked entries into locked interval.
- if($errors->isEmpty() && $lockdate && $new_date->before($lockdate))
+ if($errors->no() && $lockdate && $new_date->before($lockdate))
$errors->add($i18n->getKey('error.period_locked'));
// Now, an update.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttExpenseHelper::update(array('id'=>$cl_id,'date'=>$new_date->toString(DB_DATEFORMAT),'user_id'=>$user->getActiveUser(),
'client_id'=>$cl_client,'project_id'=>$cl_project,'name'=>$cl_item_name,'cost'=>$cl_cost))) {
header('Location: expenses.php?date='.$new_date->toString(DB_DATEFORMAT));
$errors->add($i18n->getKey('error.period_locked'));
// Now, a new insert.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttExpenseHelper::insert(array('date'=>$new_date->toString(DB_DATEFORMAT),'user_id'=>$user->getActiveUser(),
'client_id'=>$cl_client,'project_id'=>$cl_project,'name'=>$cl_item_name,'cost'=>$cl_cost,'status'=>1))) {
header('Location: expenses.php?date='.$new_date->toString(DB_DATEFORMAT));
$errors->add($i18n->getKey('error.period_locked'));
// Insert record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttExpenseHelper::insert(array('date'=>$cl_date,'user_id'=>$user->getActiveUser(),
'client_id'=>$cl_client,'project_id'=>$cl_project,'name'=>$cl_item_name,'cost'=>$cl_cost,'status'=>1))) {
header('Location: expenses.php');
$import = new ttImportHelper($errors);
$import->importXml();
- if ($errors->isEmpty())
+ if ($errors->no())
$messages->add($i18n->getKey('form.import.success'));
} // POST
if (!ttValidDate($cl_finish)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.end_date'));
$fields = array('date'=>$cl_date,'name'=>$cl_number,'client_id'=>$cl_client,'project_id'=>$cl_project,'start_date'=>$cl_start,'end_date'=>$cl_finish);
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttInvoiceHelper::getInvoiceByName($cl_number))
$errors->add($i18n->getKey('error.invoice_exists'));
$errors->add($i18n->getKey('error.no_invoiceable_items'));
}
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Now we can go ahead and create our invoice.
if (ttInvoiceHelper::createInvoice($fields)) {
header('Location: invoices.php');
if (!ttValidString($cl_subject)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.subject'));
if (!ttValidString($cl_comment, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.comment'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Save last invoice emails for future use.
$sc->setValue(SYSC_LAST_INVOICE_EMAIL, $cl_receiver);
$sc->setValue(SYSC_LAST_INVOICE_CC, $cl_cc);
if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
if (!ttValidString($cl_password)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Use the "limit" plugin if we have one. Ignore include errors.
// The "limit" plugin is not required for normal operation of Time Tracker.
@include('plugins/limit/access_check.php');
if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
if (!ttValidString($cl_password)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Use the "limit" plugin if we have one. Ignore include errors.
// The "limit" plugin is not required for normal operation of the Time Tracker.
$errors->add($i18n->getKey('error.period_locked'));
// Prohibit creating another uncompleted record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (($not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser())) && (($cl_finish == '') && ($cl_duration == '')))
$errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
}
// Prohibit creating an overlapping record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
$errors->add($i18n->getKey('error.overlap'));
}
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
'user_id' => $user->getActiveUser(),
$errors->add($i18n->getKey('error.period_locked'));
}
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Delete the record.
$result = ttTimeHelper::delete($cl_id, $user->getActiveUser());
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
// Now, step by step.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// 1) Prohibit saving locked time entries in any form.
if($lockdate && $item_date->before($lockdate))
$errors->add($i18n->getKey('error.period_locked'));
// 2) Prohibit saving completed unlocked entries into locked interval.
- if($errors->isEmpty() && $lockdate && $new_date->before($lockdate))
+ if($errors->no() && $lockdate && $new_date->before($lockdate))
$errors->add($i18n->getKey('error.period_locked'));
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
$uncompleted = ($cl_finish == '' && $cl_duration == '');
}
// Prohibit creating an overlapping record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
$errors->add($i18n->getKey('error.overlap'));
}
// Now, an update.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$res = ttTimeHelper::update(array(
'id'=>$cl_id,
'date'=>$new_date->toString(DB_DATEFORMAT),
$errors->add($i18n->getKey('error.period_locked'));
// Prohibit creating another uncompleted record.
- if ($errors->isEmpty() && $uncompleted) {
+ if ($errors->no() && $uncompleted) {
$errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
}
// Prohibit creating an overlapping record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
$errors->add($i18n->getKey('error.overlap'));
}
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
'user_id' => $user->getActiveUser(),
if (!ttValidCronSpec($cl_cron_spec)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.cron_schedule'));
if (!ttValidEmail($cl_email)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Calculate next execution time.
$next = tdCron::getNextOccurrence($cl_cron_spec, mktime());
if (!ttValidCronSpec($cl_cron_spec)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.cron_schedule'));
if (!ttValidEmail($cl_email)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Calculate next execution time.
$next = tdCron::getNextOccurrence($cl_cron_spec, mktime());
if ($cl_password1 !== $cl_password2)
$errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Use the "limit" plugin if we have one. Ignore include errors.
// The "limit" plugin is not required for normal operation of Time Tracker.
$cl_login = $user->login; // $cl_login is used in access_check.cpp.
}
// Finished validating user input.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if ($cl_lock_interval == null || trim($cl_lock_interval) == '')
$cl_lock_interval = 0;
if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
if (!ttValidString($cl_description, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (!ttProjectHelper::getProjectByName($cl_name)) {
if (ttProjectHelper::insert(array(
'team_id' => $user->team_id,
if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
if (!ttValidString($cl_description, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if ($request->getParameter('btn_save')) {
$existing_project = ttProjectHelper::getProjectByName($cl_name);
if (!$existing_project || ($cl_project_id == $existing_project['id'])) {
$errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
if (!ttValidEmail($cl_manager_email, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (!ttUserHelper::getUserByLogin($cl_manager_login)) {
// Create a new team.
$team_id = ttTeamHelper::insert(array('name'=>$cl_team_name,'currency'=>$cl_currency));
if (!ttValidString($cl_subject)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.subject'));
if (!ttValidString($cl_comment, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.comment'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Save last report emails for future use.
$sc->setValue(SYSC_LAST_REPORT_EMAIL, $cl_receiver);
$sc->setValue(SYSC_LAST_REPORT_CC, $cl_cc);
// User clicked the Save button. We need to save form options as new favorite report.
if (!ttValidString($bean->getAttribute('new_fav_report'))) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.reports.save_as_favorite'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$id = ttFavReportHelper::saveReport($user->id, $bean);
if (!$id)
$errors->add($i18n->getKey('error.db'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$bean->setAttribute('favorite_report', $id);
$bean->saveBean();
header('Location: reports.php');
$bean->saveBean();
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Now we can go ahead and create a report.
header('Location: report.php');
exit();
if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
if (!ttValidString($cl_description, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
'team_id' => $user->team_id,
if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
if (!ttValidString($cl_description, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if ($request->getParameter('btn_save')) {
$existing_task = ttTaskHelper::getTaskByName($cl_name);
if (!$existing_task || ($cl_task_id == $existing_task['id'])) {
$errors->add($i18n->getKey('error.period_locked'));
// Prohibit creating another uncompleted record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (($not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser())) && (($cl_finish == '') && ($cl_duration == '')))
$errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
}
// Prohibit creating an overlapping record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
$errors->add($i18n->getKey('error.overlap'));
}
// Insert record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
'user_id' => $user->getActiveUser(),
$errors->add($i18n->getKey('error.period_locked'));
}
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// Delete the record.
$result = ttTimeHelper::delete($cl_id, $user->getActiveUser());
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
// Now, step by step.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// 1) Prohibit saving locked time entries in any form.
if($lockdate && $item_date->before($lockdate))
$errors->add($i18n->getKey('error.period_locked'));
// 2) Prohibit saving completed unlocked entries into locked interval.
- if($errors->isEmpty() && $lockdate && $new_date->before($lockdate))
+ if($errors->no() && $lockdate && $new_date->before($lockdate))
$errors->add($i18n->getKey('error.period_locked'));
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
$uncompleted = ($cl_finish == '' && $cl_duration == '');
}
// Prohibit creating an overlapping record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
$errors->add($i18n->getKey('error.overlap'));
}
// Now, an update.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$res = ttTimeHelper::update(array(
'id'=>$cl_id,
'date'=>$new_date->toString(DB_DATEFORMAT),
// 2) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
// Now, step by step.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
// 1) Prohibit saving into locked interval.
if($lockdate && $new_date->before($lockdate))
$errors->add($i18n->getKey('error.period_locked'));
}
// Prohibit creating an overlapping record.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish))
$errors->add($i18n->getKey('error.overlap'));
}
// Now, a new insert.
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$id = ttTimeHelper::insert(array(
'date'=>$new_date->toString(DB_DATEFORMAT),
if (!ttValidEmail($cl_email, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
if (!ttValidFloat($cl_rate, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.users.default_rate'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
if (!ttUserHelper::getUserByLogin($cl_login)) {
$fields = array(
'name' => $cl_name,
if (!ttValidEmail($cl_email, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
if (!ttValidFloat($cl_rate, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.users.default_rate'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$existing_user = ttUserHelper::getUserByLogin($cl_login);
if (!$existing_user || ($user_id == $existing_user['id'])) {