X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/eb1332ec4a8cc403d3531bd472e9060dfe5e5d94..7dff008c1343e02229a5607df059a7db4774f975:/report.php diff --git a/report.php b/report.php index 6b26fe1c..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. @@ -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)) {