//----------------------------------------------------------------------------------- if ($Mode == 'Delete') { if (can_delete($selected_id)) { delete_work_centre($selected_id); display_notification(_('Selected work center 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_work_centres(check_value('show_inactive')); start_form(); start_table(TABLESTYLE, "width=50%"); $th = array(_("Name"), _("description"), "", ""); inactive_control_column($th); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["name"]); label_cell($myrow["description"]); inactive_control_cell($myrow["id"], $myrow["inactive"], 'workcentres', 'id'); edit_button_cell("Edit" . $myrow['id'], _("Edit")); delete_button_cell("Delete" . $myrow['id'], _("Delete")); end_row(); }
$myrow = db_fetch_row($result); if ($myrow[0] > 0) { display_error(tr("Cannot delete this work centre because work order requirements have been created referring to it.")); return false; } return true; } //----------------------------------------------------------------------------------- if (isset($_GET['delete'])) { if (can_delete($selected_id)) { delete_work_centre($selected_id); meta_forward($_SERVER['PHP_SELF']); } } //----------------------------------------------------------------------------------- $result = get_all_work_centres(); start_table("{$table_style} width=50%"); $th = array(tr("Name"), tr("description"), "", ""); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["name"]); label_cell($myrow["description"]); edit_link_cell("selected_id=" . $myrow["id"]); delete_link_cell("selected_id=" . $myrow["id"] . "&delete=1"); end_row(); } end_table(); //----------------------------------------------------------------------------------- hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Work Centre"));