A few bugs fixed related to role revamp.
[timetracker.git] / reports.php
index 710de52..fe56001 100644 (file)
@@ -37,7 +37,7 @@ import('ttFavReportHelper');
 import('ttClientHelper');
 
 // Access check.
-if (!ttAccessCheck(right_view_reports)) {
+if (!ttAccessAllowed('view_own_reports')) {
   header('Location: access_denied.php');
   exit();
 }
@@ -122,7 +122,7 @@ $form->addInput(array('type'=>'combobox',
   'data'=>$include_options,
   'empty'=>array(''=>$i18n->getKey('dropdown.all'))));
 
-if ($user->isPluginEnabled('ps')) {
+if ($user->canManageTeam() && $user->isPluginEnabled('ps')) {
   $form->addInput(array('type'=>'combobox',
    'name'=>'paid_status',
    'style'=>'width: 250px;',
@@ -197,12 +197,12 @@ if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type
 }
 $form->addInput(array('type'=>'checkbox','name'=>'chduration'));
 $form->addInput(array('type'=>'checkbox','name'=>'chnote'));
-if (defined('COST_ON_REPORTS') && isTrue(COST_ON_REPORTS))
-  $form->addInput(array('type'=>'checkbox','name'=>'chcost'));
+$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 ($user->canManageTeam() && $user->isPluginEnabled('ps'))
+  $form->addInput(array('type'=>'checkbox','name'=>'chpaid'));
 // Add group by control.
 $group_by_options['no_grouping'] = $i18n->getKey('form.reports.group_by_no');
 $group_by_options['date'] = $i18n->getKey('form.reports.group_by_date');
@@ -247,6 +247,7 @@ if ($request->isGet() && !$bean->isSaved()) {
   $form->setValueByElement('chfinish', '1');
   $form->setValueByElement('chnote', '1');
   $form->setValueByElement('chcf_1', '0');
+  $form->setValueByElement('chpaid', '0');
   $form->setValueByElement('chtotalsonly', '0');
 }