$Mode = 'RESET'; } } //----------------------------------------------------------------------------------- function can_delete($selected_id) { if (requisitions_in_details($selected_id)) { display_error(_("Cannot delete this requisition because details transactions have been created referring to it.")); return false; } return true; } //----------------------------------------------------------------------------------- if ($Mode == 'Delete') { if (can_delete($selected_id)) { delete_requisition($selected_id); display_notification(_('Selected requisition has been deleted')); } $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = -1; $sav = get_post('show_inactive'); unset($_POST); $_POST['show_inactive'] = $sav; } //----------------------------------------------------------------------------------- $result = get_all_requisitions(check_value('show_inactive')); start_form(); start_table(TABLESTYLE, "width=50%"); $th = array(_("RNo. "), _("Point of use"), _("Narrative"), _("Application Date"), "", "", _("Details"));
try { commit_requisition(); $_SESSION['status_msg'] = 'Your information was successfully saved!'; if ($_POST['card_used'] == 'wishlist') { header('Location: http://' . $_SERVER['HTTP_HOST'] . '/admin/budget_helper.php?function=view_wishlist'); } else { header('Location: http://' . $_SERVER['HTTP_HOST'] . '/admin/budget_helper.php'); } } catch (Exception $e) { $_SESSION['status_msg'] = $e->getMessage(); header('Location: ' . $_SERVER['HTTP_REFERER']); } break; case 'req_delete': try { delete_requisition($_POST['id']); $_SESSION['status_msg'] = 'The requisition entry was deleted!'; header('Location: http://' . $_SERVER['HTTP_HOST'] . '/admin/budget_helper.php'); } catch (Exception $e) { $_SESSION['status_msg'] = $e->getMessage(); header('Location: ' . $_SERVER['HTTP_REFERER']); } break; case 'req_attachment_delete': try { delete_requisition_attachment($_POST['req_id'], $_POST['attachment_id']); $_SESSION['status_msg'] = 'Attachment #' . $_POST['attachment_id'] . ' was deleted!'; header('Location: http://' . $_SERVER['HTTP_HOST'] . '/admin/budget_helper.php?function=view_requisition&id=' . $_POST['req_id']); } catch (Exception $e) { $_SESSION['status_msg'] = $e->getMessage(); header('Location: ' . $_SERVER['HTTP_REFERER']);