}
// saveReport - saves report options in the database.
- static function saveReport($user_id, $bean) {
+ static function saveReport($bean) {
global $user;
+ $user_id = $user->getUser();
// Set default value of 0 for not set checkboxes (in bean).
// Later in this function we use it to construct $fields array to update database.
$users = join(',', $users_in_bean);
}
if ($bean->getAttribute('start_date')) {
- $dt = new DateAndTime($user->date_format, $bean->getAttribute('start_date'));
+ $dt = new DateAndTime($user->getDateFormat(), $bean->getAttribute('start_date'));
$from = $dt->toString(DB_DATEFORMAT);
}
if ($bean->getAttribute('end_date')) {
- $dt = new DateAndTime($user->date_format, $bean->getAttribute('end_date'));
+ $dt = new DateAndTime($user->getDateFormat(), $bean->getAttribute('end_date'));
$to = $dt->toString(DB_DATEFORMAT);
}
}
// loadReport - loads report options from database into a bean.
- static function loadReport($user_id, &$bean) {
+ static function loadReport(&$bean) {
global $user;
+ $user_id = $user->getUser();
$val = ttFavReportHelper::getReport($bean->getAttribute('favorite_report'));
if ($val) {
$bean->setAttribute('period', $val['period']);
if ($val['period_start']) {
$dt = new DateAndTime(DB_DATEFORMAT, $val['period_start']);
- $bean->setAttribute('start_date', $dt->toString($user->date_format));
+ $bean->setAttribute('start_date', $dt->toString($user->getDateFormat()));
}
if ($val['period_end']) {
$dt = new DateAndTime(DB_DATEFORMAT, $val['period_end']);
- $bean->setAttribute('end_date', $dt->toString($user->date_format));
+ $bean->setAttribute('end_date', $dt->toString($user->getDateFormat()));
}
$bean->setAttribute('chclient', $val['show_client']);
$bean->setAttribute('chinvoice', $val['show_invoice']);
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.29.4632 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.29.4633 | 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>
// User changed favorite report. We need to load new values into the form.
if ($bean->getAttribute('favorite_report')) {
// This loads new favorite report options into the bean (into our form).
- ttFavReportHelper::loadReport($user->getUser(), $bean);
+ ttFavReportHelper::loadReport($bean);
// If user selected no favorite report - mark all user checkboxes (most probable scenario).
if ($bean->getAttribute('favorite_report') == -1)
if (!ttValidString($bean->getAttribute('new_fav_report'))) $err->add($i18n->get('error.field'), $i18n->get('form.reports.save_as_favorite'));
if ($err->no()) {
- $id = ttFavReportHelper::saveReport($user->id, $bean); // TODO: review "on behalf" situations (both user and group), redesign if needed.
+ $id = ttFavReportHelper::saveReport($bean);
if (!$id)
$err->add($i18n->get('error.db'));
if ($err->no()) {
// Load default report.
$bean->setAttribute('favorite_report','');
$bean->setAttribute('new_fav_report', $report_list[0]['name']);
- ttFavReportHelper::loadReport($user->id, $bean);
+ ttFavReportHelper::loadReport($bean);
$form->setValueByElement('users', array_keys($user_list));
$bean->saveBean();
header('Location: reports.php');