1<?php
2/* This script is to review the item description translations. */
3
4include('includes/session.php');
5
6$Title = _('Review Translated Descriptions');// Screen identificator.
7$ViewTopic= 'Inventory';// Filename's id in ManualContents.php's TOC.
8$BookMark = 'ReviewTranslatedDescriptions';// Anchor's id in the manual's html document.
9include('includes/header.php');
10echo '<p class="page_title_text"><img alt="" src="'.$RootPath.'/css/'.$Theme.
11	'/images/maintenance.png" title="' .// Title icon.
12	_('Review Translated Descriptions') . '" />' .// Icon title.
13	_('Review Translated Descriptions') . '</p>';// Page title.
14
15include('includes/SQL_CommonFunctions.inc');
16
17//update database if update pressed
18if(isset($_POST['Submit'])) {
19	for ($i=1;$i<count($_POST);$i++) { //loop through the returned translations
20
21		if(isset($_POST['Revised' . $i]) AND ($_POST['Revised' . $i] == '1')) {
22			$sqlUpdate="UPDATE stockdescriptiontranslations
23						SET needsrevision = '0',
24							descriptiontranslation = '". $_POST['DescriptionTranslation' .$i] ."',
25							longdescriptiontranslation = '". $_POST['LongDescriptionTranslation' .$i] ."'
26						WHERE stockid = '". $_POST['StockID' .$i] ."'
27							AND language_id = '". $_POST['LanguageID' .$i] ."'";
28			$ResultUpdate = DB_Query($sqlUpdate,'', '', true);
29			prnMsg($_POST['StockID' .$i] . ' ' . _('descriptions') . ' ' .  _('in') . ' ' . $_POST['LanguageID' .$i] . ' ' . _('have been updated'),'success');
30		}
31	}
32}
33
34echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
35echo '<div>';
36echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
37
38echo '<table class="selection">
39		<tr>
40			<th colspan="7">' . _('Translations to revise') .'</th>
41		</tr>';
42
43$sql = "SELECT stockdescriptiontranslations.stockid,
44				stockmaster.description,
45				stockmaster.longdescription,
46				stockdescriptiontranslations.language_id,
47				stockdescriptiontranslations.descriptiontranslation,
48				stockdescriptiontranslations.longdescriptiontranslation
49		FROM stockdescriptiontranslations, stockmaster
50		WHERE stockdescriptiontranslations.stockid = stockmaster.stockid
51			AND stockdescriptiontranslations.needsrevision = '1'
52		ORDER BY stockdescriptiontranslations.stockid,
53				stockdescriptiontranslations.language_id";
54
55$result = DB_query($sql);
56
57echo '<tr>
58	<th>' . _('Code') . '</th>
59	<th>' . _('Language') . '</th>
60	<th>' . _('Part Description (short)') . '</th>
61	<th>' . _('Part Description (long)') . '</th>
62	<th>' . _('Revised?') . '</th>
63</tr>';
64
65$i=1;
66while($myrow=DB_fetch_array($result)) {
67
68	echo '<tr class="striped_row">
69		<td>' . $myrow['stockid'] . '</td>
70		<td>' . $_SESSION['Language']. '</td>
71		<td>' . $myrow['description'] . '</td>
72		<td>' . nl2br($myrow['longdescription']) . '</td>
73		<td>&nbsp;</td>
74		</tr>';// nl2br: Inserts HTML line breaks before all newlines in a string.
75
76	echo '<tr class="striped_row">
77		<td>&nbsp;</td>
78		<td>' . $myrow['language_id'] . '</td>';
79
80	echo '<td><input class="text" maxlength="50" name="DescriptionTranslation' . $i .'" size="52" type="text" value="'. $myrow['descriptiontranslation'] .'" /></td>
81		<td><textarea name="LongDescriptionTranslation' . $i .'" cols="70" rows="5">'. $myrow['longdescriptiontranslation'] .'" </textarea></td>';
82
83	echo '<td>
84			<input name="Revised' . $i . '" type="checkbox" value="1" />
85			<input name="StockID' . $i . '" type="hidden" value="' . $myrow['stockid'] . '" />
86			<input name="LanguageID' . $i . '" type="hidden" value="' . $myrow['language_id'] . '" />
87		</td>
88		</tr>';
89	$i++;
90
91} //end of looping
92
93echo '</table>
94		<br />
95		<div class="centre">
96			<input type="submit" name="Submit" value="' . _('Update') . '" /></div>
97		</div>
98	</form>';
99
100include('includes/footer.php');
101?>