function show_expenseFormList($template_name) { global $db; global $TPL; global $transactionRepeat; $current_user =& singleton("current_user"); $db = new db_alloc(); $transactionRepeat = new transactionRepeat(); if (!$_GET["tfID"] && !$current_user->have_role("admin")) { $tfIDs = $current_user->get_tfIDs(); $tfIDs and $sql = prepare("WHERE tfID in (%s)", $tfIDs); } else { if ($_GET["tfID"]) { $sql = prepare("WHERE tfID = %d", $_GET["tfID"]); } } $db->query("select * FROM transactionRepeat " . $sql); while ($db->next_record()) { $i++; $transactionRepeat->read_db_record($db); $transactionRepeat->set_values(); $TPL["tfName"] = tf::get_name($transactionRepeat->get_value("tfID")); $TPL["fromTfName"] = tf::get_name($transactionRepeat->get_value("fromTfID")); include_template($template_name); } $TPL["tfID"] = $tfID; }
* License for more details. * * You should have received a copy of the GNU Affero General Public License * along with allocPSA. If not, see <http://www.gnu.org/licenses/>. */ require_once "../alloc.php"; $current_user->check_employee(); $transactionRepeat = new transactionRepeat(); $db = new db_alloc(); global $TPL; global $transactionRepeatID; $transactionRepeatID = $_POST["transactionRepeatID"] or $transactionRepeatID = $_GET["transactionRepeatID"]; if ($transactionRepeatID) { $transactionRepeat->set_id($transactionRepeatID); $transactionRepeat->select(); $transactionRepeat->set_values(); } if (!isset($_POST["reimbursementRequired"])) { $_POST["reimbursementRequired"] = 0; } if ($_POST["save"] || $_POST["delete"] || $_POST["pending"] || $_POST["approved"] || $_POST["rejected"]) { $transactionRepeat->read_globals(); if ($current_user->have_role("admin")) { if ($_POST["changeTransactionStatus"] == "pending") { $transactionRepeat->set_value("status", "pending"); $TPL["message_good"][] = "Repeating Expense form Pending."; } else { if ($_POST["changeTransactionStatus"] == "approved") { $transactionRepeat->set_value("status", "approved"); $TPL["message_good"][] = "Repeating Expense form Approved!"; } else {
function get_pending_repeat_transaction_list() { global $TPL; $transactionTypes = transaction::get_transactionTypes(); $q = "SELECT * FROM transaction \n LEFT JOIN transactionRepeat on transactionRepeat.transactionRepeatID = transaction.transactionRepeatID \n WHERE transaction.transactionRepeatID IS NOT NULL AND transaction.status = 'pending'"; $db = new db_alloc(); $db->query($q); while ($row = $db->row()) { $transaction = new transaction(); $transaction->read_db_record($db); $transaction->set_values(); $transactionRepeat = new transactionRepeat(); $transactionRepeat->read_db_record($db); $transactionRepeat->set_values(); $row["transactionType"] = $transactionTypes[$transaction->get_value("transactionType")]; $row["formTotal"] = $db->f("amount"); $row["transactionModifiedTime"] = $transaction->get_value("transactionModifiedTime"); $row["transactionCreatedTime"] = $transaction->get_value("transactionCreatedTime"); $row["transactionCreatedUser"] = person::get_fullname($transaction->get_value("transactionCreatedUser")); $rows[] = $row; } return (array) $rows; }