-
Notifications
You must be signed in to change notification settings - Fork 3
/
GLTags.php
70 lines (51 loc) · 2.18 KB
/
GLTags.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
<?php
/* $Id$*/
include('includes/session.inc');
$title = _('Maintain General Ledger Tags');
include('includes/header.inc');
if (isset($_GET['SelectedTag'])) {
$sql="SELECT tagref, tagdescription FROM tags where tagref='".$_GET['SelectedTag']."'";
$result= DB_query($sql,$db);
$myrow = DB_fetch_array($result,$db);
$ref=$myrow[0];
$description=$myrow[1];
} else {
$description='';
$_GET['SelectedTag']='';
}
if (isset($_POST['submit'])) {
$sql = "INSERT INTO tags VALUES(NULL, '".$_POST['description']."')";
$result= DB_query($sql,$db);
}
if (isset($_POST['update'])) {
$sql = "UPDATE tags SET tagdescription='".$_POST['description'].
"' WHERE tagref='".$_POST['reference']."'";
$result= DB_query($sql,$db);
}
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . '</p>';
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" name="form">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<br /><table class="selection"><tr>';
echo '<td>'. _('Description') . '</td>
<td><input type="text" size="30" maxlength="30" name="description" value="'.$description.'" /></td><td>
<input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'" />';
if (isset($_GET['Action']) and $_GET['Action']=='edit') {
echo '<button type="submit" name="update">' . _('Update') . '</button>';
} else {
echo '<button type="submit" name="submit">' . _('Insert') . '</button>';
}
echo '</td></tr></table><p></p>';
echo '</form>';
echo '<table class="selection">';
echo '<tr><th>'. _('Tag ID') .'</th>';
echo '<th>'. _('Description'). '</th>';
$sql="SELECT tagref, tagdescription FROM tags order by tagref";
$result= DB_query($sql,$db);
while ($myrow = DB_fetch_array($result,$db)){
echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td><td>
<a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?SelectedTag=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>';
}
echo '</table><p></p>';
echo '<script>defaultControl(document.form.description);</script>';
include('includes/footer.inc');
?>