<?php // Load the Expense Functions require_once 'include.php'; // Load the Translations for this Module if (!xml2php('expense')) { $smarty->assign('error_msg', "Error in language file"); } // Load PHP Language Translations $langvals = gateway_xml2php('expense'); // Load expense details $expense_details = display_expense_info($db, $VAR['expenseID']); // If details submitted run update values, if not set load edit.tpl and populate values if (isset($VAR['submit'])) { if (!update_expense($db, $VAR)) { force_page('expense', 'edit&error_msg=Falied to Update Expense Information&expenseID=' . $VAR['expenseID']); exit; } else { force_page('expense', 'expense_details&expenseID=' . $VAR['expenseID'] . '&page_title=' . $langvals['expense_details_title']); exit; } } else { $smarty->assign('expense_details', $expense_details); $smarty->display('expense' . SEP . 'edit.tpl'); }
} if ($_POST['expense_owner']) { if (!in_array($_POST['expense_owner'], $member_ids)) { $errorString[] = "Invalid expense owner selected! (what are you doing??) <br />"; } } if (!empty($errorString)) { $showaddform = true; } else { // no errors, add expense if ($_POST['expense_owner']) { $xuid = $_POST['expense_owner']; } else { $xuid = $user->data['user_id']; } if (update_expense($expid, $_POST['description'], $_POST['amount'], $_POST['type_id'], $timestamp, $xuid, $groupid, $_POST['members'], $_POST['event_id'], $emembers)) { //$resultString = "Expense succesfully added"; $msg = "x1"; $ac = new Achievements($details['groupid']); } else { //$resultString = "Error: Could not add expense"; $msg = "x2"; } } $redirect = "http://" . $_SERVER['HTTP_HOST'] . DIR . "expense_detail.php?expid={$expid}&msg={$msg}"; header("Location: {$redirect}"); break; } print_header(); // array structure: $bararray['title'], $bararray['leftnav'][$i][name|url], $bararray['rightnav'][$i][name|url] $urll = $_SERVER['PHP_SELF'] . "?expid={$expid}&mode=edit";