}
}
+ // The markApproved marks a set of records as either approved or unapproved.
+ static function markApproved($time_log_ids, $expense_item_ids, $approved = true) {
+ global $user;
+ $mdb2 = getConnection();
+
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
+ $approved_val = (int) $approved;
+ if ($time_log_ids) {
+ $sql = "update tt_log set approved = $approved_val".
+ " where id in(".join(', ', $time_log_ids).") and group_id = $group_id and org_id = $org_id";
+ $affected = $mdb2->exec($sql);
+ if (is_a($affected, 'PEAR_Error')) die($affected->getMessage());
+ }
+ if ($expense_item_ids) {
+ $sql = "update tt_expense_items set approved = $approved_val".
+ " where id in(".join(', ', $expense_item_ids).") and group_id = $group_id and org_id = $org_id";
+ $affected = $mdb2->exec($sql);
+ if (is_a($affected, 'PEAR_Error')) die($affected->getMessage());
+ }
+ }
+
// The markPaid marks a set of records as either paid or unpaid.
static function markPaid($time_log_ids, $expense_item_ids, $paid = true) {
global $user;
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.43.4777 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.43.4778 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
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) {
}
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.