+$options = ttReportHelper::getReportOptions($bean);
+
+// Do we need to show checkboxes? We show them in the following 4 situations:
+// - We can approve items.
+// - We can mark items as paid.
+// - We can sssign items to invoices.
+// - We can assign items to a timesheet.
+// Determine these conditions separately.
+if ($bean->getAttribute('chapproved') && ($user->can('approve_reports') || $user->can('approve_all_eports')))
+ $useMarkApproved = true;
+if ($bean->getAttribute('chpaid') && $user->can('manage_invoices'))
+ $useMarkPaid = true;
+if ($bean->getAttribute('chinvoice') && $client_id && 'no_grouping' == $bean->getAttribute('group_by1') && !$user->isClient() && $user->can('manage_invoices'))
+ $useAssignToInvoice = true;
+if ($bean->getAttribute('chtimesheet')) {
+ $timesheets = ttTimesheetHelper::getMatchingTimesheets($options);
+ if ($timesheets) $useAssignToTimesheet = true;
+}
+
+$use_checkboxes = $useMarkApproved || $useMarkPaid || $useAssignToInvoice || $useAssignToTimesheet;
+if ($use_checkboxes)
+ $smarty->assign('use_checkboxes', true);
+
+// Controls for "Mark approved" block.
+if ($useMarkApproved) {
+ $mark_approved_select_options = array('1'=>$i18n->get('dropdown.all'),'2'=>$i18n->get('dropdown.select'));
+ $form->addInput(array('type'=>'combobox',
+ 'name'=>'mark_approved_select_options',
+ 'data'=>$mark_approved_select_options,
+ 'value'=>$cl_mark_approved_select_option));
+ $mark_approved_action_options = array('1'=>$i18n->get('dropdown.approved'),'2'=>$i18n->get('dropdown.not_approved'));
+ $form->addInput(array('type'=>'combobox',
+ 'name'=>'mark_approved_action_options',
+ 'data'=>$mark_approved_action_options,
+ 'value'=>$cl_mark_approved_action_option));
+ $form->addInput(array('type'=>'submit','name'=>'btn_mark_approved','value'=>$i18n->get('button.submit')));
+ $smarty->assign('use_mark_approved', true);
+}
+
+// Controls for "Mark paid" block.
+if ($useMarkPaid) {
+ $mark_paid_select_options = array('1'=>$i18n->get('dropdown.all'),'2'=>$i18n->get('dropdown.select'));
+ $form->addInput(array('type'=>'combobox',
+ 'name'=>'mark_paid_select_options',
+ 'data'=>$mark_paid_select_options,
+ 'value'=>$cl_mark_paid_select_option));
+ $mark_paid_action_options = array('1'=>$i18n->get('dropdown.paid'),'2'=>$i18n->get('dropdown.not_paid'));
+ $form->addInput(array('type'=>'combobox',
+ 'name'=>'mark_paid_action_options',
+ 'data'=>$mark_paid_action_options,
+ 'value'=>$cl_mark_paid_action_option));
+ $form->addInput(array('type'=>'submit','name'=>'btn_mark_paid','value'=>$i18n->get('button.submit')));
+ $smarty->assign('use_mark_paid', true);
+}
+
+// Controls for "Assign to invoice" block.
+if ($useAssignToInvoice) {