Use the unique id (uid) to attach reports to committee members, instead of the

id, since now the id will change every year.
This commit is contained in:
dave 2009-01-22 01:23:14 +00:00
parent 9756705aad
commit b803c00881
3 changed files with 6 additions and 5 deletions

View File

@ -40,7 +40,7 @@
if($action == 'unlink') {
$id = intval($_GET['id']);
mysql_query("DELETE FROM reports_committee WHERE
users_id='{$_SESSION['users_id']}' AND id='$id'");
users_id='{$_SESSION['users_uid']}' AND id='$id'");
$_SESSION['messages'][] = 'unlinked';
header("Location: reports.php?edit=1");
exit;
@ -87,7 +87,7 @@
mysql_query("INSERT INTO `reports_committee`
(`id`, `users_id` , `reports_id` , `category` , `comment` , `format` , `stock`)
VALUES (
NULL , '{$_SESSION['users_id']}',
NULL , '{$_SESSION['users_uid']}',
'$reports_id', '$category', '$comment',
'$type', '$stock' );");
$_SESSION['messages'][] = 'added';
@ -139,7 +139,7 @@
$q = mysql_query("SELECT reports_committee.*,reports.name
FROM reports_committee
LEFT JOIN reports ON reports.id=reports_committee.reports_id
WHERE users_id='{$_SESSION['users_id']}'
WHERE users_id='{$_SESSION['users_uid']}'
ORDER BY category,id");
echo mysql_error();
if(mysql_num_rows($q) == 0) {
@ -354,7 +354,7 @@
echo "<tr><td>".i18n("Category").":</td><td>";
$q = mysql_query("SELECT DISTINCT category FROM reports_committee
WHERE users_id='{$_SESSION['users_id']}'
WHERE users_id='{$_SESSION['users_uid']}'
ORDER BY category");
echo i18n("Existing Category").": <select name=\"category_exist\">";

View File

@ -73,7 +73,7 @@
echo '<tr><td colspan="2"><hr /></td></tr>';
/* See if the report is in this committee member's list */
$q = mysql_query("SELECT * FROM reports_committee
WHERE users_id='{$_SESSION['users_id']}'
WHERE users_id='{$_SESSION['users_uid']}'
AND reports_id='{$report['id']}'");
echo "<tr><td colspan=\"2\"><h4>".i18n('My Reports Info')."</h4></td></tr>";
if(mysql_num_rows($q) > 0) {

View File

@ -157,6 +157,7 @@
$_SESSION['username']=$u['username'];
$_SESSION['email']=$u['email'];
$_SESSION['users_id']=$u['id'];
$_SESSION['users_uid']=$u['uid'];
$_SESSION['users_type']=$type;
/* Load the password expiry for each user type, and