-// Add include records control.
-$include_options = array('1'=>$i18n->getKey('form.reports.include_billable'),
- '2'=>$i18n->getKey('form.reports.include_not_billable'));
-$form->addInput(array('type'=>'combobox',
- 'name'=>'include_records',
- 'style'=>'width: 250px;',
- 'data'=>$include_options,
- 'empty'=>array(''=>$i18n->getKey('dropdown.all'))));
+// Add billable dropdown.
+$showBillable = $user->isPluginEnabled('iv');
+if ($showBillable) {
+ $include_options = array('1'=>$i18n->get('form.reports.include_billable'),
+ '2'=>$i18n->get('form.reports.include_not_billable'));
+ $form->addInput(array('type'=>'combobox',
+ 'name'=>'include_records', // TODO: how about a better name here?
+ 'style'=>'width: 250px;',
+ 'data'=>$include_options,
+ 'empty'=>array(''=>$i18n->get('dropdown.all'))));
+}
+
+// Add invoiced / not invoiced selector.
+$showInvoiceDropdown = $user->isPluginEnabled('iv') && $user->can('manage_invoices');
+if ($showInvoiceDropdown) {
+ $invoice_options = array('1'=>$i18n->get('form.reports.include_invoiced'),
+ '2'=>$i18n->get('form.reports.include_not_invoiced'));
+ $form->addInput(array('type'=>'combobox',
+ 'name'=>'invoice',
+ 'style'=>'width: 250px;',
+ 'data'=>$invoice_options,
+ 'empty'=>array(''=>$i18n->get('dropdown.all'))));
+}
+$showInvoiceCheckbox = $user->isPluginEnabled('iv') && ($user->can('manage_invoices') || $user->isClient());