/** Overridden method from Request, just so we display the subset of * request data we are interested in for QAMS. */ function RenderDetails($ef) { global $session, $bigboxcols, $bigboxrows; $html = ""; $html .= $ef->BreakLine("Project Details"); if (!$this->new_record) { $html .= $ef->DataEntryLine("W/R #", "{$this->request_id}" . " <b>Requested:</b> " . nice_date($this->request_on) . " <b>Status:</b> " . $this->status_desc); $html .= $ef->BreakLine("Quality Assurance Details"); } else { // QA Model // This determines which default approvals are set up initially.. $html .= $ef->DataEntryLine("QA Model", "", "lookup", "qa_model_id", array("_sql" => "SELECT * FROM qa_model", "_null" => "--- choose a model ---", "title" => "The QA model most appropriate to this project")); // PROJECT ROLES // These are specific important roles to be assigned to the project for QA // purposes. Note, we also consider that anyone who has been ALLOCATED to // this project is a valid QA Reviewer (client or internal). // Project Manager $html .= $ef->DataEntryLine("Project Mgr", "{$this->fullname}", "lookup", "project_manager", array("_sql" => SqlSelectRequesters($session->org_code), "_null" => "--- select a person ---", "title" => "The project manager in charge of this project.")); // QA Mentor $html .= $ef->DataEntryLine("QA Mentor", "{$this->fullname}", "lookup", "qa_mentor", array("_sql" => SqlSelectRequesters($session->org_code), "_null" => "--- select a person ---", "title" => "The QA mentor helping with quality assurance on this project.")); } $html .= $ef->DataEntryLine("Brief", "%s", "text", "brief", array("size" => 70, "title" => "A brief description of the project.")); // Organisation drop-down if ($session->AllowedTo("Admin") || $session->AllowedTo("Support") || $session->AllowedTo("Contractor")) { $html .= $ef->DataEntryLine("Organisation", "{$this->org_name}", "lookup", "org_code", array("_sql" => SqlSelectOrganisations($this->org_code), "_null" => "--- select an organisation ---", "onchange" => "OrganisationChanged();", "title" => "The organisation that this work will be done for.")); } else { if ($this->new_record) { $this->org_name = $session->org_name; } $html .= $ef->DataEntryLine("Organisation", "{$this->org_name}", "", ""); } // Person within Organisation drop-down $html .= $ef->DataEntryLine("Person", "{$this->fullname}", "lookup", "requester_id", array("_sql" => SqlSelectRequesters($this->org_code), "_null" => "--- select a person ---", "onchange" => "PersonChanged();", "title" => "The client who is requesting this, or who is in charge of ensuring it happens.")); // System (within Organisation) drop-down $html .= $ef->DataEntryLine("System", "{$this->system_desc}", "lookup", "system_id", array("_sql" => SqlSelectSystems($this->org_code), "_null" => "--- select a system ---", "onchange" => "SystemChanged();", "title" => "The business system that this project applies to.")); // Urgency of Request $html .= $ef->DataEntryLine("Urgency", $this->urgency_desc, "lookup", "urgency", array("_type" => "request|urgency", "title" => "The urgency of the project, separate from the long-term importance")); // Importance of Request $html .= $ef->DataEntryLine("Importance", $this->importance_desc, "lookup", "importance", array("_type" => "request|importance", "title" => "The relative long-term importance of the project, separate from the urgency")); // Requested By Date $html .= $ef->DataEntryLine("Requested By", $this->requested_by_date, "date", "requested_by_date", array("title" => "The date that you would like this project completed by", "onblur" => "this.value=CheckDate(this)")); // Agreed Due Date $html .= $ef->DataEntryLine("Agreed Due", $this->agreed_due_date, "date", "agreed_due_date", array("title" => "The date that has been agreed that the project will be completed by / on", "onblur" => "this.value=CheckDate(this)")); // Detailed description $html .= $ef->DataEntryLine("Details", str_replace('%', '%%', html_format($this->detailed)), "textarea", "detailed", array("title" => "Full details of the project", "rows" => $bigboxrows, "cols" => $bigboxcols)); return $html; }
} if (isset($choose_columns) && $choose_columns) { array_push($form_url_parameters, "choose_columns=1"); } $form_url = "{$PHP_SELF}"; for ($i = 0; $i < count($form_url_parameters) && $i < 20; $i++) { $form_url .= ($i == 0 ? '?' : '&') . $form_url_parameters[$i]; } echo "<form name=\"search\" action=\"{$form_url}\" Method=\"POST\">"; $systems = new PgQuery(SqlSelectSystems($org_code)); $system_list = $systems->BuildOptionList($system_id, "requestlist"); echo "<table border=0 cellspacing=2 cellpadding=0 align=center class=row0 width=100% style=\"border: 1px dashed #aaaaaa;\">\n<tr>\n"; echo "<td width=100%><table border=0 cellspacing=0 cellpadding=0 width=100%><tr valign=middle>\n"; echo "<td class=smb> System:</td><td class=\"sml\"><select class=\"sml\" name=system_id><option value=\".\">--- All Systems ---</option>{$system_list}</select></td>\n"; if (is_member_of('Admin', 'Support', 'Contractor')) { $organisations = new PgQuery(SqlSelectOrganisations($org_code)); $orglist = "<option value=\"\">--- All Organisations ---</option>\n" . $organisations->BuildOptionList("{$org_code}", "requestlist"); echo "<td class=\"smb\"> Organisation:</td><td class=\"sml\"><select class=\"sml\" name=\"org_code\">\n{$orglist}</select></td>\n"; } echo "<td valign=middle class=smb align=center><input type=submit value=\"RUN\" alt=\"Run\" title=\"Run a query with these settings\" name=submit class=\"submit\">"; echo "</tr></table></td></tr>\n"; echo "</table></form>\n"; } // if not plain or stripped style /** * Now we build the statement that will find those requests... */ $query = ""; $maxresults = isset($maxresults) && intval($maxresults) > 0 ? intval($maxresults) : 100; $flipped_columns = array_flip($columns); $query .= "SELECT request.request_id, brief, usr.fullname, usr.email, request_on, status.lookup_desc AS status_desc, last_activity, detailed ";
function RenderSearchForm($target_url) { global $session, $theme, $search_record; $html = ""; $search_record = (object) array(); $org_code = intval($GLOBALS['org_code']); if ($org_code > 0) { $search_record->org_code = $org_code; } // $session->Log( 'DBG: isset($_POST[submit])=%s isset($_GET[saved_query])=%s', isset($_POST[submit]), isset($_GET['saved_query'] ) ); if (!isset($_POST['submit']) && isset($_GET['saved_query'])) { $qry = new PgQuery("SELECT query_params FROM saved_queries WHERE (user_no = ? OR public ) AND lower(query_name) = lower(?);", $session->user_no, $_GET['saved_query']); if ($qry->Exec('RenderSearchForm') && $qry->rows == 1 && ($row = $qry->Fetch())) { $_POST = unserialize($row->query_params); } } $ef = new EntryForm($REQUEST_URI, $search_record, true); // We do the formatting fairly carefully here... $ef->SimpleForm('<span style="white-space: nowrap"><span class="srchp">%s:</span><span class="srchf">%s</span></span> '); $html .= $ef->StartForm(array("autocomplete" => "off", "onsubmit" => "return CheckSearchForm();")); $html .= "<table border=0 cellspacing=2 cellpadding=0 align=center class=row0 width=100% style=\"border: 1px dashed #aaaaaa;\">\n"; $html .= "<tr><td width=100%><table border=0 cellspacing=0 cellpadding=0 width=100%><tr valign=middle><td width=100%>\n"; if (isset($_GET['search_for']) && !isset($_POST['search_for'])) { $_POST['search_for'] = $_GET['search_for']; } $html .= $ef->DataEntryLine("Find", "%s", "text", "search_for", array("size" => 10, "class" => "srchf", "title" => "Search for free text in the request or notes. Regular expressions are OK too.")); // Organisation drop-down if ($session->AllowedTo("Admin") || $session->AllowedTo("Support") || $session->AllowedTo("Contractor")) { $html .= $ef->DataEntryLine("Organisation", "", "lookup", "org_code", array("_sql" => SqlSelectOrganisations($org_code), "_null" => "-- All Organisations --", "onchange" => "OrganisationChanged();", "title" => "The organisation that this work will be done for.", "class" => "srchf", "style" => "width: 18em")); } // System (within Organisation) drop-down $html .= $ef->DataEntryLine("System", "", "lookup", "system_id", array("_sql" => SqlSelectSystems($org_code), "_null" => "-- All Systems --", "onchange" => "SystemChanged();", "title" => "The business system that this request applies to.", "class" => "srchf", "style" => "width: 18em")); $html .= $ef->DataEntryLine("Requester", "", "lookup", "requested_by", array("_sql" => SqlSelectRequesters($org_code), "_null" => "-- Any Requester --", "onchange" => "PersonChanged();", "title" => "The client who is requesting this, or who is in charge of ensuring it happens.", "class" => "srchf", "style" => "width: 12em")); $html .= $ef->DataEntryLine("Watching", "", "lookup", "interested_in", array("_sql" => SqlSelectSubscribers($org_code), "_null" => "-- Any Interested User --", "title" => "The client who is requesting this, or who is in charge of ensuring it happens.", "class" => "srchf", "style" => "width: 12em")); // Person Assigned to W/R $html .= $ef->DataEntryLine("ToDo", "", "lookup", "allocated_to", array("_sql" => SqlSelectSubscribers($org_code), "_null" => "-- Any Assigned User --", "_nobody" => "-- Not Yet Allocated --", "class" => "srchf", "title" => "A person who has been assigned to work on requests.", "style" => "width: 12em")); // Date range $html .= $ef->DataEntryLine("Last Action", "%s", "date", "from_date", array("size" => 10, "class" => "srchf", "title" => "Only show requests with action after this date.")); $html .= "<a href=\"javascript:show_calendar('forms.form.from_date');\" onmouseover=\"window.status='Date Picker';return true;\" onmouseout=\"window.status='';return true;\">" . $theme->Image("date-picker.gif") . "</a> \n"; $html .= $ef->DataEntryLine("To", "%s", "date", "to_date", array("size" => 10, "class" => "srchf", "title" => "Only show requests with action before this date.")); $html .= "<a href=\"javascript:show_calendar('forms.form.to_date');\" onmouseover=\"window.status='Date Picker';return true;\" onmouseout=\"window.status='';return true;\">" . $theme->Image("date-picker.gif") . "</a> \n"; // Type of Request $html .= $ef->DataEntryLine("Type", "%s", "lookup", "type_code", array("_type" => "request|request_type", "_null" => "-- All Types --", "class" => "srchf", "style" => "width: 8em", "title" => "Only show this type of request")); if ($session->AllowedTo("Admin")) { // $html .= "<div id=\"whereclause\">"; $html .= $ef->DataEntryLine("Where", "%s", "text", "where_clause", array("size" => 60, "class" => "srchf", "title" => "Add an SQL 'WHERE' clause to further refine the search - you will need to know what you are doing...")); // $html .= "</div>"; } $html .= "<table border='0' cellspacing='0' cellpadding='0' width='100%'><tr>"; $html .= "<td style=\"vertical-align: top; padding-top: 0.3em; white-space:wrap;\"><span class=\"srchp\">Status:</span></td><td valign='top'>\n"; $sql = "SELECT * FROM lookup_code WHERE source_table='request' "; $sql .= " AND source_field='status_code' "; $sql .= " ORDER BY source_table, source_field, lookup_seq, lookup_code "; $qry = new PgQuery($sql); if ($qry->Exec("RenderSearchForm") && $qry->rows > 0) { $i = 0; while ($status = $qry->Fetch()) { $ef->record->incstat[$status->lookup_code] = strpos($GLOBALS['default_search_statuses'], $status->lookup_code) != false ? 1 : ''; if ($i++ > 0) { $html .= " "; } $html .= $ef->DataEntryField("%s", "checkbox", "incstat[{$status->lookup_code}]", array("_label" => $status->lookup_desc, "class" => "srchf", "value" => 1)); // if ( $i++ == round($qry->rows / 2) ) $html .= "<br />"; } $html .= $ef->DataEntryField("%s", "checkbox", "inactive", array("_label" => "inactive", "class" => "srchf", "value" => 1)); $html .= "</td>\n"; } $html .= "</tr></table>\n"; $html .= RenderTagsPanel($ef); $html .= RenderColumnSelections($ef); // style="display: block; float:right; clear: left;" $html .= '<div id="savesearch">'; $html .= $ef->DataEntryLine("Save as", "%s", "text", "savelist", array("size" => 20, "class" => "srchf", "title" => "A name to use to refer to this query in the future.")); $html .= $ef->DataEntryField("%s", "checkbox", "save_query_order", array("_label" => "With Order?", "class" => "srchf", "value" => 1)); $html .= $ef->DataEntryField("%s", "checkbox", "save_public", array("_label" => "Public?", "class" => "srchf", "value" => 1)); $search_record->save_hotlist = 't'; $html .= $ef->DataEntryField("%s", "checkbox", "save_hotlist", array("_label" => "In my menu?", "class" => "srchf", "value" => 1)); $html .= $ef->SubmitButton("submit", "Save Query", array("title" => "Save this query so you can run it again.")); $html .= "</div>"; $html .= $ef->DataEntryLine("Max results", "%s", "text", "maxresults", array("size" => 6, "class" => "srchf", "title" => "The maximum number of rows to show in the listing")); $html .= $ef->SubmitButton("submit", "Run Query", array("title" => "Run a query with these settings")); $html .= "</td></tr></table>\n"; $html .= "</td></tr></table>\n"; $html .= $ef->EndForm(); return $html; }