projects
/
timetracker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merged getWhere and getFavWhere into one function.
[timetracker.git]
/
reports.php
diff --git
a/reports.php
b/reports.php
index
bc6d8fc
..
a282532
100644
(file)
--- a/
reports.php
+++ b/
reports.php
@@
-35,6
+35,7
@@
import('Period');
import('ttProjectHelper');
import('ttFavReportHelper');
import('ttClientHelper');
import('ttProjectHelper');
import('ttFavReportHelper');
import('ttClientHelper');
+import('ttReportHelper');
// Access check.
if (!(ttAccessAllowed('view_own_reports') || ttAccessAllowed('view_reports') || ttAccessAllowed('view_all_reports'))) {
// Access check.
if (!(ttAccessAllowed('view_own_reports') || ttAccessAllowed('view_reports') || ttAccessAllowed('view_all_reports'))) {
@@
-194,11
+195,11
@@
$form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'end_date'))
// Add checkboxes for fields.
if ($user->isPluginEnabled('cl'))
$form->addInput(array('type'=>'checkbox','name'=>'chclient'));
// Add checkboxes for fields.
if ($user->isPluginEnabled('cl'))
$form->addInput(array('type'=>'checkbox','name'=>'chclient'));
-if (($user->can
ManageTeam(
) || $user->isClient()) && $user->isPluginEnabled('iv'))
+if (($user->can
('manage_invoices'
) || $user->isClient()) && $user->isPluginEnabled('iv'))
$form->addInput(array('type'=>'checkbox','name'=>'chinvoice'));
$form->addInput(array('type'=>'checkbox','name'=>'chinvoice'));
-if ($user->can
ManageTeam(
) && $user->isPluginEnabled('ps'))
+if ($user->can
('manage_invoices'
) && $user->isPluginEnabled('ps'))
$form->addInput(array('type'=>'checkbox','name'=>'chpaid'));
$form->addInput(array('type'=>'checkbox','name'=>'chpaid'));
-if ($user->can
ManageTeam(
))
+if ($user->can
('view_reports') || $user->can('view_all_reports'
))
$form->addInput(array('type'=>'checkbox','name'=>'chip'));
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
$form->addInput(array('type'=>'checkbox','name'=>'chproject'));
$form->addInput(array('type'=>'checkbox','name'=>'chip'));
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
$form->addInput(array('type'=>'checkbox','name'=>'chproject'));
@@
-214,10
+215,13
@@
$form->addInput(array('type'=>'checkbox','name'=>'chcost'));
// If we have a custom field - add a checkbox for it.
if ($custom_fields && $custom_fields->fields[0])
$form->addInput(array('type'=>'checkbox','name'=>'chcf_1'));
// If we have a custom field - add a checkbox for it.
if ($custom_fields && $custom_fields->fields[0])
$form->addInput(array('type'=>'checkbox','name'=>'chcf_1'));
+if ($user->isPluginEnabled('wu'))
+ $form->addInput(array('type'=>'checkbox','name'=>'chunits'));
+
// Add group by control.
$group_by_options['no_grouping'] = $i18n->get('form.reports.group_by_no');
$group_by_options['date'] = $i18n->get('form.reports.group_by_date');
// Add group by control.
$group_by_options['no_grouping'] = $i18n->get('form.reports.group_by_no');
$group_by_options['date'] = $i18n->get('form.reports.group_by_date');
-if ($user->can
ManageTeam(
) || $user->isClient())
+if ($user->can
('view_reports') || $user->can('view_all_reports'
) || $user->isClient())
$group_by_options['user'] = $i18n->get('form.reports.group_by_user');
if ($user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id))
$group_by_options['client'] = $i18n->get('form.reports.group_by_client');
$group_by_options['user'] = $i18n->get('form.reports.group_by_user');
if ($user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id))
$group_by_options['client'] = $i18n->get('form.reports.group_by_client');
@@
-260,6
+264,7
@@
if ($request->isGet() && !$bean->isSaved()) {
$form->setValueByElement('chfinish', '1');
$form->setValueByElement('chnote', '1');
$form->setValueByElement('chcf_1', '0');
$form->setValueByElement('chfinish', '1');
$form->setValueByElement('chnote', '1');
$form->setValueByElement('chcf_1', '0');
+ $form->setValueByElement('chunits', '0');
$form->setValueByElement('chtotalsonly', '0');
}
$form->setValueByElement('chtotalsonly', '0');
}
@@
-328,10
+333,11
@@
if ($request->isPost()) {
if ($start_date->compare($end_date) > 0)
$err->add($i18n->get('error.interval'), $i18n->get('label.end_date'), $i18n->get('label.start_date'));
}
if ($start_date->compare($end_date) > 0)
$err->add($i18n->get('error.interval'), $i18n->get('label.end_date'), $i18n->get('label.start_date'));
}
-
-
$bean->saveBean(
);
+ // Check remaining values.
+
if (!ttReportHelper::verifyBean($bean)) $err->add($i18n->get('error.sys')
);
if ($err->no()) {
if ($err->no()) {
+ $bean->saveBean();
// Now we can go ahead and create a report.
header('Location: report.php');
exit();
// Now we can go ahead and create a report.
header('Location: report.php');
exit();