X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/a93a92b4959bf35c5c6b41adaea5a666b876bf2d..88bd95ec82e6b715f84b6bd09c04aebbdb4b5e4d:/report.php diff --git a/report.php b/report.php index 135c8f27..ed7928c7 100644 --- a/report.php +++ b/report.php @@ -82,7 +82,8 @@ if ($bean->getAttribute('chpaid') || if ($user->can('manage_invoices')) $showForInvoicesOrPaid = true; } -if ($showForApproved || $showForInvoicesOrPaid) +$use_checkboxes = $showForApproved || $showForInvoicesOrPaid; +if ($use_checkboxes) $smarty->assign('use_checkboxes', true); // Controls for "Mark approved" block. @@ -92,7 +93,7 @@ if ($showForApproved) { 'name'=>'mark_approved_select_options', 'data'=>$mark_approved_select_options, 'value'=>$cl_mark_approved_select_option)); - $mark_approved_action_options = array('1'=>$i18n->get('form.reports.include_approved'),'2'=>$i18n->get('form.reports.include_not_approved')); + $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, @@ -142,7 +143,8 @@ if ($user->can('manage_invoices') && if ($request->isPost()) { // Validate parameters and at the same time build arrays of record ids. - if (($request->getParameter('btn_mark_paid') && 2 == $request->getParameter('mark_paid_select_options')) + if (($request->getParameter('btn_mark_approved') && 2 == $request->getParameter('mark_approved_select_options')) + || ($request->getParameter('btn_mark_paid') && 2 == $request->getParameter('mark_paid_select_options')) || ($request->getParameter('btn_assign') && 2 == $request->getParameter('assign_invoice_select_options'))) { // We act on selected records. Are there any? foreach($_POST as $key => $val) { @@ -164,6 +166,22 @@ if ($request->isPost()) { } if ($err->no()) { + if ($request->getParameter('btn_mark_approved')) { + // User clicked the "Mark approved" button to mark some or all items either approved or not approved. + + // Determine user action. + $mark_approved = $request->getParameter('mark_approved_action_options') == 1 ? true : false; + + // Mark as requested. + if ($time_log_ids || $expense_item_ids) { + ttReportHelper::markApproved($time_log_ids, $expense_item_ids, $mark_approved); + } + + // Re-display this form. + header('Location: report.php'); + exit(); + } + if ($request->getParameter('btn_mark_paid')) { // User clicked the "Mark paid" button to mark some or all items either paid or not paid. @@ -201,7 +219,7 @@ $options = ttReportHelper::getReportOptions($bean); $report_items = ttReportHelper::getItems($options); // Store record ids in session in case user wants to act on records such as marking them all paid. -if ($request->isGet() && $user->isPluginEnabled('ps')) +if ($request->isGet() && $use_checkboxes) ttReportHelper::putInSession($report_items); if (ttReportHelper::grouping($options)) {