require_once('initialize.php');
-$errors->add($i18n->getKey('error.access_denied'));
+$err->add($i18n->getKey('error.access_denied'));
if ($auth->isAuthenticated()) $GLOBALS['SMARTY']->assign('authenticated', true); // Used in header.tpl for menu display.
$smarty->assign('title', $i18n->getKey('label.error'));
if ($request->isPost()) {
if ($cl_password1 || $cl_password2) {
// Validate user input.
- if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ if (!ttValidString($cl_password1)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ if (!ttValidString($cl_password2)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
if ($cl_password1 !== $cl_password2)
- $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
}
- if ($errors->no() && $cl_password1) {
+ if ($err->no() && $cl_password1) {
if (ttUserHelper::setPassword($user->id, $cl_password1)) {
header('Location: admin_teams.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} // POST
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_team_name, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
- if (!ttValidString($cl_manager_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name'));
- if (!ttValidString($cl_manager_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_login'));
+ if (!ttValidString($cl_team_name, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
+ if (!ttValidString($cl_manager_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name'));
+ if (!ttValidString($cl_manager_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_login'));
if (!$auth->isPasswordExternal()) {
- if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ if (!ttValidString($cl_password1)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ if (!ttValidString($cl_password2)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
if ($cl_password1 !== $cl_password2)
- $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $err->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 (!ttValidEmail($cl_manager_email, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
- if ($errors->no()) {
+ if ($err->no()) {
if (!ttUserHelper::getUserByLogin($cl_manager_login)) {
// Create a new team.
if (!defined('CURRENCY_DEFAULT')) define('CURRENCY_DEFAULT', '$');
if ($team_id && $user_id) {
header('Location: admin_teams.php');
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.user_exists'));
+ $err->add($i18n->getKey('error.user_exists'));
}
} // isPost
header('Location: admin_teams.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
if ($request->getParameter('btn_cancel')) {
if ($request->isPost()) {
if ($request->getParameter('btn_save')) {
// Validate user input.
- if (!ttValidString($cl_team_name, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
- if (!ttValidString($cl_manager_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name'));
- if (!ttValidString($cl_manager_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_login'));
+ if (!ttValidString($cl_team_name, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
+ if (!ttValidString($cl_manager_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name'));
+ if (!ttValidString($cl_manager_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_login'));
if (!$auth->isPasswordExternal() && ($cl_password1 || $cl_password2)) {
- if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ if (!ttValidString($cl_password1)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ if (!ttValidString($cl_password2)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
if ($cl_password1 !== $cl_password2)
- $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $err->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 (!ttValidEmail($cl_manager_email, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
// New login must be unique.
if ($cl_manager_login != $team_details['manager_login'])
- if (ttUserHelper::getUserByLogin($cl_manager_login)) $errors->add($i18n->getKey('error.user_exists'));
+ if (ttUserHelper::getUserByLogin($cl_manager_login)) $err->add($i18n->getKey('error.user_exists'));
- if ($errors->no()) {
+ if ($err->no()) {
$update_result = ttTeamHelper::update($team_id, array('name'=>$cl_team_name));
if ($update_result) {
$update_result = ttUserHelper::update($team_details['manager_id'], array(
header('Location: admin_teams.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_field_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+ if (!ttValidString($cl_field_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
- if ($errors->no()) {
+ if ($err->no()) {
$res = CustomFields::insertField($cl_field_name, $cl_field_type, $cl_required);
if ($res) {
header('Location: cf_custom_fields.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} // POST
header('Location: cf_custom_fields.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
if ($request->getParameter('btn_cancel')) {
// Cancel button pressed.
} else {
$field = CustomFields::getField($id);
if (false === $field)
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
- if ($errors->no()) {
+ if ($err->no()) {
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$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')));
$cl_id = $request->getParameter('id');
$field = CustomFields::getField($cl_id);
if (false === $field)
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
$form = new Form('fieldForm');
-if ($errors->no()) {
+if ($err->no()) {
$form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$field['label']));
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
$form->addInput(array('type'=>'checkbox','name'=>'required','data'=>1,'value'=>$field['required']));
$cl_required = 0;
// Validate user input.
- if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+ if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
- if ($errors->no()) {
+ if ($err->no()) {
$res = CustomFields::updateField($cl_id, $cl_name, $cl_type, $cl_required);
if ($res) {
header('Location: cf_custom_fields.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} // POST
$cl_field_id = $request->getParameter('field_id');
$field = CustomFields::getField($cl_field_id);
if (false === $field)
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
$form = new Form('optionAddForm');
-if ($errors->no()) {
+if ($err->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')));
$cl_option_name = trim($request->getParameter('name'));
// Validate user input.
- if (!ttValidString($cl_option_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+ if (!ttValidString($cl_option_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
- if ($errors->no()) {
+ if ($err->no()) {
$res = CustomFields::insertOption($cl_field_id, $cl_option_name);
if ($res) {
header("Location: cf_dropdown_options.php?field_id=$cl_field_id");
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} // POST
header("Location: cf_dropdown_options.php?field_id=$field_id");
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
if ($request->getParameter('btn_cancel')) {
// Cancel button pressed.
} else {
$option = CustomFields::getOptionName($cl_id);
if (false === $option)
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
- if ($errors->no()) {
+ if ($err->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')));
$cl_id = $request->getParameter('id');
$cl_name = CustomFields::getOptionName($cl_id);
if (false === $cl_name)
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
$form = new Form('optionEditForm');
-if ($errors->no()) {
+if ($err->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')));
$cl_name = trim($request->getParameter('name'));
// Validate user input.
- if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+ if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
- if ($errors->no()) {
+ if ($err->no()) {
$res = CustomFields::updateOption($cl_id, $cl_name);
if ($res) {
// Determine field id for redirect.
header("Location: cf_dropdown_options.php?field_id=$field_id");
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} // POST
$field_id = $request->getParameter('field_id');
$options = CustomFields::getOptions($field_id);
if (false === $options)
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
$form = new Form('dropdownOptionsForm');
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.client_name'));
- 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 (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.client_name'));
+ if (!ttValidString($cl_address, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.client_address'));
+ if (!ttValidFloat($cl_tax, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.tax'));
- if ($errors->no()) {
+ if ($err->no()) {
if (!ttClientHelper::getClientByName($cl_name)) {
if (ttClientHelper::insert(array(
'team_id' => $user->team_id,
header('Location: clients.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.client_exists'));
+ $err->add($i18n->getKey('error.client_exists'));
}
} // POST
header('Location: clients.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
if ($request->getParameter('btn_cancel')) {
header('Location: clients.php');
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.client_name'));
- 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 (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.client_name'));
+ if (!ttValidString($cl_address, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.client_address'));
+ if (!ttValidFloat($cl_tax, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.tax'));
- if ($errors->no()) {
+ if ($err->no()) {
if ($request->getParameter('btn_save')) {
$client = ttClientHelper::getClientByName($cl_name);
if (($client && ($cl_id == $client['id'])) || !$client) {
header('Location: clients.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.client_exists'));
+ $err->add($i18n->getKey('error.client_exists'));
}
if ($request->getParameter('btn_copy')) {
header('Location: clients.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.client_exists'));
+ $err->add($i18n->getKey('error.client_exists'));
}
}
} // POST
$item_date = new DateAndTime(DB_DATEFORMAT);
$item_date->parseVal($expense_item['date'], DB_DATEFORMAT);
if ($item_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
}
- if ($errors->no()) {
+ if ($err->no()) {
// Mark the record as deleted.
if (ttExpenseHelper::markDeleted($cl_id, $user->getActiveUser())) {
header('Location: expenses.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
if ($request->getParameter('cancel_button')) { // Cancel button pressed.
if ($request->isPost()) {
// Validate user input.
if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
- $errors->add($i18n->getKey('error.client'));
+ $err->add($i18n->getKey('error.client'));
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_project) $errors->add($i18n->getKey('error.project'));
+ if (!$cl_project) $err->add($i18n->getKey('error.project'));
}
- if (!ttValidString($cl_item_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.item'));
- if (!ttValidFloat($cl_cost)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.cost'));
- if (!ttValidDate($cl_date)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.date'));
+ if (!ttValidString($cl_item_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.item'));
+ if (!ttValidFloat($cl_cost)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.cost'));
+ if (!ttValidDate($cl_date)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.date'));
// Determine lock date.
$lock_interval = $user->lock_interval;
if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) {
$browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null));
if ($new_date->after($browser_today))
- $errors->add($i18n->getKey('error.future_date'));
+ $err->add($i18n->getKey('error.future_date'));
}
// Save record.
// Now, step by step.
// 1) Prohibit updating locked entries.
if($lockdate && $item_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
// 2) Prohibit saving completed unlocked entries into locked interval.
- if($errors->no() && $lockdate && $new_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ if($err->no() && $lockdate && $new_date->before($lockdate))
+ $err->add($i18n->getKey('error.period_locked'));
// Now, an update.
- if ($errors->no()) {
+ if ($err->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));
if ($request->getParameter('btn_copy')) {
// We need to prohibit saving into locked interval.
if($lockdate && $new_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
// Now, a new insert.
- if ($errors->no()) {
+ if ($err->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));
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
if ($request->getParameter('btn_submit')) {
// Validate user input.
if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
- $errors->add($i18n->getKey('error.client'));
+ $err->add($i18n->getKey('error.client'));
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_project) $errors->add($i18n->getKey('error.project'));
+ if (!$cl_project) $err->add($i18n->getKey('error.project'));
}
- if (!ttValidString($cl_item_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.item'));
- if (!ttValidFloat($cl_cost)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.cost'));
+ if (!ttValidString($cl_item_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.item'));
+ if (!ttValidFloat($cl_cost)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.cost'));
// Prohibit creating entries in future.
if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) {
$browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null));
if ($selected_date->after($browser_today))
- $errors->add($i18n->getKey('error.future_date'));
+ $err->add($i18n->getKey('error.future_date'));
}
// Finished validating input data.
// Prohibit creating time entries in locked interval.
if($lockdate && $selected_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
// Insert record.
- if ($errors->no()) {
+ if ($err->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');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
else if ($request->getParameter('onBehalfUser')) {
}
exit;
} else
- $errors->add($i18n->getKey('error.sys'));
+ $err->add($i18n->getKey('error.sys'));
} // POST
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
if ($request->isPost()) {
- $import = new ttImportHelper($errors);
+ $import = new ttImportHelper($err);
$import->importXml();
- if ($errors->no())
+ if ($err->no())
$messages->add($i18n->getKey('form.import.success'));
} // POST
$request = new ttHttpRequest();
import('form.ActionErrors');
-$errors = new ActionErrors();
+$err = new ActionErrors();
$messages = new ActionErrors();
// Create an instance of ttUser class. This gets us most of user details.
// Assign things for smarty to use in template files.
$smarty->assign('i18n', $i18n->keys);
-$smarty->assign('errors', $errors);
+$smarty->assign('errors', $err);
$smarty->assign('messages', $messages);
// TODO: move this code out of here to the files that use it.
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_number)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.invoice.number'));
- if (!ttValidDate($cl_date)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.date'));
- if (!$cl_client) $errors->add($i18n->getKey('error.client'));
- if (!ttValidDate($cl_start)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.start_date'));
- if (!ttValidDate($cl_finish)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.end_date'));
+ if (!ttValidString($cl_number)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.invoice.number'));
+ if (!ttValidDate($cl_date)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.date'));
+ if (!$cl_client) $err->add($i18n->getKey('error.client'));
+ if (!ttValidDate($cl_start)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.start_date'));
+ if (!ttValidDate($cl_finish)) $err->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->no()) {
+ if ($err->no()) {
if (ttInvoiceHelper::getInvoiceByName($cl_number))
- $errors->add($i18n->getKey('error.invoice_exists'));
+ $err->add($i18n->getKey('error.invoice_exists'));
if (!ttInvoiceHelper::invoiceableItemsExist($fields))
- $errors->add($i18n->getKey('error.no_invoiceable_items'));
+ $err->add($i18n->getKey('error.no_invoiceable_items'));
}
- if ($errors->no()) {
+ if ($err->no()) {
// Now we can go ahead and create our invoice.
if (ttInvoiceHelper::createInvoice($fields)) {
header('Location: invoices.php');
exit();
}
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} // POST
header('Location: invoices.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else if ($request->getParameter('btn_cancel')) {
header('Location: invoices.php');
exit();
if ($request->isPost()) {
// Validate user input.
- if (!ttValidEmailList($cl_receiver)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.to'));
- if (!ttValidEmailList($cl_cc, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.cc'));
- 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 (!ttValidEmailList($cl_receiver)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.to'));
+ if (!ttValidEmailList($cl_cc, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.cc'));
+ if (!ttValidString($cl_subject)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.subject'));
+ if (!ttValidString($cl_comment, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.comment'));
- if ($errors->no()) {
+ if ($err->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 ($mailer->send($cl_subject, $body))
$messages->add($i18n->getKey('form.mail.invoice_sent'));
else
- $errors->add($i18n->getKey('error.mail_send'));
+ $err->add($i18n->getKey('error.mail_send'));
}
} // POST
if ($request->isPost()) {
// Validate user input.
- 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 (!ttValidString($cl_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
+ if (!ttValidString($cl_password)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if ($errors->no()) {
+ if ($err->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');
exit();
}
} else
- $errors->add($i18n->getKey('error.auth'));
+ $err->add($i18n->getKey('error.auth'));
}
} // POST
if(!isTrue(MULTITEAM_MODE) && !ttTeamHelper::getTeams())
- $errors->add($i18n->getKey('error.no_teams'));
+ $err->add($i18n->getKey('error.no_teams'));
// Determine whether to show login hint. It is currently used only for Windows LDAP authentication.
$show_hint = ('ad' == $GLOBALS['AUTH_MODULE_PARAMS']['type']);
require_once('../initialize.php');
-$errors->add($i18n->getKey('error.access_denied'));
+$err->add($i18n->getKey('error.access_denied'));
if ($auth->isAuthenticated()) $GLOBALS['SMARTY']->assign('authenticated', true); // Used in header.tpl for menu display.
$smarty->assign('title', $i18n->getKey('label.error'));
if ($request->isPost()) {
// Validate user input.
- 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 (!ttValidString($cl_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
+ if (!ttValidString($cl_password)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if ($errors->no()) {
+ if ($err->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.
exit();
}
} else
- $errors->add($i18n->getKey('error.auth'));
+ $err->add($i18n->getKey('error.auth'));
}
} // POST
if(!isTrue(MULTITEAM_MODE) && !ttTeamHelper::getTeams())
- $errors->add($i18n->getKey('error.no_teams'));
+ $err->add($i18n->getKey('error.no_teams'));
// Determine whether to show login hint. It is currently used only for Windows LDAP authentication.
$show_hint = ('ad' == $GLOBALS['AUTH_MODULE_PARAMS']['type']);
// Validate user input.
if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
- $errors->add($i18n->getKey('error.client'));
+ $err->add($i18n->getKey('error.client'));
if ($custom_fields) {
- if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $errors->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
+ if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
}
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_project) $errors->add($i18n->getKey('error.project'));
+ if (!$cl_project) $err->add($i18n->getKey('error.project'));
}
if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_task) $errors->add($i18n->getKey('error.task'));
+ if (!$cl_task) $err->add($i18n->getKey('error.task'));
}
if (!$cl_duration) {
if ('0' == $cl_duration)
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
else if ($cl_start || $cl_finish) {
if (!ttTimeHelper::isValidTime($cl_start))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.start'));
if ($cl_finish) {
if (!ttTimeHelper::isValidTime($cl_finish))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.finish'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.finish'));
if (!ttTimeHelper::isValidInterval($cl_start, $cl_finish))
- $errors->add($i18n->getKey('error.interval'), $i18n->getKey('label.finish'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.interval'), $i18n->getKey('label.finish'), $i18n->getKey('label.start'));
}
} else {
if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type)) {
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.start'));
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.finish'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.finish'));
}
if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
}
} else {
if (!ttTimeHelper::isValidDuration($cl_duration))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
}
- if (!ttValidString($cl_note, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));
+ if (!ttValidString($cl_note, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));
// Finished validating user input.
// Prohibit creating entries in future.
if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) {
$browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null));
if ($selected_date->after($browser_today))
- $errors->add($i18n->getKey('error.future_date'));
+ $err->add($i18n->getKey('error.future_date'));
}
// Prohibit creating time entries in locked interval.
if($lockdate && $selected_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
// Prohibit creating another uncompleted record.
- if ($errors->no()) {
+ if ($err->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>");
+ $err->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->no()) {
+ if ($err->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
- $errors->add($i18n->getKey('error.overlap'));
+ $err->add($i18n->getKey('error.overlap'));
}
- if ($errors->no()) {
+ if ($err->no()) {
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
'user_id' => $user->getActiveUser(),
header('Location: time.php');
exit();
}
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
} // POST
$uncompleted = ($time_rec['duration'] == '0:00');
if($lockdate && $item_date->before($lockdate) && !$uncompleted) {
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
}
- if ($errors->no()) {
+ if ($err->no()) {
// Delete the record.
$result = ttTimeHelper::delete($cl_id, $user->getActiveUser());
header('Location: time.php');
exit();
} else {
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
}
// Validate user input.
if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
- $errors->add($i18n->getKey('error.client'));
+ $err->add($i18n->getKey('error.client'));
if ($custom_fields) {
- if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $errors->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
+ if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
}
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_project) $errors->add($i18n->getKey('error.project'));
+ if (!$cl_project) $err->add($i18n->getKey('error.project'));
}
if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_task) $errors->add($i18n->getKey('error.task'));
+ if (!$cl_task) $err->add($i18n->getKey('error.task'));
}
if (!$cl_duration) {
if ('0' == $cl_duration)
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
else if ($cl_start || $cl_finish) {
if (!ttTimeHelper::isValidTime($cl_start))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.start'));
if ($cl_finish) {
if (!ttTimeHelper::isValidTime($cl_finish))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.finish'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.finish'));
if (!ttTimeHelper::isValidInterval($cl_start, $cl_finish))
- $errors->add($i18n->getKey('error.interval'), $i18n->getKey('label.finish'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.interval'), $i18n->getKey('label.finish'), $i18n->getKey('label.start'));
}
} else {
if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type)) {
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.start'));
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.finish'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.finish'));
}
if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
}
} else {
if (!ttTimeHelper::isValidDuration($cl_duration))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
}
- if (!ttValidDate($cl_date)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.date'));
- if (!ttValidString($cl_note, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));
+ if (!ttValidDate($cl_date)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.date'));
+ if (!ttValidString($cl_note, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));
// Finished validating user input.
// Determine lock date.
if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) {
$browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null));
if ($new_date->after($browser_today))
- $errors->add($i18n->getKey('error.future_date'));
+ $err->add($i18n->getKey('error.future_date'));
}
// Save record.
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
// Now, step by step.
- if ($errors->no()) {
+ if ($err->no()) {
// 1) Prohibit saving locked time entries in any form.
if($lockdate && $item_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
// 2) Prohibit saving completed unlocked entries into locked interval.
- if($errors->no() && $lockdate && $new_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ if($err->no() && $lockdate && $new_date->before($lockdate))
+ $err->add($i18n->getKey('error.period_locked'));
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
$uncompleted = ($cl_finish == '' && $cl_duration == '');
if ($uncompleted) {
$not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser());
if ($not_completed_rec && ($time_rec['id'] <> $not_completed_rec['id'])) {
// We have another not completed record.
- $errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
+ $err->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->no()) {
+ if ($err->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
- $errors->add($i18n->getKey('error.overlap'));
+ $err->add($i18n->getKey('error.overlap'));
}
// Now, an update.
- if ($errors->no()) {
+ if ($err->no()) {
$res = ttTimeHelper::update(array(
'id'=>$cl_id,
'date'=>$new_date->toString(DB_DATEFORMAT),
// Validate user input.
if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
- $errors->add($i18n->getKey('error.client'));
+ $err->add($i18n->getKey('error.client'));
if ($custom_fields) {
- if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $errors->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
+ if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
}
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_project) $errors->add($i18n->getKey('error.project'));
+ if (!$cl_project) $err->add($i18n->getKey('error.project'));
}
if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_task) $errors->add($i18n->getKey('error.task'));
+ if (!$cl_task) $err->add($i18n->getKey('error.task'));
}
// Finished validating user input.
if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) {
$browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null));
if ($selected_date->after($browser_today))
- $errors->add($i18n->getKey('error.future_date'));
+ $err->add($i18n->getKey('error.future_date'));
}
// Prohibit creating time entries in locked interval.
if($lockdate && $selected_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
// Prohibit creating another uncompleted record.
- 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>");
+ if ($err->no() && $uncompleted) {
+ $err->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->no()) {
+ if ($err->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
- $errors->add($i18n->getKey('error.overlap'));
+ $err->add($i18n->getKey('error.overlap'));
}
- if ($errors->no()) {
+ if ($err->no()) {
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
'user_id' => $user->getActiveUser(),
header('Location: timer.php');
exit();
}
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
if ($request->getParameter('btn_stop')) {
header('Location: timer.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else {
// Cannot complete, redirect for manual edit.
header('Location: time_edit.php?id='.$record['id']);
if ($request->isPost()) {
// Validate user input.
- if (!$cl_fav_report) $errors->add($i18n->getKey('error.report'));
- 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 (!$cl_fav_report) $err->add($i18n->getKey('error.report'));
+ if (!ttValidCronSpec($cl_cron_spec)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.cron_schedule'));
+ if (!ttValidEmail($cl_email)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
- if ($errors->no()) {
+ if ($err->no()) {
// Calculate next execution time.
$next = tdCron::getNextOccurrence($cl_cron_spec, mktime());
header('Location: notifications.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} // POST
header('Location: notifications.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else if ($request->getParameter('btn_cancel')) {
header('Location: notifications.php');
exit();
if ($request->isPost()) {
// Validate user input.
- if (!$cl_fav_report) $errors->add($i18n->getKey('error.report'));
- 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 (!$cl_fav_report) $err->add($i18n->getKey('error.report'));
+ if (!ttValidCronSpec($cl_cron_spec)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.cron_schedule'));
+ if (!ttValidEmail($cl_email)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
- if ($errors->no()) {
+ if ($err->no()) {
// Calculate next execution time.
$next = tdCron::getNextOccurrence($cl_cron_spec, mktime());
header('Location: notifications.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} // POST
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ if (!ttValidString($cl_password1)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ if (!ttValidString($cl_password2)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
if ($cl_password1 !== $cl_password2)
- $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
- if ($errors->no()) {
+ if ($err->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.
header('Location: time.php');
exit();
} else {
- $errors->add($i18n->getKey('error.auth'));
+ $err->add($i18n->getKey('error.auth'));
}
}
} // POST
$cl_login = $request->getParameter('login');
// Validate user input.
- if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
+ if (!ttValidString($cl_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
- if ($errors->IsEmpty()) {
+ if ($err->IsEmpty()) {
if (!ttUserHelper::getUserByLogin($cl_login)) {
// User with a specified login was not found.
// In this case, if login looks like email, try finding user by email.
if ($login)
$cl_login = $login;
else
- $errors->add($i18n->getKey('error.no_login'));
+ $err->add($i18n->getKey('error.no_login'));
} else
- $errors->add($i18n->getKey('error.no_login'));
+ $err->add($i18n->getKey('error.no_login'));
}
}
- if ($errors->IsEmpty()) {
+ if ($err->IsEmpty()) {
$user = new ttUser($cl_login); // Note: reusing $user from initialize.php here.
// Prepare and save a temporary reference for user.
if (ttValidEmail($cl_login))
$receiver = $cl_login;
else
- $errors->add($i18n->getKey('error.no_email'));
+ $err->add($i18n->getKey('error.no_email'));
}
if ($receiver) {
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name'));
+ if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name'));
if ($can_change_login) {
- if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
+ if (!ttValidString($cl_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
// New login must be unique.
if ($cl_login != $user->login && ttUserHelper::getUserByLogin($cl_login))
- $errors->add($i18n->getKey('error.user_exists'));
+ $err->add($i18n->getKey('error.user_exists'));
}
if (!$auth->isPasswordExternal() && ($cl_password1 || $cl_password2)) {
- if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ if (!ttValidString($cl_password1)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ if (!ttValidString($cl_password2)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
if ($cl_password1 !== $cl_password2)
- $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
}
- if (!ttValidEmail($cl_email, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
+ if (!ttValidEmail($cl_email, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
if ($user->canManageTeam()) {
- if (!ttValidString($cl_team, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
- if (!ttValidString($cl_address, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.address'));
- if (!ttValidString($cl_currency, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.currency'));
- if (!ttValidInteger($cl_lock_interval, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.lock_interval'));
+ if (!ttValidString($cl_team, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
+ if (!ttValidString($cl_address, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.address'));
+ if (!ttValidString($cl_currency, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.currency'));
+ if (!ttValidInteger($cl_lock_interval, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.lock_interval'));
}
// Finished validating user input.
- if ($errors->no()) {
+ if ($err->no()) {
if ($cl_lock_interval == null || trim($cl_lock_interval) == '')
$cl_lock_interval = 0;
header('Location: time.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
} // POST
if ($request->isPost()) {
// Validate user input.
- 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 (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+ if (!ttValidString($cl_description, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
- if ($errors->no()) {
+ if ($err->no()) {
if (!ttProjectHelper::getProjectByName($cl_name)) {
if (ttProjectHelper::insert(array(
'team_id' => $user->team_id,
header('Location: projects.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.project_exists'));
+ $err->add($i18n->getKey('error.project_exists'));
}
} // POST
header('Location: projects.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else if ($request->getParameter('btn_cancel')) {
header('Location: projects.php');
exit();
if ($request->isPost()) {
// Validate user input.
- 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 (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+ if (!ttValidString($cl_description, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
- if ($errors->no()) {
+ if ($err->no()) {
if ($request->getParameter('btn_save')) {
$existing_project = ttProjectHelper::getProjectByName($cl_name);
if (!$existing_project || ($cl_project_id == $existing_project['id'])) {
header('Location: projects.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.project_exists'));
+ $err->add($i18n->getKey('error.project_exists'));
}
if ($request->getParameter('btn_copy')) {
header('Location: projects.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.project_exists'));
+ $err->add($i18n->getKey('error.project_exists'));
}
}
} // POST
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_team_name, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
- if (!ttValidString($cl_currency, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.currency'));
- if (!ttValidString($cl_manager_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name'));
- if (!ttValidString($cl_manager_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_login'));
- if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ if (!ttValidString($cl_team_name, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
+ if (!ttValidString($cl_currency, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.currency'));
+ if (!ttValidString($cl_manager_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name'));
+ if (!ttValidString($cl_manager_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_login'));
+ if (!ttValidString($cl_password1)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ if (!ttValidString($cl_password2)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
if ($cl_password1 !== $cl_password2)
- $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'));
+ $err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ if (!ttValidEmail($cl_manager_email, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
- if ($errors->no()) {
+ if ($err->no()) {
if (!ttUserHelper::getUserByLogin($cl_manager_login)) {
// Create a new team.
$team_id = ttTeamHelper::insert(array('name'=>$cl_team_name,'currency'=>$cl_currency));
}
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.user_exists'));
+ $err->add($i18n->getKey('error.user_exists'));
}
} // POST
if ($request->isPost()) {
// Validate user input.
- if (!ttValidEmailList($cl_receiver)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.to'));
- if (!ttValidEmailList($cl_cc, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.cc'));
- 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 (!ttValidEmailList($cl_receiver)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.to'));
+ if (!ttValidEmailList($cl_cc, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.cc'));
+ if (!ttValidString($cl_subject)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.subject'));
+ if (!ttValidString($cl_comment, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.comment'));
- if ($errors->no()) {
+ if ($err->no()) {
// Save last report emails for future use.
$sc->setValue(SYSC_LAST_REPORT_EMAIL, $cl_receiver);
$sc->setValue(SYSC_LAST_REPORT_CC, $cl_cc);
if ($mailer->send($cl_subject, $body))
$messages->add($i18n->getKey('form.mail.report_sent'));
else
- $errors->add($i18n->getKey('error.mail_send'));
+ $err->add($i18n->getKey('error.mail_send'));
}
}
}
} elseif ($bean->getAttribute('btn_save')) {
// 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 (!ttValidString($bean->getAttribute('new_fav_report'))) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.reports.save_as_favorite'));
- if ($errors->no()) {
+ if ($err->no()) {
$id = ttFavReportHelper::saveReport($user->id, $bean);
if (!$id)
- $errors->add($i18n->getKey('error.db'));
- if ($errors->no()) {
+ $err->add($i18n->getKey('error.db'));
+ if ($err->no()) {
$bean->setAttribute('favorite_report', $id);
$bean->saveBean();
header('Location: reports.php');
$start_date = new DateAndTime($user->date_format, $bean->getAttribute('start_date'));
if ($start_date->isError() || !$bean->getAttribute('start_date'))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.start_date'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.start_date'));
$end_date = new DateAndTime($user->date_format, $bean->getAttribute('end_date'));
if ($end_date->isError() || !$bean->getAttribute('end_date'))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.end_date'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.end_date'));
if ($start_date->compare($end_date) > 0)
- $errors->add($i18n->getKey('error.interval'), $i18n->getKey('label.end_date'), $i18n->getKey('label.start_date'));
+ $err->add($i18n->getKey('error.interval'), $i18n->getKey('label.end_date'), $i18n->getKey('label.start_date'));
}
$bean->saveBean();
- if ($errors->no()) {
+ if ($err->no()) {
// Now we can go ahead and create a report.
header('Location: report.php');
exit();
if ($request->isPost()) {
// Validate user input.
- 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 (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+ if (!ttValidString($cl_description, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
- if ($errors->no()) {
+ if ($err->no()) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
'team_id' => $user->team_id,
header('Location: tasks.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.task_exists'));
+ $err->add($i18n->getKey('error.task_exists'));
}
} // POST
header('Location: tasks.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else if ($request->getParameter('btn_cancel')) {
header('Location: tasks.php');
exit();
if ($request->isPost()) {
// Validate user input.
- 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 (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+ if (!ttValidString($cl_description, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
- if ($errors->no()) {
+ if ($err->no()) {
if ($request->getParameter('btn_save')) {
$existing_task = ttTaskHelper::getTaskByName($cl_name);
if (!$existing_task || ($cl_task_id == $existing_task['id'])) {
header('Location: tasks.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.task_exists'));
+ $err->add($i18n->getKey('error.task_exists'));
}
if ($request->getParameter('btn_copy')) {
header('Location: tasks.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.task_exists'));
+ $err->add($i18n->getKey('error.task_exists'));
}
}
} // POST
// Validate user input.
if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
- $errors->add($i18n->getKey('error.client'));
+ $err->add($i18n->getKey('error.client'));
if ($custom_fields) {
- if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $errors->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
+ if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
}
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_project) $errors->add($i18n->getKey('error.project'));
+ if (!$cl_project) $err->add($i18n->getKey('error.project'));
}
if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_task) $errors->add($i18n->getKey('error.task'));
+ if (!$cl_task) $err->add($i18n->getKey('error.task'));
}
if (!$cl_duration) {
if ('0' == $cl_duration)
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
else if ($cl_start || $cl_finish) {
if (!ttTimeHelper::isValidTime($cl_start))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.start'));
if ($cl_finish) {
if (!ttTimeHelper::isValidTime($cl_finish))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.finish'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.finish'));
if (!ttTimeHelper::isValidInterval($cl_start, $cl_finish))
- $errors->add($i18n->getKey('error.interval'), $i18n->getKey('label.finish'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.interval'), $i18n->getKey('label.finish'), $i18n->getKey('label.start'));
}
} else {
if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type)) {
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.start'));
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.finish'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.finish'));
}
if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
}
} else {
if (!ttTimeHelper::isValidDuration($cl_duration))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
}
- if (!ttValidString($cl_note, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));
+ if (!ttValidString($cl_note, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));
// Finished validating user input.
// Prohibit creating entries in future.
if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) {
$browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null));
if ($selected_date->after($browser_today))
- $errors->add($i18n->getKey('error.future_date'));
+ $err->add($i18n->getKey('error.future_date'));
}
// Prohibit creating time entries in locked interval.
if($lockdate && $selected_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
// Prohibit creating another uncompleted record.
- if ($errors->no()) {
+ if ($err->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>");
+ $err->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->no()) {
+ if ($err->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
- $errors->add($i18n->getKey('error.overlap'));
+ $err->add($i18n->getKey('error.overlap'));
}
// Insert record.
- if ($errors->no()) {
+ if ($err->no()) {
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
'user_id' => $user->getActiveUser(),
header('Location: time.php');
exit();
}
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
else if ($request->getParameter('btn_stop')) {
'note'=>$record['comment'],
'billable'=>$record['billable']));
if (!$res)
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else {
// Cannot complete, redirect for manual edit.
header('Location: time_edit.php?id='.$record_id);
$uncompleted = ($time_rec['duration'] == '0:00');
if($lockdate && $item_date->before($lockdate) && !$uncompleted) {
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
}
- if ($errors->no()) {
+ if ($err->no()) {
// Delete the record.
$result = ttTimeHelper::delete($cl_id, $user->getActiveUser());
header('Location: time.php');
exit();
} else {
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
}
// Validate user input.
if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
- $errors->add($i18n->getKey('error.client'));
+ $err->add($i18n->getKey('error.client'));
if ($custom_fields) {
- if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $errors->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
+ if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
}
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_project) $errors->add($i18n->getKey('error.project'));
+ if (!$cl_project) $err->add($i18n->getKey('error.project'));
}
if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
- if (!$cl_task) $errors->add($i18n->getKey('error.task'));
+ if (!$cl_task) $err->add($i18n->getKey('error.task'));
}
if (!$cl_duration) {
if ('0' == $cl_duration)
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
else if ($cl_start || $cl_finish) {
if (!ttTimeHelper::isValidTime($cl_start))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.start'));
if ($cl_finish) {
if (!ttTimeHelper::isValidTime($cl_finish))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.finish'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.finish'));
if (!ttTimeHelper::isValidInterval($cl_start, $cl_finish))
- $errors->add($i18n->getKey('error.interval'), $i18n->getKey('label.finish'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.interval'), $i18n->getKey('label.finish'), $i18n->getKey('label.start'));
}
} else {
if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type)) {
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.start'));
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.finish'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.start'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.finish'));
}
if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
- $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
}
} else {
if (!ttTimeHelper::isValidDuration($cl_duration))
- $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
+ $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
}
- if (!ttValidDate($cl_date)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.date'));
- if (!ttValidString($cl_note, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));
+ if (!ttValidDate($cl_date)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.date'));
+ if (!ttValidString($cl_note, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));
// Finished validating user input.
// Determine lock date.
if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) {
$browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null));
if ($new_date->after($browser_today))
- $errors->add($i18n->getKey('error.future_date'));
+ $err->add($i18n->getKey('error.future_date'));
}
// Save record.
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
// Now, step by step.
- if ($errors->no()) {
+ if ($err->no()) {
// 1) Prohibit saving locked time entries in any form.
if($lockdate && $item_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
// 2) Prohibit saving completed unlocked entries into locked interval.
- if($errors->no() && $lockdate && $new_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ if($err->no() && $lockdate && $new_date->before($lockdate))
+ $err->add($i18n->getKey('error.period_locked'));
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
$uncompleted = ($cl_finish == '' && $cl_duration == '');
if ($uncompleted) {
$not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser());
if ($not_completed_rec && ($time_rec['id'] <> $not_completed_rec['id'])) {
// We have another not completed record.
- $errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
+ $err->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->no()) {
+ if ($err->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
- $errors->add($i18n->getKey('error.overlap'));
+ $err->add($i18n->getKey('error.overlap'));
}
// Now, an update.
- if ($errors->no()) {
+ if ($err->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->no()) {
+ if ($err->no()) {
// 1) Prohibit saving into locked interval.
if($lockdate && $new_date->before($lockdate))
- $errors->add($i18n->getKey('error.period_locked'));
+ $err->add($i18n->getKey('error.period_locked'));
// 2) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
$uncompleted = ($cl_finish == '' && $cl_duration == '');
if ($uncompleted) {
$not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser());
if ($not_completed_rec) {
// We have another not completed record.
- $errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
+ $err->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->no()) {
+ if ($err->no()) {
if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish))
- $errors->add($i18n->getKey('error.overlap'));
+ $err->add($i18n->getKey('error.overlap'));
}
// Now, a new insert.
- if ($errors->no()) {
+ if ($err->no()) {
$id = ttTimeHelper::insert(array(
'date'=>$new_date->toString(DB_DATEFORMAT),
header('Location: time.php?date='.$new_date->toString(DB_DATEFORMAT));
exit();
}
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
$project_with_rate['rate'] = $request->getParameter('rate_'.$p);
$assigned_projects[] = $project_with_rate;
} else
- $errors->add($i18n->getKey('error.field'), 'rate_'.$p);
+ $err->add($i18n->getKey('error.field'), 'rate_'.$p);
}
}
}
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name'));
- if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
+ if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name'));
+ if (!ttValidString($cl_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
if (!$auth->isPasswordExternal()) {
- if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ if (!ttValidString($cl_password1)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ if (!ttValidString($cl_password2)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
if ($cl_password1 !== $cl_password2)
- $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
}
- 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 (!ttValidEmail($cl_email, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
+ if (!ttValidFloat($cl_rate, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.users.default_rate'));
- if ($errors->no()) {
+ if ($err->no()) {
if (!ttUserHelper::getUserByLogin($cl_login)) {
$fields = array(
'name' => $cl_name,
header('Location: users.php');
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.user_exists'));
+ $err->add($i18n->getKey('error.user_exists'));
}
} // POST
}
exit();
} else {
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
}
}
if ($request->getParameter('btn_cancel')) {
$project_with_rate['rate'] = $request->getParameter('rate_'.$p);
$assigned_projects[] = $project_with_rate;
} else
- $errors->add($i18n->getKey('error.field'), 'rate_'.$p);
+ $err->add($i18n->getKey('error.field'), 'rate_'.$p);
}
}
} else {
if ($request->isPost()) {
// Validate user input.
- if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name'));
- if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
+ if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name'));
+ if (!ttValidString($cl_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
if (!$auth->isPasswordExternal() && ($cl_password1 || $cl_password2)) {
- if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
- if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ if (!ttValidString($cl_password1)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ if (!ttValidString($cl_password2)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
if ($cl_password1 !== $cl_password2)
- $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
}
- 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 (!ttValidEmail($cl_email, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
+ if (!ttValidFloat($cl_rate, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.users.default_rate'));
- if ($errors->no()) {
+ if ($err->no()) {
$existing_user = ttUserHelper::getUserByLogin($cl_login);
if (!$existing_user || ($user_id == $existing_user['id'])) {
exit();
} else
- $errors->add($i18n->getKey('error.db'));
+ $err->add($i18n->getKey('error.db'));
} else
- $errors->add($i18n->getKey('error.user_exists'));
+ $err->add($i18n->getKey('error.user_exists'));
}
} // POST