1<?php
2
3include('includes/session.php');
4$Title = _('Product Specifications Maintenance');
5$ViewTopic= 'QualityAssurance';// Filename in ManualContents.php's TOC.
6$BookMark = 'QA_ProdSpecs';// Anchor's id in the manual's html document.
7include('includes/header.php');
8
9if (isset($_GET['SelectedQATest'])){
10	$SelectedQATest =mb_strtoupper($_GET['SelectedQATest']);
11} elseif(isset($_POST['SelectedQATest'])){
12	$SelectedQATest =mb_strtoupper($_POST['SelectedQATest']);
13}
14if (isset($_GET['KeyValue'])){
15	$KeyValue =mb_strtoupper($_GET['KeyValue']);
16} elseif(isset($_POST['KeyValue'])){
17	$KeyValue =mb_strtoupper($_POST['KeyValue']);
18}
19
20if (!isset($_POST['RangeMin']) OR $_POST['RangeMin']=='') {
21	$RangeMin = 'NULL';
22} else {
23	$RangeMin = "'" . $_POST['RangeMin'] . "'";
24}
25if (!isset($_POST['RangeMax']) OR $_POST['RangeMax']=='') {
26	$RangeMax = 'NULL';
27} else {
28	$RangeMax = "'" . $_POST['RangeMax'] . "'";
29}
30
31if (isset($Errors)) {
32	unset($Errors);
33}
34
35$Errors = array();
36
37echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p>';
38
39if (isset($_GET['CopySpec']) OR isset($_POST['CopySpec'])) {
40	if (!isset($_POST['CopyTo']) OR $_POST['CopyTo']=='' ) {
41		echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
42		echo '<div>
43			<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
44		echo _('Enter The Item, Fixed Asset or Template to Copy this Specification to') . ':<input type="text" name="CopyTo" size="25" maxlength="25" />
45			<div class="centre">
46				<input type="hidden" name="KeyValue" value="' . $KeyValue . '" />
47				<input type="submit" name="CopySpec" value="' . _('Copy') . '" />
48			</div>
49			</form>';
50		include('includes/footer.php');
51		exit;
52	} else {
53		$sql = "INSERT IGNORE INTO prodspecs
54							(keyval,
55							testid,
56							defaultvalue,
57							targetvalue,
58							rangemin,
59							rangemax,
60							showoncert,
61							showonspec,
62							showontestplan,
63							active)
64					SELECT '"  . $_POST['CopyTo'] . "',
65								testid,
66								defaultvalue,
67								targetvalue,
68								rangemin,
69								rangemax,
70								showoncert,
71								showonspec,
72								showontestplan,
73								active
74					FROM prodspecs WHERE keyval='" .$KeyValue. "'";
75			$msg = _('A Product Specification has been copied to') . ' ' . $_POST['CopyTo']  . ' from ' . ' ' . $KeyValue ;
76			$ErrMsg = _('The insert of the Product Specification failed because');
77			$DbgMsg = _('The SQL that was used and failed was');
78			$result = DB_query($sql,$ErrMsg, $DbgMsg);
79			prnMsg($msg , 'success');
80		$KeyValue=$_POST['CopyTo'];
81		unset($_GET['CopySpec']);
82		unset($_POST['CopySpec']);
83	} //else
84} //CopySpec
85
86if (!isset($KeyValue) OR $KeyValue=='') {
87	//prompt user for Key Value
88	echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .  '" method="post">
89			<div>
90			<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
91			<table class="selection">
92				<tr>
93					<td>' . _('Enter Specification Name') .':</td>
94					<td><input type="text" name="KeyValue" size="25" maxlength="25" /></td>
95				</tr>
96			</table>
97			</div>
98			<div>
99				<input type="submit" name="pickspec" value="' . _('Submit') . '" />
100			</div>
101		</form>
102		<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .  '" method="post">
103			<div>
104				<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
105				<table class="selection">
106				<tr>
107					<td>' . _('Or Select Existing Specification') .':</td>';
108
109	$SQLSpecSelect="SELECT DISTINCT(keyval),
110							description
111						FROM prodspecs LEFT OUTER JOIN stockmaster
112						ON stockmaster.stockid=prodspecs.keyval";
113
114
115	$ResultSelection=DB_query($SQLSpecSelect);
116	echo '<td><select name="KeyValue">';
117
118	while ($MyRowSelection=DB_fetch_array($ResultSelection)){
119		echo '<option value="' . $MyRowSelection['keyval'] . '">' . $MyRowSelection['keyval'].' - ' .htmlspecialchars($MyRowSelection['description'], ENT_QUOTES,'UTF-8', false)  . '</option>';
120	}
121	echo 	'</select></td>
122			</tr>
123		</table>
124		</div>
125		<div>
126			<input type="submit" name="pickspec" value="' . _('Submit') . '" />
127		</div>
128		</form>';
129
130
131} else {
132	//show header
133	$SQLSpecSelect="SELECT description
134						FROM stockmaster
135						WHERE stockmaster.stockid='" .$KeyValue. "'";
136
137	$ResultSelection=DB_query($SQLSpecSelect);
138	$MyRowSelection=DB_fetch_array($ResultSelection);
139	echo '<br/>' . _('Product Specification for') . ' ' . $KeyValue . '-' . $MyRowSelection['description'] . '<br/><br/>';
140}
141if (isset($_GET['ListTests'])) {
142	$sql = "SELECT qatests.testid,
143				name,
144				method,
145				units,
146				type,
147				numericvalue,
148				qatests.defaultvalue
149			FROM qatests
150			LEFT JOIN prodspecs
151			ON prodspecs.testid=qatests.testid
152			AND prodspecs.keyval='".$KeyValue."'
153			WHERE qatests.active='1'
154			AND prodspecs.keyval IS NULL
155			ORDER BY name";
156	$result = DB_query($sql);
157	echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
158    echo '<div>';
159	echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
160		<table class="selection">
161		<thead>
162			<tr>
163				<th class="ascending">' . _('Add') . '</th>
164				<th class="ascending">' . _('Name') . '</th>
165				<th class="ascending">' . _('Method') . '</th>
166				<th class="ascending">' . _('Units') . '</th>
167				<th>' . _('Possible Values') . '</th>
168				<th>' . _('Target Value') . '</th>
169				<th>' . _('Range Min') . '</th>
170				<th>' . _('Range Max') . '</th>
171			</tr>
172		</thead>
173		<tbody>';
174
175	$x=0;
176	while ($myrow=DB_fetch_array($result)) {
177
178	$x++;
179	$Class='';
180	$RangeMin='';
181	$RangeMax='';
182	if ($myrow['numericvalue'] == 1) {
183		$IsNumeric = _('Yes');
184		$Class="number";
185	} else {
186		$IsNumeric = _('No');
187	}
188
189	switch ($myrow['type']) {
190	 	case 0; //textbox
191	 		$TypeDisp=_('Text Box');
192	 		break;
193	 	case 1; //select box
194	 		$TypeDisp=_('Select Box');
195			break;
196		case 2; //checkbox
197			$TypeDisp=_('Check Box');
198			break;
199		case 3; //datebox
200			$TypeDisp=_('Date Box');
201			$Class="date";
202			break;
203		case 4; //range
204			$TypeDisp=_('Range');
205			$RangeMin='<input  class="' .$Class. '" type="text" name="AddRangeMin' .$x.'" />';
206			$RangeMax='<input  class="' .$Class. '" type="text" name="AddRangeMax' .$x.'" />';
207			break;
208	} //end switch
209		printf('<tr class="striped_row">
210			<td>%s</td>
211			<td>%s</td>
212			<td>%s</td>
213			<td>%s</td>
214			<td>%s</td>
215			<td>%s</td>
216			<td>%s</td>
217			<td>%s</td>
218			</tr>',
219			'<input type="checkbox" name="AddRow' .$x.'"><input type="hidden" name="AddTestID' .$x.'" value="' .$myrow['testid']. '">',
220			$myrow['name'],
221			$myrow['method'],
222			$myrow['units'],
223			$myrow['defaultvalue'],
224			'<input  class="' .$Class. '" type="text" name="AddTargetValue' .$x.'" />',
225			$RangeMin,
226			$RangeMax);
227
228	} //END WHILE LIST LOOP
229
230	echo '</tbody>
231		</table><br />
232			<div class="centre">
233				<input type="hidden" name="KeyValue" value="' . $KeyValue . '" />
234				<input type="hidden" name="AddTestsCounter" value="' . $x . '" />
235				<input type="submit" name="AddTests" value="' . _('Add') . '" />
236		</div>
237		</div>
238		</form>';
239	include('includes/footer.php');
240	exit;
241}  //ListTests
242if (isset($_POST['AddTests'])) {
243	for ($i=0;$i<=$_POST['AddTestsCounter'];$i++){
244		if ($_POST['AddRow' .$i]=='on') {
245			if ($_POST['AddRangeMin' .$i]=='') {
246				$AddRangeMin="NULL";
247			} else {
248				$AddRangeMin="'" . $_POST['AddRangeMin' .$i] . "'";
249			}
250			if ($_POST['AddRangeMax' .$i]=='') {
251				$AddRangeMax="NULL";
252			} else {
253				$AddRangeMax="'" . $_POST['AddRangeMax' .$i] . "'";
254			}
255
256			$sql = "INSERT INTO prodspecs
257							(keyval,
258							testid,
259							defaultvalue,
260							targetvalue,
261							rangemin,
262							rangemax,
263							showoncert,
264							showonspec,
265							showontestplan,
266							active)
267						SELECT '"  . $KeyValue . "',
268								testid,
269								defaultvalue,
270								'"  .  $_POST['AddTargetValue' .$i] . "',
271								"  . $AddRangeMin . ",
272								"  . $AddRangeMax. ",
273								showoncert,
274								showonspec,
275								showontestplan,
276								active
277						FROM qatests WHERE testid='" .$_POST['AddTestID' .$i]. "'";
278			//echo $sql;
279			$msg = _('A Product Specification record has been added for Test ID') . ' ' . $_POST['AddTestID' .$i]  . ' for ' . ' ' . $KeyValue ;
280			$ErrMsg = _('The insert of the Product Specification failed because');
281			$DbgMsg = _('The SQL that was used and failed was');
282			$result = DB_query($sql,$ErrMsg, $DbgMsg);
283			prnMsg($msg , 'success');
284		} //if on
285	} //for
286} //AddTests
287
288if (isset($_POST['submit'])) {
289
290	//initialise no input errors assumed initially before we test
291	$InputError = 0;
292
293	/* actions to take once the user has clicked the submit button
294	ie the page has called itself with some user input */
295	$i=1;
296
297	//first off validate inputs sensible
298
299	if (isset($SelectedQATest) AND $InputError !=1) {
300
301		/*SelectedQATest could also exist if submit had not been clicked this code would not run in this case cos submit is false of course  see the delete code below*/
302
303		$sql = "UPDATE prodspecs SET defaultvalue='" . $_POST['DefaultValue'] . "',
304									targetvalue='" . $_POST['TargetValue'] . "',
305									rangemin=" . $RangeMin . ",
306									rangemax=" . $RangeMax . ",
307									showoncert='" . $_POST['ShowOnCert'] . "',
308									showonspec='" . $_POST['ShowOnSpec'] . "',
309									showontestplan='" . $_POST['ShowOnTestPlan'] . "',
310									active='" . $_POST['Active'] . "'
311				WHERE prodspecs.keyval = '".$KeyValue."'
312				AND prodspecs.testid = '".$SelectedQATest."'";
313
314		$msg = _('Product Specification record for') . ' ' . $_POST['QATestName']  . ' for ' . ' ' . $KeyValue .  _('has been updated');
315		$ErrMsg = _('The update of the Product Specification failed because');
316		$DbgMsg = _('The SQL that was used and failed was');
317		$result = DB_query($sql,$ErrMsg, $DbgMsg);
318
319		prnMsg($msg , 'success');
320
321		unset($SelectedQATest);
322		unset($_POST['DefaultValue']);
323		unset($_POST['TargetValue']);
324		unset($_POST['RangeMax']);
325		unset($_POST['RangeMin']);
326		unset($_POST['ShowOnCert']);
327		unset($_POST['ShowOnSpec']);
328		unset($_POST['Active']);
329	}
330} elseif (isset($_GET['delete'])) {
331//the link to delete a selected record was clicked instead of the submit button
332
333// PREVENT DELETES IF DEPENDENT RECORDS
334
335	$sql= "SELECT COUNT(*) FROM qasamples
336			INNER JOIN sampleresults on sampleresults.sampleid=qasamples.sampleid AND sampleresults.testid='". $SelectedQATest."'
337			WHERE qasamples.prodspeckey='".$KeyValue."'";
338	$result = DB_query($sql);
339	$myrow = DB_fetch_row($result);
340	if ($myrow[0]>0) {
341		prnMsg(_('Cannot delete this Product Specification because there are test results tied to it'),'error');
342	} else {
343		$sql="DELETE FROM prodspecs WHERE keyval='". $KeyValue."'
344									AND testid='". $SelectedQATest."'";
345		$ErrMsg = _('The Product Specification could not be deleted because');
346		$result = DB_query($sql,$ErrMsg);
347
348		prnMsg(_('Product Specification') . ' ' . $SelectedQATest . ' for ' . ' ' . $KeyValue . _('has been deleted from the database'),'success');
349		unset ($SelectedQATest);
350		unset($delete);
351		unset ($_GET['delete']);
352	}
353}
354
355if (!isset($SelectedQATest)) {
356
357/* It could still be the second time the page has been run and a record has been selected for modification - SelectedQATest will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters
358then none of the above are true and the list of QA Test will be displayed with
359links to delete or edit each. These will call the same page again and allow update/input
360or deletion of the records*/
361
362	$sql = "SELECT prodspecs.testid,
363				name,
364				method,
365				units,
366				type,
367				numericvalue,
368				prodspecs.defaultvalue,
369				prodspecs.targetvalue,
370				prodspecs.rangemin,
371				prodspecs.rangemax,
372				prodspecs.showoncert,
373				prodspecs.showonspec,
374				prodspecs.showontestplan,
375				prodspecs.active
376			FROM prodspecs INNER JOIN qatests
377			ON qatests.testid=prodspecs.testid
378			WHERE prodspecs.keyval='" .$KeyValue."'
379			ORDER BY name";
380	$result = DB_query($sql);
381
382	echo '<table class="selection">
383		<thead>
384		<tr>
385			<th class="ascending">' . _('Name') . '</th>
386			<th class="ascending">' . _('Method') . '</th>
387			<th class="ascending">' . _('Units') . '</th>
388			<th class="ascending">' . _('Type') . '</th>
389			<th>' . _('Possible Values') . '</th>
390			<th>' . _('Target Value') . '</th>
391			<th>' . _('Range Min') . '</th>
392			<th>' . _('Range Max') . '</th>
393			<th class="ascending">' . _('Show on Cert') . '</th>
394			<th class="ascending">' . _('Show on Spec') . '</th>
395			<th class="ascending">' . _('Show on Test Plan') . '</th>
396			<th class="ascending">' . _('Active') . '</th>
397			</tr>
398		</thead>
399		<tbody>';
400
401	while ($myrow=DB_fetch_array($result)) {
402
403	if ($myrow['active'] == 1) {
404		$ActiveText = _('Yes');
405	} else {
406		$ActiveText = _('No');
407	}
408	if ($myrow['numericvalue'] == 1) {
409		$IsNumeric = _('Yes');
410		$Class="number";
411	} else {
412		$IsNumeric = _('No');
413	}
414	if ($myrow['showoncert'] == 1) {
415		$ShowOnCertText = _('Yes');
416	} else {
417		$ShowOnCertText = _('No');
418	}
419	if ($myrow['showonspec'] == 1) {
420		$ShowOnSpecText = _('Yes');
421	} else {
422		$ShowOnSpecText = _('No');
423	}
424	if ($myrow['showontestplan'] == 1) {
425		$ShowOnTestPlanText = _('Yes');
426	} else {
427		$ShowOnTestPlanText = _('No');
428	}
429	switch ($myrow['type']) {
430	 	case 0; //textbox
431	 		$TypeDisp='Text Box';
432	 		break;
433	 	case 1; //select box
434	 		$TypeDisp='Select Box';
435			break;
436		case 2; //checkbox
437			$TypeDisp='Check Box';
438			break;
439		case 3; //datebox
440			$TypeDisp='Date Box';
441			$Class="date";
442			break;
443		case 4; //range
444			$TypeDisp='Range';
445			break;
446	} //end switch
447
448		printf('<tr class="striped_row">
449			<td>%s</td>
450			<td>%s</td>
451			<td>%s</td>
452			<td>%s</td>
453			<td>%s</td>
454			<td>%s</td>
455			<td>%s</td>
456			<td>%s</td>
457			<td>%s</td>
458			<td>%s</td>
459			<td>%s</td>
460			<td>%s</td>
461			<td><a href="%sSelectedQATest=%s&amp;KeyValue=%s">' .  _('Edit') . '</a></td>
462			<td><a href="%sSelectedQATest=%s&amp;KeyValue=%s&amp;delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this Product Specification ?') . '\');">' . _('Delete') . '</a></td>
463			</tr>',
464			$myrow['name'],
465			$myrow['method'],
466			$myrow['units'],
467			$TypeDisp,
468			$myrow['defaultvalue'],
469			$myrow['targetvalue'],
470			$myrow['rangemin'],
471			$myrow['rangemax'],
472			$ShowOnCertText,
473			$ShowOnSpecText,
474			$ShowOnTestPlanText,
475			$ActiveText,
476			htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
477			$myrow['testid'],
478			$KeyValue,
479			htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
480			$myrow['testid'],
481			$KeyValue);
482
483	} //END WHILE LIST LOOP
484	echo '</tbody></table><br />';
485} //end of ifs and buts!
486
487if (isset($SelectedQATest)) {
488	echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?KeyValue=' .$KeyValue .'">' . _('Show All Product Specs') . '</a></div>';
489}
490
491if (! isset($_GET['delete'])) {
492
493	echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
494    echo '<div>';
495	echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
496
497	if (isset($SelectedQATest)) {
498		//editing an existing Prod Spec
499
500		$sql = "SELECT prodspecs.testid,
501						name,
502						method,
503						units,
504						type,
505						numericvalue,
506						prodspecs.defaultvalue,
507						prodspecs.targetvalue,
508						prodspecs.rangemin,
509						prodspecs.rangemax,
510						prodspecs.showoncert,
511						prodspecs.showonspec,
512						prodspecs.showontestplan,
513						prodspecs.active
514				FROM prodspecs INNER JOIN qatests
515				ON qatests.testid=prodspecs.testid
516				WHERE prodspecs.keyval='".$KeyValue."'
517				AND prodspecs.testid='".$SelectedQATest."'";
518
519		$result = DB_query($sql);
520		$myrow = DB_fetch_array($result);
521
522		$_POST['SelectedQATest'] = $myrow['testid'];
523		$_POST['QATestName'] = $myrow['name'];
524		$_POST['Method'] = $myrow['method'];
525		$_POST['GroupBy'] = $myrow['groupby'];
526		$_POST['Type'] = $myrow['type'];
527		$_POST['Units'] = $myrow['units'];
528		$_POST['DefaultValue'] = $myrow['defaultvalue'];
529		$_POST['NumericValue'] = $myrow['numericvalue'];
530		$_POST['TargetValue'] = $myrow['targetvalue'];
531		$_POST['RangeMin'] = $myrow['rangemin'];
532		$_POST['RangeMax'] = $myrow['rangemax'];
533		$_POST['ShowOnCert'] = $myrow['showoncert'];
534		$_POST['ShowOnSpec'] = $myrow['showonspec'];
535		$_POST['ShowOnTestPlan'] = $myrow['showontestplan'];
536		$_POST['Active'] = $myrow['active'];
537
538
539		echo '<input type="hidden" name="SelectedQATest" value="' . $SelectedQATest . '" />';
540		echo '<input type="hidden" name="KeyValue" value="' . $KeyValue . '" />';
541		echo '<input type="hidden" name="TestID" value="' . $_POST['SelectedQATest'] . '" />';
542		echo '<table class="selection">
543				<tr>
544					<td>' . _('Test Name') . ':</td>
545					<td>' . $_POST['QATestName'] . '</td>
546				</tr>';
547
548		if (!isset($_POST['Active'])) {
549			$_POST['Active']=1;
550		}
551		if (!isset($_POST['ShowOnCert'])) {
552			$_POST['ShowOnCert']=1;
553		}
554		if (!isset($_POST['ShowOnSpec'])) {
555			$_POST['ShowOnSpec']=1;
556		}
557		if ($myrow['numericvalue'] == 1) {
558			$IsNumeric = _('Yes');
559			$Class="number";
560		}
561		switch ($myrow['type']) {
562			case 0; //textbox
563				$TypeDisp='Text Box';
564				break;
565			case 1; //select box
566				$TypeDisp='Select Box';
567				break;
568			case 2; //checkbox
569				$TypeDisp='Check Box';
570				break;
571			case 3; //datebox
572				$TypeDisp='Date Box';
573				$Class="date";
574				break;
575			case 4; //range
576				$TypeDisp='Range';
577				break;
578		} //end switch
579		if ($TypeDisp=='Select Box') {
580			echo '<tr>
581					<td>' . _('Possible Values') . ':</td>
582					<td><input type="text" name="DefaultValue" size="50" maxlength="150" value="' . $_POST['DefaultValue']. '" /></td>
583				</tr>';
584		}
585		echo '<tr>
586				<td>' . _('Target Value') . ':</td>
587				<td><input type="text" class="' . $Class.'" name="TargetValue" size="15" maxlength="15" value="' . $_POST['TargetValue']. '" />&nbsp;'.$_POST['Units'].'</td>
588			</tr>';
589
590		if ($TypeDisp=='Range') {
591			echo '<tr>
592					<td>' . _('Range Min') . ':</td>
593					<td><input class="' . $Class.'" type="text" name="RangeMin" size="10" maxlength="10" value="' . $_POST['RangeMin']. '" /></td>
594				</tr>';
595			echo '<tr>
596					<td>' . _('Range Max') . ':</td>
597					<td><input class="' . $Class.'" type="text" name="RangeMax" size="10" maxlength="10" value="' . $_POST['RangeMax']. '" /></td>
598				</tr>';
599		}
600		echo '<tr>
601				<td>' . _('Show On Cert?') . ':</td>
602				<td><select name="ShowOnCert">';
603		if ($_POST['ShowOnCert']==1){
604			echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
605		} else {
606			echo '<option value="1">' . _('Yes') . '</option>';
607		}
608		if ($_POST['ShowOnCert']==0){
609			echo '<option selected="selected" value="0">' . _('No') . '</option>';
610		} else {
611			echo '<option value="0">' . _('No') . '</option>';
612		}
613		echo '</select></td></tr><tr>
614				<td>' . _('Show On Spec?') . ':</td>
615				<td><select name="ShowOnSpec">';
616		if ($_POST['ShowOnSpec']==1){
617			echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
618		} else {
619			echo '<option value="1">' . _('Yes') . '</option>';
620		}
621		if ($_POST['ShowOnSpec']==0){
622			echo '<option selected="selected" value="0">' . _('No') . '</option>';
623		} else {
624			echo '<option value="0">' . _('No') . '</option>';
625		}
626		echo '</select></td></tr><tr>
627			<td>' . _('Show On Test Plan?') . ':</td>
628			<td><select name="ShowOnTestPlan">';
629		if ($_POST['ShowOnTestPlan']==1){
630			echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
631		} else {
632			echo '<option value="1">' . _('Yes') . '</option>';
633		}
634		if ($_POST['ShowOnTestPlan']==0){
635			echo '<option selected="selected" value="0">' . _('No') . '</option>';
636		} else {
637			echo '<option value="0">' . _('No') . '</option>';
638		}
639		echo '</select></td></tr><tr>
640				<td>' . _('Active?') . ':</td>
641				<td><select name="Active">';
642		if ($_POST['Active']==1){
643			echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
644		} else {
645			echo '<option value="1">' . _('Yes') . '</option>';
646		}
647		if ($_POST['Active']==0){
648			echo '<option selected="selected" value="0">' . _('No') . '</option>';
649		} else {
650			echo '<option value="0">' . _('No') . '</option>';
651		}
652		echo '</select></td>
653			</tr>
654			</table>
655			<br />
656			<div class="centre">
657				<input type="submit" name="submit" value="' . _('Enter Information') . '" />
658			</div>
659			</div>
660			</form>';
661	}
662	if (isset($KeyValue)) {
663		echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?ListTests=yes&amp;KeyValue=' .$KeyValue .'">' . _('Add More Tests') . '</a></div>';
664		echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?CopySpec=yes&amp;KeyValue=' .$KeyValue .'">' . _('Copy This Specification') . '</a></div>';
665		echo '<div class="centre"><a target="_blank" href="'. $RootPath . '/PDFProdSpec.php?KeyValue=' .$KeyValue .'">' . _('Print Product Specification') . '</a></div>';
666		echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'">' . _('Product Specification Main Page') . '</a></div>';
667	}
668} //end if record deleted no point displaying form to add record
669
670include('includes/footer.php');
671?>