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